diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ca7ddef --- /dev/null +++ b/.editorconfig @@ -0,0 +1,6 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..55f988c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/.vscode/ +*.DS_Store diff --git a/.no-sublime-package b/.no-sublime-package new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/.no-sublime-package @@ -0,0 +1 @@ + diff --git a/Context.sublime-menu b/Context.sublime-menu deleted file mode 100644 index a7aaef6..0000000 --- a/Context.sublime-menu +++ /dev/null @@ -1,4 +0,0 @@ -[ - { "command": "query_database", "caption": "show_cloums" ,"args": {"cmd" :"show_cloum"}}, - { "command": "goto_php_document", "caption": "goto_php_document" } -] diff --git a/Default (Linux).sublime-mousemap b/Default (Linux).sublime-mousemap deleted file mode 100644 index a4732d1..0000000 --- a/Default (Linux).sublime-mousemap +++ /dev/null @@ -1,4 +0,0 @@ -[ - { "button": "button1", "modifiers": ["shift"], "command": "goto_definition" }, - { "button": "button1", "modifiers": ["alt"], "command": "goto_php_document" } -] diff --git a/Default (OSX).sublime-mousemap b/Default (OSX).sublime-mousemap deleted file mode 100644 index 1917654..0000000 --- a/Default (OSX).sublime-mousemap +++ /dev/null @@ -1,3 +0,0 @@ -[ - { "button": "button1", "modifiers": ["alt"], "command": "goto_php_document" } -] diff --git a/Default (Windows).sublime-mousemap b/Default (Windows).sublime-mousemap deleted file mode 100644 index a4732d1..0000000 --- a/Default (Windows).sublime-mousemap +++ /dev/null @@ -1,4 +0,0 @@ -[ - { "button": "button1", "modifiers": ["shift"], "command": "goto_definition" }, - { "button": "button1", "modifiers": ["alt"], "command": "goto_php_document" } -] diff --git a/Main.sublime-menu b/Main.sublime-menu deleted file mode 100644 index 7222b08..0000000 --- a/Main.sublime-menu +++ /dev/null @@ -1,50 +0,0 @@ -[ - { - "id": "tools", - "children": - [ - { - "caption": "ThinkPHP manual: api", - "id": "ThinkPHP api manual", - "command": "view_thinkphp_api_manual" - }, - { - "caption": "ThinkPHP change database", - "id": "ThinkPHP change database", - "command": "query_database", - "args": {"cmd" :"change_database"} - }, - { - "caption": "ThinkPHP database queryer", - "id": "ThinkPHP database queryer", - "command": "query_database", - "args": {"cmd" :"query"} - }, - { - "caption": "ThinkPHP-CLI", - "id": "ThinkPHP executer", - "command": "thinkphp" - }, - { - "caption": "del workspace 's bom", - "id": "del workspace 's bom", - "command": "del_workspace_boms" - }, - { "caption": "-" }, - { - "command": "open_file", - "args": {"file": "${packages}/Thinkphp/ThinkPHP.sublime-settings"}, - "caption": "Settings – Default" - }, - { "command": "open_file", - "args": {"file": "${packages}/Thinkphp/php.sublime-completions"}, - "caption": "Browse Complation - php", "mnemonic": "B" - }, - { - "command": "open_file", - "args": {"file": "${packages}/Thinkphp/tpl.sublime-completions"}, - "caption": "Browse Complation - tpl" - } - ] - } -] \ No newline at end of file diff --git a/README.md b/README.md index 203faef..4b9f8a0 100644 --- a/README.md +++ b/README.md @@ -1,62 +1,43 @@ -##Thinkphp是什么? -Sublime中的一个THinkphp框架的工具包,主要包括thinkphp snippet、访问框架在线api、以及一些编程辅助功能。目前重构的插件去除了手册相关功能,同时支持Sublime text2和3版本。 - -##Thinkphp有哪些功能? - -* 访问官网框架在线api -* 辅助删除编辑器中打开目录所有文件的bom头(后期补上,移植到3的时候报错解决不了,等我想办法解决) -* 通过sublime-completions提供代码完成功能 -* ctrl点击或者选中函数名后右键显示函数说明文档(英文) -手册目录 -![ThinkPHP manual](http://www.thinkphp.cn/Uploads/editor/2013-07-14/51e25dad0bc2b.jpg) -改进后的菜单少了一层,更快捷 -Snippet提示 -![sublime-completions](http://www.thinkphp.cn/Uploads/editor/2013-07-14/51e25e9621c58.png) - -![视频: 用Sublime text2的Thinkphp插件 像zencoding)一样快速开发TP](http://v.youku.com/v_show/id_XNTA1NjE2MTM2.html) -查看函数说明文档 -![查看函数说明文档](http://www.thinkphp.cn/Uploads/speech/2013-08-04/51fe0aa40ca40.png "查看函数说明文档 Sublime text3效果") - -![查看函数说明文档](http://www.thinkphp.cn/Uploads/speech/2013-08-04/51fe0bdca306c.png "查看函数说明文档 Sublime text2效果") -mysql编辑器内简单查询 -![效果图](http://www.thinkphp.cn/Uploads/speech/2013-08-04/51fe0a85ecca9.png "效果图") -1.在tools->ThinkPHP->ThinkPHP choose database来添加数据库和选择当前数据库 -![选择数据库](http://ww2.sinaimg.cn/mw1024/50075709jw1e61cpzgtwpj20e304tmxg.jpg "选择数据库") - -添加数据库选择"add database",后如下图: -![添加数据库](http://ww2.sinaimg.cn/mw1024/50075709jw1e61cpzwnbqj20j10hv0ul.jpg) - -注意database里 0 的那个键不要删除,剪切板里会有要添加的模板,自己要么先删除只剩0,保存后。下次选添加进来,粘贴会有1的模板,自己替换下即可。以后会扩展支持sqlserver。 - -现在查看数据表字段注释和数据库查询统一用配置里的去访问数据库,因此有个“change database”菜单和“database queryer”菜单,查询表字段支持tp的命名方式,比如原表名think_user,在配置文件里配了前缀后我们在php文件里写D('User') 这样User选中后右键直接show_cloums就行了,为了方便大家记忆去除从输入框填写的步骤,简化为一个操作 -效果如下: - -![效果图](http://www.thinkphp.cn/Uploads/editor/2012-12-10/50c56b7fd4e97.png) - -最后还支持了命令行访问网页cli模式方便大家调试action中操作,不需要开浏览器。 -选择菜单中的ThinkPHP-CLI 弹出的文件中 输入你想访问的url 记住打开的项目更目录要有入口文件,并且php在path环境变量中有设置。 -保存就可显示结果: - -![效果图](http://www.thinkphp.cn/Uploads/editor/2013-07-14/51e2689cce54a.png) - -这样方便大家调试数据而不必切换浏览器,或者调试接口的时候用 - - -##有问题反馈 -在使用中有任何问题,欢迎反馈给我,可以用以下联系方式跟我交流 - -* 邮件(yangweijiest#gmail.com, 把#换成@) -* QQ: 917647288 -* weibo: [@黑白世界4648](http://weibo.com/1342658313) -* 人人: [@杨维杰](http://www.renren.com/247050624) - -##注意点 -由于新版emmet(原名zencoding)插件禁用了模板中的php自动完成,导致我的完成不生效。想使用者在emmet的user配置中 使用'"use_old_tab_handler": true,' 就可以有原先的功能了。 -##关于作者 - -```javascript - var code-tech = { - nickName : "杨维杰", - site : "http://code-tech.diandian.com" - } +# 欢迎使用Thinkphp5.1 插件 + +## 功能 + +插件会提供使用tp5.1项目所必须的框架级常量、函数、类方法的完成,以及模板标签的完成。 + +## 前提 +大家的环境变量里有php + +> PS: 插件里包含着一个tp5.1项目,可以通过composer 调整该框架的版本,用于php.sublime-completions的更新。(安装时会自动生成一次) +> 大家可以通过内置项目的composer来安装一些类库,只要自动加载了,一样可以生成类库的完成的。 +> 可能某些同名方法会冲突消失,大家可以修改tp5目录里extend的生成方法。 + +## 计划 + +- [x] php文件里的完成 +- [ ] 模版标签的完成文件的动态生成 +- [ ] 实现tp3插件和5插件的动态加载,判断项目目录里tp版本来自动加载 有思路了。 +- [ ] 看能否将vscode那套 language server 集成进来,那样跳转定义也更方便。对于项目来说完成更实时化。 + +## 反馈 + +请github上 给我提issue。 + +在使用中有任何问题,欢迎反馈给我,可以用以下联系方式跟我交流 + +* 邮件(yangweijiest#gmail.com, 把#换成@) +* QQ: 917647288 +* weibo: [@黑白世界4648](http://weibo.com/1342658313) +* 人人: [@杨维杰](http://www.renren.com/247050624) +* wechat: yangweijiester + +##注意点 +由于新版emmet(原名zencoding)插件禁用了模板中的php自动完成,导致我的完成不生效。想使用者在emmet的user配置中 使用'"use_old_tab_handler": true,' 就可以有原先的功能了。 + +##关于作者 + +```javascript + var code-tech = { + nickName : "杨维杰", + site : "https://yangweijie.github.io/note/" + } ``` \ No newline at end of file diff --git a/ThinkPHP-CLI.html b/ThinkPHP-CLI.html deleted file mode 100644 index d6393fb..0000000 --- a/ThinkPHP-CLI.html +++ /dev/null @@ -1,4 +0,0 @@ -Index/test -################################################### - -result to be display. \ No newline at end of file diff --git a/ThinkPHP-Queryer b/ThinkPHP-Queryer deleted file mode 100644 index 096ceae..0000000 --- a/ThinkPHP-Queryer +++ /dev/null @@ -1 +0,0 @@ -select user from user \ No newline at end of file diff --git a/ThinkPHP-Queryer.sql b/ThinkPHP-Queryer.sql deleted file mode 100644 index 7585515..0000000 --- a/ThinkPHP-Queryer.sql +++ /dev/null @@ -1,11 +0,0 @@ -select user from user -########################################################################## - -+------+ -| user | -+------+ -| root | -| root | -| | -| root | -+------+ diff --git a/Thinkphp.py b/Thinkphp.py deleted file mode 100644 index 90720c9..0000000 --- a/Thinkphp.py +++ /dev/null @@ -1,284 +0,0 @@ -# -*- coding: utf-8 -*- -import sublime, sublime_plugin -import os, json, threading, codecs, re, subprocess, webbrowser -from subprocess import PIPE - -packages_path = sublime.packages_path() + os.sep + 'Thinkphp' -query_window = packages_path + os.sep + 'ThinkPHP-CLI.html' -query_table = packages_path + os.sep + 'ThinkPHP-Queryer' -seperator = '\n###################################################\n\n' -settings = sublime.load_settings('Thinkphp.sublime-settings') - -def is_version2(): - if sublime.version() < '3000': - return True - else: - return False - -def fs_reader(path): - return codecs.open(path, mode='r', encoding='utf8').read() - -def fs_writer(path, raw): - codecs.open(path, mode='w', encoding='utf8', errors='ignore').write(raw) - -def open_tab(url): - webbrowser.open_new_tab(url) - -def show_outpanel(self, name, string, readonly = True): - self.output_view = self.window.get_output_panel(name) - if is_version2(): - edit = self.output_view.begin_edit() - self.output_view.insert(edit, 0, string) - self.output_view.end_edit(edit) - else: - self.output_view.run_command('append', {'characters': string, 'force': True, 'scroll_to_end': True}) - if readonly: - self.output_view.set_read_only(True) - show_panel_on_build = sublime.load_settings("Preferences.sublime-settings").get("show_panel_on_build", True) - if show_panel_on_build: - self.window.run_command("show_panel", {"panel": "output." + name}) - -class ThinkphpCommand(sublime_plugin.TextCommand): - def run(self, edit): - window = sublime.active_window() - views = window.views() - view = None - for _view in views: - if _view.name() == 'ThinkPHP-CLI.html': - view = _view - break - if not view: - tpl = seperator + 'result to be display.' - fs_writer(query_window, tpl) - self.view.window().open_file(query_window) - - def view_api(self): - url = settings.get('api_url') - open_tab(url) - - -class Thinkphp(sublime_plugin.EventListener): - def on_load(self, view): - if view.file_name().find('ThinkPHP-Queryer') != -1: - view.set_syntax_file('Packages/SQL/SQL.tmLanguage') - view.run_command('select_all') - - - def on_post_save(self, view): - dir = view.window().folders() - title = "ThinkPHP-CLI.html" - title2 = "ThinkPHP-Queryer" - content = view.substr(sublime.Region(0, view.size())) - global seperator - if dir == []: - if view.file_name().find(title) != -1: - sublime.status_message('Please open a folder') - else: - if view.file_name().find(title) != -1: - query = content.split(seperator) - cmd = query[0] - command_text = ['php', dir[0] + os.sep + 'index.php', cmd] - thread = cli(command_text,view,dir[0]) - thread.start() - ThreadProgress(thread, 'Is excuting', 'cli excuted') - - if view.file_name().find(title2) != -1: - sql = content - if sql == '': - sublime.status_message('Pls input correct sql') - else: - command_text = 'php "' + packages_path + os.sep + 'command.php" "query"' - cloums = os.popen(command_text) - data = cloums.read() - self.window = view.window() - show_outpanel(self, 'ThinkPHP-Queryer', data , True) - -class query_database(ThinkphpCommand, sublime_plugin.TextCommand): - def run(self, edit, cmd): - self.cmd = cmd - if cmd == 'change_database': - self.list_database() - else: - current_database = fs_reader(packages_path + os.sep + 'current_database') - if current_database < '1': - self.list_database() - else: - if cmd == 'show_cloum': - self.show_cloum() - else: - self.show_query_database() - - def show_cloum(self): - region = self.view.sel()[0] - if region.begin() != region.end(): - table = self.view.substr(region) - command_text = 'php "' + packages_path + os.sep + 'command.php" "show_colums" "' + table + '"' - cloums = os.popen(command_text) - data = json.loads(cloums.read()) - if(data['status'] == 0): - sublime.error_message(data['info']) - else: - cloums = [] - for i in data['data']: - cloums.append([i['Field'], i['Type'], i['Comment']]) - self.view.window().show_quick_panel(cloums, self.cancel) - else: - sublime.error_message('Pls choose your table') - - def cancel(self,arg): - pass - - def list_database(self): - database = [] - db_list = settings.get('database') - for i in db_list: - database.insert(int(i), db_list[i]['list_title']) - self.database = database - self.view.window().show_quick_panel(database, self.choose_database) - - def choose_database(self, arg): - if arg == -1: - pass - else: - db_num = len(settings.get('database')) - if arg == 0: - setting_file = packages_path + os.sep + 'Thinkphp.sublime-settings' - new_key = '%d' % db_num - tpl = '"' + new_key + '":' + """{ - "list_title":"test", - "DB_HOST": "localhost", - "DB_USER": "xxx", - "DB_PWD": "xxx", - "DB_NAME": "xx", - "DB_PREFIX": "" - } -""" - sublime.set_clipboard(tpl) - self.view.window().open_file(setting_file) - else: - fs_writer(packages_path + os.sep + 'current_database', str(arg)) - if self.cmd == 'show_cloum': - self.show_cloum() - - def show_query_database(self): - window = sublime.active_window() - views = window.views() - view = None - for _view in views: - if _view.name() == 'ThinkPHP-Queryer': - view = _view - break - - if not view: - tpl = """here to input sql""" - fs_writer(query_table, tpl) - self.view.window().open_file(query_table) - - -class goto_php_document(ThinkphpCommand, sublime_plugin.TextCommand): - def run(self, edit): - region = self.view.sel()[0] - if region.begin() != region.end(): - function = self.view.substr(region) - command_text = 'php "' + packages_path + os.sep + 'command.php" "find_php_defination" "' + function + '"' - cloums = os.popen(command_text) - data = json.loads(cloums.read()) - if data['status'] == 0: - sublime.status_message(data['info']) - else: - if is_version2(): - self.window = self.view.window() - show_outpanel(self, 'php function docmentor', data['data']) - else: - content = data['data'] - content = content[4:] - content = content[:-4] - content = content.replace('*', '') - re_h = re.compile(']*>') - content = re_h.sub('',content) - fun_def_item = content.split('\n') - self.item = fun_def_item - self.view.show_popup_menu(fun_def_item, self.choose) - else: - sublime.status_message('must be a word') - def choose(self, flag): - if flag != -1: - sublime.set_clipboard(self.item[flag]) - -class view_thinkphp_api_manual(ThinkphpCommand, sublime_plugin.TextCommand): - """see the ThinkPHP api online""" - def run(self, arg): - self.view_api() - -class cli(threading.Thread): - def __init__(self, command_text, view,cwd): - self.command_text = command_text - self.view = view - self.cwd = cwd - threading.Thread.__init__(self) - - def run(self): - proce = subprocess.Popen(self.command_text, stdout=PIPE, shell=True, cwd=self.cwd) - data,error = proce.communicate() - if data != b'': - content = self.command_text[2] + seperator + data.decode('utf-8') - fs_writer(query_window, content) - else: - if is_version2(): - sublime.error_message('cli executed!') - -class queryWithPhp(threading.Thread): - def __init__(self, command_text, window): - self.command_text = command_text - self.window = window - threading.Thread.__init__(self) - - def run(self): - cloums = os.popen(self.command_text) - data = cloums.read() - if data is None: - data = 'no results!' - show_outpanel(self, 'ThinkPHP-Queryer', data) - -class ThreadProgress(): - """ - Animates an indicator, [= ], in the status area while a thread runs - - :param thread: - The thread to track for activity - - :param message: - The message to display next to the activity indicator - - :param success_message: - The message to display once the thread is complete - """ - - def __init__(self, thread, message, success_message): - self.thread = thread - self.message = message - self.success_message = success_message - self.addend = 1 - self.size = 8 - sublime.set_timeout(lambda: self.run(0), 100) - - def run(self, i): - if not self.thread.is_alive(): - if hasattr(self.thread, 'result') and not self.thread.result: - sublime.status_message('') - return - sublime.status_message(self.success_message) - return - - before = i % self.size - after = (self.size - 1) - before - - sublime.status_message('%s [%s=%s]' % (self.message, ' ' * before, ' ' * after)) - - if not after: - self.addend = -1 - if not before: - self.addend = 1 - i += self.addend - - sublime.set_timeout(lambda: self.run(i), 100) \ No newline at end of file diff --git a/Thinkphp.sublime-settings b/Thinkphp.sublime-settings deleted file mode 100644 index 256f9c8..0000000 --- a/Thinkphp.sublime-settings +++ /dev/null @@ -1,25 +0,0 @@ -{ - "api_url" : "http://www.thinkphp.cn/api", - "database" : { - "0":{ - "list_title":"add_database" - }, - "1":{ - "list_title":"fujian", - "DB_HOST":"192.168.1.200", - "DB_USER": "fujian", - "DB_PWD": "fujian", - "DB_NAME": "fujian", - "DB_PREFIX": "sister_", - "DB_PORT": "3306" - }, - "2":{ - "list_title":"local", - "DB_HOST": "localhost", - "DB_USER": "root", - "DB_PWD": "", - "DB_NAME": "mysql", - "DB_PREFIX": "" - } - } -} \ No newline at end of file diff --git a/Thinkphp5_1.py b/Thinkphp5_1.py new file mode 100644 index 0000000..207c570 --- /dev/null +++ b/Thinkphp5_1.py @@ -0,0 +1,34 @@ +import sys +import os + +package_name = 'ThinkPHP5_1' +packages_path = os.path.split(os.path.realpath(__file__))[0] +command_bin = packages_path + os.sep + 'tp5' + os.sep + 'public' + os.sep + 'index.php'; + +def plugin_loaded(): + from package_control import events + + if events.install(package_name): + print('Installed %s!' % events.install(package_name)) + global command_bin + command_text = 'php "' + command_bin + '" index/index/build_completion' + print(command_text) + cloums = os.popen(command_text) + print(cloums.read()) + elif events.post_upgrade(package_name): + print('Upgraded to %s!' % events.post_upgrade(package_name)) + + +def plugin_unloaded(): + from package_control import events + + if events.pre_upgrade(package_name): + print('Upgrading from %s!' % events.pre_upgrade(package_name)) + elif events.remove(package_name): + print('Removing %s!' % events.remove(package_name)) + + +# Compat with ST2 +if sys.version_info < (3,): + plugin_loaded() + unload_handler = plugin_unloaded \ No newline at end of file diff --git a/command.php b/command.php deleted file mode 100644 index 4198bdb..0000000 --- a/command.php +++ /dev/null @@ -1,178 +0,0 @@ -$config['DB_HOST'].':'.$config['DB_PORT'], - 1=>$config['DB_USER'], - 2=>$config['DB_PWD'], - 3=>$config['DB_NAME'], - 4=>$config['DB_PREFIX'] - ); - $conn = mysql_connect($argv[0],$argv[1],$argv[2]); - if(!$conn && (strpos('localhost', $argv[0])!= -1)){ - $conn = mysql_connect(str_replace('localhost', '127.0.0.1', $argv[0]),$argv[1],$argv[2]); - } - if(!$conn) - exit('can\'t connect database'); - mysql_select_db($argv[3],$conn); - mysql_set_charset('UTF8', $conn); - return $argv; -} - -function show_colums($argv){ - $config = connect_db(); - $table = $config[4].parse_name($argv[0]); - $result = mysql_query("SHOW FULL COLUMNS FROM {$table}"); - if(!$result){ - error(mysql_error()); - }else{ - while($row = mysql_fetch_assoc($result)){ - $res[] = $row; - } - success('query success',$res); - } - mysql_close(); -} - -function find_php_defination($argv){ - $word = $argv[0]; - $path = realpath(dirname(__FILE__)); - $path .= DIRECTORY_SEPARATOR.'phpruntime'.DIRECTORY_SEPARATOR; - chdir($path); - $list = glob('*.php'); - $to_search = "function {$word} ("; - foreach ($list as $key => $value) { - $content = file_get_contents($path.$value); - $pos_search = strpos($content, $to_search); - if($pos_search !== false){ - $comment = get_comment($pos_search, $content); - if($comment){ - success('found it!', $comment); - break; - } - } - } - error('didn\'t find it'); -} - -function get_comment($pos,$content){ - $content_length = strlen($content); - $end_pos = strripos($content, '*/', $pos - $content_length); - $start_pos = strripos($content, '/**', $end_pos - $content_length); - return substr($content, $start_pos, $end_pos - $start_pos + 2); -} - -function query($argv = ''){ - error_reporting(7); - $table_queryer_file = __DIR__.DIRECTORY_SEPARATOR.'ThinkPHP-Queryer'; - $content = file_get_contents($table_queryer_file); - $sep = '##########################################################################'; - $arr_content = split($sep, $content); - $sql = trim($arr_content[0]); - connect_db($argv); - $result = mysql_query($sql); - $rows = array(); - if($result){ - $i = 0; - while ($row = mysql_fetch_assoc($result)) { - if($i == 0) - $header = array_keys($row); - $i++; - $rows[] = array_values($row); - } - } - require __DIR__.'/table.php'; - $in = array( - 'header'=>$header? $header : array(), - 'rows'=>$rows - ); - if($rows){ - $table = new table($in); - $output = $table->render(0); - } - if(!$output) - $output = 'no results!'; - exit($output); -} - -//----------------------下面是通用函数------------------------- -function error($msg,$data=''){ - exit(json_encode(array('status'=>0,'info'=>$msg,'data'=>$data))); -} - -function success($msg,$data=''){ - exit(json_encode(array('status'=>1,'info'=>$msg,'data'=>$data))); -} - -/** - +---------------------------------------------------------- - * 字符串命名风格转换 - * type - * =0 将Java风格转换为C的风格 - * =1 将C风格转换为Java的风格 - +---------------------------------------------------------- - * @access protected - +---------------------------------------------------------- - * @param string $name 字符串 - * @param integer $type 转换类型 - +---------------------------------------------------------- - * @return string - +---------------------------------------------------------- - */ -function parse_name($name, $type=0) { - if ($type) { - return ucfirst(preg_replace("/_([a-zA-Z])/e", "strtoupper('\\1')", $name)); - } else { - return strtolower(trim(preg_replace("/[A-Z]/", "_\\0", $name), "_")); - } -} - -function make_request($url, $param = array(), $httpMethod = 'GET') { - $oCurl = curl_init(); - if (stripos($url, "https://") !== FALSE) { - curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, FALSE); - curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, FALSE); - } - - if ($httpMethod == 'GET') { - curl_setopt($oCurl, CURLOPT_URL, $url . "?" . http_build_query($param)); - curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1); - } else { - curl_setopt($oCurl, CURLOPT_URL, $url); - curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($oCurl, CURLOPT_POST, 1); - curl_setopt($oCurl, CURLOPT_POSTFIELDS, http_build_query($param)); - } - - $sContent = curl_exec($oCurl); - $aStatus = curl_getinfo($oCurl); - curl_close($oCurl); - if (intval($aStatus["http_code"]) == 200) { - return $sContent; - } else { - return FALSE; - } -} diff --git a/current_database b/current_database deleted file mode 100644 index d8263ee..0000000 --- a/current_database +++ /dev/null @@ -1 +0,0 @@ -2 \ No newline at end of file diff --git a/dependencies.json b/dependencies.json new file mode 100644 index 0000000..f663827 --- /dev/null +++ b/dependencies.json @@ -0,0 +1,7 @@ +{ + "*": { + "*": [ + "php" + ] + } +} \ No newline at end of file diff --git a/messages.json b/messages.json new file mode 100644 index 0000000..c42b512 --- /dev/null +++ b/messages.json @@ -0,0 +1,4 @@ +{ + "install": "messages/install.txt", + "1.0.0": "messages/1.0.0.txt" +} \ No newline at end of file diff --git a/messages/1.0.0.txt b/messages/1.0.0.txt new file mode 100644 index 0000000..8927e0c --- /dev/null +++ b/messages/1.0.0.txt @@ -0,0 +1 @@ +初版 \ No newline at end of file diff --git a/messages/install.txt b/messages/install.txt new file mode 100644 index 0000000..eea6b4c --- /dev/null +++ b/messages/install.txt @@ -0,0 +1,26 @@ +# 欢迎使用Thinkphp5.1 插件 + +## 功能 + +插件会提供使用tp5.1项目所必须的框架级常量、函数、类方法的完成,以及模板标签的完成。 + +## 前提 +大家的环境变量里有php + +> +PS: 插件里包含着一个tp5.1项目,可以通过composer 调整该框架的版本,用于php.sublime-completions的更新。(安装时会自动生成一次) + +大家可以通过内置项目的composer来安装一些类库,只要自动加载了,一样可以生成类库的完成的。 + +可能某些同名方法会冲突消失,大家可以修改tp5目录里extend的生成方法。 + +## 计划 + +- [x] php文件里的完成 +- [] 模版标签的完成文件的动态生成 +- [] 实现tp3插件和5插件的动态加载,判断项目目录里tp版本来自动加载 有思路了。 +- [] 看能否将vscode那套 language server 集成进来,那样跳转定义也更方便。对于项目来说完成更实时化。 + +## 反馈 + +请github上 给我提issue。 \ No newline at end of file diff --git a/php.sublime-completions b/php.sublime-completions deleted file mode 100644 index 4d4cb59..0000000 --- a/php.sublime-completions +++ /dev/null @@ -1,265 +0,0 @@ -{ - "scope": "source.php - variable.other.php", - - "completions": - [ - //预定义常量 - "URL_COMMON", - "URL_PATHINFO", - "URL_REWRITE", - "URL_REWRITE", - "URL_COMPAT", - "HAS_ONE", - "BELONGS_TO", - "HAS_MANY", - "MANY_TO_MANY", - "THINK_VERSION", - //路径常量 - "CORE_PATH", - "EXTEND_PATH", - "MODE_PATH", - "ENGINE_PATH", - "VENDOR_PATH", - "LIBRARY_PATH", - "COMMON_PATH", - "LIB_PATH", - "RUNTIME_PATH", - "CONF_PATH", - "LOG_PATH", - "CACHE_PATH", - "LANG_PATH", - "TEMP_PATH", - "DATA_PATH", - "TMPL_PATH", - "HTML_PATH", - //系统常量 - "IS_CGI", - "IS_WIN", - "IS_CLI", - "__ROOT__", - "__APP__", - "__GROUP__", - "__URL__", - "__ACTION__", - "__SELF__", - "__INFO__", - "APP_NAME", - "GROUP_NAME", - "MODULE_NAME", - "ACTION_NAME", - "APP_DEBUG", - "MODE_NAME", - "APP_PATH", - "THINK_PATH", - "MEMORY_LIMIT_ON", - "RUNTIME_FILE", - "THEME_NAME", - "THEME_PATH", - "APP_TMPL_PATH", - "LANG_SET", - "MAGIC_QUOTES_GPC", - "APP_STATUS", - //项目中C函数默认获取到的所有配置键名 - "APP_FILE_CASE", - "APP_AUTOLOAD_PATH", - "APP_TAGS_ON", - "APP_SUB_DOMAIN_DEPLOY", - "APP_SUB_DOMAIN_RULES", - "APP_SUB_DOMAIN_DENY", - "APP_GROUP_LIST", - "APP_GROUP_MODE", - "APP_GROUP_PATH", - "ACTION_SUFFIX", - "COOKIE_EXPIRE", - "COOKIE_DOMAIN", - "COOKIE_PATH", - "COOKIE_PREFIX", - "DEFAULT_M_LAYER", - "DEFAULT_C_LAYER", - "DEFAULT_APP", - "DEFAULT_LANG", - "DEFAULT_THEME", - "DEFAULT_GROUP", - "DEFAULT_MODULE", - "DEFAULT_ACTION", - "DEFAULT_CHARSET", - "DEFAULT_TIMEZONE", - "DEFAULT_AJAX_RETURN", - "DEFAULT_JSONP_HANDLER", - "DEFAULT_FILTER", - "DB_TYPE", - "DB_HOST", - "DB_NAME", - "DB_USER", - "DB_PWD", - "DB_PORT", - "DB_PREFIX", - "DB_FIELDTYPE_CHECK", - "DB_FIELDS_CACHE", - "DB_CHARSET", - "DB_DEPLOY_TYPE", - "DB_RW_SEPARATE", - "DB_MASTER_NUM", - "DB_SLAVE_NO", - "DB_SQL_BUILD_CACHE", - "DB_SQL_BUILD_QUEUE", - "DB_SQL_BUILD_LENGTH", - "DB_SQL_LOG", - "DATA_CACHE_TIME", - "DATA_CACHE_COMPRESS", - "DATA_CACHE_CHECK", - "DATA_CACHE_PREFIX", - "DATA_CACHE_TYPE", - "DATA_CACHE_PATH", - "DATA_CACHE_SUBDIR", - "DATA_PATH_LEVEL", - "ERROR_MESSAGE", - "ERROR_PAGE", - "SHOW_ERROR_MSG", - "TRACE_EXCEPTION", - "LOG_RECORD", - "LOG_TYPE", - "LOG_DEST", - "LOG_EXTRA", - "LOG_LEVEL", - "LOG_FILE_SIZE", - "LOG_EXCEPTION_RECORD", - "SESSION_AUTO_START", - "SESSION_OPTIONS", - "SESSION_TYPE", - "SESSION_PREFIX", - "TMPL_CONTENT_TYPE", - "TMPL_ACTION_ERROR", - "TMPL_ACTION_SUCCESS", - "TMPL_EXCEPTION_FILE", - "TMPL_DETECT_THEME", - "TMPL_TEMPLATE_SUFFIX", - "TMPL_FILE_DEPR", - "URL_CASE_INSENSITIVE", - "URL_MODEL", - "URL_PATHINFO_DEPR", - "URL_PATHINFO_FETCH", - "URL_HTML_SUFFIX", - "URL_PARAMS_BIND", - "URL_404_REDIRECT", - "VAR_GROUP", - "VAR_MODULE", - "VAR_ACTION", - "VAR_AJAX_SUBMIT", - "VAR_JSONP_HANDLER", - "VAR_PAGE", - "VAR_PATHINFO", - "VAR_URL_PARAMS", - "VAR_TEMPLATE", - "VAR_FILTERS", - "OUTPUT_ENCODE", - "HTTP_CACHE_CONTROL", - "SHOW_PAGE_TRACE", - "EXTENDS", - "TMPL_CACHE_ON", - "TMPL_STRIP_SPACE", - "CACHE_PATH", - "HTML_CACHE_ON", - "HTML_CACHE_TIME", - "HTML_CACHE_RULES", - "HTML_FILE_SUFFIX", - "TEMPLATE_NAME", - { "trigger": "_ad", "contents": "protected function _after_delete(\\$data,\\$options) {\n ${1:}\n}$0" }, - { "trigger": "_af", "contents": "protected function _after_find(&\\$result,\\$options) {\n ${1:}\n}$0" }, - { "trigger": "_ai", "contents": "protected function _after_insert(\\$data,\\$options) {\n ${1:}\n}$0" }, - { "trigger": "_as", "contents": "protected function _after_select(&\\$result,\\$options){\n ${1:foreach(\\$result as &\\$record)\\{\n ${2:\\$this->_after_find(\\$record,\\$options);}\n \\}}\n}$0" }, - { "trigger": "_au", "contents": "protected function _after_update(\\$data,\\$options) {\n ${1:}\n}$0" }, - { "trigger": "_bi", "contents": "protected function _before_insert(&\\$data,\\$options) {\n ${1:}\n}$0" }, - { "trigger": "_bu", "contents": "protected function _before_update(&\\$data,\\$options) {\n ${1:}\n}$0" }, - { "trigger": "->_empty", "contents": "\\$this->_empty()$0" }, - { "trigger": "_get", "contents": "_get('${1:\\$name}')$0" }, - { "trigger": "_post", "contents": "_post('${1:\\$name}')$0" }, - { "trigger": "->_sql", "contents": "->_sql('${1:\\$name}')$0" }, - { "trigger": "->addAll", "contents": "->addAll(\\$${1:dataList},\\$${2:options},\\$${3:replace})$0" }, - { "trigger": "->ajaxReturn", "contents": "->ajaxReturn(${1:\\$data},${2:\\$info},${3:\\$status},${4:\\$type})$0" }, - { "trigger": "->alias", "contents": "->alias('${1:}')$0" }, - { "trigger": "->assign", "contents": "->assign('${1:name}',\\$${2:name})$0" }, - { "trigger": "->avg()", "contents": "->avg()$0" }, - { "trigger": "auto_charset()", "contents": "auto_charset(${1:\\$fContents}${2:,\\$from='gbk'}${3:,\\$to='utf-8'})$0" }, - { "trigger": "->buildSql()", "contents": "->buildSql()$0" }, - { "trigger": "build_count_rand()", "contents": "build_count_rand(${1:\\$num}${2:,\\$length=4}${3:,\\$mode=1})$0" }, - { "trigger": "build_verify()", "contents": "build_verify(${1:\\$length=4}${2:\\$mode=1})$0" }, - { "trigger": "byte_format()", "contents": "byte_format(${1:\\$size}${2:,\\$dec=2})$0" }, - { "trigger": "->commit()", "contents": "->commit()$0" }, - { "trigger": "cookie", "contents": "cookie(${1:\\$name}${2:,\\$value}${3:,\\$option})$0" }, - { "trigger": "->count", "contents": "->count$0" }, - { "trigger": "->create()", "contents": "->create()$0" }, - { "trigger": "->delete()", "contents": "->delete()$0" }, - { "trigger": "display", "contents": "\\$this->display(${1:})$0" }, - { "trigger": "->distinct", "contents": "->distinct('${1:}')$0" }, - { "trigger": "dump", "contents": "dump('${1:str}')$0" }, - { "trigger": "error", "contents": "error('${1:name}')$0" }, - { "trigger": "->execute", "contents": "->execute(${1:})$0" }, - { "trigger": "->fetch", "contents": "->fetch('${1:}')$0" }, - { "trigger": "field()", "contents": "field()$0" }, - { "trigger": "find()", "contents": "find()$0" }, - { "trigger": "F", "contents": "F($name, $value='', $path=DATA_PATH)$0" }, - { "trigger": "get_client_ip", "contents": "get_client_ip(${1:\\$type})$0" }, - { "trigger": "getActionName()", "contents": "getActionName()$0" }, - { "trigger": "getDbError()", "contents": "getDbError()$0" }, - { "trigger": "getError()", "contents": "getError()$0" }, - { "trigger": "->getField", "contents": "->getField(${1:\\$field},${2:\\$value})$0" }, - { "trigger": "getModelName()", "contents": "getModelName()$0" }, - { "trigger": "getTableName()", "contents": "getTableName()$0" }, - { "trigger": "group()", "contents": "group('${1:}')$0" }, - { "trigger": "h", "contents": "h(${1:\\$text}${2:, \\$tags = null})$0" }, - { "trigger": "having()", "contents": "having('${1:}')$0" }, - { "trigger": "halt", "contents": "halt(${1:\\$error})$0" }, - { "trigger": "highlight_code", "contents": "highlight_code(${1:\\$str}${2:,\\$show=false})$0" }, - { "trigger": "isAjax()", "contents": "\\$this->isAjax()$0" }, - { "trigger": "isDelete()", "contents": "\\$this->isDelete()$0" }, - { "trigger": "isGet()", "contents": "\\$this->isGet()$0" }, - { "trigger": "isHead()", "contents": "\\$this->isHead()$0" }, - { "trigger": "isPost()", "contents": "\\$this->isPost()$0" }, - { "trigger": "isPut()", "contents": "\\$this->isPut()$0" }, - { "trigger": "is_utf8()", "contents": "is_utf8(${1:\\$string})$0" }, - { "trigger": "is_ssl()", "contents": "is_ssl()$0" }, - { "trigger": "join", "contents": "join(${1:\\$join})$0" }, - { "trigger": "->limit", "contents": "->limit(${1:})$0" }, - { "trigger": "layout", "contents": "layout(${1:\\$layout})$0" }, - { "trigger": "list_search()", "contents": "list_search(${1:\\$list},${2:\\$condition})$0" }, - { "trigger": "list_sort_by()", "contents": "list_sort_by(${1:\\$list},${2:\\$field}${3:,\\$sortby='asc'})$0" }, - { "trigger": "list_to_tree()", "contents": "list_to_tree(${1:\\$list}${2:,\\$pk='id'}${3:,\\$pid='pid'}${4:,\\$child='_child'}${5:,\\$root=0})$0" }, - { "trigger": "lock()", "contents": "lock('${1:}')$0" }, - { "trigger": "max()", "contents": "max()$0" }, - { "trigger": "min()", "contents": "min()$0" }, - { "trigger": "Model", "contents": "Class ${1:New}Model extends Model{\n ${2:}\n}$0" }, - { "trigger": "msubstr()", "contents": "msubstr(${1:\\$str},${2:0},${3:\\$length}${4:,\"utf-8\"}${5:,\\$suffix=true})$0" }, - { "trigger": "->order", "contents": "->order('${1:}')$0" }, - { "trigger": "page()", "contents": "page(${1:})$0" }, - { "trigger": "query()", "contents": "query(${1:})$0" }, - { "trigger": "rand_string()", "contents": "rand_string(${1:6}${2:,\\$type}${3:,\\$addStr})$0" }, - { "trigger": "redirect", "contents": "redirect(${1:\\$url}${2:,\\$time}${3:,\\$msg})$0" }, - { "trigger": "redirect()", "contents": "\\$this->redirect(${1:'\\$url'}${2:,\\$params}${3:,\\$delay}${4:,\\$msg})$0" }, - { "trigger": "remove_xss()", "contents": "remove_xss(${1:\\$val})$0" }, - { "trigger": "rollback()", "contents": "rollback()$0" }, - { "trigger": "scope()", "contents": "scope(${1:${2:\\$scope}${3:,\\$args}})$0" }, - { "trigger": "send_http_status", "contents": "send_http_status(${1:\\$code})$0" }, - { "trigger": "selectAdd()", "contents": "selectAdd(\\$${1:fields},\\$${2:table}${3:,\\$options})$0" }, - { "trigger": "session", "contents": "session(${1:\\$name}${2:,\\$value})$0" }, - { "trigger": "setField()", "contents": "setField(\\$${1:field},\\$${2:value})$0" }, - { "trigger": "setInc()", "contents": "setInc(\\$${1:field}${2:,\\$step})$0" }, - { "trigger": "setProperty()", "contents": "setProperty(${1:name},${2:value})$0" }, - { "trigger": "startTrans()", "contents": "startTrans()$0" }, - { "trigger": "success", "contents": "success('${1:info}')$0" }, - { "trigger": "sum()", "contents": "sum()$0" }, - { "trigger": "switchModel()", "contents": "switchModel(\\$${1:type},\\$${2:var})$0" }, - { "trigger": "S", "contents": "S(${1:\\$name}${2:,\\$value}${3:,\\$options})$0" }, - { "trigger": "table()", "contents": "table('${1:}')$0" }, - { "trigger": "tablePrefix", "contents": "protected \\$tablePrefix$0" }, - { "trigger": "throw_exception", "contents": "throw_exception(${1:\\$msg}${2:,\\$type}${3:,\\$code})$0" }, - { "trigger": "trueTableName", "contents": "protected \\$trueTableName$0" }, - { "trigger": "ts", "contents": "\\$this->$0" }, - { "trigger": "ubb()", "contents": "ubb(${1:\\$text})$0" }, - { "trigger": "val", "contents": "protected \\$_validate = array(\n array('verify','require','验证码必须!'), //默认情况下用正则进行验证\n array('name','','帐号名称已经存在!',0,'unique',1), // 在新增的时候验证name字段是否唯一\n array('value',array(1,2,3),'值的范围不正确!',2,'in'), // 当值不为空的时候判断是否在一个范围内\n array('repassword','password','确认密码不正确',0,'confirm'), // 验证确认密码是否和密码一致\n array('password','checkPwd','密码格式不正确',0,'function'), // 自定义函数验证密码格式\n);\n$0" }, - { "trigger": "where()", "contents": "where('${1:}')$0" }, - { "trigger": "W", "contents": "W(${1:\\$name},${2:array()}${3:,\\$return})$0" }, - { "trigger": "m_auto", "contents": "protected \\$_auto = array (\n array('status','1'), // 新增的时候把status字段设置为1\n array('password','md5',1,'function') , // 对password字段在新增的时候使md5函数处理\n array('name','getName',1,'callback'), // 对name字段在新增的时候回调getName方法\n array('create_time','time',2,'function'), // 对create_time字段在更新的时候写入当前时间戳\n);$0" }, - { "trigger": "Action", "contents": "\nClass ${1:Index}Action extends Action{\n public function ${2:index}(){\n ${3:}\n }\n}" } - ] -} \ No newline at end of file diff --git a/phpruntime/Core.php b/phpruntime/Core.php deleted file mode 100644 index 976a6ae..0000000 --- a/phpruntime/Core.php +++ /dev/null @@ -1,1612 +0,0 @@ - - * Retrieve an external iterator - * @link http://php.net/manual/en/iteratoraggregate.getiterator.php - * @return Traversable An instance of an object implementing Iterator or - * Traversable - */ - abstract public function getIterator (); - -} - -/** - * Interface for external iterators or objects that can be iterated - * themselves internally. - * @link http://php.net/manual/en/class.iterator.php - */ -interface Iterator extends Traversable { - - /** - * (PHP 5 >= 5.0.0)
- * Return the current element - * @link http://php.net/manual/en/iterator.current.php - * @return mixed Can return any type. - */ - abstract public function current (); - - /** - * (PHP 5 >= 5.0.0)
- * Move forward to next element - * @link http://php.net/manual/en/iterator.next.php - * @return void Any returned value is ignored. - */ - abstract public function next (); - - /** - * (PHP 5 >= 5.0.0)
- * Return the key of the current element - * @link http://php.net/manual/en/iterator.key.php - * @return scalar scalar on success, or NULL on failure. - */ - abstract public function key (); - - /** - * (PHP 5 >= 5.0.0)
- * Checks if current position is valid - * @link http://php.net/manual/en/iterator.valid.php - * @return boolean The return value will be casted to boolean and then evaluated. - * Returns TRUE on success or FALSE on failure. - */ - abstract public function valid (); - - /** - * (PHP 5 >= 5.0.0)
- * Rewind the Iterator to the first element - * @link http://php.net/manual/en/iterator.rewind.php - * @return void Any returned value is ignored. - */ - abstract public function rewind (); - -} - -/** - * Interface to provide accessing objects as arrays. - * @link http://php.net/manual/en/class.arrayaccess.php - */ -interface ArrayAccess { - - /** - * (PHP 5 >= 5.0.0)
- * Whether a offset exists - * @link http://php.net/manual/en/arrayaccess.offsetexists.php - * @param mixed $offset

- * An offset to check for. - *

- * @return boolean TRUE on success or FALSE on failure. - *

- *

- * The return value will be casted to boolean if non-boolean was returned. - */ - abstract public function offsetExists ($offset); - - /** - * (PHP 5 >= 5.0.0)
- * Offset to retrieve - * @link http://php.net/manual/en/arrayaccess.offsetget.php - * @param mixed $offset

- * The offset to retrieve. - *

- * @return mixed Can return all value types. - */ - abstract public function offsetGet ($offset); - - /** - * (PHP 5 >= 5.0.0)
- * Offset to set - * @link http://php.net/manual/en/arrayaccess.offsetset.php - * @param mixed $offset

- * The offset to assign the value to. - *

- * @param mixed $value

- * The value to set. - *

- * @return void No value is returned. - */ - abstract public function offsetSet ($offset, $value); - - /** - * (PHP 5 >= 5.0.0)
- * Offset to unset - * @link http://php.net/manual/en/arrayaccess.offsetunset.php - * @param mixed $offset

- * The offset to unset. - *

- * @return void No value is returned. - */ - abstract public function offsetUnset ($offset); - -} - -/** - * Interface for customized serializing. - * @link http://php.net/manual/en/class.serializable.php - */ -interface Serializable { - - /** - * (PHP 5 >= 5.1.0)
- * String representation of object - * @link http://php.net/manual/en/serializable.serialize.php - * @return string the string representation of the object or NULL - */ - abstract public function serialize (); - - /** - * (PHP 5 >= 5.1.0)
- * Constructs the object - * @link http://php.net/manual/en/serializable.unserialize.php - * @param string $serialized

- * The string representation of the object. - *

- * @return void The return value from this method is ignored. - */ - abstract public function unserialize ($serialized); - -} - -/** - * Exception is the base class for - * all Exceptions. - * @link http://php.net/manual/en/class.exception.php - */ -class Exception { - protected $message; - private $string; - protected $code; - protected $file; - protected $line; - private $trace; - private $previous; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * An Error Exception. - * @link http://php.net/manual/en/class.errorexception.php - */ -class ErrorException extends Exception { - protected $message; - protected $code; - protected $file; - protected $line; - protected $severity; - - - /** - * (PHP 5 >= 5.1.0)
- * Constructs the exception - * @link http://php.net/manual/en/errorexception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $severity [optional] - * @param $filename [optional] - * @param $lineno [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $severity, $filename, $lineno, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the exception severity - * @link http://php.net/manual/en/errorexception.getseverity.php - * @return int the severity level of the exception. - */ - final public function getSeverity () {} - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * Class used to represent anonymous - * functions. - * @link http://php.net/manual/en/class.closure.php - */ -final class Closure { - - /** - * (PHP 5 >= 5.3.0)
- * Constructor that disallows instantiation - * @link http://php.net/manual/en/closure.construct.php - */ - private function __construct () {} - - /** - * (PHP 5 >= 5.4.0)
- * Duplicates a closure with a specific bound object and class scope - * @link http://php.net/manual/en/closure.bind.php - * @param Closure $closure

- * The anonymous functions to bind. - *

- * @param object $newthis

- * The object to which the given anonymous function should be bound, or - * NULL for the closure to be unbound. - *

- * @param mixed $newscope [optional]

- * The class scope to which associate the closure is to be associated, or - * 'static' to keep the current one. If an object is given, the type of the - * object will be used instead. This determines the visibility of protected - * and private methods of the bound object. - *

- * @return Closure a new Closure object or FALSE on failure - */ - public static function bind (Closure $closure, $newthis, $newscope = null) {} - - /** - * (PHP 5 >= 5.4.0)
- * Duplicates the closure with a new bound object and class scope - * @link http://php.net/manual/en/closure.bindto.php - * @param object $newthis

- * The object to which the given anonymous function should be bound, or - * NULL for the closure to be unbound. - *

- * @param mixed $newscope [optional]

- * The class scope to which associate the closure is to be associated, or - * 'static' to keep the current one. If an object is given, the type of the - * object will be used instead. This determines the visibility of protected - * and private methods of the bound object. - *

- * @return Closure the newly created Closure object - * or FALSE on failure - */ - public function bindTo ($newthis, $newscope = null) {} - -} - -/** - * (PHP 4, PHP 5)
- * Gets the version of the current Zend engine - * @link http://php.net/manual/en/function.zend-version.php - * @return string the Zend Engine version number, as a string. - */ -function zend_version () {} - -/** - * (PHP 4, PHP 5)
- * Returns the number of arguments passed to the function - * @link http://php.net/manual/en/function.func-num-args.php - * @return int the number of arguments passed into the current user-defined - * function. - */ -function func_num_args () {} - -/** - * (PHP 4, PHP 5)
- * Return an item from the argument list - * @link http://php.net/manual/en/function.func-get-arg.php - * @param int $arg_num

- * The argument offset. Function arguments are counted starting from - * zero. - *

- * @return mixed the specified argument, or FALSE on error. - */ -function func_get_arg ($arg_num) {} - -/** - * (PHP 4, PHP 5)
- * Returns an array comprising a function's argument list - * @link http://php.net/manual/en/function.func-get-args.php - * @return array an array in which each element is a copy of the corresponding - * member of the current user-defined function's argument list. - */ -function func_get_args () {} - -/** - * (PHP 4, PHP 5)
- * Get string length - * @link http://php.net/manual/en/function.strlen.php - * @param string $string

- * The string being measured for length. - *

- * @return int The length of the string on success, - * and 0 if the string is empty. - */ -function strlen ($string) {} - -/** - * (PHP 4, PHP 5)
- * Binary safe string comparison - * @link http://php.net/manual/en/function.strcmp.php - * @param string $str1

- * The first string. - *

- * @param string $str2

- * The second string. - *

- * @return int < 0 if str1 is less than - * str2; > 0 if str1 - * is greater than str2, and 0 if they are - * equal. - */ -function strcmp ($str1, $str2) {} - -/** - * (PHP 4, PHP 5)
- * Binary safe string comparison of the first n characters - * @link http://php.net/manual/en/function.strncmp.php - * @param string $str1

- * The first string. - *

- * @param string $str2

- * The second string. - *

- * @param int $len

- * Number of characters to use in the comparison. - *

- * @return int < 0 if str1 is less than - * str2; > 0 if str1 - * is greater than str2, and 0 if they are - * equal. - */ -function strncmp ($str1, $str2, $len) {} - -/** - * (PHP 4, PHP 5)
- * Binary safe case-insensitive string comparison - * @link http://php.net/manual/en/function.strcasecmp.php - * @param string $str1

- * The first string - *

- * @param string $str2

- * The second string - *

- * @return int < 0 if str1 is less than - * str2; > 0 if str1 - * is greater than str2, and 0 if they are - * equal. - */ -function strcasecmp ($str1, $str2) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Binary safe case-insensitive string comparison of the first n characters - * @link http://php.net/manual/en/function.strncasecmp.php - * @param string $str1

- * The first string. - *

- * @param string $str2

- * The second string. - *

- * @param int $len

- * The length of strings to be used in the comparison. - *

- * @return int < 0 if str1 is less than - * str2; > 0 if str1 is - * greater than str2, and 0 if they are equal. - */ -function strncasecmp ($str1, $str2, $len) {} - -/** - * (PHP 4, PHP 5)
- * Return the current key and value pair from an array and advance the array cursor - * @link http://php.net/manual/en/function.each.php - * @param array $array

- * The input array. - *

- * @return array the current key and value pair from the array - * array. This pair is returned in a four-element - * array, with the keys 0, 1, - * key, and value. Elements - * 0 and key contain the key name of - * the array element, and 1 and value - * contain the data. - *

- *

- * If the internal pointer for the array points past the end of the - * array contents, each returns - * FALSE. - */ -function each (array &$array) {} - -/** - * (PHP 4, PHP 5)
- * Sets which PHP errors are reported - * @link http://php.net/manual/en/function.error-reporting.php - * @param int $level [optional]

- * The new error_reporting - * level. It takes on either a bitmask, or named constants. Using named - * constants is strongly encouraged to ensure compatibility for future - * versions. As error levels are added, the range of integers increases, - * so older integer-based error levels will not always behave as expected. - *

- *

- * The available error level constants and the actual - * meanings of these error levels are described in the - * predefined constants. - *

- * @return int the old error_reporting - * level or the current level if no level parameter is - * given. - */ -function error_reporting ($level = null) {} - -/** - * (PHP 4, PHP 5)
- * Defines a named constant - * @link http://php.net/manual/en/function.define.php - * @param string $name

- * The name of the constant. - *

- * @param mixed $value

- * The value of the constant; only scalar and null values are allowed. - * Scalar values are integer, - * float, string or boolean values. It is - * possible to define resource constants, however it is not recommended - * and may cause unpredictable behavior. - *

- * @param bool $case_insensitive [optional]

- * If set to TRUE, the constant will be defined case-insensitive. - * The default behavior is case-sensitive; i.e. - * CONSTANT and Constant represent - * different values. - *

- *

- * Case-insensitive constants are stored as lower-case. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function define ($name, $value, $case_insensitive = false) {} - -/** - * (PHP 4, PHP 5)
- * Checks whether a given named constant exists - * @link http://php.net/manual/en/function.defined.php - * @param string $name

- * The constant name. - *

- * @return bool TRUE if the named constant given by name - * has been defined, FALSE otherwise. - */ -function defined ($name) {} - -/** - * (PHP 4, PHP 5)
- * Returns the name of the class of an object - * @link http://php.net/manual/en/function.get-class.php - * @param object $object [optional]

- * The tested object. This parameter may be omitted when inside a class. - *

- * @return string the name of the class of which object is an - * instance. Returns FALSE if object is not an - * object. - *

- *

- * If object is omitted when inside a class, the - * name of that class is returned. - */ -function get_class ($object = null) {} - -/** - * (PHP 5 >= 5.3.0)
- * the "Late Static Binding" class name - * @link http://php.net/manual/en/function.get-called-class.php - * @return string the class name. Returns FALSE if called from outside a class. - */ -function get_called_class () {} - -/** - * (PHP 4, PHP 5)
- * Retrieves the parent class name for object or class - * @link http://php.net/manual/en/function.get-parent-class.php - * @param mixed $object [optional]

- * The tested object or class name - *

- * @return string the name of the parent class of the class of which - * object is an instance or the name. - *

- *

- * If the object does not have a parent or the class given does not exist FALSE will be returned. - *

- *

- * If called without parameter outside object, this function returns FALSE. - */ -function get_parent_class ($object = null) {} - -/** - * (PHP 4, PHP 5)
- * Checks if the class method exists - * @link http://php.net/manual/en/function.method-exists.php - * @param mixed $object

- * An object instance or a class name - *

- * @param string $method_name

- * The method name - *

- * @return bool TRUE if the method given by method_name - * has been defined for the given object, FALSE - * otherwise. - */ -function method_exists ($object, $method_name) {} - -/** - * (PHP 5 >= 5.1.0)
- * Checks if the object or class has a property - * @link http://php.net/manual/en/function.property-exists.php - * @param mixed $class

- * The class name or an object of the class to test for - *

- * @param string $property

- * The name of the property - *

- * @return bool TRUE if the property exists, FALSE if it doesn't exist or - * NULL in case of an error. - */ -function property_exists ($class, $property) {} - -/** - * (PHP 4, PHP 5)
- * Checks if the class has been defined - * @link http://php.net/manual/en/function.class-exists.php - * @param string $class_name

- * The class name. The name is matched in a case-insensitive manner. - *

- * @param bool $autoload [optional]

- * Whether or not to call __autoload by default. - *

- * @return bool TRUE if class_name is a defined class, - * FALSE otherwise. - */ -function class_exists ($class_name, $autoload = true) {} - -/** - * (PHP 5 >= 5.0.2)
- * Checks if the interface has been defined - * @link http://php.net/manual/en/function.interface-exists.php - * @param string $interface_name

- * The interface name - *

- * @param bool $autoload [optional]

- * Whether to call __autoload or not by default. - *

- * @return bool TRUE if the interface given by - * interface_name has been defined, FALSE otherwise. - */ -function interface_exists ($interface_name, $autoload = true) {} - -/** - * (No version information available, might only be in SVN)
- * Checks if the trait exists - * @link http://php.net/manual/en/function.trait-exists.php - * @param string $traitname

- * Name of the trait to check - *

- * @param bool $autoload [optional]

- * Whether to autoload if not already loaded. - *

- * @return bool TRUE if trait exists, FALSE if not, NULL in case of an error. - */ -function trait_exists ($traitname, $autoload = null) {} - -/** - * (PHP 4, PHP 5)
- * Return TRUE if the given function has been defined - * @link http://php.net/manual/en/function.function-exists.php - * @param string $function_name

- * The function name, as a string. - *

- * @return bool TRUE if function_name exists and is a - * function, FALSE otherwise. - *

- *

- * This function will return FALSE for constructs, such as - * include_once and echo. - */ -function function_exists ($function_name) {} - -/** - * (PHP 5 >= 5.3.0)
- * Creates an alias for a class - * @link http://php.net/manual/en/function.class-alias.php - * @param string $original

- * The original class. - *

- * @param string $alias

- * The alias name for the class. - *

- * @param bool $autoload [optional]

- * Whether do autoload if the original class is not found. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function class_alias ($original, $alias, $autoload = '&true;') {} - -/** - * (PHP 4, PHP 5)
- * Returns an array with the names of included or required files - * @link http://php.net/manual/en/function.get-included-files.php - * @return array an array of the names of all files. - *

- *

- * The script originally called is considered an "included file," so it will - * be listed together with the files referenced by - * include and family. - *

- *

- * Files that are included or required multiple times only show up once in - * the returned array. - */ -function get_included_files () {} - -/** - * (PHP 4, PHP 5)
- * Alias of get_included_files - * @link http://php.net/manual/en/function.get-required-files.php - */ -function get_required_files () {} - -/** - * (PHP 4, PHP 5)
- * Checks if the object has this class as one of its parents - * @link http://php.net/manual/en/function.is-subclass-of.php - * @param mixed $object

- * A class name or an object instance - *

- * @param string $class_name

- * The class name - *

- * @param bool $allow_string [optional]

- * If this parameter set to false, string class name as object - * is not allowed. This also prevents from calling autoloader if the class doesn't exist. - *

- * @return bool This function returns TRUE if the object object, - * belongs to a class which is a subclass of - * class_name, FALSE otherwise. - */ -function is_subclass_of ($object, $class_name, $allow_string = '&true;') {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Checks if the object is of this class or has this class as one of its parents - * @link http://php.net/manual/en/function.is-a.php - * @param object $object

- * The tested object - *

- * @param string $class_name

- * The class name - *

- * @param bool $allow_string [optional]

- * If this parameter set to false, string class name as object - * is not allowed. This also prevents from calling autoloader if the class doesn't exist. - *

- * @return bool TRUE if the object is of this class or has this class as one of - * its parents, FALSE otherwise. - */ -function is_a ($object, $class_name, $allow_string = '&false;') {} - -/** - * (PHP 4, PHP 5)
- * Get the default properties of the class - * @link http://php.net/manual/en/function.get-class-vars.php - * @param string $class_name

- * The class name - *

- * @return array an associative array of declared properties visible from the - * current scope, with their default value. - * The resulting array elements are in the form of - * varname => value. - * In case of an error, it returns FALSE. - */ -function get_class_vars ($class_name) {} - -/** - * (PHP 4, PHP 5)
- * Gets the properties of the given object - * @link http://php.net/manual/en/function.get-object-vars.php - * @param object $object

- * An object instance. - *

- * @return array an associative array of defined object accessible non-static properties - * for the specified object in scope. If a property has - * not been assigned a value, it will be returned with a NULL value. - */ -function get_object_vars ($object) {} - -/** - * (PHP 4, PHP 5)
- * Gets the class methods' names - * @link http://php.net/manual/en/function.get-class-methods.php - * @param mixed $class_name

- * The class name or an object instance - *

- * @return array an array of method names defined for the class specified by - * class_name. In case of an error, it returns NULL. - */ -function get_class_methods ($class_name) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Generates a user-level error/warning/notice message - * @link http://php.net/manual/en/function.trigger-error.php - * @param string $error_msg

- * The designated error message for this error. It's limited to 1024 - * characters in length. Any additional characters beyond 1024 will be - * truncated. - *

- * @param int $error_type [optional]

- * The designated error type for this error. It only works with the E_USER - * family of constants, and will default to E_USER_NOTICE. - *

- * @return bool This function returns FALSE if wrong error_type is - * specified, TRUE otherwise. - */ -function trigger_error ($error_msg, $error_type = 'E_USER_NOTICE') {} - -/** - * (PHP 4, PHP 5)
- * Alias of trigger_error - * @link http://php.net/manual/en/function.user-error.php - * @param $message - * @param $error_type [optional] - */ -function user_error ($message, $error_type) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Sets a user-defined error handler function - * @link http://php.net/manual/en/function.set-error-handler.php - * @param callable $error_handler

- * The user function needs to accept two parameters: the error code, and a - * string describing the error. Then there are three optional parameters - * that may be supplied: the filename in which the error occurred, the - * line number in which the error occurred, and the context in which the - * error occurred (an array that points to the active symbol table at the - * point the error occurred). The function can be shown as: - *

- *

- * handler - * interrno - * stringerrstr - * stringerrfile - * interrline - * arrayerrcontext - * errno - * The first parameter, errno, contains the - * level of the error raised, as an integer. - * @param int $error_types [optional]

- * Can be used to mask the triggering of the - * error_handler function just like the error_reporting ini setting - * controls which errors are shown. Without this mask set the - * error_handler will be called for every error - * regardless to the setting of the error_reporting setting. - *

- * @return mixed a string containing the previously defined error handler (if any). If - * the built-in error handler is used NULL is returned. NULL is also returned - * in case of an error such as an invalid callback. If the previous error handler - * was a class method, this function will return an indexed array with the class - * and the method name. - */ -function set_error_handler (callable $error_handler, $error_types = 'E_ALL | E_STRICT') {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Restores the previous error handler function - * @link http://php.net/manual/en/function.restore-error-handler.php - * @return bool This function always returns TRUE. - */ -function restore_error_handler () {} - -/** - * (PHP 5)
- * Sets a user-defined exception handler function - * @link http://php.net/manual/en/function.set-exception-handler.php - * @param callable $exception_handler

- * Name of the function to be called when an uncaught exception occurs. - * This function must be defined before calling - * set_exception_handler. This handler function - * needs to accept one parameter, which will be the exception object that - * was thrown. - *

- *

- * NULL may be passed instead, to reset this handler to its - * default state. - *

- * @return callable the name of the previously defined exception handler, or NULL on error. If - * no previous handler was defined, NULL is also returned. If NULL is passed, - * resetting the handler to its default state, TRUE is returned. - */ -function set_exception_handler (callable $exception_handler) {} - -/** - * (PHP 5)
- * Restores the previously defined exception handler function - * @link http://php.net/manual/en/function.restore-exception-handler.php - * @return bool This function always returns TRUE. - */ -function restore_exception_handler () {} - -/** - * (PHP 4, PHP 5)
- * Returns an array with the name of the defined classes - * @link http://php.net/manual/en/function.get-declared-classes.php - * @return array an array of the names of the declared classes in the current - * script. - *

- *

- * Note that depending on what extensions you have compiled or - * loaded into PHP, additional classes could be present. This means that - * you will not be able to define your own classes using these - * names. There is a list of predefined classes in the Predefined Classes section of - * the appendices. - */ -function get_declared_classes () {} - -/** - * (No version information available, might only be in SVN)
- * Returns an array of all declared traits - * @link http://php.net/manual/en/function.get-declared-traits.php - * @return array an array with names of all declared traits in values. - * Returns NULL in case of a failure. - */ -function get_declared_traits () {} - -/** - * (PHP 5)
- * Returns an array of all declared interfaces - * @link http://php.net/manual/en/function.get-declared-interfaces.php - * @return array an array of the names of the declared interfaces in the current - * script. - */ -function get_declared_interfaces () {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Returns an array of all defined functions - * @link http://php.net/manual/en/function.get-defined-functions.php - * @return array a multidimensional array containing a list of all defined - * functions, both built-in (internal) and user-defined. The internal - * functions will be accessible via $arr["internal"], and - * the user defined ones using $arr["user"] (see example - * below). - */ -function get_defined_functions () {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Returns an array of all defined variables - * @link http://php.net/manual/en/function.get-defined-vars.php - * @return array A multidimensional array with all the variables. - */ -function get_defined_vars () {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Create an anonymous (lambda-style) function - * @link http://php.net/manual/en/function.create-function.php - * @param string $args

- * The function arguments. - *

- * @param string $code

- * The function code. - *

- * @return string a unique function name as a string, or FALSE on error. - */ -function create_function ($args, $code) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Returns the resource type - * @link http://php.net/manual/en/function.get-resource-type.php - * @param resource $handle

- * The evaluated resource handle. - *

- * @return string If the given handle is a resource, this function - * will return a string representing its type. If the type is not identified - * by this function, the return value will be the string - * Unknown. - *

- *

- * This function will return FALSE and generate an error if - * handle is not a resource. - */ -function get_resource_type ($handle) {} - -/** - * (PHP 4, PHP 5)
- * Returns an array with the names of all modules compiled and loaded - * @link http://php.net/manual/en/function.get-loaded-extensions.php - * @param bool $zend_extensions [optional]

- * Only return Zend extensions, if not then regular extensions, like - * mysqli are listed. Defaults to FALSE (return regular extensions). - *

- * @return array an indexed array of all the modules names. - */ -function get_loaded_extensions ($zend_extensions = false) {} - -/** - * (PHP 4, PHP 5)
- * Find out whether an extension is loaded - * @link http://php.net/manual/en/function.extension-loaded.php - * @param string $name

- * The extension name. - *

- *

- * You can see the names of various extensions by using - * phpinfo or if you're using the - * CGI or CLI version of - * PHP you can use the -m switch to - * list all available extensions: - *

- * $ php -m
- * [PHP Modules]
- * xml
- * tokenizer
- * standard
- * sockets
- * session
- * posix
- * pcre
- * overload
- * mysql
- * mbstring
- * ctype
- * [Zend Modules]
- * 
- *

- * @return bool TRUE if the extension identified by name - * is loaded, FALSE otherwise. - */ -function extension_loaded ($name) {} - -/** - * (PHP 4, PHP 5)
- * Returns an array with the names of the functions of a module - * @link http://php.net/manual/en/function.get-extension-funcs.php - * @param string $module_name

- * The module name. - *

- *

- * This parameter must be in lowercase. - *

- * @return array an array with all the functions, or FALSE if - * module_name is not a valid extension. - */ -function get_extension_funcs ($module_name) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Returns an associative array with the names of all the constants and their values - * @link http://php.net/manual/en/function.get-defined-constants.php - * @param bool $categorize [optional]

- * Causing this function to return a multi-dimensional - * array with categories in the keys of the first dimension and constants - * and their values in the second dimension. - * - * define("MY_CONSTANT", 1); - * print_r(get_defined_constants(true)); - * - * The above example will output - * something similar to:

- *
- * Array
- * (
- * [Core] => Array
- * (
- * [E_ERROR] => 1
- * [E_WARNING] => 2
- * [E_PARSE] => 4
- * [E_NOTICE] => 8
- * [E_CORE_ERROR] => 16
- * [E_CORE_WARNING] => 32
- * [E_COMPILE_ERROR] => 64
- * [E_COMPILE_WARNING] => 128
- * [E_USER_ERROR] => 256
- * [E_USER_WARNING] => 512
- * [E_USER_NOTICE] => 1024
- * [E_ALL] => 2047
- * [TRUE] => 1
- * )
- * [pcre] => Array
- * (
- * [PREG_PATTERN_ORDER] => 1
- * [PREG_SET_ORDER] => 2
- * [PREG_OFFSET_CAPTURE] => 256
- * [PREG_SPLIT_NO_EMPTY] => 1
- * [PREG_SPLIT_DELIM_CAPTURE] => 2
- * [PREG_SPLIT_OFFSET_CAPTURE] => 4
- * [PREG_GREP_INVERT] => 1
- * )
- * [user] => Array
- * (
- * [MY_CONSTANT] => 1
- * )
- * )
- * 
- *

- * @return array - */ -function get_defined_constants ($categorize = false) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Generates a backtrace - * @link http://php.net/manual/en/function.debug-backtrace.php - * @param int $options [optional]

- * As of 5.3.6, this parameter is a bitmask for the following options: - * - * debug_backtrace options - * - * - * - * - * - * - * - * - *
DEBUG_BACKTRACE_PROVIDE_OBJECT - * Whether or not to populate the "object" index. - *
DEBUG_BACKTRACE_IGNORE_ARGS - * Whether or not to omit the "args" index, and thus all the function/method arguments, - * to save memory. - *
- * Before 5.3.6, the only values recognized are TRUE or FALSE, which are the same as - * setting or not setting the DEBUG_BACKTRACE_PROVIDE_OBJECT option respectively. - *

- * @param int $limit [optional]

- * As of 5.4.0, this parameter can be used to limit the number of stack frames returned. - * By default (limit=0) it returns all stack frames. - *

- * @return array an array of associative arrays. The possible returned elements - * are as follows: - *

- *

- * - * Possible returned elements from debug_backtrace - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
NameTypeDescription
functionstring - * The current function name. See also - * __FUNCTION__. - *
lineinteger - * The current line number. See also - * __LINE__. - *
filestring - * The current file name. See also - * __FILE__. - *
classstring - * The current class name. See also - * __CLASS__ - *
objectobject - * The current object. - *
typestring - * The current call type. If a method call, "->" is returned. If a static - * method call, "::" is returned. If a function call, nothing is returned. - *
argsarray - * If inside a function, this lists the functions arguments. If - * inside an included file, this lists the included file name(s). - *
- */ -function debug_backtrace ($options = 'DEBUG_BACKTRACE_PROVIDE_OBJECT', $limit = 0) {} - -/** - * (PHP 5)
- * Prints a backtrace - * @link http://php.net/manual/en/function.debug-print-backtrace.php - * @param int $options [optional]

- * As of 5.3.6, this parameter is a bitmask for the following options: - * - * debug_print_backtrace options - * - * - * - * - *
DEBUG_BACKTRACE_IGNORE_ARGS - * Whether or not to omit the "args" index, and thus all the function/method arguments, - * to save memory. - *
- *

- * @param int $limit [optional]

- * As of 5.4.0, this parameter can be used to limit the number of stack frames printed. - * By default (limit=0) it prints all stack frames. - *

- * @return void No value is returned. - */ -function debug_print_backtrace ($options = 0, $limit = 0) {} - -/** - * (PHP 5 >= 5.3.0)
- * Forces collection of any existing garbage cycles - * @link http://php.net/manual/en/function.gc-collect-cycles.php - * @return int number of collected cycles. - */ -function gc_collect_cycles () {} - -/** - * (PHP 5 >= 5.3.0)
- * Returns status of the circular reference collector - * @link http://php.net/manual/en/function.gc-enabled.php - * @return bool TRUE if the garbage collector is enabled, FALSE otherwise. - */ -function gc_enabled () {} - -/** - * (PHP 5 >= 5.3.0)
- * Activates the circular reference collector - * @link http://php.net/manual/en/function.gc-enable.php - * @return void No value is returned. - */ -function gc_enable () {} - -/** - * (PHP 5 >= 5.3.0)
- * Deactivates the circular reference collector - * @link http://php.net/manual/en/function.gc-disable.php - * @return void No value is returned. - */ -function gc_disable () {} - - -/** - * Fatal run-time errors. These indicate errors that can not be - * recovered from, such as a memory allocation problem. - * Execution of the script is halted. - * @link http://php.net/manual/en/errorfunc.constants.php - */ -define ('E_ERROR', 1); - -/** - * Catchable fatal error. It indicates that a probably dangerous error - * occured, but did not leave the Engine in an unstable state. If the error - * is not caught by a user defined handle (see also - * set_error_handler), the application aborts as it - * was an E_ERROR. - * @link http://php.net/manual/en/errorfunc.constants.php - */ -define ('E_RECOVERABLE_ERROR', 4096); - -/** - * Run-time warnings (non-fatal errors). Execution of the script is not - * halted. - * @link http://php.net/manual/en/errorfunc.constants.php - */ -define ('E_WARNING', 2); - -/** - * Compile-time parse errors. Parse errors should only be generated by - * the parser. - * @link http://php.net/manual/en/errorfunc.constants.php - */ -define ('E_PARSE', 4); - -/** - * Run-time notices. Indicate that the script encountered something that - * could indicate an error, but could also happen in the normal course of - * running a script. - * @link http://php.net/manual/en/errorfunc.constants.php - */ -define ('E_NOTICE', 8); - -/** - * Enable to have PHP suggest changes - * to your code which will ensure the best interoperability - * and forward compatibility of your code. - * @link http://php.net/manual/en/errorfunc.constants.php - */ -define ('E_STRICT', 2048); - -/** - * Run-time notices. Enable this to receive warnings about code - * that will not work in future versions. - * @link http://php.net/manual/en/errorfunc.constants.php - */ -define ('E_DEPRECATED', 8192); - -/** - * Fatal errors that occur during PHP's initial startup. This is like an - * E_ERROR, except it is generated by the core of PHP. - * @link http://php.net/manual/en/errorfunc.constants.php - */ -define ('E_CORE_ERROR', 16); - -/** - * Warnings (non-fatal errors) that occur during PHP's initial startup. - * This is like an E_WARNING, except it is generated - * by the core of PHP. - * @link http://php.net/manual/en/errorfunc.constants.php - */ -define ('E_CORE_WARNING', 32); - -/** - * Fatal compile-time errors. This is like an E_ERROR, - * except it is generated by the Zend Scripting Engine. - * @link http://php.net/manual/en/errorfunc.constants.php - */ -define ('E_COMPILE_ERROR', 64); - -/** - * Compile-time warnings (non-fatal errors). This is like an - * E_WARNING, except it is generated by the Zend - * Scripting Engine. - * @link http://php.net/manual/en/errorfunc.constants.php - */ -define ('E_COMPILE_WARNING', 128); - -/** - * User-generated error message. This is like an - * E_ERROR, except it is generated in PHP code by - * using the PHP function trigger_error. - * @link http://php.net/manual/en/errorfunc.constants.php - */ -define ('E_USER_ERROR', 256); - -/** - * User-generated warning message. This is like an - * E_WARNING, except it is generated in PHP code by - * using the PHP function trigger_error. - * @link http://php.net/manual/en/errorfunc.constants.php - */ -define ('E_USER_WARNING', 512); - -/** - * User-generated notice message. This is like an - * E_NOTICE, except it is generated in PHP code by - * using the PHP function trigger_error. - * @link http://php.net/manual/en/errorfunc.constants.php - */ -define ('E_USER_NOTICE', 1024); - -/** - * User-generated warning message. This is like an - * E_DEPRECATED, except it is generated in PHP code by - * using the PHP function trigger_error. - * @link http://php.net/manual/en/errorfunc.constants.php - */ -define ('E_USER_DEPRECATED', 16384); - -/** - * All errors and warnings, as supported, except of level - * E_STRICT prior to PHP 5.4.0. - * @link http://php.net/manual/en/errorfunc.constants.php - */ -define ('E_ALL', 32767); -define ('DEBUG_BACKTRACE_PROVIDE_OBJECT', 1); -define ('DEBUG_BACKTRACE_IGNORE_ARGS', 2); -define ('TRUE', true); -define ('FALSE', false); -define ('NULL', null); -define ('ZEND_THREAD_SAFE', false); -define ('ZEND_DEBUG_BUILD', false); -define ('PHP_VERSION', "5.4.6-1ubuntu1.1"); -define ('PHP_MAJOR_VERSION', 5); -define ('PHP_MINOR_VERSION', 4); -define ('PHP_RELEASE_VERSION', 6); -define ('PHP_EXTRA_VERSION', "-1ubuntu1.1"); -define ('PHP_VERSION_ID', 50406); -define ('PHP_ZTS', 0); -define ('PHP_DEBUG', 0); -define ('PHP_OS', "Linux"); -define ('PHP_SAPI', "cli"); -define ('DEFAULT_INCLUDE_PATH', ".:/usr/share/php:/usr/share/pear"); -define ('PEAR_INSTALL_DIR', "/usr/share/php"); -define ('PEAR_EXTENSION_DIR', "/usr/lib/php5/20100525"); -define ('PHP_EXTENSION_DIR', "/usr/lib/php5/20100525"); -define ('PHP_PREFIX', "/usr"); -define ('PHP_BINDIR', "/usr/bin"); -define ('PHP_MANDIR', "/usr/share/man"); -define ('PHP_LIBDIR', "/usr/lib/php5"); -define ('PHP_DATADIR', "${prefix}/share"); -define ('PHP_SYSCONFDIR', "/etc"); -define ('PHP_LOCALSTATEDIR', "/var"); -define ('PHP_CONFIG_FILE_PATH', "/etc/php5/cli"); -define ('PHP_CONFIG_FILE_SCAN_DIR', "/etc/php5/cli/conf.d"); -define ('PHP_SHLIB_SUFFIX', "so"); -define ('PHP_EOL', "\n"); -define ('PHP_MAXPATHLEN', 4096); -define ('PHP_INT_MAX', 9223372036854775807); -define ('PHP_INT_SIZE', 8); -define ('PHP_BINARY', "/usr/bin/php5"); - -/** - *

- * Indicates that output buffering has begun. - *

- * @link http://php.net/manual/en/outcontrol.constants.php - */ -define ('PHP_OUTPUT_HANDLER_START', 1); - -/** - *

- * Indicates that the output buffer is being flushed, and had data to output. - *

- *

- * Available since PHP 5.4. - *

- * @link http://php.net/manual/en/outcontrol.constants.php - */ -define ('PHP_OUTPUT_HANDLER_WRITE', 0); - -/** - *

- * Indicates that the buffer has been flushed. - *

- *

- * Available since PHP 5.4. - *

- * @link http://php.net/manual/en/outcontrol.constants.php - */ -define ('PHP_OUTPUT_HANDLER_FLUSH', 4); - -/** - *

- * Indicates that the output buffer has been cleaned. - *

- *

- * Available since PHP 5.4. - *

- * @link http://php.net/manual/en/outcontrol.constants.php - */ -define ('PHP_OUTPUT_HANDLER_CLEAN', 2); - -/** - *

- * Indicates that this is the final output buffering operation. - *

- *

- * Available since PHP 5.4. - *

- * @link http://php.net/manual/en/outcontrol.constants.php - */ -define ('PHP_OUTPUT_HANDLER_FINAL', 8); - -/** - *

- * Indicates that the buffer has been flushed, but output buffering will - * continue. - *

- *

- * As of PHP 5.4, this is an alias for - * PHP_OUTPUT_HANDLER_WRITE. - *

- * @link http://php.net/manual/en/outcontrol.constants.php - */ -define ('PHP_OUTPUT_HANDLER_CONT', 0); - -/** - *

- * Indicates that output buffering has ended. - *

- *

- * As of PHP 5.4, this is an alias for - * PHP_OUTPUT_HANDLER_FINAL. - *

- * @link http://php.net/manual/en/outcontrol.constants.php - */ -define ('PHP_OUTPUT_HANDLER_END', 8); -define ('PHP_OUTPUT_HANDLER_CLEANABLE', 16); -define ('PHP_OUTPUT_HANDLER_FLUSHABLE', 32); -define ('PHP_OUTPUT_HANDLER_REMOVABLE', 64); -define ('PHP_OUTPUT_HANDLER_STDFLAGS', 112); -define ('PHP_OUTPUT_HANDLER_STARTED', 4096); -define ('PHP_OUTPUT_HANDLER_DISABLED', 8192); -define ('UPLOAD_ERR_OK', 0); -define ('UPLOAD_ERR_INI_SIZE', 1); -define ('UPLOAD_ERR_FORM_SIZE', 2); -define ('UPLOAD_ERR_PARTIAL', 3); -define ('UPLOAD_ERR_NO_FILE', 4); -define ('UPLOAD_ERR_NO_TMP_DIR', 6); -define ('UPLOAD_ERR_CANT_WRITE', 7); -define ('UPLOAD_ERR_EXTENSION', 8); -define ('STDIN', "Resource id #1"); -define ('STDOUT', "Resource id #2"); -define ('STDERR', "Resource id #3"); - -// End of Core v.5.4.6-1ubuntu1.1 -?> diff --git a/phpruntime/PDO.php b/phpruntime/PDO.php deleted file mode 100644 index 1e2c810..0000000 --- a/phpruntime/PDO.php +++ /dev/null @@ -1,1424 +0,0 @@ -PDOException from your own code. - * See Exceptions for more - * information about Exceptions in PHP. - * @link http://php.net/manual/en/class.pdoexception.php - */ -class PDOException extends RuntimeException { - protected $message; - protected $code; - protected $file; - protected $line; - public $errorInfo; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * Represents a connection between PHP and a database server. - * @link http://php.net/manual/en/class.pdo.php - */ -class PDO { - - /** - * Represents a boolean data type. - * @link http://php.net/manual/en/pdo.constants.php - */ - const PARAM_BOOL = 5; - - /** - * Represents the SQL NULL data type. - * @link http://php.net/manual/en/pdo.constants.php - */ - const PARAM_NULL = 0; - - /** - * Represents the SQL INTEGER data type. - * @link http://php.net/manual/en/pdo.constants.php - */ - const PARAM_INT = 1; - - /** - * Represents the SQL CHAR, VARCHAR, or other string data type. - * @link http://php.net/manual/en/pdo.constants.php - */ - const PARAM_STR = 2; - - /** - * Represents the SQL large object data type. - * @link http://php.net/manual/en/pdo.constants.php - */ - const PARAM_LOB = 3; - - /** - * Represents a recordset type. Not currently supported by any drivers. - * @link http://php.net/manual/en/pdo.constants.php - */ - const PARAM_STMT = 4; - - /** - * Specifies that the parameter is an INOUT parameter for a stored - * procedure. You must bitwise-OR this value with an explicit - * PDO::PARAM_* data type. - * @link http://php.net/manual/en/pdo.constants.php - */ - const PARAM_INPUT_OUTPUT = 2147483648; - - /** - * Allocation event - * @link http://php.net/manual/en/pdo.constants.php - */ - const PARAM_EVT_ALLOC = 0; - - /** - * Deallocation event - * @link http://php.net/manual/en/pdo.constants.php - */ - const PARAM_EVT_FREE = 1; - - /** - * Event triggered prior to execution of a prepared statement. - * @link http://php.net/manual/en/pdo.constants.php - */ - const PARAM_EVT_EXEC_PRE = 2; - - /** - * Event triggered subsequent to execution of a prepared statement. - * @link http://php.net/manual/en/pdo.constants.php - */ - const PARAM_EVT_EXEC_POST = 3; - - /** - * Event triggered prior to fetching a result from a resultset. - * @link http://php.net/manual/en/pdo.constants.php - */ - const PARAM_EVT_FETCH_PRE = 4; - - /** - * Event triggered subsequent to fetching a result from a resultset. - * @link http://php.net/manual/en/pdo.constants.php - */ - const PARAM_EVT_FETCH_POST = 5; - - /** - * Event triggered during bound parameter registration - * allowing the driver to normalize the parameter name. - * @link http://php.net/manual/en/pdo.constants.php - */ - const PARAM_EVT_NORMALIZE = 6; - - /** - * Specifies that the fetch method shall return each row as an object with - * variable names that correspond to the column names returned in the result - * set. PDO::FETCH_LAZY creates the object variable names as they are accessed. - * Not valid inside PDOStatement::fetchAll. - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_LAZY = 1; - - /** - * Specifies that the fetch method shall return each row as an array indexed - * by column name as returned in the corresponding result set. If the result - * set contains multiple columns with the same name, - * PDO::FETCH_ASSOC returns - * only a single value per column name. - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_ASSOC = 2; - - /** - * Specifies that the fetch method shall return each row as an array indexed - * by column number as returned in the corresponding result set, starting at - * column 0. - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_NUM = 3; - - /** - * Specifies that the fetch method shall return each row as an array indexed - * by both column name and number as returned in the corresponding result set, - * starting at column 0. - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_BOTH = 4; - - /** - * Specifies that the fetch method shall return each row as an object with - * property names that correspond to the column names returned in the result - * set. - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_OBJ = 5; - - /** - * Specifies that the fetch method shall return TRUE and assign the values of - * the columns in the result set to the PHP variables to which they were - * bound with the PDOStatement::bindParam or - * PDOStatement::bindColumn methods. - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_BOUND = 6; - - /** - * Specifies that the fetch method shall return only a single requested - * column from the next row in the result set. - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_COLUMN = 7; - - /** - * Specifies that the fetch method shall return a new instance of the - * requested class, mapping the columns to named properties in the class. - * The magic - * __set - * method is called if the property doesn't exist in the requested class - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_CLASS = 8; - - /** - * Specifies that the fetch method shall update an existing instance of the - * requested class, mapping the columns to named properties in the class. - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_INTO = 9; - - /** - * Allows completely customize the way data is treated on the fly (only - * valid inside PDOStatement::fetchAll). - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_FUNC = 10; - - /** - * Group return by values. Usually combined with - * PDO::FETCH_COLUMN or - * PDO::FETCH_KEY_PAIR. - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_GROUP = 65536; - - /** - * Fetch only the unique values. - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_UNIQUE = 196608; - - /** - * Fetch a two-column result into an array where the first column is a key and the second column - * is the value. Available since PHP 5.2.3. - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_KEY_PAIR = 12; - - /** - * Determine the class name from the value of first column. - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_CLASSTYPE = 262144; - - /** - * As PDO::FETCH_INTO but object is provided as a serialized string. - * Available since PHP 5.1.0. - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_SERIALIZE = 524288; - - /** - * Available since PHP 5.2.0 - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_PROPS_LATE = 1048576; - - /** - * Specifies that the fetch method shall return each row as an array indexed - * by column name as returned in the corresponding result set. If the result - * set contains multiple columns with the same name, - * PDO::FETCH_NAMED returns - * an array of values per column name. - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_NAMED = 11; - - /** - * If this value is FALSE, PDO attempts to disable autocommit so that the - * connection begins a transaction. - * @link http://php.net/manual/en/pdo.constants.php - */ - const ATTR_AUTOCOMMIT = 0; - - /** - * Setting the prefetch size allows you to balance speed against memory - * usage for your application. Not all database/driver combinations support - * setting of the prefetch size. A larger prefetch size results in - * increased performance at the cost of higher memory usage. - * @link http://php.net/manual/en/pdo.constants.php - */ - const ATTR_PREFETCH = 1; - - /** - * Sets the timeout value in seconds for communications with the database. - * @link http://php.net/manual/en/pdo.constants.php - */ - const ATTR_TIMEOUT = 2; - - /** - * See the Errors and error - * handling section for more information about this attribute. - * @link http://php.net/manual/en/pdo.constants.php - */ - const ATTR_ERRMODE = 3; - - /** - * This is a read only attribute; it will return information about the - * version of the database server to which PDO is connected. - * @link http://php.net/manual/en/pdo.constants.php - */ - const ATTR_SERVER_VERSION = 4; - - /** - * This is a read only attribute; it will return information about the - * version of the client libraries that the PDO driver is using. - * @link http://php.net/manual/en/pdo.constants.php - */ - const ATTR_CLIENT_VERSION = 5; - - /** - * This is a read only attribute; it will return some meta information about the - * database server to which PDO is connected. - * @link http://php.net/manual/en/pdo.constants.php - */ - const ATTR_SERVER_INFO = 6; - const ATTR_CONNECTION_STATUS = 7; - - /** - * Force column names to a specific case specified by the PDO::CASE_* - * constants. - * @link http://php.net/manual/en/pdo.constants.php - */ - const ATTR_CASE = 8; - - /** - * Get or set the name to use for a cursor. Most useful when using - * scrollable cursors and positioned updates. - * @link http://php.net/manual/en/pdo.constants.php - */ - const ATTR_CURSOR_NAME = 9; - - /** - * Selects the cursor type. PDO currently supports either - * PDO::CURSOR_FWDONLY and - * PDO::CURSOR_SCROLL. Stick with - * PDO::CURSOR_FWDONLY unless you know that you need a - * scrollable cursor. - * @link http://php.net/manual/en/pdo.constants.php - */ - const ATTR_CURSOR = 10; - - /** - * Convert empty strings to SQL NULL values on data fetches. - * @link http://php.net/manual/en/pdo.constants.php - */ - const ATTR_ORACLE_NULLS = 11; - - /** - * Request a persistent connection, rather than creating a new connection. - * See Connections and Connection - * management for more information on this attribute. - * @link http://php.net/manual/en/pdo.constants.php - */ - const ATTR_PERSISTENT = 12; - const ATTR_STATEMENT_CLASS = 13; - - /** - * Prepend the containing table name to each column name returned in the - * result set. The table name and column name are separated by a decimal (.) - * character. Support of this attribute is at the driver level; it may not - * be supported by your driver. - * @link http://php.net/manual/en/pdo.constants.php - */ - const ATTR_FETCH_TABLE_NAMES = 14; - - /** - * Prepend the containing catalog name to each column name returned in the - * result set. The catalog name and column name are separated by a decimal - * (.) character. Support of this attribute is at the driver level; it may - * not be supported by your driver. - * @link http://php.net/manual/en/pdo.constants.php - */ - const ATTR_FETCH_CATALOG_NAMES = 15; - - /** - * Returns the name of the driver. - *

- * using PDO::ATTR_DRIVER_NAME - * - * if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { - * echo "Running on mysql; doing something mysql specific here\n"; - * } - * - *

- * @link http://php.net/manual/en/pdo.constants.php - */ - const ATTR_DRIVER_NAME = 16; - const ATTR_STRINGIFY_FETCHES = 17; - const ATTR_MAX_COLUMN_LEN = 18; - - /** - * Available since PHP 5.1.3. - * @link http://php.net/manual/en/pdo.constants.php - */ - const ATTR_EMULATE_PREPARES = 20; - - /** - * Available since PHP 5.2.0 - * @link http://php.net/manual/en/pdo.constants.php - */ - const ATTR_DEFAULT_FETCH_MODE = 19; - - /** - * Do not raise an error or exception if an error occurs. The developer is - * expected to explicitly check for errors. This is the default mode. - * See Errors and error handling - * for more information about this attribute. - * @link http://php.net/manual/en/pdo.constants.php - */ - const ERRMODE_SILENT = 0; - - /** - * Issue a PHP E_WARNING message if an error occurs. - * See Errors and error handling - * for more information about this attribute. - * @link http://php.net/manual/en/pdo.constants.php - */ - const ERRMODE_WARNING = 1; - - /** - * Throw a PDOException if an error occurs. - * See Errors and error handling - * for more information about this attribute. - * @link http://php.net/manual/en/pdo.constants.php - */ - const ERRMODE_EXCEPTION = 2; - - /** - * Leave column names as returned by the database driver. - * @link http://php.net/manual/en/pdo.constants.php - */ - const CASE_NATURAL = 0; - - /** - * Force column names to lower case. - * @link http://php.net/manual/en/pdo.constants.php - */ - const CASE_LOWER = 2; - - /** - * Force column names to upper case. - * @link http://php.net/manual/en/pdo.constants.php - */ - const CASE_UPPER = 1; - const NULL_NATURAL = 0; - const NULL_EMPTY_STRING = 1; - const NULL_TO_STRING = 2; - - /** - * Corresponds to SQLSTATE '00000', meaning that the SQL statement was - * successfully issued with no errors or warnings. This constant is for - * your convenience when checking PDO::errorCode or - * PDOStatement::errorCode to determine if an error - * occurred. You will usually know if this is the case by examining the - * return code from the method that raised the error condition anyway. - * @link http://php.net/manual/en/pdo.constants.php - */ - const ERR_NONE = 00000; - - /** - * Fetch the next row in the result set. Valid only for scrollable cursors. - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_ORI_NEXT = 0; - - /** - * Fetch the previous row in the result set. Valid only for scrollable - * cursors. - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_ORI_PRIOR = 1; - - /** - * Fetch the first row in the result set. Valid only for scrollable cursors. - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_ORI_FIRST = 2; - - /** - * Fetch the last row in the result set. Valid only for scrollable cursors. - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_ORI_LAST = 3; - - /** - * Fetch the requested row by row number from the result set. Valid only - * for scrollable cursors. - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_ORI_ABS = 4; - - /** - * Fetch the requested row by relative position from the current position - * of the cursor in the result set. Valid only for scrollable cursors. - * @link http://php.net/manual/en/pdo.constants.php - */ - const FETCH_ORI_REL = 5; - - /** - * Create a PDOStatement object with a forward-only cursor. This is the - * default cursor choice, as it is the fastest and most common data access - * pattern in PHP. - * @link http://php.net/manual/en/pdo.constants.php - */ - const CURSOR_FWDONLY = 0; - - /** - * Create a PDOStatement object with a scrollable cursor. Pass the - * PDO::FETCH_ORI_* constants to control the rows fetched from the result set. - * @link http://php.net/manual/en/pdo.constants.php - */ - const CURSOR_SCROLL = 1; - - /** - * If this attribute is set to TRUE on a - * PDOStatement, the MySQL driver will use the - * buffered versions of the MySQL API. If you're writing portable code, you - * should use PDOStatement::fetchAll instead. - *

- * Forcing queries to be buffered in mysql - * - * if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { - * $stmt = $db->prepare('select * from foo', - * array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true)); - * } else { - * die("my application only works with mysql; I should use \$stmt->fetchAll() instead"); - * } - * - *

- * @link http://php.net/manual/en/pdo-mysql.constants.php - */ - const MYSQL_ATTR_USE_BUFFERED_QUERY = 1000; - - /** - *

- * Enable LOAD LOCAL INFILE. - *

- *

- * Note, this constant can only be used in the driver_options - * array when constructing a new database handle. - *

- * @link http://php.net/manual/en/pdo-mysql.constants.php - */ - const MYSQL_ATTR_LOCAL_INFILE = 1001; - - /** - *

- * Command to execute when connecting to the MySQL server. Will - * automatically be re-executed when reconnecting. - *

- *

- * Note, this constant can only be used in the driver_options - * array when constructing a new database handle. - *

- * @link http://php.net/manual/en/pdo-mysql.constants.php - */ - const MYSQL_ATTR_INIT_COMMAND = 1002; - - /** - *

- * Maximum buffer size. Defaults to 1 MiB. This constant is not supported when - * compiled against mysqlnd. - *

- * @link http://php.net/manual/en/pdo-mysql.constants.php - */ - const MYSQL_ATTR_MAX_BUFFER_SIZE = 1005; - - /** - *

- * Read options from the named option file instead of from - * my.cnf. This option is not available if - * mysqlnd is used, because mysqlnd does not read the mysql - * configuration files. - *

- * @link http://php.net/manual/en/pdo-mysql.constants.php - */ - const MYSQL_ATTR_READ_DEFAULT_FILE = 1003; - - /** - *

- * Read options from the named group from my.cnf or the - * file specified with MYSQL_READ_DEFAULT_FILE. This option - * is not available if mysqlnd is used, because mysqlnd does not read the mysql - * configuration files. - *

- * @link http://php.net/manual/en/pdo-mysql.constants.php - */ - const MYSQL_ATTR_READ_DEFAULT_GROUP = 1004; - - /** - *

- * Enable network communication compression. This is not supported when - * compiled against mysqlnd. - *

- * @link http://php.net/manual/en/pdo-mysql.constants.php - */ - const MYSQL_ATTR_COMPRESS = 1006; - - /** - *

- * Perform direct queries, don't use prepared statements. - *

- * @link http://php.net/manual/en/pdo-mysql.constants.php - */ - const MYSQL_ATTR_DIRECT_QUERY = 1007; - - /** - *

- * Return the number of found (matched) rows, not the - * number of changed rows. - *

- * @link http://php.net/manual/en/pdo-mysql.constants.php - */ - const MYSQL_ATTR_FOUND_ROWS = 1008; - - /** - *

- * Permit spaces after function names. Makes all functions - * names reserved words. - *

- * @link http://php.net/manual/en/pdo-mysql.constants.php - */ - const MYSQL_ATTR_IGNORE_SPACE = 1009; - const MYSQL_ATTR_SSL_KEY = 1010; - - /** - *

- * The file path to the SSL certificate. - *

- *

- * This exists as of PHP 5.3.7. - *

- * @link http://php.net/manual/en/pdo-mysql.constants.php - */ - const MYSQL_ATTR_SSL_CERT = 1011; - - /** - *

- * The file path to the SSL certificate authority. - *

- *

- * This exists as of PHP 5.3.7. - *

- * @link http://php.net/manual/en/pdo-mysql.constants.php - */ - const MYSQL_ATTR_SSL_CA = 1012; - - /** - *

- * The file path to the directory that contains the trusted SSL - * CA certificates, which are stored in PEM format. - *

- *

- * This exists as of PHP 5.3.7. - *

- * @link http://php.net/manual/en/pdo-mysql.constants.php - */ - const MYSQL_ATTR_SSL_CAPATH = 1013; - const MYSQL_ATTR_SSL_CIPHER = 1014; - const PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT = 1000; - const PGSQL_TRANSACTION_IDLE = 0; - const PGSQL_TRANSACTION_ACTIVE = 1; - const PGSQL_TRANSACTION_INTRANS = 2; - const PGSQL_TRANSACTION_INERROR = 3; - const PGSQL_TRANSACTION_UNKNOWN = 4; - - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)
- * Creates a PDO instance representing a connection to a database - * @link http://php.net/manual/en/pdo.construct.php - * @param $dsn - * @param $username - * @param $passwd - * @param $options [optional] - */ - public function __construct ($dsn, $username, $passwd, $options) {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)
- * Prepares a statement for execution and returns a statement object - * @link http://php.net/manual/en/pdo.prepare.php - * @param string $statement

- * This must be a valid SQL statement for the target database server. - *

- * @param array $driver_options [optional]

- * This array holds one or more key=>value pairs to set - * attribute values for the PDOStatement object that this method - * returns. You would most commonly use this to set the - * PDO::ATTR_CURSOR value to - * PDO::CURSOR_SCROLL to request a scrollable cursor. - * Some drivers have driver specific options that may be set at - * prepare-time. - *

- * @return PDOStatement If the database server successfully prepares the statement, - * PDO::prepare returns a - * PDOStatement object. - * If the database server cannot successfully prepare the statement, - * PDO::prepare returns FALSE or emits - * PDOException (depending on error handling). - *

- *

- * Emulated prepared statements does not communicate with the database server - * so PDO::prepare does not check the statement. - */ - public function prepare ($statement, array $driver_options = 'array()') {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)
- * Initiates a transaction - * @link http://php.net/manual/en/pdo.begintransaction.php - * @return bool TRUE on success or FALSE on failure. - */ - public function beginTransaction () {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)
- * Commits a transaction - * @link http://php.net/manual/en/pdo.commit.php - * @return bool TRUE on success or FALSE on failure. - */ - public function commit () {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)
- * Rolls back a transaction - * @link http://php.net/manual/en/pdo.rollback.php - * @return bool TRUE on success or FALSE on failure. - */ - public function rollBack () {} - - /** - * (PHP 5 >= 5.3.3, Bundled pdo_pgsql)
- * Checks if inside a transaction - * @link http://php.net/manual/en/pdo.intransaction.php - * @return bool TRUE if a transaction is currently active, and FALSE if not. - */ - public function inTransaction () {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)
- * Set an attribute - * @link http://php.net/manual/en/pdo.setattribute.php - * @param int $attribute - * @param mixed $value - * @return bool TRUE on success or FALSE on failure. - */ - public function setAttribute ($attribute, $value) {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)
- * Execute an SQL statement and return the number of affected rows - * @link http://php.net/manual/en/pdo.exec.php - * @param string $statement

- * The SQL statement to prepare and execute. - *

- *

- * Data inside the query should be properly escaped. - *

- * @return int PDO::exec returns the number of rows that were modified - * or deleted by the SQL statement you issued. If no rows were affected, - * PDO::exec returns 0. - *

- * This function may - * return Boolean FALSE, but may also return a non-Boolean value which - * evaluates to FALSE. Please read the section on Booleans for more - * information. Use the === - * operator for testing the return value of this - * function. - *

- * The following example incorrectly relies on the return value of - * PDO::exec, wherein a statement that affected 0 rows - * results in a call to die: - * - * $db->exec() or die(print_r($db->errorInfo(), true)); - * - */ - public function exec ($statement) {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.2.0)
- * Executes an SQL statement, returning a result set as a PDOStatement object - * @link http://php.net/manual/en/pdo.query.php - * @param string $statement

- * The SQL statement to prepare and execute. - *

- *

- * Data inside the query should be properly escaped. - *

- * @return PDOStatement PDO::query returns a PDOStatement object, or FALSE - * on failure. - */ - public function query ($statement) {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)
- * Returns the ID of the last inserted row or sequence value - * @link http://php.net/manual/en/pdo.lastinsertid.php - * @param string $name [optional]

- * Name of the sequence object from which the ID should be returned. - *

- * @return string If a sequence name was not specified for the name - * parameter, PDO::lastInsertId returns a - * string representing the row ID of the last row that was inserted into - * the database. - *

- *

- * If a sequence name was specified for the name - * parameter, PDO::lastInsertId returns a - * string representing the last value retrieved from the specified sequence - * object. - *

- *

- * If the PDO driver does not support this capability, - * PDO::lastInsertId triggers an - * IM001 SQLSTATE. - */ - public function lastInsertId ($name = null) {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)
- * Fetch the SQLSTATE associated with the last operation on the database handle - * @link http://php.net/manual/en/pdo.errorcode.php - * @return mixed an SQLSTATE, a five characters alphanumeric identifier defined in - * the ANSI SQL-92 standard. Briefly, an SQLSTATE consists of a - * two characters class value followed by a three characters subclass value. A - * class value of 01 indicates a warning and is accompanied by a return code - * of SQL_SUCCESS_WITH_INFO. Class values other than '01', except for the - * class 'IM', indicate an error. The class 'IM' is specific to warnings - * and errors that derive from the implementation of PDO (or perhaps ODBC, - * if you're using the ODBC driver) itself. The subclass value '000' in any - * class indicates that there is no subclass for that SQLSTATE. - *

- *

- * PDO::errorCode only retrieves error codes for operations - * performed directly on the database handle. If you create a PDOStatement - * object through PDO::prepare or - * PDO::query and invoke an error on the statement - * handle, PDO::errorCode will not reflect that error. - * You must call PDOStatement::errorCode to return the error - * code for an operation performed on a particular statement handle. - *

- *

- * Returns NULL if no operation has been run on the database handle. - */ - public function errorCode () {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)
- * Fetch extended error information associated with the last operation on the database handle - * @link http://php.net/manual/en/pdo.errorinfo.php - * @return array PDO::errorInfo returns an array of error information - * about the last operation performed by this database handle. The array - * consists of the following fields: - * - * Element - * Information - * - * - * 0 - * SQLSTATE error code (a five characters alphanumeric identifier defined - * in the ANSI SQL standard). - * - * - * 1 - * Driver-specific error code. - * - * - * 2 - * Driver-specific error message. - * - *

- *

- * If the SQLSTATE error code is not set or there is no driver-specific - * error, the elements following element 0 will be set to NULL. - *

- *

- * PDO::errorInfo only retrieves error information for - * operations performed directly on the database handle. If you create a - * PDOStatement object through PDO::prepare or - * PDO::query and invoke an error on the statement - * handle, PDO::errorInfo will not reflect the error - * from the statement handle. You must call - * PDOStatement::errorInfo to return the error - * information for an operation performed on a particular statement handle. - */ - public function errorInfo () {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.2.0)
- * Retrieve a database connection attribute - * @link http://php.net/manual/en/pdo.getattribute.php - * @param int $attribute

- * One of the PDO::ATTR_* constants. The constants that - * apply to database connections are as follows: - * PDO::ATTR_AUTOCOMMIT - * PDO::ATTR_CASE - * PDO::ATTR_CLIENT_VERSION - * PDO::ATTR_CONNECTION_STATUS - * PDO::ATTR_DRIVER_NAME - * PDO::ATTR_ERRMODE - * PDO::ATTR_ORACLE_NULLS - * PDO::ATTR_PERSISTENT - * PDO::ATTR_PREFETCH - * PDO::ATTR_SERVER_INFO - * PDO::ATTR_SERVER_VERSION - * PDO::ATTR_TIMEOUT - *

- * @return mixed A successful call returns the value of the requested PDO attribute. - * An unsuccessful call returns null. - */ - public function getAttribute ($attribute) {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.2.1)
- * Quotes a string for use in a query. - * @link http://php.net/manual/en/pdo.quote.php - * @param string $string

- * The string to be quoted. - *

- * @param int $parameter_type [optional]

- * Provides a data type hint for drivers that have alternate quoting styles. - *

- * @return string a quoted string that is theoretically safe to pass into an - * SQL statement. Returns FALSE if the driver does not support quoting in - * this way. - */ - public function quote ($string, $parameter_type = 'PDO::PARAM_STR') {} - - final public function __wakeup () {} - - final public function __sleep () {} - - /** - * (PHP 5 >= 5.1.3, PECL pdo >= 1.0.3)
- * Return an array of available PDO drivers - * @link http://php.net/manual/en/pdo.getavailabledrivers.php - * @return array PDO::getAvailableDrivers returns an array of PDO driver names. If - * no drivers are available, it returns an empty array. - */ - public static function getAvailableDrivers () {} - -} - -/** - * Represents a prepared statement and, after the statement is executed, an - * associated result set. - * @link http://php.net/manual/en/class.pdostatement.php - */ -class PDOStatement implements Traversable { - /** - * @var string - */ - public $queryString; - - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)
- * Executes a prepared statement - * @link http://php.net/manual/en/pdostatement.execute.php - * @param array $input_parameters [optional]

- * An array of values with as many elements as there are bound - * parameters in the SQL statement being executed. - * All values are treated as PDO::PARAM_STR. - *

- *

- * You cannot bind multiple values to a single parameter; for example, - * you cannot bind two values to a single named parameter in an IN() - * clause. - *

- *

- * You cannot bind more values than specified; if more keys exist in - * input_parameters than in the SQL specified - * in the PDO::prepare, then the statement will - * fail and an error is emitted. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function execute (array $input_parameters = null) {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)
- * Fetches the next row from a result set - * @link http://php.net/manual/en/pdostatement.fetch.php - * @param int $fetch_style [optional]

- * Controls how the next row will be returned to the caller. This value - * must be one of the PDO::FETCH_* constants, - * defaulting to value of PDO::ATTR_DEFAULT_FETCH_MODE - * (which defaults to PDO::FETCH_BOTH). - *

- * PDO::FETCH_ASSOC: returns an array indexed by column - * name as returned in your result set - *

- * @param int $cursor_orientation [optional]

- * For a PDOStatement object representing a scrollable cursor, this - * value determines which row will be returned to the caller. This value - * must be one of the PDO::FETCH_ORI_* constants, - * defaulting to PDO::FETCH_ORI_NEXT. To request a - * scrollable cursor for your PDOStatement object, you must set the - * PDO::ATTR_CURSOR attribute to - * PDO::CURSOR_SCROLL when you prepare the SQL - * statement with PDO::prepare. - *

- * @param int $cursor_offset [optional] - * @return mixed The return value of this function on success depends on the fetch type. In - * all cases, FALSE is returned on failure. - */ - public function fetch ($fetch_style = null, $cursor_orientation = 'PDO::FETCH_ORI_NEXT', $cursor_offset = 0) {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)
- * Binds a parameter to the specified variable name - * @link http://php.net/manual/en/pdostatement.bindparam.php - * @param mixed $parameter

- * Parameter identifier. For a prepared statement using named - * placeholders, this will be a parameter name of the form - * :name. For a prepared statement using - * question mark placeholders, this will be the 1-indexed position of - * the parameter. - *

- * @param mixed $variable

- * Name of the PHP variable to bind to the SQL statement parameter. - *

- * @param int $data_type [optional]

- * Explicit data type for the parameter using the PDO::PARAM_* - * constants. - * To return an INOUT parameter from a stored procedure, - * use the bitwise OR operator to set the PDO::PARAM_INPUT_OUTPUT bits - * for the data_type parameter. - *

- * @param int $length [optional]

- * Length of the data type. To indicate that a parameter is an OUT - * parameter from a stored procedure, you must explicitly set the - * length. - *

- * @param mixed $driver_options [optional]

- *

- * @return bool TRUE on success or FALSE on failure. - */ - public function bindParam ($parameter, &$variable, $data_type = 'PDO::PARAM_STR', $length = null, $driver_options = null) {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)
- * Bind a column to a PHP variable - * @link http://php.net/manual/en/pdostatement.bindcolumn.php - * @param mixed $column

- * Number of the column (1-indexed) or name of the column in the result set. - * If using the column name, be aware that the name should match the - * case of the column, as returned by the driver. - *

- * @param mixed $param

- * Name of the PHP variable to which the column will be bound. - *

- * @param int $type [optional]

- * Data type of the parameter, specified by the PDO::PARAM_* constants. - *

- * @param int $maxlen [optional]

- * A hint for pre-allocation. - *

- * @param mixed $driverdata [optional]

- * Optional parameter(s) for the driver. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function bindColumn ($column, &$param, $type = null, $maxlen = null, $driverdata = null) {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 1.0.0)
- * Binds a value to a parameter - * @link http://php.net/manual/en/pdostatement.bindvalue.php - * @param mixed $parameter

- * Parameter identifier. For a prepared statement using named - * placeholders, this will be a parameter name of the form - * :name. For a prepared statement using - * question mark placeholders, this will be the 1-indexed position of - * the parameter. - *

- * @param mixed $value

- * The value to bind to the parameter. - *

- * @param int $data_type [optional]

- * Explicit data type for the parameter using the PDO::PARAM_* - * constants. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function bindValue ($parameter, $value, $data_type = 'PDO::PARAM_STR') {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)
- * Returns the number of rows affected by the last SQL statement - * @link http://php.net/manual/en/pdostatement.rowcount.php - * @return int the number of rows. - */ - public function rowCount () {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.9.0)
- * Returns a single column from the next row of a result set - * @link http://php.net/manual/en/pdostatement.fetchcolumn.php - * @param int $column_number [optional]

- * 0-indexed number of the column you wish to retrieve from the row. If - * no value is supplied, PDOStatement::fetchColumn - * fetches the first column. - *

- * @return string PDOStatement::fetchColumn returns a single column - * in the next row of a result set. - *

- *

- * There is no way to return another column from the same row if you - * use PDOStatement::fetchColumn to retrieve data. - */ - public function fetchColumn ($column_number = 0) {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)
- * Returns an array containing all of the result set rows - * @link http://php.net/manual/en/pdostatement.fetchall.php - * @param int $fetch_style [optional]

- * Controls the contents of the returned array as documented in - * PDOStatement::fetch. - * Defaults to value of PDO::ATTR_DEFAULT_FETCH_MODE - * (which defaults to PDO::FETCH_BOTH) - *

- *

- * To return an array consisting of all values of a single column from - * the result set, specify PDO::FETCH_COLUMN. You - * can specify which column you want with the - * column-index parameter. - *

- *

- * To fetch only the unique values of a single column from the result set, - * bitwise-OR PDO::FETCH_COLUMN with - * PDO::FETCH_UNIQUE. - *

- *

- * To return an associative array grouped by the values of a specified - * column, bitwise-OR PDO::FETCH_COLUMN with - * PDO::FETCH_GROUP. - *

- * @param mixed $fetch_argument [optional]

- * This argument have a different meaning depending on the value of - * the fetch_style parameter: - *

- * PDO::FETCH_COLUMN: Returns the indicated 0-indexed - * column. - *

- * @param array $ctor_args [optional]

- * Arguments of custom class constructor when the fetch_style - * parameter is PDO::FETCH_CLASS. - *

- * @return array PDOStatement::fetchAll returns an array containing - * all of the remaining rows in the result set. The array represents each - * row as either an array of column values or an object with properties - * corresponding to each column name. - *

- *

- * Using this method to fetch large result sets will result in a heavy - * demand on system and possibly network resources. Rather than retrieving - * all of the data and manipulating it in PHP, consider using the database - * server to manipulate the result sets. For example, use the WHERE and - * ORDER BY clauses in SQL to restrict results before retrieving and - * processing them with PHP. - */ - public function fetchAll ($fetch_style = null, $fetch_argument = null, array $ctor_args = 'array()') {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.2.4)
- * Fetches the next row and returns it as an object. - * @link http://php.net/manual/en/pdostatement.fetchobject.php - * @param string $class_name [optional]

- * Name of the created class. - *

- * @param array $ctor_args [optional]

- * Elements of this array are passed to the constructor. - *

- * @return mixed an instance of the required class with property names that - * correspond to the column names or FALSE on failure. - */ - public function fetchObject ($class_name = "stdClass", array $ctor_args = null) {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)
- * Fetch the SQLSTATE associated with the last operation on the statement handle - * @link http://php.net/manual/en/pdostatement.errorcode.php - * @return string Identical to PDO::errorCode, except that - * PDOStatement::errorCode only retrieves error codes - * for operations performed with PDOStatement objects. - */ - public function errorCode () {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.1.0)
- * Fetch extended error information associated with the last operation on the statement handle - * @link http://php.net/manual/en/pdostatement.errorinfo.php - * @return array PDOStatement::errorInfo returns an array of - * error information about the last operation performed by this - * statement handle. The array consists of the following fields: - * - * Element - * Information - * - * - * 0 - * SQLSTATE error code (a five characters alphanumeric identifier defined - * in the ANSI SQL standard). - * - * - * 1 - * Driver specific error code. - * - * - * 2 - * Driver specific error message. - * - */ - public function errorInfo () {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.2.0)
- * Set a statement attribute - * @link http://php.net/manual/en/pdostatement.setattribute.php - * @param int $attribute - * @param mixed $value - * @return bool TRUE on success or FALSE on failure. - */ - public function setAttribute ($attribute, $value) {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.2.0)
- * Retrieve a statement attribute - * @link http://php.net/manual/en/pdostatement.getattribute.php - * @param int $attribute - * @return mixed the attribute value. - */ - public function getAttribute ($attribute) {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.2.0)
- * Returns the number of columns in the result set - * @link http://php.net/manual/en/pdostatement.columncount.php - * @return int the number of columns in the result set represented by the - * PDOStatement object. If there is no result set, - * PDOStatement::columnCount returns 0. - */ - public function columnCount () {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.2.0)
- * Returns metadata for a column in a result set - * @link http://php.net/manual/en/pdostatement.getcolumnmeta.php - * @param int $column

- * The 0-indexed column in the result set. - *

- * @return array an associative array containing the following values representing - * the metadata for a single column: - *

- * - * Column metadata - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
NameValue
native_typeThe PHP native type used to represent the column value.
driver:decl_typeThe SQL type used to represent the column value in the database. - * If the column in the result set is the result of a function, this value - * is not returned by PDOStatement::getColumnMeta. - *
flagsAny flags set for this column.
nameThe name of this column as returned by the database.
tableThe name of this column's table as returned by the database.
lenThe length of this column. Normally -1 for - * types other than floating point decimals.
precisionThe numeric precision of this column. Normally - * 0 for types other than floating point - * decimals.
pdo_typeThe type of this column as represented by the - * PDO::PARAM_* constants.
- *

- * Returns FALSE if the requested column does not exist in the result set, - * or if no result set exists. - */ - public function getColumnMeta ($column) {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.2.0)
- * Set the default fetch mode for this statement - * @link http://php.net/manual/en/pdostatement.setfetchmode.php - * @param int $mode

- * The fetch mode must be one of the PDO::FETCH_* constants. - *

- * @return bool 1 on success or FALSE on failure. - */ - public function setFetchMode ($mode) {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.2.0)
- * Advances to the next rowset in a multi-rowset statement handle - * @link http://php.net/manual/en/pdostatement.nextrowset.php - * @return bool TRUE on success or FALSE on failure. - */ - public function nextRowset () {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.9.0)
- * Closes the cursor, enabling the statement to be executed again. - * @link http://php.net/manual/en/pdostatement.closecursor.php - * @return bool TRUE on success or FALSE on failure. - */ - public function closeCursor () {} - - /** - * (PHP 5 >= 5.1.0, PECL pdo >= 0.9.0)
- * Dump an SQL prepared command - * @link http://php.net/manual/en/pdostatement.debugdumpparams.php - * @return bool No value is returned. - */ - public function debugDumpParams () {} - - final public function __wakeup () {} - - final public function __sleep () {} - -} - -final class PDORow { -} - -function pdo_drivers () {} - -// End of PDO v.1.0.4dev -?> diff --git a/phpruntime/PDO_ODBC.php b/phpruntime/PDO_ODBC.php deleted file mode 100644 index a1ef860..0000000 --- a/phpruntime/PDO_ODBC.php +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/phpruntime/Phar.php b/phpruntime/Phar.php deleted file mode 100644 index 0ab4dff..0000000 --- a/phpruntime/Phar.php +++ /dev/null @@ -1,2505 +0,0 @@ - - * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * The Phar class provides a high-level interface to accessing and creating - * phar archives. - * @link http://php.net/manual/en/class.phar.php - */ -class Phar extends RecursiveDirectoryIterator implements RecursiveIterator, SeekableIterator, Traversable, Iterator, Countable, ArrayAccess { - const CURRENT_MODE_MASK = 240; - const CURRENT_AS_PATHNAME = 32; - const CURRENT_AS_FILEINFO = 0; - const CURRENT_AS_SELF = 16; - const KEY_MODE_MASK = 3840; - const KEY_AS_PATHNAME = 0; - const FOLLOW_SYMLINKS = 512; - const KEY_AS_FILENAME = 256; - const NEW_CURRENT_AND_KEY = 256; - const OTHER_MODE_MASK = 12288; - const SKIP_DOTS = 4096; - const UNIX_PATHS = 8192; - const BZ2 = 8192; - const GZ = 4096; - const NONE = 0; - const PHAR = 1; - const TAR = 2; - const ZIP = 3; - const COMPRESSED = 61440; - const PHP = 0; - const PHPS = 1; - const MD5 = 1; - const OPENSSL = 16; - const SHA1 = 2; - const SHA256 = 3; - const SHA512 = 4; - - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Construct a Phar archive object - * @link http://php.net/manual/en/phar.construct.php - * @param string $fname

- * Path to an existing Phar archive or to-be-created archive - *

- * @param int $flags [optional]

- * Flags to pass to parent class RecursiveDirectoryIterator. - *

- * @param string $alias [optional]

- * Alias with which this Phar archive should be referred to in calls to stream - * functionality. - *

- */ - public function __construct ($fname, $flags = null, $alias = null) {} - - public function __destruct () {} - - /** - * (Unknown)
- * Add an empty directory to the phar archive - * @link http://php.net/manual/en/phar.addemptydir.php - * @param string $dirname

- * The name of the empty directory to create in the phar archive - *

- * @return void no return value, exception is thrown on failure. - */ - public function addEmptyDir ($dirname) {} - - /** - * (Unknown)
- * Add a file from the filesystem to the phar archive - * @link http://php.net/manual/en/phar.addfile.php - * @param string $file

- * Full or relative path to a file on disk to be added - * to the phar archive. - *

- * @param string $localname [optional]

- * Path that the file will be stored in the archive. - *

- * @return void no return value, exception is thrown on failure. - */ - public function addFile ($file, $localname = null) {} - - /** - * (Unknown)
- * Add a file from the filesystem to the phar archive - * @link http://php.net/manual/en/phar.addfromstring.php - * @param string $localname

- * Path that the file will be stored in the archive. - *

- * @param string $contents

- * The file contents to store - *

- * @return void no return value, exception is thrown on failure. - */ - public function addFromString ($localname, $contents) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Construct a phar archive from the files within a directory. - * @link http://php.net/manual/en/phar.buildfromdirectory.php - * @param string $base_dir

- * The full or relative path to the directory that contains all files - * to add to the archive. - *

- * @param string $regex [optional]

- * An optional pcre regular expression that is used to filter the - * list of files. Only file paths matching the regular expression - * will be included in the archive. - *

- * @return array Phar::buildFromDirectory returns an associative array - * mapping internal path of file to the full path of the file on the - * filesystem. - */ - public function buildFromDirectory ($base_dir, $regex = null) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Construct a phar archive from an iterator. - * @link http://php.net/manual/en/phar.buildfromiterator.php - * @param Iterator $iter

- * Any iterator that either associatively maps phar file to location or - * returns SplFileInfo objects - *

- * @param string $base_directory [optional]

- * For iterators that return SplFileInfo objects, the portion of each - * file's full path to remove when adding to the phar archive - *

- * @return array Phar::buildFromIterator returns an associative array - * mapping internal path of file to the full path of the file on the - * filesystem. - */ - public function buildFromIterator (Iterator $iter, $base_directory = null) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Compresses all files in the current Phar archive - * @link http://php.net/manual/en/phar.compressfiles.php - * @param int $compression

- * Compression must be one of Phar::GZ, - * Phar::BZ2 to add compression, or Phar::NONE - * to remove compression. - *

- * @return void No value is returned. - */ - public function compressFiles ($compression) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Decompresses all files in the current Phar archive - * @link http://php.net/manual/en/phar.decompressfiles.php - * @return bool TRUE on success or FALSE on failure. - */ - public function decompressFiles () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Compresses the entire Phar archive using Gzip or Bzip2 compression - * @link http://php.net/manual/en/phar.compress.php - * @param int $compression

- * Compression must be one of Phar::GZ, - * Phar::BZ2 to add compression, or Phar::NONE - * to remove compression. - *

- * @param string $extension [optional]

- * By default, the extension is .phar.gz - * or .phar.bz2 for compressing phar archives, and - * .phar.tar.gz or .phar.tar.bz2 for - * compressing tar archives. For decompressing, the default file extensions - * are .phar and .phar.tar. - *

- * @return object a Phar object. - */ - public function compress ($compression, $extension = null) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Decompresses the entire Phar archive - * @link http://php.net/manual/en/phar.decompress.php - * @param string $extension [optional]

- * For decompressing, the default file extensions - * are .phar and .phar.tar. - * Use this parameter to specify another file extension. Be aware - * that all executable phar archives must contain .phar - * in their filename. - *

- * @return object A Phar object is returned. - */ - public function decompress ($extension = null) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Convert a phar archive to another executable phar archive file format - * @link http://php.net/manual/en/phar.converttoexecutable.php - * @param int $format [optional]

- * This should be one of Phar::PHAR, Phar::TAR, - * or Phar::ZIP. If set to NULL, the existing file format - * will be preserved. - *

- * @param int $compression [optional]

- * This should be one of Phar::NONE for no whole-archive - * compression, Phar::GZ for zlib-based compression, and - * Phar::BZ2 for bzip-based compression. - *

- * @param string $extension [optional]

- * This parameter is used to override the default file extension for a - * converted archive. Note that all zip- and tar-based phar archives must contain - * .phar in their file extension in order to be processed as a - * phar archive. - *

- *

- * If converting to a phar-based archive, the default extensions are - * .phar, .phar.gz, or .phar.bz2 - * depending on the specified compression. For tar-based phar archives, the - * default extensions are .phar.tar, .phar.tar.gz, - * and .phar.tar.bz2. For zip-based phar archives, the - * default extension is .phar.zip. - *

- * @return Phar The method returns a Phar object on success and throws an - * exception on failure. - */ - public function convertToExecutable ($format = 9021976, $compression = 9021976, $extension = null) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Convert a phar archive to a non-executable tar or zip file - * @link http://php.net/manual/en/phar.converttodata.php - * @param int $format [optional]

- * This should be one of Phar::TAR - * or Phar::ZIP. If set to NULL, the existing file format - * will be preserved. - *

- * @param int $compression [optional]

- * This should be one of Phar::NONE for no whole-archive - * compression, Phar::GZ for zlib-based compression, and - * Phar::BZ2 for bzip-based compression. - *

- * @param string $extension [optional]

- * This parameter is used to override the default file extension for a - * converted archive. Note that .phar cannot be used - * anywhere in the filename for a non-executable tar or zip archive. - *

- *

- * If converting to a tar-based phar archive, the - * default extensions are .tar, .tar.gz, - * and .tar.bz2 depending on specified compression. - * For zip-based archives, the - * default extension is .zip. - *

- * @return PharData The method returns a PharData object on success and throws an - * exception on failure. - */ - public function convertToData ($format = 9021976, $compression = 9021976, $extension = null) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Copy a file internal to the phar archive to another new file within the phar - * @link http://php.net/manual/en/phar.copy.php - * @param string $oldfile - * @param string $newfile - * @return bool returns TRUE on success, but it is safer to encase method call in a - * try/catch block and assume success if no exception is thrown. - */ - public function copy ($oldfile, $newfile) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Returns the number of entries (files) in the Phar archive - * @link http://php.net/manual/en/phar.count.php - * @return int The number of files contained within this phar, or 0 (the number zero) - * if none. - */ - public function count () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Delete a file within a phar archive - * @link http://php.net/manual/en/phar.delete.php - * @param string $entry

- * Path within an archive to the file to delete. - *

- * @return bool returns TRUE on success, but it is better to check for thrown exception, - * and assume success if none is thrown. - */ - public function delete ($entry) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.2.0)
- * Deletes the global metadata of the phar - * @link http://php.net/manual/en/phar.delmetadata.php - * @return bool returns TRUE on success, but it is better to check for thrown exception, - * and assume success if none is thrown. - */ - public function delMetadata () {} - - /** - * (Unknown)
- * Extract the contents of a phar archive to a directory - * @link http://php.net/manual/en/phar.extractto.php - * @param string $pathto

- * Path within an archive to the file to delete. - *

- * @param string|array $files [optional]

- * The name of a file or directory to extract, or an array of files/directories to extract - *

- * @param bool $overwrite [optional]

- * Set to TRUE to enable overwriting existing files - *

- * @return bool returns TRUE on success, but it is better to check for thrown exception, - * and assume success if none is thrown. - */ - public function extractTo ($pathto, $files = null, $overwrite = false) {} - - public function getAlias () {} - - public function getPath () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Returns phar archive meta-data - * @link http://php.net/manual/en/phar.getmetadata.php - * @return mixed any PHP variable that can be serialized and is stored as meta-data for the Phar archive, - * or NULL if no meta-data is stored. - */ - public function getMetadata () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Return whether phar was modified - * @link http://php.net/manual/en/phar.getmodified.php - * @return bool TRUE if the phar has been modified since opened, FALSE if not. - */ - public function getModified () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Return MD5/SHA1/SHA256/SHA512/OpenSSL signature of a Phar archive - * @link http://php.net/manual/en/phar.getsignature.php - * @return array Array with the opened archive's signature in hash key and MD5, - * SHA-1, - * SHA-256, SHA-512, or OpenSSL - * in hash_type. This signature is a hash calculated on the - * entire phar's contents, and may be used to verify the integrity of the archive. - * A valid signature is absolutely required of all executable phar archives if the - * phar.require_hash INI variable - * is set to true. - */ - public function getSignature () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Return the PHP loader or bootstrap stub of a Phar archive - * @link http://php.net/manual/en/phar.getstub.php - * @return string a string containing the contents of the bootstrap loader (stub) of - * the current Phar archive. - */ - public function getStub () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Return version info of Phar archive - * @link http://php.net/manual/en/phar.getversion.php - * @return string The opened archive's API version. This is not to be confused with - * the API version that the loaded phar extension will use to create - * new phars. Each Phar archive has the API version hard-coded into - * its manifest. See Phar file format - * documentation for more information. - */ - public function getVersion () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.2.0)
- * Returns whether phar has global meta-data - * @link http://php.net/manual/en/phar.hasmetadata.php - * @return bool TRUE if meta-data has been set, and FALSE if not. - */ - public function hasMetadata () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Used to determine whether Phar write operations are being buffered, or are flushing directly to disk - * @link http://php.net/manual/en/phar.isbuffering.php - * @return bool TRUE if the write operations are being buffer, FALSE otherwise. - */ - public function isBuffering () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Returns Phar::GZ or PHAR::BZ2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on) - * @link http://php.net/manual/en/phar.iscompressed.php - * @return mixed Phar::GZ, Phar::BZ2 or FALSE - */ - public function isCompressed () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Returns true if the phar archive is based on the tar/phar/zip file format depending on the parameter - * @link http://php.net/manual/en/phar.isfileformat.php - * @param int $format

- * Either Phar::PHAR, Phar::TAR, or - * Phar::ZIP to test for the format of the archive. - *

- * @return bool TRUE if the phar archive matches the file format requested by the parameter - */ - public function isFileFormat ($format) {} - - /** - * (Unknown)
- * Returns true if the phar archive can be modified - * @link http://php.net/manual/en/phar.iswritable.php - * @return bool TRUE if the phar archive can be modified - */ - public function isWritable () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * determines whether a file exists in the phar - * @link http://php.net/manual/en/phar.offsetexists.php - * @param string $offset

- * The filename (relative path) to look for in a Phar. - *

- * @return bool TRUE if the file exists within the phar, or FALSE if not. - */ - public function offsetExists ($offset) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Gets a PharFileInfo object for a specific file - * @link http://php.net/manual/en/phar.offsetget.php - * @param string $offset

- * The filename (relative path) to look for in a Phar. - *

- * @return int A PharFileInfo object is returned that can be used to - * iterate over a file's contents or to retrieve information about the current file. - */ - public function offsetGet ($offset) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * set the contents of an internal file to those of an external file - * @link http://php.net/manual/en/phar.offsetset.php - * @param string $offset

- * The filename (relative path) to modify in a Phar. - *

- * @param string $value

- * Content of the file. - *

- * @return void No return values. - */ - public function offsetSet ($offset, $value) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * remove a file from a phar - * @link http://php.net/manual/en/phar.offsetunset.php - * @param string $offset

- * The filename (relative path) to modify in a Phar. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function offsetUnset ($offset) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.2.1)
- * Set the alias for the Phar archive - * @link http://php.net/manual/en/phar.setalias.php - * @param string $alias

- * A shorthand string that this archive can be referred to in phar - * stream wrapper access. - *

- * @return bool - */ - public function setAlias ($alias) {} - - /** - * (Unknown)
- * Used to set the PHP loader or bootstrap stub of a Phar archive to the default loader - * @link http://php.net/manual/en/phar.setdefaultstub.php - * @param string $index [optional]

- * Relative path within the phar archive to run if accessed on the command-line - *

- * @param string $webindex [optional]

- * Relative path within the phar archive to run if accessed through a web browser - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setDefaultStub ($index = null, $webindex = null) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Sets phar archive meta-data - * @link http://php.net/manual/en/phar.setmetadata.php - * @param mixed $metadata

- * Any PHP variable containing information to store that describes the phar archive - *

- * @return void No value is returned. - */ - public function setMetadata ($metadata) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.1.0)
- * set the signature algorithm for a phar and apply it. - * @link http://php.net/manual/en/phar.setsignaturealgorithm.php - * @param int $sigtype

- * One of Phar::MD5, - * Phar::SHA1, Phar::SHA256, - * Phar::SHA512, or Phar::OPENSSL - *

- * @param string $privatekey [optional]

- * The contents of an OpenSSL private key, as extracted from a certificate or - * OpenSSL key file: - * - * $private = openssl_get_privatekey(file_get_contents('private.pem')); - * $pkey = ''; - * openssl_pkey_export($private, $pkey); - * $p->setSignatureAlgorithm(Phar::OPENSSL, $pkey); - * - * See phar introduction for instructions on - * naming and placement of the public key file. - *

- * @return void No value is returned. - */ - public function setSignatureAlgorithm ($sigtype, $privatekey = null) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Used to set the PHP loader or bootstrap stub of a Phar archive - * @link http://php.net/manual/en/phar.setstub.php - * @param string $stub

- * A string or an open stream handle to use as the executable stub for this - * phar archive. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setStub ($stub) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Start buffering Phar write operations, do not modify the Phar object on disk - * @link http://php.net/manual/en/phar.startbuffering.php - * @return void No value is returned. - */ - public function startBuffering () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Stop buffering write requests to the Phar archive, and save changes to disk - * @link http://php.net/manual/en/phar.stopbuffering.php - * @return void No value is returned. - */ - public function stopBuffering () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Returns the api version - * @link http://php.net/manual/en/phar.apiversion.php - * @return string The API version string as in "1.0.0". - */ - final public static function apiVersion () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Returns whether phar extension supports compression using either zlib or bzip2 - * @link http://php.net/manual/en/phar.cancompress.php - * @param int $type [optional]

- * Either Phar::GZ or Phar::BZ2 can be - * used to test whether compression is possible with a specific compression - * algorithm (zlib or bzip2). - *

- * @return bool TRUE if compression/decompression is available, FALSE if not. - */ - final public static function canCompress ($type = 0) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Returns whether phar extension supports writing and creating phars - * @link http://php.net/manual/en/phar.canwrite.php - * @return bool TRUE if write access is enabled, FALSE if it is disabled. - */ - final public static function canWrite () {} - - /** - * (Unknown)
- * Create a phar-file format specific stub - * @link http://php.net/manual/en/phar.createdefaultstub.php - * @param string $indexfile [optional] - * @param string $webindexfile [optional] - * @return string a string containing the contents of a customized bootstrap loader (stub) - * that allows the created Phar archive to work with or without the Phar extension - * enabled. - */ - final public static function createDefaultStub ($indexfile = null, $webindexfile = null) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.2.0)
- * Return array of supported compression algorithms - * @link http://php.net/manual/en/phar.getsupportedcompression.php - * @return array an array containing any of Phar::GZ or - * Phar::BZ2, depending on the availability of - * the zlib extension or the - * bz2 extension. - */ - final public static function getSupportedCompression () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.1.0)
- * Return array of supported signature types - * @link http://php.net/manual/en/phar.getsupportedsignatures.php - * @return array an array containing any of MD5, SHA-1, - * SHA-256, SHA-512, or OpenSSL. - */ - final public static function getSupportedSignatures () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * instructs phar to intercept fopen, file_get_contents, opendir, and all of the stat-related functions - * @link http://php.net/manual/en/phar.interceptfilefuncs.php - * @return void - */ - final public static function interceptFileFuncs () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.2.0)
- * Returns whether the given filename is a valid phar filename - * @link http://php.net/manual/en/phar.isvalidpharfilename.php - * @param string $filename

- * The name or full path to a phar archive not yet created - *

- * @param bool $executable [optional]

- * This parameter determines whether the filename should be treated as - * a phar executable archive, or a data non-executable archive - *

- * @return bool TRUE if the filename is valid, FALSE if not. - */ - final public static function isValidPharFilename ($filename, $executable = true) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Loads any phar archive with an alias - * @link http://php.net/manual/en/phar.loadphar.php - * @param string $filename

- * the full or relative path to the phar archive to open - *

- * @param string $alias [optional]

- * The alias that may be used to refer to the phar archive. Note - * that many phar archives specify an explicit alias inside the - * phar archive, and a PharException will be thrown if - * a new alias is specified in this case. - *

- * @return bool TRUE on success or FALSE on failure. - */ - final public static function loadPhar ($filename, $alias = null) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Reads the currently executed file (a phar) and registers its manifest - * @link http://php.net/manual/en/phar.mapphar.php - * @param string $alias [optional]

- * The alias that can be used in phar:// URLs to - * refer to this archive, rather than its full path. - *

- * @param int $dataoffset [optional]

- * Unused variable, here for compatibility with PEAR's PHP_Archive. - *

- * @return bool TRUE on success or FALSE on failure. - */ - final public static function mapPhar ($alias = null, $dataoffset = 0) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Returns the full path on disk or full phar URL to the currently executing Phar archive - * @link http://php.net/manual/en/phar.running.php - * @param bool $retphar [optional]

- * If FALSE, the full path on disk to the phar - * archive is returned. If TRUE, a full phar URL is returned. - *

- * @return string the filename if valid, empty string otherwise. - */ - final public static function running ($retphar = true) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Mount an external path or file to a virtual location within the phar archive - * @link http://php.net/manual/en/phar.mount.php - * @param string $pharpath

- * The internal path within the phar archive to use as the mounted path location. - * This must be a relative path within the phar archive, and must not already exist. - *

- * @param string $externalpath

- * A path or URL to an external file or directory to mount within the phar archive - *

- * @return void No return. PharException is thrown on failure. - */ - final public static function mount ($pharpath, $externalpath) {} - - /** - * (Unknown)
- * Defines a list of up to 4 $_SERVER variables that should be modified for execution - * @link http://php.net/manual/en/phar.mungserver.php - * @param array $munglist

- * an array containing as string indices any of - * REQUEST_URI, PHP_SELF, - * SCRIPT_NAME and SCRIPT_FILENAME. - * Other values trigger an exception, and Phar::mungServer - * is case-sensitive. - *

- * @return void No return. - */ - final public static function mungServer (array $munglist) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Completely remove a phar archive from disk and from memory - * @link http://php.net/manual/en/phar.unlinkarchive.php - * @param string $archive

- * The path on disk to the phar archive. - *

- * @return bool TRUE on success or FALSE on failure. - */ - final public static function unlinkArchive ($archive) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * mapPhar for web-based phars. front controller for web applications - * @link http://php.net/manual/en/phar.webphar.php - * @param string $alias [optional]

- * The alias that can be used in phar:// URLs to - * refer to this archive, rather than its full path. - *

- * @param string $index [optional]

- * The location within the phar of the directory index. - *

- * @param string $f404 [optional]

- * The location of the script to run when a file is not found. This - * script should output the proper HTTP 404 headers. - *

- * @param array $mimetypes [optional]

- * An array mapping additional file extensions to MIME type. - * If the default mapping is sufficient, pass an empty array. - * By default, these extensions are mapped to these MIME types: - * - * $mimes = array( - * 'phps' => Phar::PHPS, // pass to highlight_file() - * 'c' => 'text/plain', - * 'cc' => 'text/plain', - * 'cpp' => 'text/plain', - * 'c++' => 'text/plain', - * 'dtd' => 'text/plain', - * 'h' => 'text/plain', - * 'log' => 'text/plain', - * 'rng' => 'text/plain', - * 'txt' => 'text/plain', - * 'xsd' => 'text/plain', - * 'php' => Phar::PHP, // parse as PHP - * 'inc' => Phar::PHP, // parse as PHP - * 'avi' => 'video/avi', - * 'bmp' => 'image/bmp', - * 'css' => 'text/css', - * 'gif' => 'image/gif', - * 'htm' => 'text/html', - * 'html' => 'text/html', - * 'htmls' => 'text/html', - * 'ico' => 'image/x-ico', - * 'jpe' => 'image/jpeg', - * 'jpg' => 'image/jpeg', - * 'jpeg' => 'image/jpeg', - * 'js' => 'application/x-javascript', - * 'midi' => 'audio/midi', - * 'mid' => 'audio/midi', - * 'mod' => 'audio/mod', - * 'mov' => 'movie/quicktime', - * 'mp3' => 'audio/mp3', - * 'mpg' => 'video/mpeg', - * 'mpeg' => 'video/mpeg', - * 'pdf' => 'application/pdf', - * 'png' => 'image/png', - * 'swf' => 'application/shockwave-flash', - * 'tif' => 'image/tiff', - * 'tiff' => 'image/tiff', - * 'wav' => 'audio/wav', - * 'xbm' => 'image/xbm', - * 'xml' => 'text/xml', - * ); - * - *

- * @param callable $rewrites [optional]

- * The rewrites function is passed a string as its only parameter and must return a string or FALSE. - *

- *

- * If you are using fast-cgi or cgi then the parameter passed to the function is the value of the - * $_SERVER['PATH_INFO'] variable. Otherwise, the parameter passed to the function is the value - * of the $_SERVER['REQUEST_URI'] variable. - *

- *

- * If a string is returned it is used as the internal file path. If FALSE is returned then webPhar() will - * send a HTTP 403 Denied Code. - *

- * @return void No value is returned. - */ - final public static function webPhar ($alias = null, $index = "index.php", $f404 = null, array $mimetypes = null, callable $rewrites = null) {} - - /** - * (PHP 5)
- * Returns whether current entry is a directory and not '.' or '..' - * @link http://php.net/manual/en/recursivedirectoryiterator.haschildren.php - * @param bool $allow_links [optional]

- *

- * @return bool whether the current entry is a directory, but not '.' or '..' - */ - public function hasChildren ($allow_links = false) {} - - /** - * (PHP 5 >= 5.1.0)
- * Returns an iterator for the current entry if it is a directory - * @link http://php.net/manual/en/recursivedirectoryiterator.getchildren.php - * @return mixed The filename, file information, or $this depending on the set flags. - * See the FilesystemIterator - * constants. - */ - public function getChildren () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get sub path - * @link http://php.net/manual/en/recursivedirectoryiterator.getsubpath.php - * @return string The sub path (sub directory). - */ - public function getSubPath () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get sub path and name - * @link http://php.net/manual/en/recursivedirectoryiterator.getsubpathname.php - * @return string The sub path (sub directory) and filename. - */ - public function getSubPathname () {} - - /** - * (PHP 5 >= 5.3.0)
- * Rewinds back to the beginning - * @link http://php.net/manual/en/filesystemiterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.3.0)
- * Move to the next file - * @link http://php.net/manual/en/filesystemiterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.3.0)
- * Retrieve the key for the current file - * @link http://php.net/manual/en/filesystemiterator.key.php - * @return string the pathname or filename depending on the set flags. - * See the FilesystemIterator constants. - */ - public function key () {} - - /** - * (PHP 5 >= 5.3.0)
- * The current file - * @link http://php.net/manual/en/filesystemiterator.current.php - * @return mixed The filename, file information, or $this depending on the set flags. - * See the FilesystemIterator constants. - */ - public function current () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get the handling flags - * @link http://php.net/manual/en/filesystemiterator.getflags.php - * @return int The integer value of the set flags. - */ - public function getFlags () {} - - /** - * (PHP 5 >= 5.3.0)
- * Sets handling flags - * @link http://php.net/manual/en/filesystemiterator.setflags.php - * @param int $flags [optional]

- * The handling flags to set. - * See the FilesystemIterator constants. - *

- * @return void No value is returned. - */ - public function setFlags ($flags = null) {} - - /** - * (PHP 5)
- * Return file name of current DirectoryIterator item. - * @link http://php.net/manual/en/directoryiterator.getfilename.php - * @return string the file name of the current DirectoryIterator item. - */ - public function getFilename () {} - - /** - * (PHP 5 >= 5.3.6)
- * Gets the file extension - * @link http://php.net/manual/en/directoryiterator.getextension.php - * @return string a string containing the file extension, or an - * empty string if the file has no extension. - */ - public function getExtension () {} - - /** - * (PHP 5 >= 5.2.2)
- * Get base name of current DirectoryIterator item. - * @link http://php.net/manual/en/directoryiterator.getbasename.php - * @param string $suffix [optional]

- * If the base name ends in suffix, - * this will be cut. - *

- * @return string The base name of the current DirectoryIterator item. - */ - public function getBasename ($suffix = null) {} - - /** - * (PHP 5)
- * Determine if current DirectoryIterator item is '.' or '..' - * @link http://php.net/manual/en/directoryiterator.isdot.php - * @return bool TRUE if the entry is . or .., - * otherwise FALSE - */ - public function isDot () {} - - /** - * (PHP 5)
- * Check whether current DirectoryIterator position is a valid file - * @link http://php.net/manual/en/directoryiterator.valid.php - * @return bool TRUE if the position is valid, otherwise FALSE - */ - public function valid () {} - - /** - * (PHP 5 >= 5.3.0)
- * Seek to a DirectoryIterator item - * @link http://php.net/manual/en/directoryiterator.seek.php - * @param int $position

- * The zero-based numeric position to seek to. - *

- * @return void No value is returned. - */ - public function seek ($position) {} - - /** - * (PHP 5)
- * Get file name as a string - * @link http://php.net/manual/en/directoryiterator.tostring.php - * @return string the file name of the current DirectoryIterator item. - */ - public function __toString () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the path to the file - * @link http://php.net/manual/en/splfileinfo.getpathname.php - * @return string The path to the file. - */ - public function getPathname () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file permissions - * @link http://php.net/manual/en/splfileinfo.getperms.php - * @return int the file permissions. - */ - public function getPerms () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the inode for the file - * @link http://php.net/manual/en/splfileinfo.getinode.php - * @return int the inode number for the filesystem object. - */ - public function getInode () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file size - * @link http://php.net/manual/en/splfileinfo.getsize.php - * @return int The filesize in bytes. - */ - public function getSize () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the owner of the file - * @link http://php.net/manual/en/splfileinfo.getowner.php - * @return int The owner id in numerical format. - */ - public function getOwner () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the file group - * @link http://php.net/manual/en/splfileinfo.getgroup.php - * @return int The group id in numerical format. - */ - public function getGroup () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets last access time of the file - * @link http://php.net/manual/en/splfileinfo.getatime.php - * @return int the time the file was last accessed. - */ - public function getATime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the last modified time - * @link http://php.net/manual/en/splfileinfo.getmtime.php - * @return int the last modified time for the file, in a Unix timestamp. - */ - public function getMTime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the inode change time - * @link http://php.net/manual/en/splfileinfo.getctime.php - * @return int The last change time, in a Unix timestamp. - */ - public function getCTime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file type - * @link http://php.net/manual/en/splfileinfo.gettype.php - * @return string A string representing the type of the entry. - * May be one of file, link, - * or dir - */ - public function getType () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if file is readable - * @link http://php.net/manual/en/splfileinfo.isreadable.php - * @return bool TRUE if readable, FALSE otherwise. - */ - public function isReadable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is executable - * @link http://php.net/manual/en/splfileinfo.isexecutable.php - * @return bool TRUE if executable, FALSE otherwise. - */ - public function isExecutable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the object references a regular file - * @link http://php.net/manual/en/splfileinfo.isfile.php - * @return bool TRUE if the file exists and is a regular file (not a link), FALSE otherwise. - */ - public function isFile () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is a directory - * @link http://php.net/manual/en/splfileinfo.isdir.php - * @return bool TRUE if a directory, FALSE otherwise. - */ - public function isDir () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is a link - * @link http://php.net/manual/en/splfileinfo.islink.php - * @return bool TRUE if the file is a link, FALSE otherwise. - */ - public function isLink () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets the target of a link - * @link http://php.net/manual/en/splfileinfo.getlinktarget.php - * @return string the target of the filesystem link. - */ - public function getLinkTarget () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets absolute path to file - * @link http://php.net/manual/en/splfileinfo.getrealpath.php - * @return string the path to the file. - */ - public function getRealPath () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileInfo object for the file - * @link http://php.net/manual/en/splfileinfo.getfileinfo.php - * @param string $class_name [optional]

- * Name of an SplFileInfo derived class to use. - *

- * @return SplFileInfo An SplFileInfo object created for the file. - */ - public function getFileInfo ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileInfo object for the path - * @link http://php.net/manual/en/splfileinfo.getpathinfo.php - * @param string $class_name [optional]

- * Name of an SplFileInfo derived class to use. - *

- * @return SplFileInfo an SplFileInfo object for the parent path of the file. - */ - public function getPathInfo ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileObject object for the file - * @link http://php.net/manual/en/splfileinfo.openfile.php - * @param string $open_mode [optional]

- * The mode for opening the file. See the fopen - * documentation for descriptions of possible modes. The default - * is read only. - *

- * @param bool $use_include_path [optional]

- * When set to TRUE, the filename is also - * searched for within the include_path - *

- * @param resource $context [optional]

- * Refer to the context - * section of the manual for a description of contexts. - *

- * @return SplFileObject The opened file as an SplFileObject object. - */ - public function openFile ($open_mode = 'r', $use_include_path = false, $context = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets the class name used with SplFileInfo::openFile - * @link http://php.net/manual/en/splfileinfo.setfileclass.php - * @param string $class_name [optional]

- * The class name to use when openFile() is called. - *

- * @return void No value is returned. - */ - public function setFileClass ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets the class used with getFileInfo and getPathInfo - * @link http://php.net/manual/en/splfileinfo.setinfoclass.php - * @param string $class_name [optional]

- * The class name to use. - *

- * @return void No value is returned. - */ - public function setInfoClass ($class_name = null) {} - - final public function _bad_state_ex () {} - -} - -/** - * The PharData class provides a high-level interface to accessing and creating - * non-executable tar and zip archives. Because these archives do not contain - * a stub and cannot be executed by the phar extension, it is possible to create - * and manipulate regular zip and tar files using the PharData class even if - * phar.readonly php.ini setting is 1. - * @link http://php.net/manual/en/class.phardata.php - */ -class PharData extends RecursiveDirectoryIterator implements RecursiveIterator, SeekableIterator, Traversable, Iterator, Countable, ArrayAccess { - const CURRENT_MODE_MASK = 240; - const CURRENT_AS_PATHNAME = 32; - const CURRENT_AS_FILEINFO = 0; - const CURRENT_AS_SELF = 16; - const KEY_MODE_MASK = 3840; - const KEY_AS_PATHNAME = 0; - const FOLLOW_SYMLINKS = 512; - const KEY_AS_FILENAME = 256; - const NEW_CURRENT_AND_KEY = 256; - const OTHER_MODE_MASK = 12288; - const SKIP_DOTS = 4096; - const UNIX_PATHS = 8192; - - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Construct a non-executable tar or zip archive object - * @link http://php.net/manual/en/phardata.construct.php - * @param string $fname

- * Path to an existing tar/zip archive or to-be-created archive - *

- * @param int $flags [optional]

- * Flags to pass to Phar parent class - * RecursiveDirectoryIterator. - *

- * @param string $alias [optional]

- * Alias with which this Phar archive should be referred to in calls to stream - * functionality. - *

- * @param int $format [optional]

- * One of the - * file format constants - * available within the Phar class. - *

- */ - public function __construct ($fname, $flags = null, $alias = null, $format = 'Phar::TAR') {} - - public function __destruct () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Add an empty directory to the tar/zip archive - * @link http://php.net/manual/en/phardata.addemptydir.php - * @param string $dirname

- * The name of the empty directory to create in the phar archive - *

- * @return bool no return value, exception is thrown on failure. - */ - public function addEmptyDir ($dirname) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Add a file from the filesystem to the tar/zip archive - * @link http://php.net/manual/en/phardata.addfile.php - * @param string $file

- * Full or relative path to a file on disk to be added - * to the phar archive. - *

- * @param string $localname [optional]

- * Path that the file will be stored in the archive. - *

- * @return void no return value, exception is thrown on failure. - */ - public function addFile ($file, $localname = null) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Add a file from the filesystem to the tar/zip archive - * @link http://php.net/manual/en/phardata.addfromstring.php - * @param string $localname

- * Path that the file will be stored in the archive. - *

- * @param string $contents

- * The file contents to store - *

- * @return bool no return value, exception is thrown on failure. - */ - public function addFromString ($localname, $contents) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Construct a tar/zip archive from the files within a directory. - * @link http://php.net/manual/en/phardata.buildfromdirectory.php - * @param string $base_dir

- * The full or relative path to the directory that contains all files - * to add to the archive. - *

- * @param string $regex [optional]

- * An optional pcre regular expression that is used to filter the - * list of files. Only file paths matching the regular expression - * will be included in the archive. - *

- * @return array Phar::buildFromDirectory returns an associative array - * mapping internal path of file to the full path of the file on the - * filesystem. - */ - public function buildFromDirectory ($base_dir, $regex = null) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Construct a tar or zip archive from an iterator. - * @link http://php.net/manual/en/phardata.buildfromiterator.php - * @param Iterator $iter

- * Any iterator that either associatively maps tar/zip file to location or - * returns SplFileInfo objects - *

- * @param string $base_directory [optional]

- * For iterators that return SplFileInfo objects, the portion of each - * file's full path to remove when adding to the tar/zip archive - *

- * @return array PharData::buildFromIterator returns an associative array - * mapping internal path of file to the full path of the file on the - * filesystem. - */ - public function buildFromIterator (Iterator $iter, $base_directory = null) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Compresses all files in the current tar/zip archive - * @link http://php.net/manual/en/phardata.compressfiles.php - * @param int $compression

- * Compression must be one of Phar::GZ, - * Phar::BZ2 to add compression, or Phar::NONE - * to remove compression. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function compressFiles ($compression) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Decompresses all files in the current zip archive - * @link http://php.net/manual/en/phardata.decompressfiles.php - * @return bool TRUE on success or FALSE on failure. - */ - public function decompressFiles () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Compresses the entire tar/zip archive using Gzip or Bzip2 compression - * @link http://php.net/manual/en/phardata.compress.php - * @param int $compression

- * Compression must be one of Phar::GZ, - * Phar::BZ2 to add compression, or Phar::NONE - * to remove compression. - *

- * @param string $extension [optional]

- * By default, the extension is .tar.gz or .tar.bz2 - * for compressing a tar, and .tar for decompressing. - *

- * @return object A PharData object is returned. - */ - public function compress ($compression, $extension = null) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Decompresses the entire Phar archive - * @link http://php.net/manual/en/phardata.decompress.php - * @param string $extension [optional]

- * For decompressing, the default file extension - * is .phar.tar. - * Use this parameter to specify another file extension. Be aware - * that no non-executable archives cannot contain .phar - * in their filename. - *

- * @return object A PharData object is returned. - */ - public function decompress ($extension = null) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Convert a non-executable tar/zip archive to an executable phar archive - * @link http://php.net/manual/en/phardata.converttoexecutable.php - * @param int $format [optional]

- * This should be one of Phar::PHAR, Phar::TAR, - * or Phar::ZIP. If set to NULL, the existing file format - * will be preserved. - *

- * @param int $compression [optional]

- * This should be one of Phar::NONE for no whole-archive - * compression, Phar::GZ for zlib-based compression, and - * Phar::BZ2 for bzip-based compression. - *

- * @param string $extension [optional]

- * This parameter is used to override the default file extension for a - * converted archive. Note that all zip- and tar-based phar archives must contain - * .phar in their file extension in order to be processed as a - * phar archive. - *

- *

- * If converting to a phar-based archive, the default extensions are - * .phar, .phar.gz, or .phar.bz2 - * depending on the specified compression. For tar-based phar archives, the - * default extensions are .phar.tar, .phar.tar.gz, - * and .phar.tar.bz2. For zip-based phar archives, the - * default extension is .phar.zip. - *

- * @return Phar The method returns a Phar object on success and throws an - * exception on failure. - */ - public function convertToExecutable ($format = null, $compression = null, $extension = null) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Convert a phar archive to a non-executable tar or zip file - * @link http://php.net/manual/en/phardata.converttodata.php - * @param int $format [optional]

- * This should be one of Phar::TAR - * or Phar::ZIP. If set to NULL, the existing file format - * will be preserved. - *

- * @param int $compression [optional]

- * This should be one of Phar::NONE for no whole-archive - * compression, Phar::GZ for zlib-based compression, and - * Phar::BZ2 for bzip-based compression. - *

- * @param string $extension [optional]

- * This parameter is used to override the default file extension for a - * converted archive. Note that .phar cannot be used - * anywhere in the filename for a non-executable tar or zip archive. - *

- *

- * If converting to a tar-based phar archive, the - * default extensions are .tar, .tar.gz, - * and .tar.bz2 depending on specified compression. - * For zip-based archives, the - * default extension is .zip. - *

- * @return PharData The method returns a PharData object on success and throws an - * exception on failure. - */ - public function convertToData ($format = null, $compression = null, $extension = null) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Copy a file internal to the phar archive to another new file within the phar - * @link http://php.net/manual/en/phardata.copy.php - * @param string $oldfile - * @param string $newfile - * @return bool returns TRUE on success, but it is safer to encase method call in a - * try/catch block and assume success if no exception is thrown. - */ - public function copy ($oldfile, $newfile) {} - - public function count () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Delete a file within a tar/zip archive - * @link http://php.net/manual/en/phardata.delete.php - * @param string $entry

- * Path within an archive to the file to delete. - *

- * @return bool returns TRUE on success, but it is better to check for thrown exception, - * and assume success if none is thrown. - */ - public function delete ($entry) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Deletes the global metadata of a zip archive - * @link http://php.net/manual/en/phardata.delmetadata.php - * @return bool returns TRUE on success, but it is better to check for thrown exception, - * and assume success if none is thrown. - */ - public function delMetadata () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Extract the contents of a tar/zip archive to a directory - * @link http://php.net/manual/en/phardata.extractto.php - * @param string $pathto

- * Path within an archive to the file to delete. - *

- * @param string|array $files [optional]

- * The name of a file or directory to extract, or an array of files/directories to extract - *

- * @param bool $overwrite [optional]

- * Set to TRUE to enable overwriting existing files - *

- * @return bool returns TRUE on success, but it is better to check for thrown exception, - * and assume success if none is thrown. - */ - public function extractTo ($pathto, $files = null, $overwrite = false) {} - - public function getAlias () {} - - public function getPath () {} - - public function getMetadata () {} - - public function getModified () {} - - public function getSignature () {} - - public function getStub () {} - - public function getVersion () {} - - public function hasMetadata () {} - - public function isBuffering () {} - - public function isCompressed () {} - - /** - * @param $fileformat - */ - public function isFileFormat ($fileformat) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Returns true if the tar/zip archive can be modified - * @link http://php.net/manual/en/phardata.iswritable.php - * @return bool TRUE if the tar/zip archive can be modified - */ - public function isWritable () {} - - /** - * @param $entry - */ - public function offsetExists ($entry) {} - - /** - * @param $entry - */ - public function offsetGet ($entry) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * set the contents of a file within the tar/zip to those of an external file or string - * @link http://php.net/manual/en/phardata.offsetset.php - * @param string $offset

- * The filename (relative path) to modify in a tar or zip archive. - *

- * @param string $value

- * Content of the file. - *

- * @return void No return values. - */ - public function offsetSet ($offset, $value) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * remove a file from a tar/zip archive - * @link http://php.net/manual/en/phardata.offsetunset.php - * @param string $offset

- * The filename (relative path) to modify in the tar/zip archive. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function offsetUnset ($offset) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * dummy function (Phar::setAlias is not valid for PharData) - * @link http://php.net/manual/en/phardata.setalias.php - * @param string $alias

- * A shorthand string that this archive can be referred to in phar - * stream wrapper access. This parameter is ignored. - *

- * @return bool - */ - public function setAlias ($alias) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * dummy function (Phar::setDefaultStub is not valid for PharData) - * @link http://php.net/manual/en/phardata.setdefaultstub.php - * @param string $index [optional]

- * Relative path within the phar archive to run if accessed on the command-line - *

- * @param string $webindex [optional]

- * Relative path within the phar archive to run if accessed through a web browser - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setDefaultStub ($index = null, $webindex = null) {} - - /** - * @param $metadata - */ - public function setMetadata ($metadata) {} - - /** - * @param $algorithm - * @param $privatekey [optional] - */ - public function setSignatureAlgorithm ($algorithm, $privatekey) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * dummy function (Phar::setStub is not valid for PharData) - * @link http://php.net/manual/en/phardata.setstub.php - * @param string $stub

- * A string or an open stream handle to use as the executable stub for this - * phar archive. This parameter is ignored. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setStub ($stub) {} - - public function startBuffering () {} - - public function stopBuffering () {} - - final public static function apiVersion () {} - - /** - * @param $method [optional] - */ - final public static function canCompress ($method) {} - - final public static function canWrite () {} - - /** - * @param $index [optional] - * @param $webindex [optional] - */ - final public static function createDefaultStub ($index, $webindex) {} - - final public static function getSupportedCompression () {} - - final public static function getSupportedSignatures () {} - - final public static function interceptFileFuncs () {} - - /** - * @param $filename - * @param $executable [optional] - */ - final public static function isValidPharFilename ($filename, $executable) {} - - /** - * @param $filename - * @param $alias [optional] - */ - final public static function loadPhar ($filename, $alias) {} - - /** - * @param $alias [optional] - * @param $offset [optional] - */ - final public static function mapPhar ($alias, $offset) {} - - /** - * @param $retphar - */ - final public static function running ($retphar) {} - - /** - * @param $inphar - * @param $externalfile - */ - final public static function mount ($inphar, $externalfile) {} - - /** - * @param $munglist - */ - final public static function mungServer ($munglist) {} - - /** - * @param $archive - */ - final public static function unlinkArchive ($archive) {} - - /** - * @param $alias [optional] - * @param $index [optional] - * @param $f404 [optional] - * @param $mimetypes [optional] - * @param $rewrites [optional] - */ - final public static function webPhar ($alias, $index, $f404, $mimetypes, $rewrites) {} - - /** - * (PHP 5)
- * Returns whether current entry is a directory and not '.' or '..' - * @link http://php.net/manual/en/recursivedirectoryiterator.haschildren.php - * @param bool $allow_links [optional]

- *

- * @return bool whether the current entry is a directory, but not '.' or '..' - */ - public function hasChildren ($allow_links = false) {} - - /** - * (PHP 5 >= 5.1.0)
- * Returns an iterator for the current entry if it is a directory - * @link http://php.net/manual/en/recursivedirectoryiterator.getchildren.php - * @return mixed The filename, file information, or $this depending on the set flags. - * See the FilesystemIterator - * constants. - */ - public function getChildren () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get sub path - * @link http://php.net/manual/en/recursivedirectoryiterator.getsubpath.php - * @return string The sub path (sub directory). - */ - public function getSubPath () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get sub path and name - * @link http://php.net/manual/en/recursivedirectoryiterator.getsubpathname.php - * @return string The sub path (sub directory) and filename. - */ - public function getSubPathname () {} - - /** - * (PHP 5 >= 5.3.0)
- * Rewinds back to the beginning - * @link http://php.net/manual/en/filesystemiterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.3.0)
- * Move to the next file - * @link http://php.net/manual/en/filesystemiterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.3.0)
- * Retrieve the key for the current file - * @link http://php.net/manual/en/filesystemiterator.key.php - * @return string the pathname or filename depending on the set flags. - * See the FilesystemIterator constants. - */ - public function key () {} - - /** - * (PHP 5 >= 5.3.0)
- * The current file - * @link http://php.net/manual/en/filesystemiterator.current.php - * @return mixed The filename, file information, or $this depending on the set flags. - * See the FilesystemIterator constants. - */ - public function current () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get the handling flags - * @link http://php.net/manual/en/filesystemiterator.getflags.php - * @return int The integer value of the set flags. - */ - public function getFlags () {} - - /** - * (PHP 5 >= 5.3.0)
- * Sets handling flags - * @link http://php.net/manual/en/filesystemiterator.setflags.php - * @param int $flags [optional]

- * The handling flags to set. - * See the FilesystemIterator constants. - *

- * @return void No value is returned. - */ - public function setFlags ($flags = null) {} - - /** - * (PHP 5)
- * Return file name of current DirectoryIterator item. - * @link http://php.net/manual/en/directoryiterator.getfilename.php - * @return string the file name of the current DirectoryIterator item. - */ - public function getFilename () {} - - /** - * (PHP 5 >= 5.3.6)
- * Gets the file extension - * @link http://php.net/manual/en/directoryiterator.getextension.php - * @return string a string containing the file extension, or an - * empty string if the file has no extension. - */ - public function getExtension () {} - - /** - * (PHP 5 >= 5.2.2)
- * Get base name of current DirectoryIterator item. - * @link http://php.net/manual/en/directoryiterator.getbasename.php - * @param string $suffix [optional]

- * If the base name ends in suffix, - * this will be cut. - *

- * @return string The base name of the current DirectoryIterator item. - */ - public function getBasename ($suffix = null) {} - - /** - * (PHP 5)
- * Determine if current DirectoryIterator item is '.' or '..' - * @link http://php.net/manual/en/directoryiterator.isdot.php - * @return bool TRUE if the entry is . or .., - * otherwise FALSE - */ - public function isDot () {} - - /** - * (PHP 5)
- * Check whether current DirectoryIterator position is a valid file - * @link http://php.net/manual/en/directoryiterator.valid.php - * @return bool TRUE if the position is valid, otherwise FALSE - */ - public function valid () {} - - /** - * (PHP 5 >= 5.3.0)
- * Seek to a DirectoryIterator item - * @link http://php.net/manual/en/directoryiterator.seek.php - * @param int $position

- * The zero-based numeric position to seek to. - *

- * @return void No value is returned. - */ - public function seek ($position) {} - - /** - * (PHP 5)
- * Get file name as a string - * @link http://php.net/manual/en/directoryiterator.tostring.php - * @return string the file name of the current DirectoryIterator item. - */ - public function __toString () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the path to the file - * @link http://php.net/manual/en/splfileinfo.getpathname.php - * @return string The path to the file. - */ - public function getPathname () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file permissions - * @link http://php.net/manual/en/splfileinfo.getperms.php - * @return int the file permissions. - */ - public function getPerms () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the inode for the file - * @link http://php.net/manual/en/splfileinfo.getinode.php - * @return int the inode number for the filesystem object. - */ - public function getInode () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file size - * @link http://php.net/manual/en/splfileinfo.getsize.php - * @return int The filesize in bytes. - */ - public function getSize () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the owner of the file - * @link http://php.net/manual/en/splfileinfo.getowner.php - * @return int The owner id in numerical format. - */ - public function getOwner () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the file group - * @link http://php.net/manual/en/splfileinfo.getgroup.php - * @return int The group id in numerical format. - */ - public function getGroup () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets last access time of the file - * @link http://php.net/manual/en/splfileinfo.getatime.php - * @return int the time the file was last accessed. - */ - public function getATime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the last modified time - * @link http://php.net/manual/en/splfileinfo.getmtime.php - * @return int the last modified time for the file, in a Unix timestamp. - */ - public function getMTime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the inode change time - * @link http://php.net/manual/en/splfileinfo.getctime.php - * @return int The last change time, in a Unix timestamp. - */ - public function getCTime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file type - * @link http://php.net/manual/en/splfileinfo.gettype.php - * @return string A string representing the type of the entry. - * May be one of file, link, - * or dir - */ - public function getType () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if file is readable - * @link http://php.net/manual/en/splfileinfo.isreadable.php - * @return bool TRUE if readable, FALSE otherwise. - */ - public function isReadable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is executable - * @link http://php.net/manual/en/splfileinfo.isexecutable.php - * @return bool TRUE if executable, FALSE otherwise. - */ - public function isExecutable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the object references a regular file - * @link http://php.net/manual/en/splfileinfo.isfile.php - * @return bool TRUE if the file exists and is a regular file (not a link), FALSE otherwise. - */ - public function isFile () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is a directory - * @link http://php.net/manual/en/splfileinfo.isdir.php - * @return bool TRUE if a directory, FALSE otherwise. - */ - public function isDir () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is a link - * @link http://php.net/manual/en/splfileinfo.islink.php - * @return bool TRUE if the file is a link, FALSE otherwise. - */ - public function isLink () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets the target of a link - * @link http://php.net/manual/en/splfileinfo.getlinktarget.php - * @return string the target of the filesystem link. - */ - public function getLinkTarget () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets absolute path to file - * @link http://php.net/manual/en/splfileinfo.getrealpath.php - * @return string the path to the file. - */ - public function getRealPath () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileInfo object for the file - * @link http://php.net/manual/en/splfileinfo.getfileinfo.php - * @param string $class_name [optional]

- * Name of an SplFileInfo derived class to use. - *

- * @return SplFileInfo An SplFileInfo object created for the file. - */ - public function getFileInfo ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileInfo object for the path - * @link http://php.net/manual/en/splfileinfo.getpathinfo.php - * @param string $class_name [optional]

- * Name of an SplFileInfo derived class to use. - *

- * @return SplFileInfo an SplFileInfo object for the parent path of the file. - */ - public function getPathInfo ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileObject object for the file - * @link http://php.net/manual/en/splfileinfo.openfile.php - * @param string $open_mode [optional]

- * The mode for opening the file. See the fopen - * documentation for descriptions of possible modes. The default - * is read only. - *

- * @param bool $use_include_path [optional]

- * When set to TRUE, the filename is also - * searched for within the include_path - *

- * @param resource $context [optional]

- * Refer to the context - * section of the manual for a description of contexts. - *

- * @return SplFileObject The opened file as an SplFileObject object. - */ - public function openFile ($open_mode = 'r', $use_include_path = false, $context = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets the class name used with SplFileInfo::openFile - * @link http://php.net/manual/en/splfileinfo.setfileclass.php - * @param string $class_name [optional]

- * The class name to use when openFile() is called. - *

- * @return void No value is returned. - */ - public function setFileClass ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets the class used with getFileInfo and getPathInfo - * @link http://php.net/manual/en/splfileinfo.setinfoclass.php - * @param string $class_name [optional]

- * The class name to use. - *

- * @return void No value is returned. - */ - public function setInfoClass ($class_name = null) {} - - final public function _bad_state_ex () {} - -} - -/** - * The PharFileInfo class provides a high-level interface to the contents - * and attributes of a single file within a phar archive. - * @link http://php.net/manual/en/class.pharfileinfo.php - */ -class PharFileInfo extends SplFileInfo { - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Construct a Phar entry object - * @link http://php.net/manual/en/pharfileinfo.construct.php - * @param string $entry

- * The full url to retrieve a file. If you wish to retrieve the information - * for the file my/file.php from the phar boo.phar, - * the entry should be phar://boo.phar/my/file.php. - *

- */ - public function __construct ($entry) {} - - public function __destruct () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Sets file-specific permission bits - * @link http://php.net/manual/en/pharfileinfo.chmod.php - * @param int $permissions

- * permissions (see chmod) - *

- * @return void No value is returned. - */ - public function chmod ($permissions) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Compresses the current Phar entry with either zlib or bzip2 compression - * @link http://php.net/manual/en/pharfileinfo.compress.php - * @param int $compression - * @return bool TRUE on success or FALSE on failure. - */ - public function compress ($compression) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 2.0.0)
- * Decompresses the current Phar entry within the phar - * @link http://php.net/manual/en/pharfileinfo.decompress.php - * @return bool TRUE on success or FALSE on failure. - */ - public function decompress () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.2.0)
- * Deletes the metadata of the entry - * @link http://php.net/manual/en/pharfileinfo.delmetadata.php - * @return bool TRUE if successful, FALSE if the entry had no metadata. - * As with all functionality that modifies the contents of - * a phar, the phar.readonly INI variable - * must be off in order to succeed if the file is within a Phar - * archive. Files within PharData archives do not have - * this restriction. - */ - public function delMetadata () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Returns the actual size of the file (with compression) inside the Phar archive - * @link http://php.net/manual/en/pharfileinfo.getcompressedsize.php - * @return int The size in bytes of the file within the Phar archive on disk. - */ - public function getCompressedSize () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Returns CRC32 code or throws an exception if CRC has not been verified - * @link http://php.net/manual/en/pharfileinfo.getcrc32.php - * @return int The crc32 checksum of the file within the Phar archive. - */ - public function getCRC32 () {} - - public function getContent () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Returns file-specific meta-data saved with a file - * @link http://php.net/manual/en/pharfileinfo.getmetadata.php - * @return mixed any PHP variable that can be serialized and is stored as meta-data for the file, - * or NULL if no meta-data is stored. - */ - public function getMetadata () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Returns the Phar file entry flags - * @link http://php.net/manual/en/pharfileinfo.getpharflags.php - * @return int The Phar flags (always 0 in the current implementation) - */ - public function getPharFlags () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.2.0)
- * Returns the metadata of the entry - * @link http://php.net/manual/en/pharfileinfo.hasmetadata.php - * @return bool FALSE if no metadata is set or is NULL, TRUE if metadata is not NULL - */ - public function hasMetadata () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Returns whether the entry is compressed - * @link http://php.net/manual/en/pharfileinfo.iscompressed.php - * @param int $compression_type [optional]

- * One of Phar::GZ or Phar::BZ2, - * defaults to any compression. - *

- * @return bool TRUE if the file is compressed within the Phar archive, FALSE if not. - */ - public function isCompressed ($compression_type = 9021976) {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Returns whether file entry has had its CRC verified - * @link http://php.net/manual/en/pharfileinfo.iscrcchecked.php - * @return bool TRUE if the file has had its CRC verified, FALSE if not. - */ - public function isCRCChecked () {} - - /** - * (PHP >= 5.3.0, PECL phar >= 1.0.0)
- * Sets file-specific meta-data saved with a file - * @link http://php.net/manual/en/pharfileinfo.setmetadata.php - * @param mixed $metadata

- * Any PHP variable containing information to store alongside a file - *

- * @return void No value is returned. - */ - public function setMetadata ($metadata) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the path without filename - * @link http://php.net/manual/en/splfileinfo.getpath.php - * @return string the path to the file. - */ - public function getPath () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the filename - * @link http://php.net/manual/en/splfileinfo.getfilename.php - * @return string The filename. - */ - public function getFilename () {} - - /** - * (PHP 5 >= 5.3.6)
- * Gets the file extension - * @link http://php.net/manual/en/splfileinfo.getextension.php - * @return string a string containing the file extension, or an - * empty string if the file has no extension. - */ - public function getExtension () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets the base name of the file - * @link http://php.net/manual/en/splfileinfo.getbasename.php - * @param string $suffix [optional]

- * Optional suffix to omit from the base name returned. - *

- * @return string the base name without path information. - */ - public function getBasename ($suffix = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the path to the file - * @link http://php.net/manual/en/splfileinfo.getpathname.php - * @return string The path to the file. - */ - public function getPathname () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file permissions - * @link http://php.net/manual/en/splfileinfo.getperms.php - * @return int the file permissions. - */ - public function getPerms () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the inode for the file - * @link http://php.net/manual/en/splfileinfo.getinode.php - * @return int the inode number for the filesystem object. - */ - public function getInode () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file size - * @link http://php.net/manual/en/splfileinfo.getsize.php - * @return int The filesize in bytes. - */ - public function getSize () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the owner of the file - * @link http://php.net/manual/en/splfileinfo.getowner.php - * @return int The owner id in numerical format. - */ - public function getOwner () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the file group - * @link http://php.net/manual/en/splfileinfo.getgroup.php - * @return int The group id in numerical format. - */ - public function getGroup () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets last access time of the file - * @link http://php.net/manual/en/splfileinfo.getatime.php - * @return int the time the file was last accessed. - */ - public function getATime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the last modified time - * @link http://php.net/manual/en/splfileinfo.getmtime.php - * @return int the last modified time for the file, in a Unix timestamp. - */ - public function getMTime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the inode change time - * @link http://php.net/manual/en/splfileinfo.getctime.php - * @return int The last change time, in a Unix timestamp. - */ - public function getCTime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file type - * @link http://php.net/manual/en/splfileinfo.gettype.php - * @return string A string representing the type of the entry. - * May be one of file, link, - * or dir - */ - public function getType () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the entry is writable - * @link http://php.net/manual/en/splfileinfo.iswritable.php - * @return bool TRUE if writable, FALSE otherwise; - */ - public function isWritable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if file is readable - * @link http://php.net/manual/en/splfileinfo.isreadable.php - * @return bool TRUE if readable, FALSE otherwise. - */ - public function isReadable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is executable - * @link http://php.net/manual/en/splfileinfo.isexecutable.php - * @return bool TRUE if executable, FALSE otherwise. - */ - public function isExecutable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the object references a regular file - * @link http://php.net/manual/en/splfileinfo.isfile.php - * @return bool TRUE if the file exists and is a regular file (not a link), FALSE otherwise. - */ - public function isFile () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is a directory - * @link http://php.net/manual/en/splfileinfo.isdir.php - * @return bool TRUE if a directory, FALSE otherwise. - */ - public function isDir () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is a link - * @link http://php.net/manual/en/splfileinfo.islink.php - * @return bool TRUE if the file is a link, FALSE otherwise. - */ - public function isLink () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets the target of a link - * @link http://php.net/manual/en/splfileinfo.getlinktarget.php - * @return string the target of the filesystem link. - */ - public function getLinkTarget () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets absolute path to file - * @link http://php.net/manual/en/splfileinfo.getrealpath.php - * @return string the path to the file. - */ - public function getRealPath () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileInfo object for the file - * @link http://php.net/manual/en/splfileinfo.getfileinfo.php - * @param string $class_name [optional]

- * Name of an SplFileInfo derived class to use. - *

- * @return SplFileInfo An SplFileInfo object created for the file. - */ - public function getFileInfo ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileInfo object for the path - * @link http://php.net/manual/en/splfileinfo.getpathinfo.php - * @param string $class_name [optional]

- * Name of an SplFileInfo derived class to use. - *

- * @return SplFileInfo an SplFileInfo object for the parent path of the file. - */ - public function getPathInfo ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileObject object for the file - * @link http://php.net/manual/en/splfileinfo.openfile.php - * @param string $open_mode [optional]

- * The mode for opening the file. See the fopen - * documentation for descriptions of possible modes. The default - * is read only. - *

- * @param bool $use_include_path [optional]

- * When set to TRUE, the filename is also - * searched for within the include_path - *

- * @param resource $context [optional]

- * Refer to the context - * section of the manual for a description of contexts. - *

- * @return SplFileObject The opened file as an SplFileObject object. - */ - public function openFile ($open_mode = 'r', $use_include_path = false, $context = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets the class name used with SplFileInfo::openFile - * @link http://php.net/manual/en/splfileinfo.setfileclass.php - * @param string $class_name [optional]

- * The class name to use when openFile() is called. - *

- * @return void No value is returned. - */ - public function setFileClass ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets the class used with getFileInfo and getPathInfo - * @link http://php.net/manual/en/splfileinfo.setinfoclass.php - * @param string $class_name [optional]

- * The class name to use. - *

- * @return void No value is returned. - */ - public function setInfoClass ($class_name = null) {} - - final public function _bad_state_ex () {} - - /** - * (PHP 5 >= 5.1.2)
- * Returns the path to the file as a string - * @link http://php.net/manual/en/splfileinfo.tostring.php - * @return void the path to the file. - */ - public function __toString () {} - -} -// End of Phar v.2.0.1 -?> diff --git a/phpruntime/Reflection.php b/phpruntime/Reflection.php deleted file mode 100644 index c12457d..0000000 --- a/phpruntime/Reflection.php +++ /dev/null @@ -1,2566 +0,0 @@ - - * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * The reflection class. - * @link http://php.net/manual/en/class.reflection.php - */ -class Reflection { - - /** - * (PHP 5)
- * Gets modifier names - * @link http://php.net/manual/en/reflection.getmodifiernames.php - * @param int $modifiers

- * The modifiers to get, which is from a numeric value. - *

- * @return array An array of modifier names. - */ - public static function getModifierNames ($modifiers) {} - - /** - * (PHP 5)
- * Exports - * @link http://php.net/manual/en/reflection.export.php - * @param Reflector $reflector

- * The reflection to export. - *

- * @param bool $return [optional]

- * Setting to TRUE will return the export, - * as opposed to emitting it. Setting to FALSE (the default) will do the opposite. - *

- * @return string If the return parameter - * is set to TRUE, then the export is returned as a string, - * otherwise NULL is returned. - */ - public static function export (Reflector $reflector, $return = false) {} - -} - -/** - * Reflector is an interface implemented by all - * exportable Reflection classes. - * @link http://php.net/manual/en/class.reflector.php - */ -interface Reflector { - - /** - * (PHP 5)
- * Exports - * @link http://php.net/manual/en/reflector.export.php - * @return string - */ - abstract public static function export (); - - /** - * (PHP 5)
- * To string - * @link http://php.net/manual/en/reflector.tostring.php - * @return string - */ - abstract public function __toString (); - -} - -/** - * A parent class to ReflectionFunction, read its - * description for details. - * @link http://php.net/manual/en/class.reflectionfunctionabstract.php - */ -class ReflectionFunctionAbstract implements Reflector { - public $name; - - - /** - * (PHP 5)
- * Clones function - * @link http://php.net/manual/en/reflectionfunctionabstract.clone.php - * @return void - */ - final private function __clone () {} - - /** - * (PHP 5)
- * To string - * @link http://php.net/manual/en/reflectionfunctionabstract.tostring.php - * @return void The string. - */ - abstract public function __toString (); - - /** - * (PHP 5 >= 5.3.0)
- * Checks if function in namespace - * @link http://php.net/manual/en/reflectionfunctionabstract.innamespace.php - * @return bool TRUE if it's in a namespace, otherwise FALSE - */ - public function inNamespace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Checks if closure - * @link http://php.net/manual/en/reflectionfunctionabstract.isclosure.php - * @return bool TRUE if it's a closure, otherwise FALSE - */ - public function isClosure () {} - - /** - * (PHP 5)
- * Checks if deprecated - * @link http://php.net/manual/en/reflectionfunctionabstract.isdeprecated.php - * @return bool TRUE if it's deprecated, otherwise FALSE - */ - public function isDeprecated () {} - - /** - * (PHP 5)
- * Checks if is internal - * @link http://php.net/manual/en/reflectionfunctionabstract.isinternal.php - * @return bool TRUE if it's internal, otherwise FALSE - */ - public function isInternal () {} - - /** - * (PHP 5)
- * Checks if user defined - * @link http://php.net/manual/en/reflectionfunctionabstract.isuserdefined.php - * @return bool TRUE if it's user-defined, otherwise false; - */ - public function isUserDefined () {} - - /** - * (No version information available, might only be in SVN)
- * Returns this pointer bound to closure - * @link http://php.net/manual/en/reflectionfunctionabstract.getclosurethis.php - * @return object $this pointer. - * Returns NULL in case of an error. - */ - public function getClosureThis () {} - - public function getClosureScopeClass () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets doc comment - * @link http://php.net/manual/en/reflectionfunctionabstract.getdoccomment.php - * @return string The doc comment if it exists, otherwise FALSE - */ - public function getDocComment () {} - - /** - * (PHP 5)
- * Gets end line number - * @link http://php.net/manual/en/reflectionfunctionabstract.getendline.php - * @return int The ending line number of the user defined function, or FALSE if unknown. - */ - public function getEndLine () {} - - /** - * (PHP 5)
- * Gets extension info - * @link http://php.net/manual/en/reflectionfunctionabstract.getextension.php - * @return ReflectionExtension The extension information, as a ReflectionExtension object. - */ - public function getExtension () {} - - /** - * (PHP 5)
- * Gets extension name - * @link http://php.net/manual/en/reflectionfunctionabstract.getextensionname.php - * @return string The extensions name. - */ - public function getExtensionName () {} - - /** - * (PHP 5)
- * Gets file name - * @link http://php.net/manual/en/reflectionfunctionabstract.getfilename.php - * @return string The file name. - */ - public function getFileName () {} - - /** - * (PHP 5)
- * Gets function name - * @link http://php.net/manual/en/reflectionfunctionabstract.getname.php - * @return string The name of the function. - */ - public function getName () {} - - /** - * (PHP 5 >= 5.3.0)
- * Gets namespace name - * @link http://php.net/manual/en/reflectionfunctionabstract.getnamespacename.php - * @return string The namespace name. - */ - public function getNamespaceName () {} - - /** - * (PHP 5 >= 5.0.3)
- * Gets number of parameters - * @link http://php.net/manual/en/reflectionfunctionabstract.getnumberofparameters.php - * @return int The number of parameters. - */ - public function getNumberOfParameters () {} - - /** - * (PHP 5 >= 5.0.3)
- * Gets number of required parameters - * @link http://php.net/manual/en/reflectionfunctionabstract.getnumberofrequiredparameters.php - * @return int The number of required parameters. - */ - public function getNumberOfRequiredParameters () {} - - /** - * (PHP 5)
- * Gets parameters - * @link http://php.net/manual/en/reflectionfunctionabstract.getparameters.php - * @return array The parameters, as a ReflectionParameter object. - */ - public function getParameters () {} - - /** - * (PHP 5 >= 5.3.0)
- * Gets function short name - * @link http://php.net/manual/en/reflectionfunctionabstract.getshortname.php - * @return string The short name of the function. - */ - public function getShortName () {} - - /** - * (PHP 5)
- * Gets starting line number - * @link http://php.net/manual/en/reflectionfunctionabstract.getstartline.php - * @return int The starting line number. - */ - public function getStartLine () {} - - /** - * (PHP 5)
- * Gets static variables - * @link http://php.net/manual/en/reflectionfunctionabstract.getstaticvariables.php - * @return array An array of static variables. - */ - public function getStaticVariables () {} - - /** - * (PHP 5)
- * Checks if returns reference - * @link http://php.net/manual/en/reflectionfunctionabstract.returnsreference.php - * @return bool TRUE if it returns a reference, otherwise FALSE - */ - public function returnsReference () {} - -} - -/** - * The ReflectionFunction class reports - * information about a function. - * @link http://php.net/manual/en/class.reflectionfunction.php - */ -class ReflectionFunction extends ReflectionFunctionAbstract implements Reflector { - const IS_DEPRECATED = 262144; - - public $name; - - - /** - * (PHP 5)
- * Constructs a ReflectionFunction object - * @link http://php.net/manual/en/reflectionfunction.construct.php - * @param mixed $name

- * The name of the function to reflect or a closure. - *

- */ - public function __construct ($name) {} - - /** - * (PHP 5)
- * To string - * @link http://php.net/manual/en/reflectionfunction.tostring.php - * @return string ReflectionFunction::export-like output for - * the function. - */ - public function __toString () {} - - /** - * (PHP 5)
- * Exports function - * @link http://php.net/manual/en/reflectionfunction.export.php - * @param string $name

- * The reflection to export. - *

- * @param string $return [optional]

- * Setting to TRUE will return the export, - * as opposed to emitting it. Setting to FALSE (the default) will do the opposite. - *

- * @return string If the return parameter - * is set to TRUE, then the export is returned as a string, - * otherwise NULL is returned. - */ - public static function export ($name, $return = null) {} - - /** - * (PHP 5)
- * Checks if function is disabled - * @link http://php.net/manual/en/reflectionfunction.isdisabled.php - * @return bool TRUE if it's disable, otherwise FALSE - */ - public function isDisabled () {} - - /** - * (PHP 5)
- * Invokes function - * @link http://php.net/manual/en/reflectionfunction.invoke.php - * @param mixed $parameter [optional] - * @param mixed $_ [optional] - * @return mixed the result of the invoked function call. - */ - public function invoke ($parameter = null, $_ = null) {} - - /** - * (PHP 5 >= 5.1.0)
- * Invokes function args - * @link http://php.net/manual/en/reflectionfunction.invokeargs.php - * @param array $args

- * The passed arguments to the function as an array, much like - * call_user_func_array works. - *

- * @return mixed the result of the invoked function - */ - public function invokeArgs (array $args) {} - - /** - * (No version information available, might only be in SVN)
- * Returns a dynamically created closure for the function - * @link http://php.net/manual/en/reflectionfunction.getclosure.php - * @return Closure Closure. - * Returns NULL in case of an error. - */ - public function getClosure () {} - - /** - * (PHP 5)
- * Clones function - * @link http://php.net/manual/en/reflectionfunctionabstract.clone.php - * @return void - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.3.0)
- * Checks if function in namespace - * @link http://php.net/manual/en/reflectionfunctionabstract.innamespace.php - * @return bool TRUE if it's in a namespace, otherwise FALSE - */ - public function inNamespace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Checks if closure - * @link http://php.net/manual/en/reflectionfunctionabstract.isclosure.php - * @return bool TRUE if it's a closure, otherwise FALSE - */ - public function isClosure () {} - - /** - * (PHP 5)
- * Checks if deprecated - * @link http://php.net/manual/en/reflectionfunctionabstract.isdeprecated.php - * @return bool TRUE if it's deprecated, otherwise FALSE - */ - public function isDeprecated () {} - - /** - * (PHP 5)
- * Checks if is internal - * @link http://php.net/manual/en/reflectionfunctionabstract.isinternal.php - * @return bool TRUE if it's internal, otherwise FALSE - */ - public function isInternal () {} - - /** - * (PHP 5)
- * Checks if user defined - * @link http://php.net/manual/en/reflectionfunctionabstract.isuserdefined.php - * @return bool TRUE if it's user-defined, otherwise false; - */ - public function isUserDefined () {} - - /** - * (No version information available, might only be in SVN)
- * Returns this pointer bound to closure - * @link http://php.net/manual/en/reflectionfunctionabstract.getclosurethis.php - * @return object $this pointer. - * Returns NULL in case of an error. - */ - public function getClosureThis () {} - - public function getClosureScopeClass () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets doc comment - * @link http://php.net/manual/en/reflectionfunctionabstract.getdoccomment.php - * @return string The doc comment if it exists, otherwise FALSE - */ - public function getDocComment () {} - - /** - * (PHP 5)
- * Gets end line number - * @link http://php.net/manual/en/reflectionfunctionabstract.getendline.php - * @return int The ending line number of the user defined function, or FALSE if unknown. - */ - public function getEndLine () {} - - /** - * (PHP 5)
- * Gets extension info - * @link http://php.net/manual/en/reflectionfunctionabstract.getextension.php - * @return ReflectionExtension The extension information, as a ReflectionExtension object. - */ - public function getExtension () {} - - /** - * (PHP 5)
- * Gets extension name - * @link http://php.net/manual/en/reflectionfunctionabstract.getextensionname.php - * @return string The extensions name. - */ - public function getExtensionName () {} - - /** - * (PHP 5)
- * Gets file name - * @link http://php.net/manual/en/reflectionfunctionabstract.getfilename.php - * @return string The file name. - */ - public function getFileName () {} - - /** - * (PHP 5)
- * Gets function name - * @link http://php.net/manual/en/reflectionfunctionabstract.getname.php - * @return string The name of the function. - */ - public function getName () {} - - /** - * (PHP 5 >= 5.3.0)
- * Gets namespace name - * @link http://php.net/manual/en/reflectionfunctionabstract.getnamespacename.php - * @return string The namespace name. - */ - public function getNamespaceName () {} - - /** - * (PHP 5 >= 5.0.3)
- * Gets number of parameters - * @link http://php.net/manual/en/reflectionfunctionabstract.getnumberofparameters.php - * @return int The number of parameters. - */ - public function getNumberOfParameters () {} - - /** - * (PHP 5 >= 5.0.3)
- * Gets number of required parameters - * @link http://php.net/manual/en/reflectionfunctionabstract.getnumberofrequiredparameters.php - * @return int The number of required parameters. - */ - public function getNumberOfRequiredParameters () {} - - /** - * (PHP 5)
- * Gets parameters - * @link http://php.net/manual/en/reflectionfunctionabstract.getparameters.php - * @return array The parameters, as a ReflectionParameter object. - */ - public function getParameters () {} - - /** - * (PHP 5 >= 5.3.0)
- * Gets function short name - * @link http://php.net/manual/en/reflectionfunctionabstract.getshortname.php - * @return string The short name of the function. - */ - public function getShortName () {} - - /** - * (PHP 5)
- * Gets starting line number - * @link http://php.net/manual/en/reflectionfunctionabstract.getstartline.php - * @return int The starting line number. - */ - public function getStartLine () {} - - /** - * (PHP 5)
- * Gets static variables - * @link http://php.net/manual/en/reflectionfunctionabstract.getstaticvariables.php - * @return array An array of static variables. - */ - public function getStaticVariables () {} - - /** - * (PHP 5)
- * Checks if returns reference - * @link http://php.net/manual/en/reflectionfunctionabstract.returnsreference.php - * @return bool TRUE if it returns a reference, otherwise FALSE - */ - public function returnsReference () {} - -} - -/** - * The ReflectionParameter class retrieves - * information about function's or method's parameters. - * @link http://php.net/manual/en/class.reflectionparameter.php - */ -class ReflectionParameter implements Reflector { - public $name; - - - /** - * (PHP 5)
- * Clone - * @link http://php.net/manual/en/reflectionparameter.clone.php - * @return void - */ - final private function __clone () {} - - /** - * (PHP 5)
- * Exports - * @link http://php.net/manual/en/reflectionparameter.export.php - * @param string $function

- * The function name. - *

- * @param string $parameter

- * The parameter name. - *

- * @param bool $return [optional]

- * Setting to TRUE will return the export, - * as opposed to emitting it. Setting to FALSE (the default) will do the opposite. - *

- * @return string The exported reflection. - */ - public static function export ($function, $parameter, $return = null) {} - - /** - * (PHP 5)
- * Construct - * @link http://php.net/manual/en/reflectionparameter.construct.php - * @param string $function

- * The function to reflect parameters from. - *

- * @param string $parameter

- * The parameter. - *

- */ - public function __construct ($function, $parameter) {} - - /** - * (PHP 5)
- * To string - * @link http://php.net/manual/en/reflectionparameter.tostring.php - * @return string - */ - public function __toString () {} - - /** - * (PHP 5)
- * Gets parameter name - * @link http://php.net/manual/en/reflectionparameter.getname.php - * @return string The name of the reflected parameter. - */ - public function getName () {} - - /** - * (PHP 5)
- * Checks if passed by reference - * @link http://php.net/manual/en/reflectionparameter.ispassedbyreference.php - * @return bool TRUE if the parameter is passed in by reference, otherwise FALSE - */ - public function isPassedByReference () {} - - /** - * (PHP >= 5.4.0)
- * Returns whether this parameter can be passed by value - * @link http://php.net/manual/en/reflectionparameter.canbepassedbyvalue.php - * @return bool TRUE if the parameter can be passed by value, FALSE otherwise. - * Returns NULL in case of an error. - */ - public function canBePassedByValue () {} - - /** - * (PHP 5 >= 5.2.3)
- * Gets declaring function - * @link http://php.net/manual/en/reflectionparameter.getdeclaringfunction.php - * @return ReflectionFunction A ReflectionFunction object. - */ - public function getDeclaringFunction () {} - - /** - * (PHP 5)
- * Gets declaring class - * @link http://php.net/manual/en/reflectionparameter.getdeclaringclass.php - * @return ReflectionClass A ReflectionClass object. - */ - public function getDeclaringClass () {} - - /** - * (PHP 5)
- * Get class - * @link http://php.net/manual/en/reflectionparameter.getclass.php - * @return ReflectionClass A ReflectionClass object. - */ - public function getClass () {} - - /** - * (PHP 5 >= 5.1.0)
- * Checks if parameter expects an array - * @link http://php.net/manual/en/reflectionparameter.isarray.php - * @return bool TRUE if an array is expected, FALSE otherwise. - */ - public function isArray () {} - - public function isCallable () {} - - /** - * (PHP 5)
- * Checks if null is allowed - * @link http://php.net/manual/en/reflectionparameter.allowsnull.php - * @return bool TRUE if NULL is allowed, otherwise FALSE - */ - public function allowsNull () {} - - /** - * (PHP 5 >= 5.2.3)
- * Gets parameter position - * @link http://php.net/manual/en/reflectionparameter.getposition.php - * @return int The position of the parameter, left to right, starting at position #0. - */ - public function getPosition () {} - - /** - * (PHP 5 >= 5.0.3)
- * Checks if optional - * @link http://php.net/manual/en/reflectionparameter.isoptional.php - * @return bool TRUE if the parameter is optional, otherwise FALSE - */ - public function isOptional () {} - - /** - * (PHP 5 >= 5.0.3)
- * Checks if a default value is available - * @link http://php.net/manual/en/reflectionparameter.isdefaultvalueavailable.php - * @return bool TRUE if a default value is available, otherwise FALSE - */ - public function isDefaultValueAvailable () {} - - /** - * (PHP 5 >= 5.0.3)
- * Gets default parameter value - * @link http://php.net/manual/en/reflectionparameter.getdefaultvalue.php - * @return mixed The parameters default value. - */ - public function getDefaultValue () {} - - public function isDefaultValueConstant () {} - - public function getDefaultValueConstantName () {} - -} - -/** - * The ReflectionMethod class reports - * information about a method. - * @link http://php.net/manual/en/class.reflectionmethod.php - */ -class ReflectionMethod extends ReflectionFunctionAbstract implements Reflector { - const IS_STATIC = 1; - const IS_PUBLIC = 256; - const IS_PROTECTED = 512; - const IS_PRIVATE = 1024; - const IS_ABSTRACT = 2; - const IS_FINAL = 4; - - public $name; - public $class; - - - /** - * (PHP 5)
- * Export a reflection method. - * @link http://php.net/manual/en/reflectionmethod.export.php - * @param string $class

- * The class name. - *

- * @param string $name

- * The name of the method. - *

- * @param bool $return [optional]

- * Setting to TRUE will return the export, - * as opposed to emitting it. Setting to FALSE (the default) will do the opposite. - *

- * @return string If the return parameter - * is set to TRUE, then the export is returned as a string, - * otherwise NULL is returned. - */ - public static function export ($class, $name, $return = false) {} - - /** - * (PHP 5)
- * Constructs a ReflectionMethod - * @link http://php.net/manual/en/reflectionmethod.construct.php - * @param mixed $class

- * Classname or object (instance of the class) that contains the method. - *

- * @param string $name

- * Name of the method. - *

- */ - public function __construct ($class, $name) {} - - /** - * (PHP 5)
- * Returns the string representation of the Reflection method object. - * @link http://php.net/manual/en/reflectionmethod.tostring.php - * @return string A string representation of this ReflectionMethod instance. - */ - public function __toString () {} - - /** - * (PHP 5)
- * Checks if method is public - * @link http://php.net/manual/en/reflectionmethod.ispublic.php - * @return bool TRUE if the method is public, otherwise FALSE - */ - public function isPublic () {} - - /** - * (PHP 5)
- * Checks if method is private - * @link http://php.net/manual/en/reflectionmethod.isprivate.php - * @return bool TRUE if the method is private, otherwise FALSE - */ - public function isPrivate () {} - - /** - * (PHP 5)
- * Checks if method is protected - * @link http://php.net/manual/en/reflectionmethod.isprotected.php - * @return bool TRUE if the method is protected, otherwise FALSE - */ - public function isProtected () {} - - /** - * (PHP 5)
- * Checks if method is abstract - * @link http://php.net/manual/en/reflectionmethod.isabstract.php - * @return bool TRUE if the method is abstract, otherwise FALSE - */ - public function isAbstract () {} - - /** - * (PHP 5)
- * Checks if method is final - * @link http://php.net/manual/en/reflectionmethod.isfinal.php - * @return bool TRUE if the method is final, otherwise FALSE - */ - public function isFinal () {} - - /** - * (PHP 5)
- * Checks if method is static - * @link http://php.net/manual/en/reflectionmethod.isstatic.php - * @return bool TRUE if the method is static, otherwise FALSE - */ - public function isStatic () {} - - /** - * (PHP 5)
- * Checks if method is a constructor - * @link http://php.net/manual/en/reflectionmethod.isconstructor.php - * @return bool TRUE if the method is a constructor, otherwise FALSE - */ - public function isConstructor () {} - - /** - * (PHP 5)
- * Checks if method is a destructor - * @link http://php.net/manual/en/reflectionmethod.isdestructor.php - * @return bool TRUE if the method is a destructor, otherwise FALSE - */ - public function isDestructor () {} - - /** - * (PHP >= 5.4.0)
- * Returns a dynamically created closure for the method - * @link http://php.net/manual/en/reflectionmethod.getclosure.php - * @param string $object

- * Forbidden for static methods, required for other methods. - *

- * @return Closure Closure. - * Returns NULL in case of an error. - */ - public function getClosure ($object) {} - - /** - * (PHP 5)
- * Gets the method modifiers - * @link http://php.net/manual/en/reflectionmethod.getmodifiers.php - * @return int A numeric representation of the modifiers. The modifiers are listed below. - * The actual meanings of these modifiers are described in the - * predefined constants. - */ - public function getModifiers () {} - - /** - * (PHP 5)
- * Invoke - * @link http://php.net/manual/en/reflectionmethod.invoke.php - * @param object $object

- * The object to invoke the method on. For static methods, pass - * null to this parameter. - *

- * @param mixed $parameter [optional]

- * Zero or more parameters to be passed to the method. - * It accepts a variable number of parameters which are passed to the method. - *

- * @param mixed $_ [optional] - * @return mixed the method result. - */ - public function invoke ($object, $parameter = null, $_ = null) {} - - /** - * (PHP 5 >= 5.1.0)
- * Invoke args - * @link http://php.net/manual/en/reflectionmethod.invokeargs.php - * @param object $object

- * The object to invoke the method on. In case of static methods, you can pass - * null to this parameter. - *

- * @param array $args

- * The parameters to be passed to the function, as an array. - *

- * @return mixed the method result. - */ - public function invokeArgs ($object, array $args) {} - - /** - * (PHP 5)
- * Gets declaring class for the reflected method. - * @link http://php.net/manual/en/reflectionmethod.getdeclaringclass.php - * @return ReflectionClass A ReflectionClass object of the class that the - * reflected method is part of. - */ - public function getDeclaringClass () {} - - /** - * (PHP 5)
- * Gets the method prototype (if there is one). - * @link http://php.net/manual/en/reflectionmethod.getprototype.php - * @return ReflectionMethod A ReflectionMethod instance of the method prototype. - */ - public function getPrototype () {} - - /** - * (PHP 5 >= 5.3.2)
- * Set method accessibility - * @link http://php.net/manual/en/reflectionmethod.setaccessible.php - * @param bool $accessible

- * TRUE to allow accessibility, or FALSE. - *

- * @return void No value is returned. - */ - public function setAccessible ($accessible) {} - - /** - * (PHP 5)
- * Clones function - * @link http://php.net/manual/en/reflectionfunctionabstract.clone.php - * @return void - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.3.0)
- * Checks if function in namespace - * @link http://php.net/manual/en/reflectionfunctionabstract.innamespace.php - * @return bool TRUE if it's in a namespace, otherwise FALSE - */ - public function inNamespace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Checks if closure - * @link http://php.net/manual/en/reflectionfunctionabstract.isclosure.php - * @return bool TRUE if it's a closure, otherwise FALSE - */ - public function isClosure () {} - - /** - * (PHP 5)
- * Checks if deprecated - * @link http://php.net/manual/en/reflectionfunctionabstract.isdeprecated.php - * @return bool TRUE if it's deprecated, otherwise FALSE - */ - public function isDeprecated () {} - - /** - * (PHP 5)
- * Checks if is internal - * @link http://php.net/manual/en/reflectionfunctionabstract.isinternal.php - * @return bool TRUE if it's internal, otherwise FALSE - */ - public function isInternal () {} - - /** - * (PHP 5)
- * Checks if user defined - * @link http://php.net/manual/en/reflectionfunctionabstract.isuserdefined.php - * @return bool TRUE if it's user-defined, otherwise false; - */ - public function isUserDefined () {} - - /** - * (No version information available, might only be in SVN)
- * Returns this pointer bound to closure - * @link http://php.net/manual/en/reflectionfunctionabstract.getclosurethis.php - * @return object $this pointer. - * Returns NULL in case of an error. - */ - public function getClosureThis () {} - - public function getClosureScopeClass () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets doc comment - * @link http://php.net/manual/en/reflectionfunctionabstract.getdoccomment.php - * @return string The doc comment if it exists, otherwise FALSE - */ - public function getDocComment () {} - - /** - * (PHP 5)
- * Gets end line number - * @link http://php.net/manual/en/reflectionfunctionabstract.getendline.php - * @return int The ending line number of the user defined function, or FALSE if unknown. - */ - public function getEndLine () {} - - /** - * (PHP 5)
- * Gets extension info - * @link http://php.net/manual/en/reflectionfunctionabstract.getextension.php - * @return ReflectionExtension The extension information, as a ReflectionExtension object. - */ - public function getExtension () {} - - /** - * (PHP 5)
- * Gets extension name - * @link http://php.net/manual/en/reflectionfunctionabstract.getextensionname.php - * @return string The extensions name. - */ - public function getExtensionName () {} - - /** - * (PHP 5)
- * Gets file name - * @link http://php.net/manual/en/reflectionfunctionabstract.getfilename.php - * @return string The file name. - */ - public function getFileName () {} - - /** - * (PHP 5)
- * Gets function name - * @link http://php.net/manual/en/reflectionfunctionabstract.getname.php - * @return string The name of the function. - */ - public function getName () {} - - /** - * (PHP 5 >= 5.3.0)
- * Gets namespace name - * @link http://php.net/manual/en/reflectionfunctionabstract.getnamespacename.php - * @return string The namespace name. - */ - public function getNamespaceName () {} - - /** - * (PHP 5 >= 5.0.3)
- * Gets number of parameters - * @link http://php.net/manual/en/reflectionfunctionabstract.getnumberofparameters.php - * @return int The number of parameters. - */ - public function getNumberOfParameters () {} - - /** - * (PHP 5 >= 5.0.3)
- * Gets number of required parameters - * @link http://php.net/manual/en/reflectionfunctionabstract.getnumberofrequiredparameters.php - * @return int The number of required parameters. - */ - public function getNumberOfRequiredParameters () {} - - /** - * (PHP 5)
- * Gets parameters - * @link http://php.net/manual/en/reflectionfunctionabstract.getparameters.php - * @return array The parameters, as a ReflectionParameter object. - */ - public function getParameters () {} - - /** - * (PHP 5 >= 5.3.0)
- * Gets function short name - * @link http://php.net/manual/en/reflectionfunctionabstract.getshortname.php - * @return string The short name of the function. - */ - public function getShortName () {} - - /** - * (PHP 5)
- * Gets starting line number - * @link http://php.net/manual/en/reflectionfunctionabstract.getstartline.php - * @return int The starting line number. - */ - public function getStartLine () {} - - /** - * (PHP 5)
- * Gets static variables - * @link http://php.net/manual/en/reflectionfunctionabstract.getstaticvariables.php - * @return array An array of static variables. - */ - public function getStaticVariables () {} - - /** - * (PHP 5)
- * Checks if returns reference - * @link http://php.net/manual/en/reflectionfunctionabstract.returnsreference.php - * @return bool TRUE if it returns a reference, otherwise FALSE - */ - public function returnsReference () {} - -} - -/** - * The ReflectionClass class reports - * information about a class. - * @link http://php.net/manual/en/class.reflectionclass.php - */ -class ReflectionClass implements Reflector { - const IS_IMPLICIT_ABSTRACT = 16; - const IS_EXPLICIT_ABSTRACT = 32; - const IS_FINAL = 64; - - public $name; - - - final private function __clone () {} - - /** - * (PHP 5)
- * Exports a class - * @link http://php.net/manual/en/reflectionclass.export.php - * @param mixed $argument

- * The reflection to export. - *

- * @param bool $return [optional]

- * Setting to TRUE will return the export, - * as opposed to emitting it. Setting to FALSE (the default) will do the opposite. - *

- * @return string If the return parameter - * is set to TRUE, then the export is returned as a string, - * otherwise NULL is returned. - */ - public static function export ($argument, $return = false) {} - - /** - * (PHP 5)
- * Constructs a ReflectionClass - * @link http://php.net/manual/en/reflectionclass.construct.php - * @param mixed $argument

- * Either a string containing the name of the class to - * reflect, or an object. - *

- */ - public function __construct ($argument) {} - - /** - * (PHP 5)
- * Returns the string representation of the ReflectionClass object. - * @link http://php.net/manual/en/reflectionclass.tostring.php - * @return string A string representation of this ReflectionClass instance. - */ - public function __toString () {} - - /** - * (PHP 5)
- * Gets class name - * @link http://php.net/manual/en/reflectionclass.getname.php - * @return string The class name. - */ - public function getName () {} - - /** - * (PHP 5)
- * Checks if class is defined internally by an extension, or the core - * @link http://php.net/manual/en/reflectionclass.isinternal.php - * @return bool TRUE on success or FALSE on failure. - */ - public function isInternal () {} - - /** - * (PHP 5)
- * Checks if user defined - * @link http://php.net/manual/en/reflectionclass.isuserdefined.php - * @return bool TRUE on success or FALSE on failure. - */ - public function isUserDefined () {} - - /** - * (PHP 5)
- * Checks if the class is instantiable - * @link http://php.net/manual/en/reflectionclass.isinstantiable.php - * @return bool TRUE on success or FALSE on failure. - */ - public function isInstantiable () {} - - /** - * (PHP >= 5.4.0)
- * Returns whether this class is cloneable - * @link http://php.net/manual/en/reflectionclass.iscloneable.php - * @return bool TRUE if the class is cloneable, FALSE otherwise. - */ - public function isCloneable () {} - - /** - * (PHP 5)
- * Gets the filename of the file in which the class has been defined - * @link http://php.net/manual/en/reflectionclass.getfilename.php - * @return string the filename of the file in which the class has been defined. - * If the class is defined in the PHP core or in a PHP extension, FALSE - * is returned. - */ - public function getFileName () {} - - /** - * (PHP 5)
- * Gets starting line number - * @link http://php.net/manual/en/reflectionclass.getstartline.php - * @return int The starting line number, as an integer. - */ - public function getStartLine () {} - - /** - * (PHP 5)
- * Gets end line - * @link http://php.net/manual/en/reflectionclass.getendline.php - * @return int The ending line number of the user defined class, or FALSE if unknown. - */ - public function getEndLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets doc comments - * @link http://php.net/manual/en/reflectionclass.getdoccomment.php - * @return string The doc comment if it exists, otherwise FALSE - */ - public function getDocComment () {} - - /** - * (PHP 5)
- * Gets the constructor of the class - * @link http://php.net/manual/en/reflectionclass.getconstructor.php - * @return ReflectionMethod A ReflectionMethod object reflecting the class' constructor, or NULL if the class - * has no constructor. - */ - public function getConstructor () {} - - /** - * (PHP 5 >= 5.1.0)
- * Checks if method is defined - * @link http://php.net/manual/en/reflectionclass.hasmethod.php - * @param string $name

- * Name of the method being checked for. - *

- * @return bool TRUE if it has the method, otherwise FALSE - */ - public function hasMethod ($name) {} - - /** - * (PHP 5)
- * Gets a ReflectionMethod for a class method. - * @link http://php.net/manual/en/reflectionclass.getmethod.php - * @param string $name

- * The method name to reflect. - *

- * @return ReflectionMethod A ReflectionMethod. - */ - public function getMethod ($name) {} - - /** - * (PHP 5)
- * Gets an array of methods - * @link http://php.net/manual/en/reflectionclass.getmethods.php - * @param string $filter [optional]

- * Filter the results to include only methods with certain attributes. Defaults - * to no filtering. - *

- *

- * Any combination of ReflectionMethod::IS_STATIC, - * ReflectionMethod::IS_PUBLIC, - * ReflectionMethod::IS_PROTECTED, - * ReflectionMethod::IS_PRIVATE, - * ReflectionMethod::IS_ABSTRACT, - * ReflectionMethod::IS_FINAL. - *

- * @return array An array of ReflectionMethod objects - * reflecting each method. - */ - public function getMethods ($filter = null) {} - - /** - * (PHP 5 >= 5.1.0)
- * Checks if property is defined - * @link http://php.net/manual/en/reflectionclass.hasproperty.php - * @param string $name

- * Name of the property being checked for. - *

- * @return bool TRUE if it has the property, otherwise FALSE - */ - public function hasProperty ($name) {} - - /** - * (PHP 5)
- * Gets a ReflectionProperty for a class's property - * @link http://php.net/manual/en/reflectionclass.getproperty.php - * @param string $name

- * The property name. - *

- * @return ReflectionProperty A ReflectionProperty. - */ - public function getProperty ($name) {} - - /** - * (PHP 5)
- * Gets properties - * @link http://php.net/manual/en/reflectionclass.getproperties.php - * @param int $filter [optional]

- * The optional filter, for filtering desired property types. It's configured using - * the ReflectionProperty constants, - * and defaults to all property types. - *

- * @return array An array of ReflectionProperty objects. - */ - public function getProperties ($filter = null) {} - - /** - * (PHP 5 >= 5.1.0)
- * Checks if constant is defined - * @link http://php.net/manual/en/reflectionclass.hasconstant.php - * @param string $name

- * The name of the constant being checked for. - *

- * @return bool TRUE if the constant is defined, otherwise FALSE. - */ - public function hasConstant ($name) {} - - /** - * (PHP 5)
- * Gets constants - * @link http://php.net/manual/en/reflectionclass.getconstants.php - * @return array An array of constants. - * Constant name in key, constant value in value. - */ - public function getConstants () {} - - /** - * (PHP 5)
- * Gets defined constant - * @link http://php.net/manual/en/reflectionclass.getconstant.php - * @param string $name

- * Name of the constant. - *

- * @return mixed Value of the constant. - */ - public function getConstant ($name) {} - - /** - * (PHP 5)
- * Gets the interfaces - * @link http://php.net/manual/en/reflectionclass.getinterfaces.php - * @return array An associative array of interfaces, with keys as interface - * names and the array values as ReflectionClass objects. - */ - public function getInterfaces () {} - - /** - * (PHP 5 >= 5.2.0)
- * Gets the interface names - * @link http://php.net/manual/en/reflectionclass.getinterfacenames.php - * @return array A numerical array with interface names as the values. - */ - public function getInterfaceNames () {} - - /** - * (PHP 5)
- * Checks if the class is an interface - * @link http://php.net/manual/en/reflectionclass.isinterface.php - * @return bool TRUE on success or FALSE on failure. - */ - public function isInterface () {} - - /** - * (PHP >= 5.4.0)
- * Returns an array of traits used by this class - * @link http://php.net/manual/en/reflectionclass.gettraits.php - * @return array an array with trait names in keys and instances of trait's - * ReflectionClass in values. - * Returns NULL in case of an error. - */ - public function getTraits () {} - - /** - * (PHP >= 5.4.0)
- * Returns an array of names of traits used by this class - * @link http://php.net/manual/en/reflectionclass.gettraitnames.php - * @return array an array with trait names in values. - * Returns NULL in case of an error. - */ - public function getTraitNames () {} - - /** - * (PHP >= 5.4.0)
- * Returns an array of trait aliases - * @link http://php.net/manual/en/reflectionclass.gettraitaliases.php - * @return array an array with new method names in keys and original names (in the - * format "TraitName::original") in values. - * Returns NULL in case of an error. - */ - public function getTraitAliases () {} - - /** - * (PHP >= 5.4.0)
- * Returns whether this is a trait - * @link http://php.net/manual/en/reflectionclass.istrait.php - * @return bool TRUE if this is a trait, FALSE otherwise. - * Returns NULL in case of an error. - */ - public function isTrait () {} - - /** - * (PHP 5)
- * Checks if class is abstract - * @link http://php.net/manual/en/reflectionclass.isabstract.php - * @return bool TRUE on success or FALSE on failure. - */ - public function isAbstract () {} - - /** - * (PHP 5)
- * Checks if class is final - * @link http://php.net/manual/en/reflectionclass.isfinal.php - * @return bool TRUE on success or FALSE on failure. - */ - public function isFinal () {} - - /** - * (PHP 5)
- * Gets modifiers - * @link http://php.net/manual/en/reflectionclass.getmodifiers.php - * @return int bitmask of - * modifier constants. - */ - public function getModifiers () {} - - /** - * (PHP 5)
- * Checks class for instance - * @link http://php.net/manual/en/reflectionclass.isinstance.php - * @param object $object

- * The object being compared to. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isInstance ($object) {} - - /** - * (PHP 5)
- * Creates a new class instance from given arguments. - * @link http://php.net/manual/en/reflectionclass.newinstance.php - * @param mixed $args

- * Accepts a variable number of arguments which are passed to the class - * constructor, much like call_user_func. - *

- * @param mixed $_ [optional] - * @return object - */ - public function newInstance ($args, $_ = null) {} - - /** - * (PHP >= 5.4.0)
- * Creates a new class instance without invoking the constructor. - * @link http://php.net/manual/en/reflectionclass.newinstancewithoutconstructor.php - * @return object - */ - public function newInstanceWithoutConstructor () {} - - /** - * (PHP 5 >= 5.1.3)
- * Creates a new class instance from given arguments. - * @link http://php.net/manual/en/reflectionclass.newinstanceargs.php - * @param array $args [optional]

- * The parameters to be passed to the class constructor as an array. - *

- * @return object a new instance of the class. - */ - public function newInstanceArgs (array $args = null) {} - - /** - * (PHP 5)
- * Gets parent class - * @link http://php.net/manual/en/reflectionclass.getparentclass.php - * @return object A ReflectionClass. - */ - public function getParentClass () {} - - /** - * (PHP 5)
- * Checks if a subclass - * @link http://php.net/manual/en/reflectionclass.issubclassof.php - * @param string $class

- * The class name being checked against. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSubclassOf ($class) {} - - /** - * (PHP 5)
- * Gets static properties - * @link http://php.net/manual/en/reflectionclass.getstaticproperties.php - * @return array The static properties, as an array. - */ - public function getStaticProperties () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets static property value - * @link http://php.net/manual/en/reflectionclass.getstaticpropertyvalue.php - * @param string $name

- * The name of the static property for which to return a value. - *

- * @return mixed The value of the static property. - */ - public function getStaticPropertyValue ($name) {} - - /** - * (PHP 5 >= 5.1.0)
- * Sets static property value - * @link http://php.net/manual/en/reflectionclass.setstaticpropertyvalue.php - * @param string $name

- * Property name. - *

- * @param string $value

- * New property value. - *

- * @return void No value is returned. - */ - public function setStaticPropertyValue ($name, $value) {} - - /** - * (PHP 5)
- * Gets default properties - * @link http://php.net/manual/en/reflectionclass.getdefaultproperties.php - * @return array An array of default properties, with the key being the name of - * the property and the value being the default value of the property or NULL - * if the property doesn't have a default value. The function does not distinguish - * between static and non static properties and does not take visibility modifiers - * into account. - */ - public function getDefaultProperties () {} - - /** - * (PHP 5)
- * Checks if iterateable - * @link http://php.net/manual/en/reflectionclass.isiterateable.php - * @return bool TRUE on success or FALSE on failure. - */ - public function isIterateable () {} - - /** - * (PHP 5)
- * Implements interface - * @link http://php.net/manual/en/reflectionclass.implementsinterface.php - * @param string $interface

- * The interface name. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function implementsInterface ($interface) {} - - /** - * (PHP 5)
- * Gets a ReflectionExtension object for the extension which defined the class - * @link http://php.net/manual/en/reflectionclass.getextension.php - * @return ReflectionExtension A ReflectionExtension object representing the extension which defined the class, - * or NULL for user-defined classes. - */ - public function getExtension () {} - - /** - * (PHP 5)
- * Gets the name of the extension which defined the class - * @link http://php.net/manual/en/reflectionclass.getextensionname.php - * @return string The name of the extension which defined the class, or FALSE for user-defined classes. - */ - public function getExtensionName () {} - - /** - * (PHP 5 >= 5.3.0)
- * Checks if in namespace - * @link http://php.net/manual/en/reflectionclass.innamespace.php - * @return bool TRUE on success or FALSE on failure. - */ - public function inNamespace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Gets namespace name - * @link http://php.net/manual/en/reflectionclass.getnamespacename.php - * @return string The namespace name. - */ - public function getNamespaceName () {} - - /** - * (PHP 5 >= 5.3.0)
- * Gets short name - * @link http://php.net/manual/en/reflectionclass.getshortname.php - * @return string The class short name. - */ - public function getShortName () {} - -} - -/** - * The ReflectionObject class reports - * information about an object. - * @link http://php.net/manual/en/class.reflectionobject.php - */ -class ReflectionObject extends ReflectionClass implements Reflector { - const IS_IMPLICIT_ABSTRACT = 16; - const IS_EXPLICIT_ABSTRACT = 32; - const IS_FINAL = 64; - - public $name; - - - /** - * (PHP 5)
- * Export - * @link http://php.net/manual/en/reflectionobject.export.php - * @param string $argument

- * The reflection to export. - *

- * @param bool $return [optional]

- * Setting to TRUE will return the export, - * as opposed to emitting it. Setting to FALSE (the default) will do the opposite. - *

- * @return string If the return parameter - * is set to TRUE, then the export is returned as a string, - * otherwise NULL is returned. - */ - public static function export ($argument, $return = null) {} - - /** - * (PHP 5)
- * Constructs a ReflectionObject - * @link http://php.net/manual/en/reflectionobject.construct.php - * @param object $argument

- * An object instance. - *

- */ - public function __construct ($argument) {} - - final private function __clone () {} - - /** - * (PHP 5)
- * Returns the string representation of the ReflectionClass object. - * @link http://php.net/manual/en/reflectionclass.tostring.php - * @return string A string representation of this ReflectionClass instance. - */ - public function __toString () {} - - /** - * (PHP 5)
- * Gets class name - * @link http://php.net/manual/en/reflectionclass.getname.php - * @return string The class name. - */ - public function getName () {} - - /** - * (PHP 5)
- * Checks if class is defined internally by an extension, or the core - * @link http://php.net/manual/en/reflectionclass.isinternal.php - * @return bool TRUE on success or FALSE on failure. - */ - public function isInternal () {} - - /** - * (PHP 5)
- * Checks if user defined - * @link http://php.net/manual/en/reflectionclass.isuserdefined.php - * @return bool TRUE on success or FALSE on failure. - */ - public function isUserDefined () {} - - /** - * (PHP 5)
- * Checks if the class is instantiable - * @link http://php.net/manual/en/reflectionclass.isinstantiable.php - * @return bool TRUE on success or FALSE on failure. - */ - public function isInstantiable () {} - - /** - * (PHP >= 5.4.0)
- * Returns whether this class is cloneable - * @link http://php.net/manual/en/reflectionclass.iscloneable.php - * @return bool TRUE if the class is cloneable, FALSE otherwise. - */ - public function isCloneable () {} - - /** - * (PHP 5)
- * Gets the filename of the file in which the class has been defined - * @link http://php.net/manual/en/reflectionclass.getfilename.php - * @return string the filename of the file in which the class has been defined. - * If the class is defined in the PHP core or in a PHP extension, FALSE - * is returned. - */ - public function getFileName () {} - - /** - * (PHP 5)
- * Gets starting line number - * @link http://php.net/manual/en/reflectionclass.getstartline.php - * @return int The starting line number, as an integer. - */ - public function getStartLine () {} - - /** - * (PHP 5)
- * Gets end line - * @link http://php.net/manual/en/reflectionclass.getendline.php - * @return int The ending line number of the user defined class, or FALSE if unknown. - */ - public function getEndLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets doc comments - * @link http://php.net/manual/en/reflectionclass.getdoccomment.php - * @return string The doc comment if it exists, otherwise FALSE - */ - public function getDocComment () {} - - /** - * (PHP 5)
- * Gets the constructor of the class - * @link http://php.net/manual/en/reflectionclass.getconstructor.php - * @return ReflectionMethod A ReflectionMethod object reflecting the class' constructor, or NULL if the class - * has no constructor. - */ - public function getConstructor () {} - - /** - * (PHP 5 >= 5.1.0)
- * Checks if method is defined - * @link http://php.net/manual/en/reflectionclass.hasmethod.php - * @param string $name

- * Name of the method being checked for. - *

- * @return bool TRUE if it has the method, otherwise FALSE - */ - public function hasMethod ($name) {} - - /** - * (PHP 5)
- * Gets a ReflectionMethod for a class method. - * @link http://php.net/manual/en/reflectionclass.getmethod.php - * @param string $name

- * The method name to reflect. - *

- * @return ReflectionMethod A ReflectionMethod. - */ - public function getMethod ($name) {} - - /** - * (PHP 5)
- * Gets an array of methods - * @link http://php.net/manual/en/reflectionclass.getmethods.php - * @param string $filter [optional]

- * Filter the results to include only methods with certain attributes. Defaults - * to no filtering. - *

- *

- * Any combination of ReflectionMethod::IS_STATIC, - * ReflectionMethod::IS_PUBLIC, - * ReflectionMethod::IS_PROTECTED, - * ReflectionMethod::IS_PRIVATE, - * ReflectionMethod::IS_ABSTRACT, - * ReflectionMethod::IS_FINAL. - *

- * @return array An array of ReflectionMethod objects - * reflecting each method. - */ - public function getMethods ($filter = null) {} - - /** - * (PHP 5 >= 5.1.0)
- * Checks if property is defined - * @link http://php.net/manual/en/reflectionclass.hasproperty.php - * @param string $name

- * Name of the property being checked for. - *

- * @return bool TRUE if it has the property, otherwise FALSE - */ - public function hasProperty ($name) {} - - /** - * (PHP 5)
- * Gets a ReflectionProperty for a class's property - * @link http://php.net/manual/en/reflectionclass.getproperty.php - * @param string $name

- * The property name. - *

- * @return ReflectionProperty A ReflectionProperty. - */ - public function getProperty ($name) {} - - /** - * (PHP 5)
- * Gets properties - * @link http://php.net/manual/en/reflectionclass.getproperties.php - * @param int $filter [optional]

- * The optional filter, for filtering desired property types. It's configured using - * the ReflectionProperty constants, - * and defaults to all property types. - *

- * @return array An array of ReflectionProperty objects. - */ - public function getProperties ($filter = null) {} - - /** - * (PHP 5 >= 5.1.0)
- * Checks if constant is defined - * @link http://php.net/manual/en/reflectionclass.hasconstant.php - * @param string $name

- * The name of the constant being checked for. - *

- * @return bool TRUE if the constant is defined, otherwise FALSE. - */ - public function hasConstant ($name) {} - - /** - * (PHP 5)
- * Gets constants - * @link http://php.net/manual/en/reflectionclass.getconstants.php - * @return array An array of constants. - * Constant name in key, constant value in value. - */ - public function getConstants () {} - - /** - * (PHP 5)
- * Gets defined constant - * @link http://php.net/manual/en/reflectionclass.getconstant.php - * @param string $name

- * Name of the constant. - *

- * @return mixed Value of the constant. - */ - public function getConstant ($name) {} - - /** - * (PHP 5)
- * Gets the interfaces - * @link http://php.net/manual/en/reflectionclass.getinterfaces.php - * @return array An associative array of interfaces, with keys as interface - * names and the array values as ReflectionClass objects. - */ - public function getInterfaces () {} - - /** - * (PHP 5 >= 5.2.0)
- * Gets the interface names - * @link http://php.net/manual/en/reflectionclass.getinterfacenames.php - * @return array A numerical array with interface names as the values. - */ - public function getInterfaceNames () {} - - /** - * (PHP 5)
- * Checks if the class is an interface - * @link http://php.net/manual/en/reflectionclass.isinterface.php - * @return bool TRUE on success or FALSE on failure. - */ - public function isInterface () {} - - /** - * (PHP >= 5.4.0)
- * Returns an array of traits used by this class - * @link http://php.net/manual/en/reflectionclass.gettraits.php - * @return array an array with trait names in keys and instances of trait's - * ReflectionClass in values. - * Returns NULL in case of an error. - */ - public function getTraits () {} - - /** - * (PHP >= 5.4.0)
- * Returns an array of names of traits used by this class - * @link http://php.net/manual/en/reflectionclass.gettraitnames.php - * @return array an array with trait names in values. - * Returns NULL in case of an error. - */ - public function getTraitNames () {} - - /** - * (PHP >= 5.4.0)
- * Returns an array of trait aliases - * @link http://php.net/manual/en/reflectionclass.gettraitaliases.php - * @return array an array with new method names in keys and original names (in the - * format "TraitName::original") in values. - * Returns NULL in case of an error. - */ - public function getTraitAliases () {} - - /** - * (PHP >= 5.4.0)
- * Returns whether this is a trait - * @link http://php.net/manual/en/reflectionclass.istrait.php - * @return bool TRUE if this is a trait, FALSE otherwise. - * Returns NULL in case of an error. - */ - public function isTrait () {} - - /** - * (PHP 5)
- * Checks if class is abstract - * @link http://php.net/manual/en/reflectionclass.isabstract.php - * @return bool TRUE on success or FALSE on failure. - */ - public function isAbstract () {} - - /** - * (PHP 5)
- * Checks if class is final - * @link http://php.net/manual/en/reflectionclass.isfinal.php - * @return bool TRUE on success or FALSE on failure. - */ - public function isFinal () {} - - /** - * (PHP 5)
- * Gets modifiers - * @link http://php.net/manual/en/reflectionclass.getmodifiers.php - * @return int bitmask of - * modifier constants. - */ - public function getModifiers () {} - - /** - * (PHP 5)
- * Checks class for instance - * @link http://php.net/manual/en/reflectionclass.isinstance.php - * @param object $object

- * The object being compared to. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isInstance ($object) {} - - /** - * (PHP 5)
- * Creates a new class instance from given arguments. - * @link http://php.net/manual/en/reflectionclass.newinstance.php - * @param mixed $args

- * Accepts a variable number of arguments which are passed to the class - * constructor, much like call_user_func. - *

- * @param mixed $_ [optional] - * @return object - */ - public function newInstance ($args, $_ = null) {} - - /** - * (PHP >= 5.4.0)
- * Creates a new class instance without invoking the constructor. - * @link http://php.net/manual/en/reflectionclass.newinstancewithoutconstructor.php - * @return object - */ - public function newInstanceWithoutConstructor () {} - - /** - * (PHP 5 >= 5.1.3)
- * Creates a new class instance from given arguments. - * @link http://php.net/manual/en/reflectionclass.newinstanceargs.php - * @param array $args [optional]

- * The parameters to be passed to the class constructor as an array. - *

- * @return object a new instance of the class. - */ - public function newInstanceArgs (array $args = null) {} - - /** - * (PHP 5)
- * Gets parent class - * @link http://php.net/manual/en/reflectionclass.getparentclass.php - * @return object A ReflectionClass. - */ - public function getParentClass () {} - - /** - * (PHP 5)
- * Checks if a subclass - * @link http://php.net/manual/en/reflectionclass.issubclassof.php - * @param string $class

- * The class name being checked against. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSubclassOf ($class) {} - - /** - * (PHP 5)
- * Gets static properties - * @link http://php.net/manual/en/reflectionclass.getstaticproperties.php - * @return array The static properties, as an array. - */ - public function getStaticProperties () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets static property value - * @link http://php.net/manual/en/reflectionclass.getstaticpropertyvalue.php - * @param string $name

- * The name of the static property for which to return a value. - *

- * @return mixed The value of the static property. - */ - public function getStaticPropertyValue ($name) {} - - /** - * (PHP 5 >= 5.1.0)
- * Sets static property value - * @link http://php.net/manual/en/reflectionclass.setstaticpropertyvalue.php - * @param string $name

- * Property name. - *

- * @param string $value

- * New property value. - *

- * @return void No value is returned. - */ - public function setStaticPropertyValue ($name, $value) {} - - /** - * (PHP 5)
- * Gets default properties - * @link http://php.net/manual/en/reflectionclass.getdefaultproperties.php - * @return array An array of default properties, with the key being the name of - * the property and the value being the default value of the property or NULL - * if the property doesn't have a default value. The function does not distinguish - * between static and non static properties and does not take visibility modifiers - * into account. - */ - public function getDefaultProperties () {} - - /** - * (PHP 5)
- * Checks if iterateable - * @link http://php.net/manual/en/reflectionclass.isiterateable.php - * @return bool TRUE on success or FALSE on failure. - */ - public function isIterateable () {} - - /** - * (PHP 5)
- * Implements interface - * @link http://php.net/manual/en/reflectionclass.implementsinterface.php - * @param string $interface

- * The interface name. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function implementsInterface ($interface) {} - - /** - * (PHP 5)
- * Gets a ReflectionExtension object for the extension which defined the class - * @link http://php.net/manual/en/reflectionclass.getextension.php - * @return ReflectionExtension A ReflectionExtension object representing the extension which defined the class, - * or NULL for user-defined classes. - */ - public function getExtension () {} - - /** - * (PHP 5)
- * Gets the name of the extension which defined the class - * @link http://php.net/manual/en/reflectionclass.getextensionname.php - * @return string The name of the extension which defined the class, or FALSE for user-defined classes. - */ - public function getExtensionName () {} - - /** - * (PHP 5 >= 5.3.0)
- * Checks if in namespace - * @link http://php.net/manual/en/reflectionclass.innamespace.php - * @return bool TRUE on success or FALSE on failure. - */ - public function inNamespace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Gets namespace name - * @link http://php.net/manual/en/reflectionclass.getnamespacename.php - * @return string The namespace name. - */ - public function getNamespaceName () {} - - /** - * (PHP 5 >= 5.3.0)
- * Gets short name - * @link http://php.net/manual/en/reflectionclass.getshortname.php - * @return string The class short name. - */ - public function getShortName () {} - -} - -/** - * The ReflectionProperty class reports - * information about classes properties. - * @link http://php.net/manual/en/class.reflectionproperty.php - */ -class ReflectionProperty implements Reflector { - const IS_STATIC = 1; - const IS_PUBLIC = 256; - const IS_PROTECTED = 512; - const IS_PRIVATE = 1024; - - public $name; - public $class; - - - /** - * (PHP 5)
- * Clone - * @link http://php.net/manual/en/reflectionproperty.clone.php - * @return void - */ - final private function __clone () {} - - /** - * (PHP 5)
- * Export - * @link http://php.net/manual/en/reflectionproperty.export.php - * @param mixed $class - * @param string $name

- * The property name. - *

- * @param bool $return [optional]

- * Setting to TRUE will return the export, - * as opposed to emitting it. Setting to FALSE (the default) will do the opposite. - *

- * @return string - */ - public static function export ($class, $name, $return = null) {} - - /** - * (PHP 5)
- * Construct a ReflectionProperty object - * @link http://php.net/manual/en/reflectionproperty.construct.php - * @param mixed $class

- * The class name, that contains the property. - *

- * @param string $name

- * The name of the property being reflected. - *

- */ - public function __construct ($class, $name) {} - - /** - * (PHP 5)
- * To string - * @link http://php.net/manual/en/reflectionproperty.tostring.php - * @return string - */ - public function __toString () {} - - /** - * (PHP 5)
- * Gets property name - * @link http://php.net/manual/en/reflectionproperty.getname.php - * @return string The name of the reflected property. - */ - public function getName () {} - - /** - * (PHP 5)
- * Gets value - * @link http://php.net/manual/en/reflectionproperty.getvalue.php - * @param object $object

- * If the property is non-static an object must be provided to fetch the - * property from. If you want to fetch the default property without - * providing an object use ReflectionClass::getDefaultProperties - * instead. - *

- * @return mixed The current value of the property. - */ - public function getValue ($object) {} - - /** - * (PHP 5)
- * Set property value - * @link http://php.net/manual/en/reflectionproperty.setvalue.php - * @param object $object

- * If the property is non-static an object must be provided to change - * the property on. If the property is static this parameter is left - * out and only value needs to be provided. - *

- * @param mixed $value

- * The new value. - *

- * @return void No value is returned. - */ - public function setValue ($object, $value) {} - - /** - * (PHP 5)
- * Checks if property is public - * @link http://php.net/manual/en/reflectionproperty.ispublic.php - * @return bool TRUE if the property is public, FALSE otherwise. - */ - public function isPublic () {} - - /** - * (PHP 5)
- * Checks if property is private - * @link http://php.net/manual/en/reflectionproperty.isprivate.php - * @return bool TRUE if the property is private, FALSE otherwise. - */ - public function isPrivate () {} - - /** - * (PHP 5)
- * Checks if property is protected - * @link http://php.net/manual/en/reflectionproperty.isprotected.php - * @return bool TRUE if the property is protected, FALSE otherwise. - */ - public function isProtected () {} - - /** - * (PHP 5)
- * Checks if property is static - * @link http://php.net/manual/en/reflectionproperty.isstatic.php - * @return bool TRUE if the property is static, FALSE otherwise. - */ - public function isStatic () {} - - /** - * (PHP 5)
- * Checks if default value - * @link http://php.net/manual/en/reflectionproperty.isdefault.php - * @return bool TRUE if the property was declared at compile-time, or FALSE if - * it was created at run-time. - */ - public function isDefault () {} - - /** - * (PHP 5)
- * Gets modifiers - * @link http://php.net/manual/en/reflectionproperty.getmodifiers.php - * @return int A numeric representation of the modifiers. - */ - public function getModifiers () {} - - /** - * (PHP 5)
- * Gets declaring class - * @link http://php.net/manual/en/reflectionproperty.getdeclaringclass.php - * @return ReflectionClass A ReflectionClass object. - */ - public function getDeclaringClass () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets doc comment - * @link http://php.net/manual/en/reflectionproperty.getdoccomment.php - * @return string The doc comment. - */ - public function getDocComment () {} - - /** - * (PHP 5 >= 5.3.0)
- * Set property accessibility - * @link http://php.net/manual/en/reflectionproperty.setaccessible.php - * @param bool $accessible

- * TRUE to allow accessibility, or FALSE. - *

- * @return void No value is returned. - */ - public function setAccessible ($accessible) {} - -} - -/** - * The ReflectionExtension class reports - * information about an extension. - * @link http://php.net/manual/en/class.reflectionextension.php - */ -class ReflectionExtension implements Reflector { - public $name; - - - /** - * (PHP 5)
- * Clones - * @link http://php.net/manual/en/reflectionextension.clone.php - * @return void No value is returned, if called a fatal error will occur. - */ - final private function __clone () {} - - /** - * (PHP 5)
- * Export - * @link http://php.net/manual/en/reflectionextension.export.php - * @param string $name

- * The reflection to export. - *

- * @param string $return [optional]

- * Setting to TRUE will return the export, - * as opposed to emitting it. Setting to FALSE (the default) will do the opposite. - *

- * @return string If the return parameter - * is set to TRUE, then the export is returned as a string, - * otherwise NULL is returned. - */ - public static function export ($name, $return = false) {} - - /** - * (PHP 5)
- * Constructs a ReflectionExtension - * @link http://php.net/manual/en/reflectionextension.construct.php - * @param string $name

- * Name of the extension. - *

- */ - public function __construct ($name) {} - - /** - * (PHP 5)
- * To string - * @link http://php.net/manual/en/reflectionextension.tostring.php - * @return string the exported extension as a string, in the same way as the - * ReflectionExtension::export. - */ - public function __toString () {} - - /** - * (PHP 5)
- * Gets extension name - * @link http://php.net/manual/en/reflectionextension.getname.php - * @return string The extensions name. - */ - public function getName () {} - - /** - * (PHP 5)
- * Gets extension version - * @link http://php.net/manual/en/reflectionextension.getversion.php - * @return string The version of the extension. - */ - public function getVersion () {} - - /** - * (PHP 5)
- * Gets extension functions - * @link http://php.net/manual/en/reflectionextension.getfunctions.php - * @return array An associative array of ReflectionFunction objects, - * for each function defined in the extension with the keys being the function - * names. If no function are defined, an empty array is returned. - */ - public function getFunctions () {} - - /** - * (PHP 5)
- * Gets constants - * @link http://php.net/manual/en/reflectionextension.getconstants.php - * @return array An associative array with constant names as keys. - */ - public function getConstants () {} - - /** - * (PHP 5)
- * Gets extension ini entries - * @link http://php.net/manual/en/reflectionextension.getinientries.php - * @return array An associative array with the ini entries as keys, - * with their defined values as values. - */ - public function getINIEntries () {} - - /** - * (PHP 5)
- * Gets classes - * @link http://php.net/manual/en/reflectionextension.getclasses.php - * @return array An array of ReflectionClass objects, one - * for each class within the extension. If no classes are defined, - * an empty array is returned. - */ - public function getClasses () {} - - /** - * (PHP 5)
- * Gets class names - * @link http://php.net/manual/en/reflectionextension.getclassnames.php - * @return array An array of class names, as defined in the extension. - * If no classes are defined, an empty array is returned. - */ - public function getClassNames () {} - - /** - * (PHP 5)
- * Gets dependencies - * @link http://php.net/manual/en/reflectionextension.getdependencies.php - * @return array An associative array with dependencies as keys and - * either Required, Optional - * or Conflicts as the values. - */ - public function getDependencies () {} - - /** - * (PHP 5)
- * Print extension info - * @link http://php.net/manual/en/reflectionextension.info.php - * @return void Information about the extension. - */ - public function info () {} - - /** - * (PHP >= 5.4.0)
- * Returns whether this extension is persistent - * @link http://php.net/manual/en/reflectionextension.ispersistent.php - * @return void TRUE for extensions loaded by extension, FALSE - * otherwise. - */ - public function isPersistent () {} - - /** - * (PHP >= 5.4.0)
- * Returns whether this extension is temporary - * @link http://php.net/manual/en/reflectionextension.istemporary.php - * @return void TRUE for extensions loaded by dl, - * FALSE otherwise. - */ - public function isTemporary () {} - -} - -/** - * @link http://php.net/manual/en/class.reflectionzendextension.php - */ -class ReflectionZendExtension implements Reflector { - public $name; - - - /** - * (PHP >= 5.4.0)
- * Clone handler - * @link http://php.net/manual/en/reflectionzendextension.clone.php - * @return void - */ - final private function __clone () {} - - /** - * (PHP >= 5.4.0)
- * Export - * @link http://php.net/manual/en/reflectionzendextension.export.php - * @param string $name

- *

- * @param string $return [optional]

- *

- * @return string - */ - public static function export ($name, $return = null) {} - - /** - * (PHP >= 5.4.0)
- * Constructor - * @link http://php.net/manual/en/reflectionzendextension.construct.php - * @param string $name

- *

- */ - public function __construct ($name) {} - - /** - * (PHP >= 5.4.0)
- * To string handler - * @link http://php.net/manual/en/reflectionzendextension.tostring.php - * @return string - */ - public function __toString () {} - - /** - * (PHP >= 5.4.0)
- * Gets name - * @link http://php.net/manual/en/reflectionzendextension.getname.php - * @return string - */ - public function getName () {} - - /** - * (PHP >= 5.4.0)
- * Gets version - * @link http://php.net/manual/en/reflectionzendextension.getversion.php - * @return string - */ - public function getVersion () {} - - /** - * (PHP >= 5.4.0)
- * Gets author - * @link http://php.net/manual/en/reflectionzendextension.getauthor.php - * @return string - */ - public function getAuthor () {} - - /** - * (PHP >= 5.4.0)
- * Gets URL - * @link http://php.net/manual/en/reflectionzendextension.geturl.php - * @return string - */ - public function getURL () {} - - /** - * (PHP >= 5.4.0)
- * Gets copyright - * @link http://php.net/manual/en/reflectionzendextension.getcopyright.php - * @return string - */ - public function getCopyright () {} - -} -// End of Reflection v.$Id: bcdcdaeea3aba34a8083bb62c6eda69ff3c3eab5 $ -?> diff --git a/phpruntime/SPL.php b/phpruntime/SPL.php deleted file mode 100644 index ab47cb7..0000000 --- a/phpruntime/SPL.php +++ /dev/null @@ -1,9322 +0,0 @@ - - * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * Exception thrown if a callback refers to an undefined function or if some - * arguments are missing. - * @link http://php.net/manual/en/class.badfunctioncallexception.php - */ -class BadFunctionCallException extends LogicException { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * Exception thrown if a callback refers to an undefined method or if some - * arguments are missing. - * @link http://php.net/manual/en/class.badmethodcallexception.php - */ -class BadMethodCallException extends BadFunctionCallException { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * Exception thrown if a value does not adhere to a defined valid data domain. - * @link http://php.net/manual/en/class.domainexception.php - */ -class DomainException extends LogicException { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * Exception thrown if an argument does not match with the expected value. - * @link http://php.net/manual/en/class.invalidargumentexception.php - */ -class InvalidArgumentException extends LogicException { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * Exception thrown if a length is invalid. - * @link http://php.net/manual/en/class.lengthexception.php - */ -class LengthException extends LogicException { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * Exception thrown when an illegal index was requested. This represents - * errors that should be detected at compile time. - * @link http://php.net/manual/en/class.outofrangeexception.php - */ -class OutOfRangeException extends LogicException { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * Exception thrown if an error which can only be found on runtime occurs. - * @link http://php.net/manual/en/class.runtimeexception.php - */ -class RuntimeException extends Exception { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * Exception thrown if a value is not a valid key. This represents errors - * that cannot be detected at compile time. - * @link http://php.net/manual/en/class.outofboundsexception.php - */ -class OutOfBoundsException extends RuntimeException { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * Exception thrown when adding an element to a full container. - * @link http://php.net/manual/en/class.overflowexception.php - */ -class OverflowException extends RuntimeException { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * Exception thrown to indicate range errors during program execution. - * Normally this means there was an arithmetic error other than - * under/overflow. This is the runtime version of - * DomainException. - * @link http://php.net/manual/en/class.rangeexception.php - */ -class RangeException extends RuntimeException { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * Exception thrown when performing an invalid operation on an empty - * container, such as removing an element. - * @link http://php.net/manual/en/class.underflowexception.php - */ -class UnderflowException extends RuntimeException { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * Exception thrown if a value does not match with a set of values. Typically - * this happens when a function calls another function and expects the return - * value to be of a certain type or value not including arithmetic or buffer - * related errors. - * @link http://php.net/manual/en/class.unexpectedvalueexception.php - */ -class UnexpectedValueException extends RuntimeException { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * Classes implementing RecursiveIterator can be used to iterate - * over iterators recursively. - * @link http://php.net/manual/en/class.recursiveiterator.php - */ -interface RecursiveIterator extends Iterator, Traversable { - - /** - * (PHP 5 >= 5.1.0)
- * Returns if an iterator can be created fot the current entry. - * @link http://php.net/manual/en/recursiveiterator.haschildren.php - * @return bool TRUE if the current entry can be iterated over, otherwise returns FALSE. - */ - abstract public function hasChildren (); - - /** - * (PHP 5 >= 5.1.0)
- * Returns an iterator for the current entry. - * @link http://php.net/manual/en/recursiveiterator.getchildren.php - * @return RecursiveIterator An iterator for the current entry. - */ - abstract public function getChildren (); - - /** - * (PHP 5 >= 5.0.0)
- * Return the current element - * @link http://php.net/manual/en/iterator.current.php - * @return mixed Can return any type. - */ - abstract public function current (); - - /** - * (PHP 5 >= 5.0.0)
- * Move forward to next element - * @link http://php.net/manual/en/iterator.next.php - * @return void Any returned value is ignored. - */ - abstract public function next (); - - /** - * (PHP 5 >= 5.0.0)
- * Return the key of the current element - * @link http://php.net/manual/en/iterator.key.php - * @return scalar scalar on success, or NULL on failure. - */ - abstract public function key (); - - /** - * (PHP 5 >= 5.0.0)
- * Checks if current position is valid - * @link http://php.net/manual/en/iterator.valid.php - * @return boolean The return value will be casted to boolean and then evaluated. - * Returns TRUE on success or FALSE on failure. - */ - abstract public function valid (); - - /** - * (PHP 5 >= 5.0.0)
- * Rewind the Iterator to the first element - * @link http://php.net/manual/en/iterator.rewind.php - * @return void Any returned value is ignored. - */ - abstract public function rewind (); - -} - -/** - * Can be used to iterate through recursive iterators. - * @link http://php.net/manual/en/class.recursiveiteratoriterator.php - */ -class RecursiveIteratorIterator implements Iterator, Traversable, OuterIterator { - const LEAVES_ONLY = 0; - const SELF_FIRST = 1; - const CHILD_FIRST = 2; - const CATCH_GET_CHILD = 16; - - - /** - * (PHP 5 >= 5.1.3)
- * Construct a RecursiveIteratorIterator - * @link http://php.net/manual/en/recursiveiteratoriterator.construct.php - * @param Traversable $iterator

- * The iterator being constructed from. Either a - * RecursiveIterator or IteratorAggregate. - *

- * @param int $mode [optional]

- * Optional mode. Possible values are - * RecursiveIteratorIterator::LEAVES_ONLY - * - The default. Lists only leaves in iteration. - * RecursiveIteratorIterator::SELF_FIRST - * - Lists leaves and parents in iteration with parents coming first. - * RecursiveIteratorIterator::CHILD_FIRST - * - Lists leaves and parents in iteration with leaves coming first. - *

- * @param int $flags [optional]

- * Optional flag. Possible values are RecursiveIteratorIterator::CATCH_GET_CHILD - * which will then ignore exceptions thrown in calls to RecursiveIteratorIterator::getChildren. - *

- */ - public function __construct (Traversable $iterator, $mode = 'RecursiveIteratorIterator::LEAVES_ONLY', $flags = 0) {} - - /** - * (PHP 5)
- * Rewind the iterator to the first element of the top level inner iterator - * @link http://php.net/manual/en/recursiveiteratoriterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5)
- * Check whether the current position is valid - * @link http://php.net/manual/en/recursiveiteratoriterator.valid.php - * @return bool TRUE if the current position is valid, otherwise FALSE - */ - public function valid () {} - - /** - * (PHP 5)
- * Access the current key - * @link http://php.net/manual/en/recursiveiteratoriterator.key.php - * @return mixed The current key. - */ - public function key () {} - - /** - * (PHP 5)
- * Access the current element value - * @link http://php.net/manual/en/recursiveiteratoriterator.current.php - * @return mixed The current elements value. - */ - public function current () {} - - /** - * (PHP 5)
- * Move forward to the next element - * @link http://php.net/manual/en/recursiveiteratoriterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5)
- * Get the current depth of the recursive iteration - * @link http://php.net/manual/en/recursiveiteratoriterator.getdepth.php - * @return int The current depth of the recursive iteration. - */ - public function getDepth () {} - - /** - * (PHP 5)
- * The current active sub iterator - * @link http://php.net/manual/en/recursiveiteratoriterator.getsubiterator.php - * @param $level [optional] - * @return RecursiveIterator The current active sub iterator. - */ - public function getSubIterator ($level) {} - - /** - * (PHP 5 >= 5.1.0)
- * Get inner iterator - * @link http://php.net/manual/en/recursiveiteratoriterator.getinneriterator.php - * @return iterator The current active sub iterator. - */ - public function getInnerIterator () {} - - /** - * (PHP 5 >= 5.1.0)
- * Begin Iteration - * @link http://php.net/manual/en/recursiveiteratoriterator.beginiteration.php - * @return void No value is returned. - */ - public function beginIteration () {} - - /** - * (PHP 5 >= 5.1.0)
- * End Iteration - * @link http://php.net/manual/en/recursiveiteratoriterator.enditeration.php - * @return void No value is returned. - */ - public function endIteration () {} - - /** - * (PHP 5 >= 5.1.0)
- * Has children - * @link http://php.net/manual/en/recursiveiteratoriterator.callhaschildren.php - * @return bool TRUE if the element has children, otherwise FALSE - */ - public function callHasChildren () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get children - * @link http://php.net/manual/en/recursiveiteratoriterator.callgetchildren.php - * @return RecursiveIterator A RecursiveIterator. - */ - public function callGetChildren () {} - - /** - * (PHP 5 >= 5.1.0)
- * Begin children - * @link http://php.net/manual/en/recursiveiteratoriterator.beginchildren.php - * @return void No value is returned. - */ - public function beginChildren () {} - - /** - * (PHP 5 >= 5.1.0)
- * End children - * @link http://php.net/manual/en/recursiveiteratoriterator.endchildren.php - * @return void No value is returned. - */ - public function endChildren () {} - - /** - * (PHP 5 >= 5.1.0)
- * Next element - * @link http://php.net/manual/en/recursiveiteratoriterator.nextelement.php - * @return void No value is returned. - */ - public function nextElement () {} - - /** - * (PHP 5 >= 5.1.0)
- * Set max depth - * @link http://php.net/manual/en/recursiveiteratoriterator.setmaxdepth.php - * @param string $max_depth [optional]

- * The maximum allowed depth. -1 is used - * for any depth. - *

- * @return void No value is returned. - */ - public function setMaxDepth ($max_depth = -1) {} - - /** - * (PHP 5 >= 5.1.0)
- * Get max depth - * @link http://php.net/manual/en/recursiveiteratoriterator.getmaxdepth.php - * @return mixed The maximum accepted depth, or FALSE if any depth is allowed. - */ - public function getMaxDepth () {} - -} - -/** - * Classes implementing OuterIterator can be used to iterate - * over iterators. - * @link http://php.net/manual/en/class.outeriterator.php - */ -interface OuterIterator extends Iterator, Traversable { - - /** - * (PHP 5 >= 5.1.0)
- * Returns the inner iterator for the current entry. - * @link http://php.net/manual/en/outeriterator.getinneriterator.php - * @return Iterator The inner iterator for the current entry. - */ - abstract public function getInnerIterator (); - - /** - * (PHP 5 >= 5.0.0)
- * Return the current element - * @link http://php.net/manual/en/iterator.current.php - * @return mixed Can return any type. - */ - abstract public function current (); - - /** - * (PHP 5 >= 5.0.0)
- * Move forward to next element - * @link http://php.net/manual/en/iterator.next.php - * @return void Any returned value is ignored. - */ - abstract public function next (); - - /** - * (PHP 5 >= 5.0.0)
- * Return the key of the current element - * @link http://php.net/manual/en/iterator.key.php - * @return scalar scalar on success, or NULL on failure. - */ - abstract public function key (); - - /** - * (PHP 5 >= 5.0.0)
- * Checks if current position is valid - * @link http://php.net/manual/en/iterator.valid.php - * @return boolean The return value will be casted to boolean and then evaluated. - * Returns TRUE on success or FALSE on failure. - */ - abstract public function valid (); - - /** - * (PHP 5 >= 5.0.0)
- * Rewind the Iterator to the first element - * @link http://php.net/manual/en/iterator.rewind.php - * @return void Any returned value is ignored. - */ - abstract public function rewind (); - -} - -/** - * This iterator wrapper allows the conversion of anything that is - * Traversable into an Iterator. - * It is important to understand that most classes that do not implement - * Iterators have reasons as most likely they do not allow the full - * Iterator feature set. If so, techniques should be provided to prevent - * misuse, otherwise expect exceptions or fatal errors. - * @link http://php.net/manual/en/class.iteratoriterator.php - */ -class IteratorIterator implements Iterator, Traversable, OuterIterator { - - /** - * (PHP 5 >= 5.1.0)
- * Create an iterator from anything that is traversable - * @link http://php.net/manual/en/iteratoriterator.construct.php - * @param Traversable $iterator

- * The traversable iterator. - *

- */ - public function __construct (Traversable $iterator) {} - - /** - * (PHP 5 >= 5.1.0)
- * Rewind to the first element - * @link http://php.net/manual/en/iteratoriterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.1.0)
- * Checks if the iterator is valid - * @link http://php.net/manual/en/iteratoriterator.valid.php - * @return bool TRUE if the iterator is valid, otherwise FALSE - */ - public function valid () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the key of the current element - * @link http://php.net/manual/en/iteratoriterator.key.php - * @return scalar The key of the current element. - */ - public function key () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the current value - * @link http://php.net/manual/en/iteratoriterator.current.php - * @return mixed The value of the current element. - */ - public function current () {} - - /** - * (PHP 5 >= 5.1.0)
- * Forward to the next element - * @link http://php.net/manual/en/iteratoriterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the inner iterator - * @link http://php.net/manual/en/iteratoriterator.getinneriterator.php - * @return Traversable The inner iterator as passed to IteratorIterator::__construct. - */ - public function getInnerIterator () {} - -} - -/** - * This abstract iterator filters out unwanted values. This class should be extended to - * implement custom iterator filters. The FilterIterator::accept - * must be implemented in the subclass. - * @link http://php.net/manual/en/class.filteriterator.php - */ -class FilterIterator extends IteratorIterator implements OuterIterator, Traversable, Iterator { - - /** - * (PHP 5 >= 5.1.0)
- * Construct a filterIterator - * @link http://php.net/manual/en/filteriterator.construct.php - * @param Iterator $iterator

- * The iterator that is being filtered. - *

- */ - public function __construct (Iterator $iterator) {} - - /** - * (PHP 5 >= 5.1.0)
- * Rewind the iterator - * @link http://php.net/manual/en/filteriterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.1.0)
- * Check whether the current element is valid - * @link http://php.net/manual/en/filteriterator.valid.php - * @return bool TRUE if the current element is valid, otherwise FALSE - */ - public function valid () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the current key - * @link http://php.net/manual/en/filteriterator.key.php - * @return mixed The current key. - */ - public function key () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the current element value - * @link http://php.net/manual/en/filteriterator.current.php - * @return mixed The current element value. - */ - public function current () {} - - /** - * (PHP 5 >= 5.1.0)
- * Move the iterator forward - * @link http://php.net/manual/en/filteriterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the inner iterator - * @link http://php.net/manual/en/filteriterator.getinneriterator.php - * @return Iterator The inner iterator. - */ - public function getInnerIterator () {} - - /** - * (PHP 5 >= 5.1.0)
- * Check whether the current element of the iterator is acceptable - * @link http://php.net/manual/en/filteriterator.accept.php - * @return bool TRUE if the current element is acceptable, otherwise FALSE. - */ - abstract public function accept (); - -} - -/** - * This abstract iterator filters out unwanted values for a RecursiveIterator. - * This class should be extended to implement custom filters. - * The RecursiveFilterIterator::accept must be implemented in the subclass. - * @link http://php.net/manual/en/class.recursivefilteriterator.php - */ -class RecursiveFilterIterator extends FilterIterator implements Iterator, Traversable, OuterIterator, RecursiveIterator { - - /** - * (PHP 5 >= 5.1.0)
- * Create a RecursiveFilterIterator from a RecursiveIterator - * @link http://php.net/manual/en/recursivefilteriterator.construct.php - * @param RecursiveIterator $iterator

- * The RecursiveIterator to be filtered. - *

- */ - public function __construct (RecursiveIterator $iterator) {} - - /** - * (PHP 5 >= 5.1.0)
- * Check whether the inner iterator's current element has children - * @link http://php.net/manual/en/recursivefilteriterator.haschildren.php - * @return void TRUE if the inner iterator has children, otherwise FALSE - */ - public function hasChildren () {} - - /** - * (PHP 5 >= 5.1.0)
- * Return the inner iterator's children contained in a RecursiveFilterIterator - * @link http://php.net/manual/en/recursivefilteriterator.getchildren.php - * @return void a RecursiveFilterIterator containing the inner iterator's children. - */ - public function getChildren () {} - - /** - * (PHP 5 >= 5.1.0)
- * Rewind the iterator - * @link http://php.net/manual/en/filteriterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.1.0)
- * Check whether the current element is valid - * @link http://php.net/manual/en/filteriterator.valid.php - * @return bool TRUE if the current element is valid, otherwise FALSE - */ - public function valid () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the current key - * @link http://php.net/manual/en/filteriterator.key.php - * @return mixed The current key. - */ - public function key () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the current element value - * @link http://php.net/manual/en/filteriterator.current.php - * @return mixed The current element value. - */ - public function current () {} - - /** - * (PHP 5 >= 5.1.0)
- * Move the iterator forward - * @link http://php.net/manual/en/filteriterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the inner iterator - * @link http://php.net/manual/en/filteriterator.getinneriterator.php - * @return Iterator The inner iterator. - */ - public function getInnerIterator () {} - - /** - * (PHP 5 >= 5.1.0)
- * Check whether the current element of the iterator is acceptable - * @link http://php.net/manual/en/filteriterator.accept.php - * @return bool TRUE if the current element is acceptable, otherwise FALSE. - */ - abstract public function accept (); - -} - -/** - * @link http://php.net/manual/en/class.callbackfilteriterator.php - */ -class CallbackFilterIterator extends FilterIterator implements Iterator, Traversable, OuterIterator { - - /** - * (PHP 5 >= 5.4.0)
- * Create a filtered iterator from another iterator - * @link http://php.net/manual/en/callbackfilteriterator.construct.php - * @param Iterator $iterator - * @param $callback - */ - public function __construct (Iterator $iterator, $callback) {} - - /** - * (PHP 5 >= 5.4.0)
- * Calls the callback with the current value, the current key and the inner iterator as arguments - * @link http://php.net/manual/en/callbackfilteriterator.accept.php - * @return string TRUE to accept the current item, or FALSE otherwise. - */ - public function accept () {} - - /** - * (PHP 5 >= 5.1.0)
- * Rewind the iterator - * @link http://php.net/manual/en/filteriterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.1.0)
- * Check whether the current element is valid - * @link http://php.net/manual/en/filteriterator.valid.php - * @return bool TRUE if the current element is valid, otherwise FALSE - */ - public function valid () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the current key - * @link http://php.net/manual/en/filteriterator.key.php - * @return mixed The current key. - */ - public function key () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the current element value - * @link http://php.net/manual/en/filteriterator.current.php - * @return mixed The current element value. - */ - public function current () {} - - /** - * (PHP 5 >= 5.1.0)
- * Move the iterator forward - * @link http://php.net/manual/en/filteriterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the inner iterator - * @link http://php.net/manual/en/filteriterator.getinneriterator.php - * @return Iterator The inner iterator. - */ - public function getInnerIterator () {} - -} - -/** - * @link http://php.net/manual/en/class.recursivecallbackfilteriterator.php - */ -class RecursiveCallbackFilterIterator extends CallbackFilterIterator implements OuterIterator, Traversable, Iterator, RecursiveIterator { - - /** - * (PHP 5 >= 5.4.0)
- * Create a RecursiveCallbackFilterIterator from a RecursiveIterator - * @link http://php.net/manual/en/recursivecallbackfilteriterator.construct.php - * @param RecursiveIterator $iterator - * @param $callback - */ - public function __construct (RecursiveIterator $iterator, $callback) {} - - /** - * (PHP 5 >= 5.4.0)
- * Check whether the inner iterator's current element has children - * @link http://php.net/manual/en/recursivecallbackfilteriterator.haschildren.php - * @return void TRUE if the current element has children, FALSE otherwise. - */ - public function hasChildren () {} - - /** - * (PHP 5 >= 5.4.0)
- * Return the inner iterator's children contained in a RecursiveCallbackFilterIterator - * @link http://php.net/manual/en/recursivecallbackfilteriterator.getchildren.php - * @return RecursiveCallbackFilterIterator a RecursiveCallbackFilterIterator containing - * the children. - */ - public function getChildren () {} - - /** - * (PHP 5 >= 5.4.0)
- * Calls the callback with the current value, the current key and the inner iterator as arguments - * @link http://php.net/manual/en/callbackfilteriterator.accept.php - * @return string TRUE to accept the current item, or FALSE otherwise. - */ - public function accept () {} - - /** - * (PHP 5 >= 5.1.0)
- * Rewind the iterator - * @link http://php.net/manual/en/filteriterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.1.0)
- * Check whether the current element is valid - * @link http://php.net/manual/en/filteriterator.valid.php - * @return bool TRUE if the current element is valid, otherwise FALSE - */ - public function valid () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the current key - * @link http://php.net/manual/en/filteriterator.key.php - * @return mixed The current key. - */ - public function key () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the current element value - * @link http://php.net/manual/en/filteriterator.current.php - * @return mixed The current element value. - */ - public function current () {} - - /** - * (PHP 5 >= 5.1.0)
- * Move the iterator forward - * @link http://php.net/manual/en/filteriterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the inner iterator - * @link http://php.net/manual/en/filteriterator.getinneriterator.php - * @return Iterator The inner iterator. - */ - public function getInnerIterator () {} - -} - -/** - * This extended FilterIterator allows a recursive - * iteration using RecursiveIteratorIterator that only - * shows those elements which have children. - * @link http://php.net/manual/en/class.parentiterator.php - */ -class ParentIterator extends RecursiveFilterIterator implements RecursiveIterator, OuterIterator, Traversable, Iterator { - - /** - * (PHP 5 >= 5.1.0)
- * Constructs a ParentIterator - * @link http://php.net/manual/en/parentiterator.construct.php - * @param RecursiveIterator $iterator

- * The iterator being constructed upon. - *

- */ - public function __construct (RecursiveIterator $iterator) {} - - /** - * (PHP 5 >= 5.1.0)
- * Determines acceptability - * @link http://php.net/manual/en/parentiterator.accept.php - * @return bool TRUE if the current element is acceptable, otherwise FALSE. - */ - public function accept () {} - - /** - * (PHP 5 >= 5.1.0)
- * Check whether the inner iterator's current element has children - * @link http://php.net/manual/en/recursivefilteriterator.haschildren.php - * @return void TRUE if the inner iterator has children, otherwise FALSE - */ - public function hasChildren () {} - - /** - * (PHP 5 >= 5.1.0)
- * Return the inner iterator's children contained in a RecursiveFilterIterator - * @link http://php.net/manual/en/recursivefilteriterator.getchildren.php - * @return void a RecursiveFilterIterator containing the inner iterator's children. - */ - public function getChildren () {} - - /** - * (PHP 5 >= 5.1.0)
- * Rewind the iterator - * @link http://php.net/manual/en/filteriterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.1.0)
- * Check whether the current element is valid - * @link http://php.net/manual/en/filteriterator.valid.php - * @return bool TRUE if the current element is valid, otherwise FALSE - */ - public function valid () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the current key - * @link http://php.net/manual/en/filteriterator.key.php - * @return mixed The current key. - */ - public function key () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the current element value - * @link http://php.net/manual/en/filteriterator.current.php - * @return mixed The current element value. - */ - public function current () {} - - /** - * (PHP 5 >= 5.1.0)
- * Move the iterator forward - * @link http://php.net/manual/en/filteriterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the inner iterator - * @link http://php.net/manual/en/filteriterator.getinneriterator.php - * @return Iterator The inner iterator. - */ - public function getInnerIterator () {} - -} - -/** - * Classes implementing Countable can be used with the - * count function. - * @link http://php.net/manual/en/class.countable.php - */ -interface Countable { - - /** - * (PHP 5 >= 5.1.0)
- * Count elements of an object - * @link http://php.net/manual/en/countable.count.php - * @return int The custom count as an integer. - *

- *

- * The return value is cast to an integer. - */ - abstract public function count (); - -} - -/** - * The Seekable iterator. - * @link http://php.net/manual/en/class.seekableiterator.php - */ -interface SeekableIterator extends Iterator, Traversable { - - /** - * (PHP 5 >= 5.1.0)
- * Seeks to a position - * @link http://php.net/manual/en/seekableiterator.seek.php - * @param int $position

- * The position to seek to. - *

- * @return void No value is returned. - */ - abstract public function seek ($position); - - /** - * (PHP 5 >= 5.0.0)
- * Return the current element - * @link http://php.net/manual/en/iterator.current.php - * @return mixed Can return any type. - */ - abstract public function current (); - - /** - * (PHP 5 >= 5.0.0)
- * Move forward to next element - * @link http://php.net/manual/en/iterator.next.php - * @return void Any returned value is ignored. - */ - abstract public function next (); - - /** - * (PHP 5 >= 5.0.0)
- * Return the key of the current element - * @link http://php.net/manual/en/iterator.key.php - * @return scalar scalar on success, or NULL on failure. - */ - abstract public function key (); - - /** - * (PHP 5 >= 5.0.0)
- * Checks if current position is valid - * @link http://php.net/manual/en/iterator.valid.php - * @return boolean The return value will be casted to boolean and then evaluated. - * Returns TRUE on success or FALSE on failure. - */ - abstract public function valid (); - - /** - * (PHP 5 >= 5.0.0)
- * Rewind the Iterator to the first element - * @link http://php.net/manual/en/iterator.rewind.php - * @return void Any returned value is ignored. - */ - abstract public function rewind (); - -} - -/** - * The LimitIterator class allows iteration over - * a limited subset of items in an Iterator. - * @link http://php.net/manual/en/class.limititerator.php - */ -class LimitIterator extends IteratorIterator implements OuterIterator, Traversable, Iterator { - - /** - * (PHP 5 >= 5.1.0)
- * Construct a LimitIterator - * @link http://php.net/manual/en/limititerator.construct.php - * @param Iterator $iterator

- * The Iterator to limit. - *

- * @param int $offset [optional]

- * Optional offset of the limit. - *

- * @param int $count [optional]

- * Optional count of the limit. - *

- */ - public function __construct (Iterator $iterator, $offset = 0, $count = -1) {} - - /** - * (PHP 5 >= 5.1.0)
- * Rewind the iterator to the specified starting offset - * @link http://php.net/manual/en/limititerator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.1.0)
- * Check whether the current element is valid - * @link http://php.net/manual/en/limititerator.valid.php - * @return bool TRUE on success or FALSE on failure. - */ - public function valid () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get current key - * @link http://php.net/manual/en/limititerator.key.php - * @return mixed the key for the current item. - */ - public function key () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get current element - * @link http://php.net/manual/en/limititerator.current.php - * @return mixed the current element or NULL if there is none. - */ - public function current () {} - - /** - * (PHP 5 >= 5.1.0)
- * Move the iterator forward - * @link http://php.net/manual/en/limititerator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.1.0)
- * Seek to the given position - * @link http://php.net/manual/en/limititerator.seek.php - * @param int $position

- * The position to seek to. - *

- * @return int the offset position after seeking. - */ - public function seek ($position) {} - - /** - * (PHP 5 >= 5.1.0)
- * Return the current position - * @link http://php.net/manual/en/limititerator.getposition.php - * @return int The current position. - */ - public function getPosition () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get inner iterator - * @link http://php.net/manual/en/limititerator.getinneriterator.php - * @return Iterator The inner iterator passed to LimitIterator::__construct. - */ - public function getInnerIterator () {} - -} - -/** - * This object supports cached iteration over another iterator. - * @link http://php.net/manual/en/class.cachingiterator.php - */ -class CachingIterator extends IteratorIterator implements OuterIterator, Traversable, Iterator, ArrayAccess, Countable { - const CALL_TOSTRING = 1; - const CATCH_GET_CHILD = 16; - const TOSTRING_USE_KEY = 2; - const TOSTRING_USE_CURRENT = 4; - const TOSTRING_USE_INNER = 8; - const FULL_CACHE = 256; - - - /** - * (PHP 5)
- * Construct a new CachingIterator object for the iterator. - * @link http://php.net/manual/en/cachingiterator.construct.php - * @param Iterator $iterator

- * Iterator to cache - *

- * @param string $flags [optional]

- * Bitmask of flags. - *

- */ - public function __construct (Iterator $iterator, $flags = 'self::CALL_TOSTRING') {} - - /** - * (PHP 5)
- * Rewind the iterator - * @link http://php.net/manual/en/cachingiterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5)
- * Check whether the current element is valid - * @link http://php.net/manual/en/cachingiterator.valid.php - * @return void TRUE on success or FALSE on failure. - */ - public function valid () {} - - /** - * (PHP 5)
- * Return the key for the current element - * @link http://php.net/manual/en/cachingiterator.key.php - * @return scalar - */ - public function key () {} - - /** - * (PHP 5)
- * Return the current element - * @link http://php.net/manual/en/cachingiterator.current.php - * @return void Mixed - */ - public function current () {} - - /** - * (PHP 5)
- * Move the iterator forward - * @link http://php.net/manual/en/cachingiterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5)
- * Check whether the inner iterator has a valid next element - * @link http://php.net/manual/en/cachingiterator.hasnext.php - * @return void TRUE on success or FALSE on failure. - */ - public function hasNext () {} - - /** - * (PHP 5)
- * Return the string representation of the current element - * @link http://php.net/manual/en/cachingiterator.tostring.php - * @return void The string representation of the current element. - */ - public function __toString () {} - - /** - * (PHP 5)
- * Returns the inner iterator - * @link http://php.net/manual/en/cachingiterator.getinneriterator.php - * @return Iterator an object implementing the Iterator interface. - */ - public function getInnerIterator () {} - - /** - * (PHP 5 >= 5.2.0)
- * Get flags used - * @link http://php.net/manual/en/cachingiterator.getflags.php - * @return void Description... - */ - public function getFlags () {} - - /** - * (PHP 5 >= 5.2.0)
- * The setFlags purpose - * @link http://php.net/manual/en/cachingiterator.setflags.php - * @param bitmask $flags

- * Bitmask of the flags to set. - *

- * @return void No value is returned. - */ - public function setFlags ($flags) {} - - /** - * (PHP 5 >= 5.2.0)
- * The offsetGet purpose - * @link http://php.net/manual/en/cachingiterator.offsetget.php - * @param string $index

- * Description... - *

- * @return void Description... - */ - public function offsetGet ($index) {} - - /** - * (PHP 5 >= 5.2.0)
- * The offsetSet purpose - * @link http://php.net/manual/en/cachingiterator.offsetset.php - * @param string $index

- * The index of the element to be set. - *

- * @param string $newval

- * The new value for the index. - *

- * @return void No value is returned. - */ - public function offsetSet ($index, $newval) {} - - /** - * (PHP 5 >= 5.2.0)
- * The offsetUnset purpose - * @link http://php.net/manual/en/cachingiterator.offsetunset.php - * @param string $index

- * The index of the element to be unset. - *

- * @return void No value is returned. - */ - public function offsetUnset ($index) {} - - /** - * (PHP 5 >= 5.2.0)
- * The offsetExists purpose - * @link http://php.net/manual/en/cachingiterator.offsetexists.php - * @param string $index

- * The index being checked. - *

- * @return void TRUE if an entry referenced by the offset exists, FALSE otherwise. - */ - public function offsetExists ($index) {} - - /** - * (PHP 5 >= 5.2.0)
- * The getCache purpose - * @link http://php.net/manual/en/cachingiterator.getcache.php - * @return void Description... - */ - public function getCache () {} - - /** - * (PHP 5 >= 5.2.2)
- * The number of elements in the iterator - * @link http://php.net/manual/en/cachingiterator.count.php - * @return int The count of the elements iterated over. - */ - public function count () {} - -} - -/** - * ... - * @link http://php.net/manual/en/class.recursivecachingiterator.php - */ -class RecursiveCachingIterator extends CachingIterator implements Countable, ArrayAccess, Iterator, Traversable, OuterIterator, RecursiveIterator { - const CALL_TOSTRING = 1; - const CATCH_GET_CHILD = 16; - const TOSTRING_USE_KEY = 2; - const TOSTRING_USE_CURRENT = 4; - const TOSTRING_USE_INNER = 8; - const FULL_CACHE = 256; - - - /** - * (PHP 5 >= 5.1.0)
- * Construct - * @link http://php.net/manual/en/recursivecachingiterator.construct.php - * @param Iterator $iterator

- * The iterator being used. - *

- * @param string $flags [optional]

- * The flags. Use CALL_TOSTRING to call - * RecursiveCachingIterator::__toString for every element (the default), - * and/or CATCH_GET_CHILD to catch exceptions when trying to get children. - *

- */ - public function __construct (Iterator $iterator, $flags = 'self::CALL_TOSTRING') {} - - /** - * (PHP 5 >= 5.1.0)
- * Check whether the current element of the inner iterator has children - * @link http://php.net/manual/en/recursivecachingiterator.haschildren.php - * @return bool TRUE if the inner iterator has children, otherwise FALSE - */ - public function hasChildren () {} - - /** - * (PHP 5 >= 5.1.0)
- * Return the inner iterator's children as a RecursiveCachingIterator - * @link http://php.net/manual/en/recursivecachingiterator.getchildren.php - * @return RecursiveCachingIterator The inner iterator's children, as a RecursiveCachingIterator. - */ - public function getChildren () {} - - /** - * (PHP 5)
- * Rewind the iterator - * @link http://php.net/manual/en/cachingiterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5)
- * Check whether the current element is valid - * @link http://php.net/manual/en/cachingiterator.valid.php - * @return void TRUE on success or FALSE on failure. - */ - public function valid () {} - - /** - * (PHP 5)
- * Return the key for the current element - * @link http://php.net/manual/en/cachingiterator.key.php - * @return scalar - */ - public function key () {} - - /** - * (PHP 5)
- * Return the current element - * @link http://php.net/manual/en/cachingiterator.current.php - * @return void Mixed - */ - public function current () {} - - /** - * (PHP 5)
- * Move the iterator forward - * @link http://php.net/manual/en/cachingiterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5)
- * Check whether the inner iterator has a valid next element - * @link http://php.net/manual/en/cachingiterator.hasnext.php - * @return void TRUE on success or FALSE on failure. - */ - public function hasNext () {} - - /** - * (PHP 5)
- * Return the string representation of the current element - * @link http://php.net/manual/en/cachingiterator.tostring.php - * @return void The string representation of the current element. - */ - public function __toString () {} - - /** - * (PHP 5)
- * Returns the inner iterator - * @link http://php.net/manual/en/cachingiterator.getinneriterator.php - * @return Iterator an object implementing the Iterator interface. - */ - public function getInnerIterator () {} - - /** - * (PHP 5 >= 5.2.0)
- * Get flags used - * @link http://php.net/manual/en/cachingiterator.getflags.php - * @return void Description... - */ - public function getFlags () {} - - /** - * (PHP 5 >= 5.2.0)
- * The setFlags purpose - * @link http://php.net/manual/en/cachingiterator.setflags.php - * @param bitmask $flags

- * Bitmask of the flags to set. - *

- * @return void No value is returned. - */ - public function setFlags ($flags) {} - - /** - * (PHP 5 >= 5.2.0)
- * The offsetGet purpose - * @link http://php.net/manual/en/cachingiterator.offsetget.php - * @param string $index

- * Description... - *

- * @return void Description... - */ - public function offsetGet ($index) {} - - /** - * (PHP 5 >= 5.2.0)
- * The offsetSet purpose - * @link http://php.net/manual/en/cachingiterator.offsetset.php - * @param string $index

- * The index of the element to be set. - *

- * @param string $newval

- * The new value for the index. - *

- * @return void No value is returned. - */ - public function offsetSet ($index, $newval) {} - - /** - * (PHP 5 >= 5.2.0)
- * The offsetUnset purpose - * @link http://php.net/manual/en/cachingiterator.offsetunset.php - * @param string $index

- * The index of the element to be unset. - *

- * @return void No value is returned. - */ - public function offsetUnset ($index) {} - - /** - * (PHP 5 >= 5.2.0)
- * The offsetExists purpose - * @link http://php.net/manual/en/cachingiterator.offsetexists.php - * @param string $index

- * The index being checked. - *

- * @return void TRUE if an entry referenced by the offset exists, FALSE otherwise. - */ - public function offsetExists ($index) {} - - /** - * (PHP 5 >= 5.2.0)
- * The getCache purpose - * @link http://php.net/manual/en/cachingiterator.getcache.php - * @return void Description... - */ - public function getCache () {} - - /** - * (PHP 5 >= 5.2.2)
- * The number of elements in the iterator - * @link http://php.net/manual/en/cachingiterator.count.php - * @return int The count of the elements iterated over. - */ - public function count () {} - -} - -/** - * This iterator cannot be rewound. - * @link http://php.net/manual/en/class.norewinditerator.php - */ -class NoRewindIterator extends IteratorIterator implements OuterIterator, Traversable, Iterator { - - /** - * (PHP 5 >= 5.1.0)
- * Construct a NoRewindIterator - * @link http://php.net/manual/en/norewinditerator.construct.php - * @param Iterator $iterator

- * The iterator being used. - *

- */ - public function __construct (Iterator $iterator) {} - - /** - * (PHP 5 >= 5.1.0)
- * Prevents the rewind operation on the inner iterator. - * @link http://php.net/manual/en/norewinditerator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.1.0)
- * Validates the iterator - * @link http://php.net/manual/en/norewinditerator.valid.php - * @return bool TRUE on success or FALSE on failure. - */ - public function valid () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the current key - * @link http://php.net/manual/en/norewinditerator.key.php - * @return mixed The current key. - */ - public function key () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the current value - * @link http://php.net/manual/en/norewinditerator.current.php - * @return mixed The current value. - */ - public function current () {} - - /** - * (PHP 5 >= 5.1.0)
- * Forward to the next element - * @link http://php.net/manual/en/norewinditerator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the inner iterator - * @link http://php.net/manual/en/norewinditerator.getinneriterator.php - * @return iterator The inner iterator, as passed to NoRewindIterator::__construct. - */ - public function getInnerIterator () {} - -} - -/** - * An Iterator that iterates over several iterators one after the other. - * @link http://php.net/manual/en/class.appenditerator.php - */ -class AppendIterator extends IteratorIterator implements OuterIterator, Traversable, Iterator { - - /** - * (PHP 5 >= 5.1.0)
- * Constructs an AppendIterator - * @link http://php.net/manual/en/appenditerator.construct.php - */ - public function __construct () {} - - /** - * (PHP 5 >= 5.1.0)
- * Appends an iterator - * @link http://php.net/manual/en/appenditerator.append.php - * @param Iterator $iterator

- * The iterator to append. - *

- * @return void No value is returned. - */ - public function append (Iterator $iterator) {} - - /** - * (PHP 5 >= 5.1.0)
- * Rewinds the Iterator - * @link http://php.net/manual/en/appenditerator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.1.0)
- * Checks validity of the current element - * @link http://php.net/manual/en/appenditerator.valid.php - * @return bool TRUE if the current iteration is valid, FALSE otherwise. - */ - public function valid () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the current key - * @link http://php.net/manual/en/appenditerator.key.php - * @return scalar The current key if it is valid or NULL otherwise. - */ - public function key () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the current value - * @link http://php.net/manual/en/appenditerator.current.php - * @return mixed The current value if it is valid or NULL otherwise. - */ - public function current () {} - - /** - * (PHP 5 >= 5.1.0)
- * Moves to the next element - * @link http://php.net/manual/en/appenditerator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the inner iterator - * @link http://php.net/manual/en/appenditerator.getinneriterator.php - * @return Iterator The current inner iterator, or NULL if there is not one. - */ - public function getInnerIterator () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets an index of iterators - * @link http://php.net/manual/en/appenditerator.getiteratorindex.php - * @return int an integer, which is the zero-based index - * of the current inner iterator. - */ - public function getIteratorIndex () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the ArrayIterator - * @link http://php.net/manual/en/appenditerator.getarrayiterator.php - * @return void an ArrayIterator containing - * the appended iterators. - */ - public function getArrayIterator () {} - -} - -/** - * The InfiniteIterator allows one to - * infinitely iterate over an iterator without having to manually - * rewind the iterator upon reaching its end. - * @link http://php.net/manual/en/class.infiniteiterator.php - */ -class InfiniteIterator extends IteratorIterator implements OuterIterator, Traversable, Iterator { - - /** - * (PHP 5 >= 5.1.0)
- * Constructs an InfiniteIterator - * @link http://php.net/manual/en/infiniteiterator.construct.php - * @param Iterator $iterator

- * The iterator to infinitely iterate over. - *

- */ - public function __construct (Iterator $iterator) {} - - /** - * (PHP 5 >= 5.1.0)
- * Moves the inner Iterator forward or rewinds it - * @link http://php.net/manual/en/infiniteiterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.1.0)
- * Rewind to the first element - * @link http://php.net/manual/en/iteratoriterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.1.0)
- * Checks if the iterator is valid - * @link http://php.net/manual/en/iteratoriterator.valid.php - * @return bool TRUE if the iterator is valid, otherwise FALSE - */ - public function valid () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the key of the current element - * @link http://php.net/manual/en/iteratoriterator.key.php - * @return scalar The key of the current element. - */ - public function key () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the current value - * @link http://php.net/manual/en/iteratoriterator.current.php - * @return mixed The value of the current element. - */ - public function current () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the inner iterator - * @link http://php.net/manual/en/iteratoriterator.getinneriterator.php - * @return Traversable The inner iterator as passed to IteratorIterator::__construct. - */ - public function getInnerIterator () {} - -} - -/** - * This iterator can be used to filter another iterator based on a regular expression. - * @link http://php.net/manual/en/class.regexiterator.php - */ -class RegexIterator extends FilterIterator implements Iterator, Traversable, OuterIterator { - const USE_KEY = 1; - const MATCH = 0; - const GET_MATCH = 1; - const ALL_MATCHES = 2; - const SPLIT = 3; - const REPLACE = 4; - - public $replacement; - - - /** - * (PHP 5 >= 5.2.0)
- * Create a new RegexIterator - * @link http://php.net/manual/en/regexiterator.construct.php - * @param Iterator $iterator - * @param $regex - * @param $mode [optional] - * @param $flags [optional] - * @param $preg_flags [optional] - */ - public function __construct (Iterator $iterator, $regex, $mode, $flags, $preg_flags) {} - - /** - * (PHP 5 >= 5.2.0)
- * Get accept status - * @link http://php.net/manual/en/regexiterator.accept.php - * @return bool TRUE if a match, FALSE otherwise. - */ - public function accept () {} - - /** - * (PHP 5 >= 5.2.0)
- * Returns operation mode. - * @link http://php.net/manual/en/regexiterator.getmode.php - * @return int the operation mode. - */ - public function getMode () {} - - /** - * (PHP 5 >= 5.2.0)
- * Sets the operation mode. - * @link http://php.net/manual/en/regexiterator.setmode.php - * @param int $mode

- * The operation mode. - *

- *

- * The available modes are listed below. The actual - * meanings of these modes are described in the - * predefined constants. - * - * RegexIterator modes - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
valueconstant
0 - * RegexIterator::MATCH - *
1 - * RegexIterator::GET_MATCH - *
2 - * RegexIterator::ALL_MATCHES - *
3 - * RegexIterator::SPLIT - *
4 - * RegexIterator::REPLACE - *
- *

- * @return void No value is returned. - */ - public function setMode ($mode) {} - - /** - * (PHP 5 >= 5.2.0)
- * Get flags - * @link http://php.net/manual/en/regexiterator.getflags.php - * @return int the set flags. - */ - public function getFlags () {} - - /** - * (PHP 5 >= 5.2.0)
- * Sets the flags. - * @link http://php.net/manual/en/regexiterator.setflags.php - * @param int $flags

- * The flags to set, a bitmask of class constants. - *

- *

- * The available flags are listed below. The actual - * meanings of these flags are described in the - * predefined constants. - * - * RegexIterator flags - * - * - * - * - * - * - * - * - *
valueconstant
1 - * RegexIterator::USE_KEY - *
- *

- * @return void No value is returned. - */ - public function setFlags ($flags) {} - - /** - * (PHP 5 >= 5.2.0)
- * Returns the regular expression flags. - * @link http://php.net/manual/en/regexiterator.getpregflags.php - * @return int a bitmask of the regular expression flags. - */ - public function getPregFlags () {} - - /** - * (PHP 5 >= 5.2.0)
- * Sets the regular expression flags. - * @link http://php.net/manual/en/regexiterator.setpregflags.php - * @param int $preg_flags

- * The regular expression flags. See RegexIterator::__construct - * for an overview of available flags. - *

- * @return void No value is returned. - */ - public function setPregFlags ($preg_flags) {} - - /** - * (PHP 5 >= 5.4.0)
- * Returns current regular expression - * @link http://php.net/manual/en/regexiterator.getregex.php - * @return string - */ - public function getRegex () {} - - /** - * (PHP 5 >= 5.1.0)
- * Rewind the iterator - * @link http://php.net/manual/en/filteriterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.1.0)
- * Check whether the current element is valid - * @link http://php.net/manual/en/filteriterator.valid.php - * @return bool TRUE if the current element is valid, otherwise FALSE - */ - public function valid () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the current key - * @link http://php.net/manual/en/filteriterator.key.php - * @return mixed The current key. - */ - public function key () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the current element value - * @link http://php.net/manual/en/filteriterator.current.php - * @return mixed The current element value. - */ - public function current () {} - - /** - * (PHP 5 >= 5.1.0)
- * Move the iterator forward - * @link http://php.net/manual/en/filteriterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the inner iterator - * @link http://php.net/manual/en/filteriterator.getinneriterator.php - * @return Iterator The inner iterator. - */ - public function getInnerIterator () {} - -} - -/** - * This recursive iterator can filter another recursive iterator via a regular expression. - * @link http://php.net/manual/en/class.recursiveregexiterator.php - */ -class RecursiveRegexIterator extends RegexIterator implements OuterIterator, Traversable, Iterator, RecursiveIterator { - const USE_KEY = 1; - const MATCH = 0; - const GET_MATCH = 1; - const ALL_MATCHES = 2; - const SPLIT = 3; - const REPLACE = 4; - - public $replacement; - - - /** - * (PHP 5 >= 5.2.0)
- * Creates a new RecursiveRegexIterator. - * @link http://php.net/manual/en/recursiveregexiterator.construct.php - * @param RecursiveIterator $iterator - * @param $regex - * @param $mode [optional] - * @param $flags [optional] - * @param $preg_flags [optional] - */ - public function __construct (RecursiveIterator $iterator, $regex, $mode, $flags, $preg_flags) {} - - /** - * (PHP 5 >= 5.2.0)
- * Returns whether an iterator can be obtained for the current entry. - * @link http://php.net/manual/en/recursiveregexiterator.haschildren.php - * @return bool TRUE if an iterator can be obtained for the current entry, otherwise returns FALSE. - */ - public function hasChildren () {} - - /** - * (PHP 5 >= 5.2.0)
- * Returns an iterator for the current entry. - * @link http://php.net/manual/en/recursiveregexiterator.getchildren.php - * @return RecursiveRegexIterator An iterator for the current entry, if it can be iterated over by the inner iterator. - */ - public function getChildren () {} - - /** - * (PHP 5 >= 5.2.0)
- * Get accept status - * @link http://php.net/manual/en/regexiterator.accept.php - * @return bool TRUE if a match, FALSE otherwise. - */ - public function accept () {} - - /** - * (PHP 5 >= 5.2.0)
- * Returns operation mode. - * @link http://php.net/manual/en/regexiterator.getmode.php - * @return int the operation mode. - */ - public function getMode () {} - - /** - * (PHP 5 >= 5.2.0)
- * Sets the operation mode. - * @link http://php.net/manual/en/regexiterator.setmode.php - * @param int $mode

- * The operation mode. - *

- *

- * The available modes are listed below. The actual - * meanings of these modes are described in the - * predefined constants. - * - * RegexIterator modes - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
valueconstant
0 - * RegexIterator::MATCH - *
1 - * RegexIterator::GET_MATCH - *
2 - * RegexIterator::ALL_MATCHES - *
3 - * RegexIterator::SPLIT - *
4 - * RegexIterator::REPLACE - *
- *

- * @return void No value is returned. - */ - public function setMode ($mode) {} - - /** - * (PHP 5 >= 5.2.0)
- * Get flags - * @link http://php.net/manual/en/regexiterator.getflags.php - * @return int the set flags. - */ - public function getFlags () {} - - /** - * (PHP 5 >= 5.2.0)
- * Sets the flags. - * @link http://php.net/manual/en/regexiterator.setflags.php - * @param int $flags

- * The flags to set, a bitmask of class constants. - *

- *

- * The available flags are listed below. The actual - * meanings of these flags are described in the - * predefined constants. - * - * RegexIterator flags - * - * - * - * - * - * - * - * - *
valueconstant
1 - * RegexIterator::USE_KEY - *
- *

- * @return void No value is returned. - */ - public function setFlags ($flags) {} - - /** - * (PHP 5 >= 5.2.0)
- * Returns the regular expression flags. - * @link http://php.net/manual/en/regexiterator.getpregflags.php - * @return int a bitmask of the regular expression flags. - */ - public function getPregFlags () {} - - /** - * (PHP 5 >= 5.2.0)
- * Sets the regular expression flags. - * @link http://php.net/manual/en/regexiterator.setpregflags.php - * @param int $preg_flags

- * The regular expression flags. See RegexIterator::__construct - * for an overview of available flags. - *

- * @return void No value is returned. - */ - public function setPregFlags ($preg_flags) {} - - /** - * (PHP 5 >= 5.4.0)
- * Returns current regular expression - * @link http://php.net/manual/en/regexiterator.getregex.php - * @return string - */ - public function getRegex () {} - - /** - * (PHP 5 >= 5.1.0)
- * Rewind the iterator - * @link http://php.net/manual/en/filteriterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.1.0)
- * Check whether the current element is valid - * @link http://php.net/manual/en/filteriterator.valid.php - * @return bool TRUE if the current element is valid, otherwise FALSE - */ - public function valid () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the current key - * @link http://php.net/manual/en/filteriterator.key.php - * @return mixed The current key. - */ - public function key () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the current element value - * @link http://php.net/manual/en/filteriterator.current.php - * @return mixed The current element value. - */ - public function current () {} - - /** - * (PHP 5 >= 5.1.0)
- * Move the iterator forward - * @link http://php.net/manual/en/filteriterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the inner iterator - * @link http://php.net/manual/en/filteriterator.getinneriterator.php - * @return Iterator The inner iterator. - */ - public function getInnerIterator () {} - -} - -/** - * The EmptyIterator class for an empty iterator. - * @link http://php.net/manual/en/class.emptyiterator.php - */ -class EmptyIterator implements Iterator, Traversable { - - /** - * (PHP 5 >= 5.1.0)
- * The rewind() method - * @link http://php.net/manual/en/emptyiterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.1.0)
- * The valid() method - * @link http://php.net/manual/en/emptyiterator.valid.php - * @return void FALSE - */ - public function valid () {} - - /** - * (PHP 5 >= 5.1.0)
- * The key() method - * @link http://php.net/manual/en/emptyiterator.key.php - * @return void No value is returned. - */ - public function key () {} - - /** - * (PHP 5 >= 5.1.0)
- * The current() method - * @link http://php.net/manual/en/emptyiterator.current.php - * @return void No value is returned. - */ - public function current () {} - - /** - * (PHP 5 >= 5.1.0)
- * The next() method - * @link http://php.net/manual/en/emptyiterator.next.php - * @return void No value is returned. - */ - public function next () {} - -} - -/** - * Allows iterating over a RecursiveIterator to generate an ASCII graphic tree. - * @link http://php.net/manual/en/class.recursivetreeiterator.php - */ -class RecursiveTreeIterator extends RecursiveIteratorIterator implements OuterIterator, Traversable, Iterator { - const LEAVES_ONLY = 0; - const SELF_FIRST = 1; - const CHILD_FIRST = 2; - const CATCH_GET_CHILD = 16; - const BYPASS_CURRENT = 4; - const BYPASS_KEY = 8; - const PREFIX_LEFT = 0; - const PREFIX_MID_HAS_NEXT = 1; - const PREFIX_MID_LAST = 2; - const PREFIX_END_HAS_NEXT = 3; - const PREFIX_END_LAST = 4; - const PREFIX_RIGHT = 5; - - - /** - * (PHP 5 >= 5.3.0)
- * Construct a RecursiveTreeIterator - * @link http://php.net/manual/en/recursivetreeiterator.construct.php - * @param RecursiveIterator|IteratorAggregate $it

- * The RecursiveIterator or IteratorAggregate to iterate over. - *

- * @param int $flags [optional]

- * Flags may be provided which will affect the behavior of some methods. - * A list of the flags can found under RecursiveTreeIterator predefined constants. - *

- * @param int $cit_flags [optional] - * @param int $mode [optional]

- * Flags to affect the behavior of the RecursiveIteratorIterator used internally. - *

- */ - public function __construct ($it, $flags = 'RecursiveTreeIterator::BYPASS_KEY', $cit_flags = 'CachingIterator::CATCH_GET_CHILD', $mode = 'RecursiveIteratorIterator::SELF_FIRST') {} - - /** - * (PHP 5 >= 5.3.0)
- * Rewind iterator - * @link http://php.net/manual/en/recursivetreeiterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.3.0)
- * Check validity - * @link http://php.net/manual/en/recursivetreeiterator.valid.php - * @return bool TRUE if the current position is valid, otherwise FALSE - */ - public function valid () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get the key of the current element - * @link http://php.net/manual/en/recursivetreeiterator.key.php - * @return string the current key prefixed and postfixed. - */ - public function key () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get current element - * @link http://php.net/manual/en/recursivetreeiterator.current.php - * @return string the current element prefixed and postfixed. - */ - public function current () {} - - /** - * (PHP 5 >= 5.3.0)
- * Move to next element - * @link http://php.net/manual/en/recursivetreeiterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.3.0)
- * Begin iteration - * @link http://php.net/manual/en/recursivetreeiterator.beginiteration.php - * @return RecursiveIterator A RecursiveIterator. - */ - public function beginIteration () {} - - /** - * (PHP 5 >= 5.3.0)
- * End iteration - * @link http://php.net/manual/en/recursivetreeiterator.enditeration.php - * @return void No value is returned. - */ - public function endIteration () {} - - /** - * (PHP 5 >= 5.3.0)
- * Has children - * @link http://php.net/manual/en/recursivetreeiterator.callhaschildren.php - * @return bool TRUE if there are children, otherwise FALSE - */ - public function callHasChildren () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get children - * @link http://php.net/manual/en/recursivetreeiterator.callgetchildren.php - * @return RecursiveIterator A RecursiveIterator. - */ - public function callGetChildren () {} - - /** - * (PHP 5 >= 5.3.0)
- * Begin children - * @link http://php.net/manual/en/recursivetreeiterator.beginchildren.php - * @return void No value is returned. - */ - public function beginChildren () {} - - /** - * (PHP 5 >= 5.3.0)
- * End children - * @link http://php.net/manual/en/recursivetreeiterator.endchildren.php - * @return void No value is returned. - */ - public function endChildren () {} - - /** - * (PHP 5 >= 5.3.0)
- * Next element - * @link http://php.net/manual/en/recursivetreeiterator.nextelement.php - * @return void No value is returned. - */ - public function nextElement () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get the prefix - * @link http://php.net/manual/en/recursivetreeiterator.getprefix.php - * @return string the string to place in front of current element - */ - public function getPrefix () {} - - /** - * (PHP 5 >= 5.3.0)
- * Set a part of the prefix - * @link http://php.net/manual/en/recursivetreeiterator.setprefixpart.php - * @param int $part

- * One of the RecursiveTreeIterator::PREFIX_* constants. - *

- * @param string $value

- * The value to assign to the part of the prefix specified in part. - *

- * @return void No value is returned. - */ - public function setPrefixPart ($part, $value) {} - - /** - * (PHP 5 >= 5.3.0)
- * Get current entry - * @link http://php.net/manual/en/recursivetreeiterator.getentry.php - * @return string the part of the tree built for the current element. - */ - public function getEntry () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get the postfix - * @link http://php.net/manual/en/recursivetreeiterator.getpostfix.php - * @return void the string to place after the current element. - */ - public function getPostfix () {} - - /** - * (PHP 5)
- * Get the current depth of the recursive iteration - * @link http://php.net/manual/en/recursiveiteratoriterator.getdepth.php - * @return int The current depth of the recursive iteration. - */ - public function getDepth () {} - - /** - * (PHP 5)
- * The current active sub iterator - * @link http://php.net/manual/en/recursiveiteratoriterator.getsubiterator.php - * @param $level [optional] - * @return RecursiveIterator The current active sub iterator. - */ - public function getSubIterator ($level) {} - - /** - * (PHP 5 >= 5.1.0)
- * Get inner iterator - * @link http://php.net/manual/en/recursiveiteratoriterator.getinneriterator.php - * @return iterator The current active sub iterator. - */ - public function getInnerIterator () {} - - /** - * (PHP 5 >= 5.1.0)
- * Set max depth - * @link http://php.net/manual/en/recursiveiteratoriterator.setmaxdepth.php - * @param string $max_depth [optional]

- * The maximum allowed depth. -1 is used - * for any depth. - *

- * @return void No value is returned. - */ - public function setMaxDepth ($max_depth = -1) {} - - /** - * (PHP 5 >= 5.1.0)
- * Get max depth - * @link http://php.net/manual/en/recursiveiteratoriterator.getmaxdepth.php - * @return mixed The maximum accepted depth, or FALSE if any depth is allowed. - */ - public function getMaxDepth () {} - -} - -/** - * This class allows objects to work as arrays. - * @link http://php.net/manual/en/class.arrayobject.php - */ -class ArrayObject implements IteratorAggregate, Traversable, ArrayAccess, Serializable, Countable { - const STD_PROP_LIST = 1; - const ARRAY_AS_PROPS = 2; - - - /** - * (PHP 5 >= 5.0.0)
- * Construct a new array object - * @link http://php.net/manual/en/arrayobject.construct.php - * @param $array - */ - public function __construct ($array) {} - - /** - * (PHP 5 >= 5.0.0)
- * Returns whether the requested index exists - * @link http://php.net/manual/en/arrayobject.offsetexists.php - * @param mixed $index

- * The index being checked. - *

- * @return bool TRUE if the requested index exists, otherwise FALSE - */ - public function offsetExists ($index) {} - - /** - * (PHP 5 >= 5.0.0)
- * Returns the value at the specified index - * @link http://php.net/manual/en/arrayobject.offsetget.php - * @param mixed $index

- * The index with the value. - *

- * @return mixed The value at the specified index or FALSE. - */ - public function offsetGet ($index) {} - - /** - * (PHP 5 >= 5.0.0)
- * Sets the value at the specified index to newval - * @link http://php.net/manual/en/arrayobject.offsetset.php - * @param mixed $index

- * The index being set. - *

- * @param mixed $newval

- * The new value for the index. - *

- * @return void No value is returned. - */ - public function offsetSet ($index, $newval) {} - - /** - * (PHP 5 >= 5.0.0)
- * Unsets the value at the specified index - * @link http://php.net/manual/en/arrayobject.offsetunset.php - * @param mixed $index

- * The index being unset. - *

- * @return void No value is returned. - */ - public function offsetUnset ($index) {} - - /** - * (PHP 5 >= 5.0.0)
- * Appends the value - * @link http://php.net/manual/en/arrayobject.append.php - * @param mixed $value

- * The value being appended. - *

- * @return void No value is returned. - */ - public function append ($value) {} - - /** - * (PHP 5 >= 5.0.0)
- * Creates a copy of the ArrayObject. - * @link http://php.net/manual/en/arrayobject.getarraycopy.php - * @return array a copy of the array. When the ArrayObject refers to an object - * an array of the public properties of that object will be returned. - */ - public function getArrayCopy () {} - - /** - * (PHP 5 >= 5.0.0)
- * Get the number of public properties in the ArrayObject - * @link http://php.net/manual/en/arrayobject.count.php - * @return int The number of public properties in the ArrayObject. - *

- *

- * When the ArrayObject is constructed from an array all properties are public. - */ - public function count () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the behavior flags. - * @link http://php.net/manual/en/arrayobject.getflags.php - * @return int the behavior flags of the ArrayObject. - */ - public function getFlags () {} - - /** - * (PHP 5 >= 5.1.0)
- * Sets the behavior flags. - * @link http://php.net/manual/en/arrayobject.setflags.php - * @param int $flags

- * The new ArrayObject behavior. - * It takes on either a bitmask, or named constants. Using named - * constants is strongly encouraged to ensure compatibility for future - * versions. - *

- *

- * The available behavior flags are listed below. The actual - * meanings of these flags are described in the - * predefined constants. - * - * ArrayObject behavior flags - * - * - * - * - * - * - * - * - * - * - * - * - *
valueconstant
1 - * ArrayObject::STD_PROP_LIST - *
2 - * ArrayObject::ARRAY_AS_PROPS - *
- *

- * @return void No value is returned. - */ - public function setFlags ($flags) {} - - /** - * (PHP 5 >= 5.2.0)
- * Sort the entries by value - * @link http://php.net/manual/en/arrayobject.asort.php - * @return void No value is returned. - */ - public function asort () {} - - /** - * (PHP 5 >= 5.2.0)
- * Sort the entries by key - * @link http://php.net/manual/en/arrayobject.ksort.php - * @return void No value is returned. - */ - public function ksort () {} - - /** - * (PHP 5 >= 5.2.0)
- * Sort the entries with a user-defined comparison function and maintain key association - * @link http://php.net/manual/en/arrayobject.uasort.php - * @param callable $cmp_function

- * Function cmp_function should accept two - * parameters which will be filled by pairs of entries. - * The comparison function must return an integer less than, equal - * to, or greater than zero if the first argument is considered to - * be respectively less than, equal to, or greater than the - * second. - *

- * @return void No value is returned. - */ - public function uasort (callable $cmp_function) {} - - /** - * (PHP 5 >= 5.2.0)
- * Sort the entries by keys using a user-defined comparison function - * @link http://php.net/manual/en/arrayobject.uksort.php - * @param callable $cmp_function

- * The callback comparison function. - *

- *

- * Function cmp_function should accept two - * parameters which will be filled by pairs of entry keys. - * The comparison function must return an integer less than, equal - * to, or greater than zero if the first argument is considered to - * be respectively less than, equal to, or greater than the - * second. - *

- * @return void No value is returned. - */ - public function uksort (callable $cmp_function) {} - - /** - * (PHP 5 >= 5.2.0)
- * Sort entries using a "natural order" algorithm - * @link http://php.net/manual/en/arrayobject.natsort.php - * @return void No value is returned. - */ - public function natsort () {} - - /** - * (PHP 5 >= 5.2.0)
- * Sort an array using a case insensitive "natural order" algorithm - * @link http://php.net/manual/en/arrayobject.natcasesort.php - * @return void No value is returned. - */ - public function natcasesort () {} - - /** - * (PHP 5 >= 5.3.0)
- * Unserialize an ArrayObject - * @link http://php.net/manual/en/arrayobject.unserialize.php - * @param string $serialized

- * The serialized ArrayObject. - *

- * @return void The unserialized ArrayObject. - */ - public function unserialize ($serialized) {} - - /** - * (PHP 5 >= 5.3.0)
- * Serialize an ArrayObject - * @link http://php.net/manual/en/arrayobject.serialize.php - * @return void The serialized representation of the ArrayObject. - */ - public function serialize () {} - - /** - * (PHP 5 >= 5.0.0)
- * Create a new iterator from an ArrayObject instance - * @link http://php.net/manual/en/arrayobject.getiterator.php - * @return ArrayIterator An iterator from an ArrayObject. - */ - public function getIterator () {} - - /** - * (PHP 5 >= 5.1.0)
- * Exchange the array for another one. - * @link http://php.net/manual/en/arrayobject.exchangearray.php - * @param mixed $input

- * The new array or object to exchange with the current array. - *

- * @return array the old array. - */ - public function exchangeArray ($input) {} - - /** - * (PHP 5 >= 5.1.0)
- * Sets the iterator classname for the ArrayObject. - * @link http://php.net/manual/en/arrayobject.setiteratorclass.php - * @param string $iterator_class

- * The classname of the array iterator to use when iterating over this object. - *

- * @return void No value is returned. - */ - public function setIteratorClass ($iterator_class) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the iterator classname for the ArrayObject. - * @link http://php.net/manual/en/arrayobject.getiteratorclass.php - * @return string the iterator class name that is used to iterate over this object. - */ - public function getIteratorClass () {} - -} - -/** - * This iterator allows to unset and modify values and keys while iterating - * over Arrays and Objects. - * @link http://php.net/manual/en/class.arrayiterator.php - */ -class ArrayIterator implements Iterator, Traversable, ArrayAccess, SeekableIterator, Serializable, Countable { - const STD_PROP_LIST = 1; - const ARRAY_AS_PROPS = 2; - - - /** - * (PHP 5 >= 5.0.0)
- * Construct an ArrayIterator - * @link http://php.net/manual/en/arrayiterator.construct.php - * @param mixed $array [optional]

- * The array or object to be iterated on. - *

- * @param int $flags [optional]

- * Flags to control the behaviour of the ArrayObject object. - * See ArrayObject::setFlags. - *

- */ - public function __construct ($array = 'array()', $flags = 0) {} - - /** - * (PHP 5 >= 5.0.0)
- * Check if offset exists - * @link http://php.net/manual/en/arrayiterator.offsetexists.php - * @param string $index

- * The offset being checked. - *

- * @return void TRUE if the offset exists, otherwise FALSE - */ - public function offsetExists ($index) {} - - /** - * (PHP 5 >= 5.0.0)
- * Get value for an offset - * @link http://php.net/manual/en/arrayiterator.offsetget.php - * @param string $index

- * The offset to get the value from. - *

- * @return mixed The value at offset index. - */ - public function offsetGet ($index) {} - - /** - * (PHP 5 >= 5.0.0)
- * Set value for an offset - * @link http://php.net/manual/en/arrayiterator.offsetset.php - * @param string $index

- * The index to set for. - *

- * @param string $newval

- * The new value to store at the index. - *

- * @return void No value is returned. - */ - public function offsetSet ($index, $newval) {} - - /** - * (PHP 5 >= 5.0.0)
- * Unset value for an offset - * @link http://php.net/manual/en/arrayiterator.offsetunset.php - * @param string $index

- * The offset to unset. - *

- * @return void No value is returned. - */ - public function offsetUnset ($index) {} - - /** - * (PHP 5 >= 5.0.0)
- * Append an element - * @link http://php.net/manual/en/arrayiterator.append.php - * @param mixed $value

- * The value to append. - *

- * @return void No value is returned. - */ - public function append ($value) {} - - /** - * (PHP 5 >= 5.0.0)
- * Get array copy - * @link http://php.net/manual/en/arrayiterator.getarraycopy.php - * @return array A copy of the array, or array of public properties - * if ArrayIterator refers to an object. - */ - public function getArrayCopy () {} - - /** - * (PHP 5 >= 5.0.0)
- * Count elements - * @link http://php.net/manual/en/arrayiterator.count.php - * @return int The number of elements or public properties in the associated - * array or object, respectively. - */ - public function count () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get flags - * @link http://php.net/manual/en/arrayiterator.getflags.php - * @return void The current flags. - */ - public function getFlags () {} - - /** - * (PHP 5 >= 5.1.0)
- * Set behaviour flags - * @link http://php.net/manual/en/arrayiterator.setflags.php - * @param string $flags

- * A bitmask as follows: - * 0 = Properties of the object have their normal functionality - * when accessed as list (var_dump, foreach, etc.). - * 1 = Array indices can be accessed as properties in read/write. - *

- * @return void No value is returned. - */ - public function setFlags ($flags) {} - - /** - * (PHP 5 >= 5.2.0)
- * Sort array by values - * @link http://php.net/manual/en/arrayiterator.asort.php - * @return void No value is returned. - */ - public function asort () {} - - /** - * (PHP 5 >= 5.2.0)
- * Sort array by keys - * @link http://php.net/manual/en/arrayiterator.ksort.php - * @return void No value is returned. - */ - public function ksort () {} - - /** - * (PHP 5 >= 5.2.0)
- * User defined sort - * @link http://php.net/manual/en/arrayiterator.uasort.php - * @param string $cmp_function

- * The compare function used for the sort. - *

- * @return void No value is returned. - */ - public function uasort ($cmp_function) {} - - /** - * (PHP 5 >= 5.2.0)
- * User defined sort - * @link http://php.net/manual/en/arrayiterator.uksort.php - * @param string $cmp_function

- * The compare function used for the sort. - *

- * @return void No value is returned. - */ - public function uksort ($cmp_function) {} - - /** - * (PHP 5 >= 5.2.0)
- * Sort an array naturally - * @link http://php.net/manual/en/arrayiterator.natsort.php - * @return void No value is returned. - */ - public function natsort () {} - - /** - * (PHP 5 >= 5.2.0)
- * Sort an array naturally, case insensitive - * @link http://php.net/manual/en/arrayiterator.natcasesort.php - * @return void No value is returned. - */ - public function natcasesort () {} - - /** - * (PHP 5 >= 5.3.0)
- * Unserialize - * @link http://php.net/manual/en/arrayiterator.unserialize.php - * @param string $serialized

- * The serialized ArrayIterator object to be unserialized. - *

- * @return string The ArrayIterator. - */ - public function unserialize ($serialized) {} - - /** - * (PHP 5 >= 5.3.0)
- * Serialize - * @link http://php.net/manual/en/arrayiterator.serialize.php - * @return string The serialized ArrayIterator. - */ - public function serialize () {} - - /** - * (PHP 5 >= 5.0.0)
- * Rewind array back to the start - * @link http://php.net/manual/en/arrayiterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.0.0)
- * Return current array entry - * @link http://php.net/manual/en/arrayiterator.current.php - * @return mixed The current array entry. - */ - public function current () {} - - /** - * (PHP 5 >= 5.0.0)
- * Return current array key - * @link http://php.net/manual/en/arrayiterator.key.php - * @return mixed The current array key. - */ - public function key () {} - - /** - * (PHP 5 >= 5.0.0)
- * Move to next entry - * @link http://php.net/manual/en/arrayiterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.0.0)
- * Check whether array contains more entries - * @link http://php.net/manual/en/arrayiterator.valid.php - * @return bool No value is returned. - */ - public function valid () {} - - /** - * (PHP 5 >= 5.0.0)
- * Seek to position - * @link http://php.net/manual/en/arrayiterator.seek.php - * @param int $position

- * The position to seek to. - *

- * @return void No value is returned. - */ - public function seek ($position) {} - -} - -/** - * This iterator allows to unset and modify values and keys while iterating over Arrays and Objects - * in the same way as the ArrayIterator. Additionally it is possible to iterate - * over the current iterator entry. - * @link http://php.net/manual/en/class.recursivearrayiterator.php - */ -class RecursiveArrayIterator extends ArrayIterator implements Countable, Serializable, SeekableIterator, ArrayAccess, Traversable, Iterator, RecursiveIterator { - const CHILD_ARRAYS_ONLY = 4; - - - /** - * (PHP 5 >= 5.1.0)
- * Returns whether current entry is an array or an object. - * @link http://php.net/manual/en/recursivearrayiterator.haschildren.php - * @return bool TRUE if the current entry is an array or an object, - * otherwise FALSE is returned. - */ - public function hasChildren () {} - - /** - * (PHP 5 >= 5.1.0)
- * Returns an iterator for the current entry if it is an array or an object. - * @link http://php.net/manual/en/recursivearrayiterator.getchildren.php - * @return RecursiveArrayIterator An iterator for the current entry, if it is an array or object. - */ - public function getChildren () {} - - /** - * (PHP 5 >= 5.0.0)
- * Construct an ArrayIterator - * @link http://php.net/manual/en/arrayiterator.construct.php - * @param mixed $array [optional]

- * The array or object to be iterated on. - *

- * @param int $flags [optional]

- * Flags to control the behaviour of the ArrayObject object. - * See ArrayObject::setFlags. - *

- */ - public function __construct ($array = 'array()', $flags = 0) {} - - /** - * (PHP 5 >= 5.0.0)
- * Check if offset exists - * @link http://php.net/manual/en/arrayiterator.offsetexists.php - * @param string $index

- * The offset being checked. - *

- * @return void TRUE if the offset exists, otherwise FALSE - */ - public function offsetExists ($index) {} - - /** - * (PHP 5 >= 5.0.0)
- * Get value for an offset - * @link http://php.net/manual/en/arrayiterator.offsetget.php - * @param string $index

- * The offset to get the value from. - *

- * @return mixed The value at offset index. - */ - public function offsetGet ($index) {} - - /** - * (PHP 5 >= 5.0.0)
- * Set value for an offset - * @link http://php.net/manual/en/arrayiterator.offsetset.php - * @param string $index

- * The index to set for. - *

- * @param string $newval

- * The new value to store at the index. - *

- * @return void No value is returned. - */ - public function offsetSet ($index, $newval) {} - - /** - * (PHP 5 >= 5.0.0)
- * Unset value for an offset - * @link http://php.net/manual/en/arrayiterator.offsetunset.php - * @param string $index

- * The offset to unset. - *

- * @return void No value is returned. - */ - public function offsetUnset ($index) {} - - /** - * (PHP 5 >= 5.0.0)
- * Append an element - * @link http://php.net/manual/en/arrayiterator.append.php - * @param mixed $value

- * The value to append. - *

- * @return void No value is returned. - */ - public function append ($value) {} - - /** - * (PHP 5 >= 5.0.0)
- * Get array copy - * @link http://php.net/manual/en/arrayiterator.getarraycopy.php - * @return array A copy of the array, or array of public properties - * if ArrayIterator refers to an object. - */ - public function getArrayCopy () {} - - /** - * (PHP 5 >= 5.0.0)
- * Count elements - * @link http://php.net/manual/en/arrayiterator.count.php - * @return int The number of elements or public properties in the associated - * array or object, respectively. - */ - public function count () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get flags - * @link http://php.net/manual/en/arrayiterator.getflags.php - * @return void The current flags. - */ - public function getFlags () {} - - /** - * (PHP 5 >= 5.1.0)
- * Set behaviour flags - * @link http://php.net/manual/en/arrayiterator.setflags.php - * @param string $flags

- * A bitmask as follows: - * 0 = Properties of the object have their normal functionality - * when accessed as list (var_dump, foreach, etc.). - * 1 = Array indices can be accessed as properties in read/write. - *

- * @return void No value is returned. - */ - public function setFlags ($flags) {} - - /** - * (PHP 5 >= 5.2.0)
- * Sort array by values - * @link http://php.net/manual/en/arrayiterator.asort.php - * @return void No value is returned. - */ - public function asort () {} - - /** - * (PHP 5 >= 5.2.0)
- * Sort array by keys - * @link http://php.net/manual/en/arrayiterator.ksort.php - * @return void No value is returned. - */ - public function ksort () {} - - /** - * (PHP 5 >= 5.2.0)
- * User defined sort - * @link http://php.net/manual/en/arrayiterator.uasort.php - * @param string $cmp_function

- * The compare function used for the sort. - *

- * @return void No value is returned. - */ - public function uasort ($cmp_function) {} - - /** - * (PHP 5 >= 5.2.0)
- * User defined sort - * @link http://php.net/manual/en/arrayiterator.uksort.php - * @param string $cmp_function

- * The compare function used for the sort. - *

- * @return void No value is returned. - */ - public function uksort ($cmp_function) {} - - /** - * (PHP 5 >= 5.2.0)
- * Sort an array naturally - * @link http://php.net/manual/en/arrayiterator.natsort.php - * @return void No value is returned. - */ - public function natsort () {} - - /** - * (PHP 5 >= 5.2.0)
- * Sort an array naturally, case insensitive - * @link http://php.net/manual/en/arrayiterator.natcasesort.php - * @return void No value is returned. - */ - public function natcasesort () {} - - /** - * (PHP 5 >= 5.3.0)
- * Unserialize - * @link http://php.net/manual/en/arrayiterator.unserialize.php - * @param string $serialized

- * The serialized ArrayIterator object to be unserialized. - *

- * @return string The ArrayIterator. - */ - public function unserialize ($serialized) {} - - /** - * (PHP 5 >= 5.3.0)
- * Serialize - * @link http://php.net/manual/en/arrayiterator.serialize.php - * @return string The serialized ArrayIterator. - */ - public function serialize () {} - - /** - * (PHP 5 >= 5.0.0)
- * Rewind array back to the start - * @link http://php.net/manual/en/arrayiterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.0.0)
- * Return current array entry - * @link http://php.net/manual/en/arrayiterator.current.php - * @return mixed The current array entry. - */ - public function current () {} - - /** - * (PHP 5 >= 5.0.0)
- * Return current array key - * @link http://php.net/manual/en/arrayiterator.key.php - * @return mixed The current array key. - */ - public function key () {} - - /** - * (PHP 5 >= 5.0.0)
- * Move to next entry - * @link http://php.net/manual/en/arrayiterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.0.0)
- * Check whether array contains more entries - * @link http://php.net/manual/en/arrayiterator.valid.php - * @return bool No value is returned. - */ - public function valid () {} - - /** - * (PHP 5 >= 5.0.0)
- * Seek to position - * @link http://php.net/manual/en/arrayiterator.seek.php - * @param int $position

- * The position to seek to. - *

- * @return void No value is returned. - */ - public function seek ($position) {} - -} - -/** - * The SplFileInfo class offers a high-level object oriented interface to - * information for an individual file. - * @link http://php.net/manual/en/class.splfileinfo.php - */ -class SplFileInfo { - - /** - * (PHP 5 >= 5.1.2)
- * Construct a new SplFileInfo object - * @link http://php.net/manual/en/splfileinfo.construct.php - * @param string $file_name

- * Path to the file. - *

- */ - public function __construct ($file_name) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the path without filename - * @link http://php.net/manual/en/splfileinfo.getpath.php - * @return string the path to the file. - */ - public function getPath () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the filename - * @link http://php.net/manual/en/splfileinfo.getfilename.php - * @return string The filename. - */ - public function getFilename () {} - - /** - * (PHP 5 >= 5.3.6)
- * Gets the file extension - * @link http://php.net/manual/en/splfileinfo.getextension.php - * @return string a string containing the file extension, or an - * empty string if the file has no extension. - */ - public function getExtension () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets the base name of the file - * @link http://php.net/manual/en/splfileinfo.getbasename.php - * @param string $suffix [optional]

- * Optional suffix to omit from the base name returned. - *

- * @return string the base name without path information. - */ - public function getBasename ($suffix = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the path to the file - * @link http://php.net/manual/en/splfileinfo.getpathname.php - * @return string The path to the file. - */ - public function getPathname () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file permissions - * @link http://php.net/manual/en/splfileinfo.getperms.php - * @return int the file permissions. - */ - public function getPerms () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the inode for the file - * @link http://php.net/manual/en/splfileinfo.getinode.php - * @return int the inode number for the filesystem object. - */ - public function getInode () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file size - * @link http://php.net/manual/en/splfileinfo.getsize.php - * @return int The filesize in bytes. - */ - public function getSize () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the owner of the file - * @link http://php.net/manual/en/splfileinfo.getowner.php - * @return int The owner id in numerical format. - */ - public function getOwner () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the file group - * @link http://php.net/manual/en/splfileinfo.getgroup.php - * @return int The group id in numerical format. - */ - public function getGroup () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets last access time of the file - * @link http://php.net/manual/en/splfileinfo.getatime.php - * @return int the time the file was last accessed. - */ - public function getATime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the last modified time - * @link http://php.net/manual/en/splfileinfo.getmtime.php - * @return int the last modified time for the file, in a Unix timestamp. - */ - public function getMTime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the inode change time - * @link http://php.net/manual/en/splfileinfo.getctime.php - * @return int The last change time, in a Unix timestamp. - */ - public function getCTime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file type - * @link http://php.net/manual/en/splfileinfo.gettype.php - * @return string A string representing the type of the entry. - * May be one of file, link, - * or dir - */ - public function getType () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the entry is writable - * @link http://php.net/manual/en/splfileinfo.iswritable.php - * @return bool TRUE if writable, FALSE otherwise; - */ - public function isWritable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if file is readable - * @link http://php.net/manual/en/splfileinfo.isreadable.php - * @return bool TRUE if readable, FALSE otherwise. - */ - public function isReadable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is executable - * @link http://php.net/manual/en/splfileinfo.isexecutable.php - * @return bool TRUE if executable, FALSE otherwise. - */ - public function isExecutable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the object references a regular file - * @link http://php.net/manual/en/splfileinfo.isfile.php - * @return bool TRUE if the file exists and is a regular file (not a link), FALSE otherwise. - */ - public function isFile () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is a directory - * @link http://php.net/manual/en/splfileinfo.isdir.php - * @return bool TRUE if a directory, FALSE otherwise. - */ - public function isDir () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is a link - * @link http://php.net/manual/en/splfileinfo.islink.php - * @return bool TRUE if the file is a link, FALSE otherwise. - */ - public function isLink () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets the target of a link - * @link http://php.net/manual/en/splfileinfo.getlinktarget.php - * @return string the target of the filesystem link. - */ - public function getLinkTarget () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets absolute path to file - * @link http://php.net/manual/en/splfileinfo.getrealpath.php - * @return string the path to the file. - */ - public function getRealPath () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileInfo object for the file - * @link http://php.net/manual/en/splfileinfo.getfileinfo.php - * @param string $class_name [optional]

- * Name of an SplFileInfo derived class to use. - *

- * @return SplFileInfo An SplFileInfo object created for the file. - */ - public function getFileInfo ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileInfo object for the path - * @link http://php.net/manual/en/splfileinfo.getpathinfo.php - * @param string $class_name [optional]

- * Name of an SplFileInfo derived class to use. - *

- * @return SplFileInfo an SplFileInfo object for the parent path of the file. - */ - public function getPathInfo ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileObject object for the file - * @link http://php.net/manual/en/splfileinfo.openfile.php - * @param string $open_mode [optional]

- * The mode for opening the file. See the fopen - * documentation for descriptions of possible modes. The default - * is read only. - *

- * @param bool $use_include_path [optional]

- * When set to TRUE, the filename is also - * searched for within the include_path - *

- * @param resource $context [optional]

- * Refer to the context - * section of the manual for a description of contexts. - *

- * @return SplFileObject The opened file as an SplFileObject object. - */ - public function openFile ($open_mode = 'r', $use_include_path = false, $context = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets the class name used with SplFileInfo::openFile - * @link http://php.net/manual/en/splfileinfo.setfileclass.php - * @param string $class_name [optional]

- * The class name to use when openFile() is called. - *

- * @return void No value is returned. - */ - public function setFileClass ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets the class used with getFileInfo and getPathInfo - * @link http://php.net/manual/en/splfileinfo.setinfoclass.php - * @param string $class_name [optional]

- * The class name to use. - *

- * @return void No value is returned. - */ - public function setInfoClass ($class_name = null) {} - - final public function _bad_state_ex () {} - - /** - * (PHP 5 >= 5.1.2)
- * Returns the path to the file as a string - * @link http://php.net/manual/en/splfileinfo.tostring.php - * @return void the path to the file. - */ - public function __toString () {} - -} - -/** - * The DirectoryIterator class provides a simple interface for viewing - * the contents of filesystem directories. - * @link http://php.net/manual/en/class.directoryiterator.php - */ -class DirectoryIterator extends SplFileInfo implements Iterator, Traversable, SeekableIterator { - - /** - * (PHP 5)
- * Constructs a new directory iterator from a path - * @link http://php.net/manual/en/directoryiterator.construct.php - * @param $path - */ - public function __construct ($path) {} - - /** - * (PHP 5)
- * Return file name of current DirectoryIterator item. - * @link http://php.net/manual/en/directoryiterator.getfilename.php - * @return string the file name of the current DirectoryIterator item. - */ - public function getFilename () {} - - /** - * (PHP 5 >= 5.3.6)
- * Gets the file extension - * @link http://php.net/manual/en/directoryiterator.getextension.php - * @return string a string containing the file extension, or an - * empty string if the file has no extension. - */ - public function getExtension () {} - - /** - * (PHP 5 >= 5.2.2)
- * Get base name of current DirectoryIterator item. - * @link http://php.net/manual/en/directoryiterator.getbasename.php - * @param string $suffix [optional]

- * If the base name ends in suffix, - * this will be cut. - *

- * @return string The base name of the current DirectoryIterator item. - */ - public function getBasename ($suffix = null) {} - - /** - * (PHP 5)
- * Determine if current DirectoryIterator item is '.' or '..' - * @link http://php.net/manual/en/directoryiterator.isdot.php - * @return bool TRUE if the entry is . or .., - * otherwise FALSE - */ - public function isDot () {} - - /** - * (PHP 5)
- * Rewind the DirectoryIterator back to the start - * @link http://php.net/manual/en/directoryiterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5)
- * Check whether current DirectoryIterator position is a valid file - * @link http://php.net/manual/en/directoryiterator.valid.php - * @return bool TRUE if the position is valid, otherwise FALSE - */ - public function valid () {} - - /** - * (PHP 5)
- * Return the key for the current DirectoryIterator item - * @link http://php.net/manual/en/directoryiterator.key.php - * @return string The key for the current DirectoryIterator item. - */ - public function key () {} - - /** - * (PHP 5)
- * Return the current DirectoryIterator item. - * @link http://php.net/manual/en/directoryiterator.current.php - * @return DirectoryIterator The current DirectoryIterator item. - */ - public function current () {} - - /** - * (PHP 5)
- * Move forward to next DirectoryIterator item - * @link http://php.net/manual/en/directoryiterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.3.0)
- * Seek to a DirectoryIterator item - * @link http://php.net/manual/en/directoryiterator.seek.php - * @param int $position

- * The zero-based numeric position to seek to. - *

- * @return void No value is returned. - */ - public function seek ($position) {} - - /** - * (PHP 5)
- * Get file name as a string - * @link http://php.net/manual/en/directoryiterator.tostring.php - * @return string the file name of the current DirectoryIterator item. - */ - public function __toString () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the path without filename - * @link http://php.net/manual/en/splfileinfo.getpath.php - * @return string the path to the file. - */ - public function getPath () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the path to the file - * @link http://php.net/manual/en/splfileinfo.getpathname.php - * @return string The path to the file. - */ - public function getPathname () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file permissions - * @link http://php.net/manual/en/splfileinfo.getperms.php - * @return int the file permissions. - */ - public function getPerms () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the inode for the file - * @link http://php.net/manual/en/splfileinfo.getinode.php - * @return int the inode number for the filesystem object. - */ - public function getInode () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file size - * @link http://php.net/manual/en/splfileinfo.getsize.php - * @return int The filesize in bytes. - */ - public function getSize () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the owner of the file - * @link http://php.net/manual/en/splfileinfo.getowner.php - * @return int The owner id in numerical format. - */ - public function getOwner () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the file group - * @link http://php.net/manual/en/splfileinfo.getgroup.php - * @return int The group id in numerical format. - */ - public function getGroup () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets last access time of the file - * @link http://php.net/manual/en/splfileinfo.getatime.php - * @return int the time the file was last accessed. - */ - public function getATime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the last modified time - * @link http://php.net/manual/en/splfileinfo.getmtime.php - * @return int the last modified time for the file, in a Unix timestamp. - */ - public function getMTime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the inode change time - * @link http://php.net/manual/en/splfileinfo.getctime.php - * @return int The last change time, in a Unix timestamp. - */ - public function getCTime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file type - * @link http://php.net/manual/en/splfileinfo.gettype.php - * @return string A string representing the type of the entry. - * May be one of file, link, - * or dir - */ - public function getType () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the entry is writable - * @link http://php.net/manual/en/splfileinfo.iswritable.php - * @return bool TRUE if writable, FALSE otherwise; - */ - public function isWritable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if file is readable - * @link http://php.net/manual/en/splfileinfo.isreadable.php - * @return bool TRUE if readable, FALSE otherwise. - */ - public function isReadable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is executable - * @link http://php.net/manual/en/splfileinfo.isexecutable.php - * @return bool TRUE if executable, FALSE otherwise. - */ - public function isExecutable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the object references a regular file - * @link http://php.net/manual/en/splfileinfo.isfile.php - * @return bool TRUE if the file exists and is a regular file (not a link), FALSE otherwise. - */ - public function isFile () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is a directory - * @link http://php.net/manual/en/splfileinfo.isdir.php - * @return bool TRUE if a directory, FALSE otherwise. - */ - public function isDir () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is a link - * @link http://php.net/manual/en/splfileinfo.islink.php - * @return bool TRUE if the file is a link, FALSE otherwise. - */ - public function isLink () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets the target of a link - * @link http://php.net/manual/en/splfileinfo.getlinktarget.php - * @return string the target of the filesystem link. - */ - public function getLinkTarget () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets absolute path to file - * @link http://php.net/manual/en/splfileinfo.getrealpath.php - * @return string the path to the file. - */ - public function getRealPath () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileInfo object for the file - * @link http://php.net/manual/en/splfileinfo.getfileinfo.php - * @param string $class_name [optional]

- * Name of an SplFileInfo derived class to use. - *

- * @return SplFileInfo An SplFileInfo object created for the file. - */ - public function getFileInfo ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileInfo object for the path - * @link http://php.net/manual/en/splfileinfo.getpathinfo.php - * @param string $class_name [optional]

- * Name of an SplFileInfo derived class to use. - *

- * @return SplFileInfo an SplFileInfo object for the parent path of the file. - */ - public function getPathInfo ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileObject object for the file - * @link http://php.net/manual/en/splfileinfo.openfile.php - * @param string $open_mode [optional]

- * The mode for opening the file. See the fopen - * documentation for descriptions of possible modes. The default - * is read only. - *

- * @param bool $use_include_path [optional]

- * When set to TRUE, the filename is also - * searched for within the include_path - *

- * @param resource $context [optional]

- * Refer to the context - * section of the manual for a description of contexts. - *

- * @return SplFileObject The opened file as an SplFileObject object. - */ - public function openFile ($open_mode = 'r', $use_include_path = false, $context = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets the class name used with SplFileInfo::openFile - * @link http://php.net/manual/en/splfileinfo.setfileclass.php - * @param string $class_name [optional]

- * The class name to use when openFile() is called. - *

- * @return void No value is returned. - */ - public function setFileClass ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets the class used with getFileInfo and getPathInfo - * @link http://php.net/manual/en/splfileinfo.setinfoclass.php - * @param string $class_name [optional]

- * The class name to use. - *

- * @return void No value is returned. - */ - public function setInfoClass ($class_name = null) {} - - final public function _bad_state_ex () {} - -} - -/** - * The Filesystem iterator - * @link http://php.net/manual/en/class.filesystemiterator.php - */ -class FilesystemIterator extends DirectoryIterator implements SeekableIterator, Traversable, Iterator { - const CURRENT_MODE_MASK = 240; - const CURRENT_AS_PATHNAME = 32; - const CURRENT_AS_FILEINFO = 0; - const CURRENT_AS_SELF = 16; - const KEY_MODE_MASK = 3840; - const KEY_AS_PATHNAME = 0; - const FOLLOW_SYMLINKS = 512; - const KEY_AS_FILENAME = 256; - const NEW_CURRENT_AND_KEY = 256; - const OTHER_MODE_MASK = 12288; - const SKIP_DOTS = 4096; - const UNIX_PATHS = 8192; - - - /** - * (PHP 5 >= 5.3.0)
- * Constructs a new filesystem iterator - * @link http://php.net/manual/en/filesystemiterator.construct.php - * @param string $path

- * The path of the filesystem item to be iterated over. - *

- * @param int $flags [optional]

- * Flags may be provided which will affect the behavior of some methods. - * A list of the flags can found under FilesystemIterator predefined constants. - * They can also be set later with FilesystemIterator::setFlags - *

- */ - public function __construct ($path, $flags = 'FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS') {} - - /** - * (PHP 5 >= 5.3.0)
- * Rewinds back to the beginning - * @link http://php.net/manual/en/filesystemiterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.3.0)
- * Move to the next file - * @link http://php.net/manual/en/filesystemiterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.3.0)
- * Retrieve the key for the current file - * @link http://php.net/manual/en/filesystemiterator.key.php - * @return string the pathname or filename depending on the set flags. - * See the FilesystemIterator constants. - */ - public function key () {} - - /** - * (PHP 5 >= 5.3.0)
- * The current file - * @link http://php.net/manual/en/filesystemiterator.current.php - * @return mixed The filename, file information, or $this depending on the set flags. - * See the FilesystemIterator constants. - */ - public function current () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get the handling flags - * @link http://php.net/manual/en/filesystemiterator.getflags.php - * @return int The integer value of the set flags. - */ - public function getFlags () {} - - /** - * (PHP 5 >= 5.3.0)
- * Sets handling flags - * @link http://php.net/manual/en/filesystemiterator.setflags.php - * @param int $flags [optional]

- * The handling flags to set. - * See the FilesystemIterator constants. - *

- * @return void No value is returned. - */ - public function setFlags ($flags = null) {} - - /** - * (PHP 5)
- * Return file name of current DirectoryIterator item. - * @link http://php.net/manual/en/directoryiterator.getfilename.php - * @return string the file name of the current DirectoryIterator item. - */ - public function getFilename () {} - - /** - * (PHP 5 >= 5.3.6)
- * Gets the file extension - * @link http://php.net/manual/en/directoryiterator.getextension.php - * @return string a string containing the file extension, or an - * empty string if the file has no extension. - */ - public function getExtension () {} - - /** - * (PHP 5 >= 5.2.2)
- * Get base name of current DirectoryIterator item. - * @link http://php.net/manual/en/directoryiterator.getbasename.php - * @param string $suffix [optional]

- * If the base name ends in suffix, - * this will be cut. - *

- * @return string The base name of the current DirectoryIterator item. - */ - public function getBasename ($suffix = null) {} - - /** - * (PHP 5)
- * Determine if current DirectoryIterator item is '.' or '..' - * @link http://php.net/manual/en/directoryiterator.isdot.php - * @return bool TRUE if the entry is . or .., - * otherwise FALSE - */ - public function isDot () {} - - /** - * (PHP 5)
- * Check whether current DirectoryIterator position is a valid file - * @link http://php.net/manual/en/directoryiterator.valid.php - * @return bool TRUE if the position is valid, otherwise FALSE - */ - public function valid () {} - - /** - * (PHP 5 >= 5.3.0)
- * Seek to a DirectoryIterator item - * @link http://php.net/manual/en/directoryiterator.seek.php - * @param int $position

- * The zero-based numeric position to seek to. - *

- * @return void No value is returned. - */ - public function seek ($position) {} - - /** - * (PHP 5)
- * Get file name as a string - * @link http://php.net/manual/en/directoryiterator.tostring.php - * @return string the file name of the current DirectoryIterator item. - */ - public function __toString () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the path without filename - * @link http://php.net/manual/en/splfileinfo.getpath.php - * @return string the path to the file. - */ - public function getPath () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the path to the file - * @link http://php.net/manual/en/splfileinfo.getpathname.php - * @return string The path to the file. - */ - public function getPathname () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file permissions - * @link http://php.net/manual/en/splfileinfo.getperms.php - * @return int the file permissions. - */ - public function getPerms () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the inode for the file - * @link http://php.net/manual/en/splfileinfo.getinode.php - * @return int the inode number for the filesystem object. - */ - public function getInode () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file size - * @link http://php.net/manual/en/splfileinfo.getsize.php - * @return int The filesize in bytes. - */ - public function getSize () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the owner of the file - * @link http://php.net/manual/en/splfileinfo.getowner.php - * @return int The owner id in numerical format. - */ - public function getOwner () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the file group - * @link http://php.net/manual/en/splfileinfo.getgroup.php - * @return int The group id in numerical format. - */ - public function getGroup () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets last access time of the file - * @link http://php.net/manual/en/splfileinfo.getatime.php - * @return int the time the file was last accessed. - */ - public function getATime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the last modified time - * @link http://php.net/manual/en/splfileinfo.getmtime.php - * @return int the last modified time for the file, in a Unix timestamp. - */ - public function getMTime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the inode change time - * @link http://php.net/manual/en/splfileinfo.getctime.php - * @return int The last change time, in a Unix timestamp. - */ - public function getCTime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file type - * @link http://php.net/manual/en/splfileinfo.gettype.php - * @return string A string representing the type of the entry. - * May be one of file, link, - * or dir - */ - public function getType () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the entry is writable - * @link http://php.net/manual/en/splfileinfo.iswritable.php - * @return bool TRUE if writable, FALSE otherwise; - */ - public function isWritable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if file is readable - * @link http://php.net/manual/en/splfileinfo.isreadable.php - * @return bool TRUE if readable, FALSE otherwise. - */ - public function isReadable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is executable - * @link http://php.net/manual/en/splfileinfo.isexecutable.php - * @return bool TRUE if executable, FALSE otherwise. - */ - public function isExecutable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the object references a regular file - * @link http://php.net/manual/en/splfileinfo.isfile.php - * @return bool TRUE if the file exists and is a regular file (not a link), FALSE otherwise. - */ - public function isFile () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is a directory - * @link http://php.net/manual/en/splfileinfo.isdir.php - * @return bool TRUE if a directory, FALSE otherwise. - */ - public function isDir () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is a link - * @link http://php.net/manual/en/splfileinfo.islink.php - * @return bool TRUE if the file is a link, FALSE otherwise. - */ - public function isLink () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets the target of a link - * @link http://php.net/manual/en/splfileinfo.getlinktarget.php - * @return string the target of the filesystem link. - */ - public function getLinkTarget () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets absolute path to file - * @link http://php.net/manual/en/splfileinfo.getrealpath.php - * @return string the path to the file. - */ - public function getRealPath () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileInfo object for the file - * @link http://php.net/manual/en/splfileinfo.getfileinfo.php - * @param string $class_name [optional]

- * Name of an SplFileInfo derived class to use. - *

- * @return SplFileInfo An SplFileInfo object created for the file. - */ - public function getFileInfo ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileInfo object for the path - * @link http://php.net/manual/en/splfileinfo.getpathinfo.php - * @param string $class_name [optional]

- * Name of an SplFileInfo derived class to use. - *

- * @return SplFileInfo an SplFileInfo object for the parent path of the file. - */ - public function getPathInfo ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileObject object for the file - * @link http://php.net/manual/en/splfileinfo.openfile.php - * @param string $open_mode [optional]

- * The mode for opening the file. See the fopen - * documentation for descriptions of possible modes. The default - * is read only. - *

- * @param bool $use_include_path [optional]

- * When set to TRUE, the filename is also - * searched for within the include_path - *

- * @param resource $context [optional]

- * Refer to the context - * section of the manual for a description of contexts. - *

- * @return SplFileObject The opened file as an SplFileObject object. - */ - public function openFile ($open_mode = 'r', $use_include_path = false, $context = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets the class name used with SplFileInfo::openFile - * @link http://php.net/manual/en/splfileinfo.setfileclass.php - * @param string $class_name [optional]

- * The class name to use when openFile() is called. - *

- * @return void No value is returned. - */ - public function setFileClass ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets the class used with getFileInfo and getPathInfo - * @link http://php.net/manual/en/splfileinfo.setinfoclass.php - * @param string $class_name [optional]

- * The class name to use. - *

- * @return void No value is returned. - */ - public function setInfoClass ($class_name = null) {} - - final public function _bad_state_ex () {} - -} - -/** - * The RecursiveDirectoryIterator provides - * an interface for iterating recursively over filesystem directories. - * @link http://php.net/manual/en/class.recursivedirectoryiterator.php - */ -class RecursiveDirectoryIterator extends FilesystemIterator implements Iterator, Traversable, SeekableIterator, RecursiveIterator { - const CURRENT_MODE_MASK = 240; - const CURRENT_AS_PATHNAME = 32; - const CURRENT_AS_FILEINFO = 0; - const CURRENT_AS_SELF = 16; - const KEY_MODE_MASK = 3840; - const KEY_AS_PATHNAME = 0; - const FOLLOW_SYMLINKS = 512; - const KEY_AS_FILENAME = 256; - const NEW_CURRENT_AND_KEY = 256; - const OTHER_MODE_MASK = 12288; - const SKIP_DOTS = 4096; - const UNIX_PATHS = 8192; - - - /** - * (PHP 5 >= 5.1.2)
- * Constructs a RecursiveDirectoryIterator - * @link http://php.net/manual/en/recursivedirectoryiterator.construct.php - * @param string $path

- * The path of the directory to be iterated over. - *

- * @param int $flags [optional]

- * Flags may be provided which will affect the behavior of some methods. - * A list of the flags can found under - * FilesystemIterator predefined constants. - * They can also be set later with FilesystemIterator::setFlags. - *

- */ - public function __construct ($path, $flags = 'FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO') {} - - /** - * (PHP 5)
- * Returns whether current entry is a directory and not '.' or '..' - * @link http://php.net/manual/en/recursivedirectoryiterator.haschildren.php - * @param bool $allow_links [optional]

- *

- * @return bool whether the current entry is a directory, but not '.' or '..' - */ - public function hasChildren ($allow_links = false) {} - - /** - * (PHP 5 >= 5.1.0)
- * Returns an iterator for the current entry if it is a directory - * @link http://php.net/manual/en/recursivedirectoryiterator.getchildren.php - * @return mixed The filename, file information, or $this depending on the set flags. - * See the FilesystemIterator - * constants. - */ - public function getChildren () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get sub path - * @link http://php.net/manual/en/recursivedirectoryiterator.getsubpath.php - * @return string The sub path (sub directory). - */ - public function getSubPath () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get sub path and name - * @link http://php.net/manual/en/recursivedirectoryiterator.getsubpathname.php - * @return string The sub path (sub directory) and filename. - */ - public function getSubPathname () {} - - /** - * (PHP 5 >= 5.3.0)
- * Rewinds back to the beginning - * @link http://php.net/manual/en/filesystemiterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.3.0)
- * Move to the next file - * @link http://php.net/manual/en/filesystemiterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.3.0)
- * Retrieve the key for the current file - * @link http://php.net/manual/en/filesystemiterator.key.php - * @return string the pathname or filename depending on the set flags. - * See the FilesystemIterator constants. - */ - public function key () {} - - /** - * (PHP 5 >= 5.3.0)
- * The current file - * @link http://php.net/manual/en/filesystemiterator.current.php - * @return mixed The filename, file information, or $this depending on the set flags. - * See the FilesystemIterator constants. - */ - public function current () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get the handling flags - * @link http://php.net/manual/en/filesystemiterator.getflags.php - * @return int The integer value of the set flags. - */ - public function getFlags () {} - - /** - * (PHP 5 >= 5.3.0)
- * Sets handling flags - * @link http://php.net/manual/en/filesystemiterator.setflags.php - * @param int $flags [optional]

- * The handling flags to set. - * See the FilesystemIterator constants. - *

- * @return void No value is returned. - */ - public function setFlags ($flags = null) {} - - /** - * (PHP 5)
- * Return file name of current DirectoryIterator item. - * @link http://php.net/manual/en/directoryiterator.getfilename.php - * @return string the file name of the current DirectoryIterator item. - */ - public function getFilename () {} - - /** - * (PHP 5 >= 5.3.6)
- * Gets the file extension - * @link http://php.net/manual/en/directoryiterator.getextension.php - * @return string a string containing the file extension, or an - * empty string if the file has no extension. - */ - public function getExtension () {} - - /** - * (PHP 5 >= 5.2.2)
- * Get base name of current DirectoryIterator item. - * @link http://php.net/manual/en/directoryiterator.getbasename.php - * @param string $suffix [optional]

- * If the base name ends in suffix, - * this will be cut. - *

- * @return string The base name of the current DirectoryIterator item. - */ - public function getBasename ($suffix = null) {} - - /** - * (PHP 5)
- * Determine if current DirectoryIterator item is '.' or '..' - * @link http://php.net/manual/en/directoryiterator.isdot.php - * @return bool TRUE if the entry is . or .., - * otherwise FALSE - */ - public function isDot () {} - - /** - * (PHP 5)
- * Check whether current DirectoryIterator position is a valid file - * @link http://php.net/manual/en/directoryiterator.valid.php - * @return bool TRUE if the position is valid, otherwise FALSE - */ - public function valid () {} - - /** - * (PHP 5 >= 5.3.0)
- * Seek to a DirectoryIterator item - * @link http://php.net/manual/en/directoryiterator.seek.php - * @param int $position

- * The zero-based numeric position to seek to. - *

- * @return void No value is returned. - */ - public function seek ($position) {} - - /** - * (PHP 5)
- * Get file name as a string - * @link http://php.net/manual/en/directoryiterator.tostring.php - * @return string the file name of the current DirectoryIterator item. - */ - public function __toString () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the path without filename - * @link http://php.net/manual/en/splfileinfo.getpath.php - * @return string the path to the file. - */ - public function getPath () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the path to the file - * @link http://php.net/manual/en/splfileinfo.getpathname.php - * @return string The path to the file. - */ - public function getPathname () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file permissions - * @link http://php.net/manual/en/splfileinfo.getperms.php - * @return int the file permissions. - */ - public function getPerms () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the inode for the file - * @link http://php.net/manual/en/splfileinfo.getinode.php - * @return int the inode number for the filesystem object. - */ - public function getInode () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file size - * @link http://php.net/manual/en/splfileinfo.getsize.php - * @return int The filesize in bytes. - */ - public function getSize () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the owner of the file - * @link http://php.net/manual/en/splfileinfo.getowner.php - * @return int The owner id in numerical format. - */ - public function getOwner () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the file group - * @link http://php.net/manual/en/splfileinfo.getgroup.php - * @return int The group id in numerical format. - */ - public function getGroup () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets last access time of the file - * @link http://php.net/manual/en/splfileinfo.getatime.php - * @return int the time the file was last accessed. - */ - public function getATime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the last modified time - * @link http://php.net/manual/en/splfileinfo.getmtime.php - * @return int the last modified time for the file, in a Unix timestamp. - */ - public function getMTime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the inode change time - * @link http://php.net/manual/en/splfileinfo.getctime.php - * @return int The last change time, in a Unix timestamp. - */ - public function getCTime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file type - * @link http://php.net/manual/en/splfileinfo.gettype.php - * @return string A string representing the type of the entry. - * May be one of file, link, - * or dir - */ - public function getType () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the entry is writable - * @link http://php.net/manual/en/splfileinfo.iswritable.php - * @return bool TRUE if writable, FALSE otherwise; - */ - public function isWritable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if file is readable - * @link http://php.net/manual/en/splfileinfo.isreadable.php - * @return bool TRUE if readable, FALSE otherwise. - */ - public function isReadable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is executable - * @link http://php.net/manual/en/splfileinfo.isexecutable.php - * @return bool TRUE if executable, FALSE otherwise. - */ - public function isExecutable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the object references a regular file - * @link http://php.net/manual/en/splfileinfo.isfile.php - * @return bool TRUE if the file exists and is a regular file (not a link), FALSE otherwise. - */ - public function isFile () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is a directory - * @link http://php.net/manual/en/splfileinfo.isdir.php - * @return bool TRUE if a directory, FALSE otherwise. - */ - public function isDir () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is a link - * @link http://php.net/manual/en/splfileinfo.islink.php - * @return bool TRUE if the file is a link, FALSE otherwise. - */ - public function isLink () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets the target of a link - * @link http://php.net/manual/en/splfileinfo.getlinktarget.php - * @return string the target of the filesystem link. - */ - public function getLinkTarget () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets absolute path to file - * @link http://php.net/manual/en/splfileinfo.getrealpath.php - * @return string the path to the file. - */ - public function getRealPath () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileInfo object for the file - * @link http://php.net/manual/en/splfileinfo.getfileinfo.php - * @param string $class_name [optional]

- * Name of an SplFileInfo derived class to use. - *

- * @return SplFileInfo An SplFileInfo object created for the file. - */ - public function getFileInfo ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileInfo object for the path - * @link http://php.net/manual/en/splfileinfo.getpathinfo.php - * @param string $class_name [optional]

- * Name of an SplFileInfo derived class to use. - *

- * @return SplFileInfo an SplFileInfo object for the parent path of the file. - */ - public function getPathInfo ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileObject object for the file - * @link http://php.net/manual/en/splfileinfo.openfile.php - * @param string $open_mode [optional]

- * The mode for opening the file. See the fopen - * documentation for descriptions of possible modes. The default - * is read only. - *

- * @param bool $use_include_path [optional]

- * When set to TRUE, the filename is also - * searched for within the include_path - *

- * @param resource $context [optional]

- * Refer to the context - * section of the manual for a description of contexts. - *

- * @return SplFileObject The opened file as an SplFileObject object. - */ - public function openFile ($open_mode = 'r', $use_include_path = false, $context = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets the class name used with SplFileInfo::openFile - * @link http://php.net/manual/en/splfileinfo.setfileclass.php - * @param string $class_name [optional]

- * The class name to use when openFile() is called. - *

- * @return void No value is returned. - */ - public function setFileClass ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets the class used with getFileInfo and getPathInfo - * @link http://php.net/manual/en/splfileinfo.setinfoclass.php - * @param string $class_name [optional]

- * The class name to use. - *

- * @return void No value is returned. - */ - public function setInfoClass ($class_name = null) {} - - final public function _bad_state_ex () {} - -} - -/** - * Iterates through a file system in a similar fashion to - * glob. - * @link http://php.net/manual/en/class.globiterator.php - */ -class GlobIterator extends FilesystemIterator implements Iterator, Traversable, SeekableIterator, Countable { - const CURRENT_MODE_MASK = 240; - const CURRENT_AS_PATHNAME = 32; - const CURRENT_AS_FILEINFO = 0; - const CURRENT_AS_SELF = 16; - const KEY_MODE_MASK = 3840; - const KEY_AS_PATHNAME = 0; - const FOLLOW_SYMLINKS = 512; - const KEY_AS_FILENAME = 256; - const NEW_CURRENT_AND_KEY = 256; - const OTHER_MODE_MASK = 12288; - const SKIP_DOTS = 4096; - const UNIX_PATHS = 8192; - - - /** - * (PHP 5 >= 5.3.0)
- * Construct a directory using glob - * @link http://php.net/manual/en/globiterator.construct.php - * @param string $path

- * The path of the directory. - *

- * @param int $flags [optional]

- * Option flags, the flags may be a bitmask of the - * FilesystemIterator constants. - *

- */ - public function __construct ($path, $flags = 'FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO') {} - - /** - * (PHP 5 >= 5.3.0)
- * Get the number of directories and files - * @link http://php.net/manual/en/globiterator.count.php - * @return int The number of returned directories and files, as an - * integer. - */ - public function count () {} - - /** - * (PHP 5 >= 5.3.0)
- * Rewinds back to the beginning - * @link http://php.net/manual/en/filesystemiterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.3.0)
- * Move to the next file - * @link http://php.net/manual/en/filesystemiterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.3.0)
- * Retrieve the key for the current file - * @link http://php.net/manual/en/filesystemiterator.key.php - * @return string the pathname or filename depending on the set flags. - * See the FilesystemIterator constants. - */ - public function key () {} - - /** - * (PHP 5 >= 5.3.0)
- * The current file - * @link http://php.net/manual/en/filesystemiterator.current.php - * @return mixed The filename, file information, or $this depending on the set flags. - * See the FilesystemIterator constants. - */ - public function current () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get the handling flags - * @link http://php.net/manual/en/filesystemiterator.getflags.php - * @return int The integer value of the set flags. - */ - public function getFlags () {} - - /** - * (PHP 5 >= 5.3.0)
- * Sets handling flags - * @link http://php.net/manual/en/filesystemiterator.setflags.php - * @param int $flags [optional]

- * The handling flags to set. - * See the FilesystemIterator constants. - *

- * @return void No value is returned. - */ - public function setFlags ($flags = null) {} - - /** - * (PHP 5)
- * Return file name of current DirectoryIterator item. - * @link http://php.net/manual/en/directoryiterator.getfilename.php - * @return string the file name of the current DirectoryIterator item. - */ - public function getFilename () {} - - /** - * (PHP 5 >= 5.3.6)
- * Gets the file extension - * @link http://php.net/manual/en/directoryiterator.getextension.php - * @return string a string containing the file extension, or an - * empty string if the file has no extension. - */ - public function getExtension () {} - - /** - * (PHP 5 >= 5.2.2)
- * Get base name of current DirectoryIterator item. - * @link http://php.net/manual/en/directoryiterator.getbasename.php - * @param string $suffix [optional]

- * If the base name ends in suffix, - * this will be cut. - *

- * @return string The base name of the current DirectoryIterator item. - */ - public function getBasename ($suffix = null) {} - - /** - * (PHP 5)
- * Determine if current DirectoryIterator item is '.' or '..' - * @link http://php.net/manual/en/directoryiterator.isdot.php - * @return bool TRUE if the entry is . or .., - * otherwise FALSE - */ - public function isDot () {} - - /** - * (PHP 5)
- * Check whether current DirectoryIterator position is a valid file - * @link http://php.net/manual/en/directoryiterator.valid.php - * @return bool TRUE if the position is valid, otherwise FALSE - */ - public function valid () {} - - /** - * (PHP 5 >= 5.3.0)
- * Seek to a DirectoryIterator item - * @link http://php.net/manual/en/directoryiterator.seek.php - * @param int $position

- * The zero-based numeric position to seek to. - *

- * @return void No value is returned. - */ - public function seek ($position) {} - - /** - * (PHP 5)
- * Get file name as a string - * @link http://php.net/manual/en/directoryiterator.tostring.php - * @return string the file name of the current DirectoryIterator item. - */ - public function __toString () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the path without filename - * @link http://php.net/manual/en/splfileinfo.getpath.php - * @return string the path to the file. - */ - public function getPath () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the path to the file - * @link http://php.net/manual/en/splfileinfo.getpathname.php - * @return string The path to the file. - */ - public function getPathname () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file permissions - * @link http://php.net/manual/en/splfileinfo.getperms.php - * @return int the file permissions. - */ - public function getPerms () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the inode for the file - * @link http://php.net/manual/en/splfileinfo.getinode.php - * @return int the inode number for the filesystem object. - */ - public function getInode () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file size - * @link http://php.net/manual/en/splfileinfo.getsize.php - * @return int The filesize in bytes. - */ - public function getSize () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the owner of the file - * @link http://php.net/manual/en/splfileinfo.getowner.php - * @return int The owner id in numerical format. - */ - public function getOwner () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the file group - * @link http://php.net/manual/en/splfileinfo.getgroup.php - * @return int The group id in numerical format. - */ - public function getGroup () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets last access time of the file - * @link http://php.net/manual/en/splfileinfo.getatime.php - * @return int the time the file was last accessed. - */ - public function getATime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the last modified time - * @link http://php.net/manual/en/splfileinfo.getmtime.php - * @return int the last modified time for the file, in a Unix timestamp. - */ - public function getMTime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the inode change time - * @link http://php.net/manual/en/splfileinfo.getctime.php - * @return int The last change time, in a Unix timestamp. - */ - public function getCTime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file type - * @link http://php.net/manual/en/splfileinfo.gettype.php - * @return string A string representing the type of the entry. - * May be one of file, link, - * or dir - */ - public function getType () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the entry is writable - * @link http://php.net/manual/en/splfileinfo.iswritable.php - * @return bool TRUE if writable, FALSE otherwise; - */ - public function isWritable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if file is readable - * @link http://php.net/manual/en/splfileinfo.isreadable.php - * @return bool TRUE if readable, FALSE otherwise. - */ - public function isReadable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is executable - * @link http://php.net/manual/en/splfileinfo.isexecutable.php - * @return bool TRUE if executable, FALSE otherwise. - */ - public function isExecutable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the object references a regular file - * @link http://php.net/manual/en/splfileinfo.isfile.php - * @return bool TRUE if the file exists and is a regular file (not a link), FALSE otherwise. - */ - public function isFile () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is a directory - * @link http://php.net/manual/en/splfileinfo.isdir.php - * @return bool TRUE if a directory, FALSE otherwise. - */ - public function isDir () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is a link - * @link http://php.net/manual/en/splfileinfo.islink.php - * @return bool TRUE if the file is a link, FALSE otherwise. - */ - public function isLink () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets the target of a link - * @link http://php.net/manual/en/splfileinfo.getlinktarget.php - * @return string the target of the filesystem link. - */ - public function getLinkTarget () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets absolute path to file - * @link http://php.net/manual/en/splfileinfo.getrealpath.php - * @return string the path to the file. - */ - public function getRealPath () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileInfo object for the file - * @link http://php.net/manual/en/splfileinfo.getfileinfo.php - * @param string $class_name [optional]

- * Name of an SplFileInfo derived class to use. - *

- * @return SplFileInfo An SplFileInfo object created for the file. - */ - public function getFileInfo ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileInfo object for the path - * @link http://php.net/manual/en/splfileinfo.getpathinfo.php - * @param string $class_name [optional]

- * Name of an SplFileInfo derived class to use. - *

- * @return SplFileInfo an SplFileInfo object for the parent path of the file. - */ - public function getPathInfo ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileObject object for the file - * @link http://php.net/manual/en/splfileinfo.openfile.php - * @param string $open_mode [optional]

- * The mode for opening the file. See the fopen - * documentation for descriptions of possible modes. The default - * is read only. - *

- * @param bool $use_include_path [optional]

- * When set to TRUE, the filename is also - * searched for within the include_path - *

- * @param resource $context [optional]

- * Refer to the context - * section of the manual for a description of contexts. - *

- * @return SplFileObject The opened file as an SplFileObject object. - */ - public function openFile ($open_mode = 'r', $use_include_path = false, $context = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets the class name used with SplFileInfo::openFile - * @link http://php.net/manual/en/splfileinfo.setfileclass.php - * @param string $class_name [optional]

- * The class name to use when openFile() is called. - *

- * @return void No value is returned. - */ - public function setFileClass ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets the class used with getFileInfo and getPathInfo - * @link http://php.net/manual/en/splfileinfo.setinfoclass.php - * @param string $class_name [optional]

- * The class name to use. - *

- * @return void No value is returned. - */ - public function setInfoClass ($class_name = null) {} - - final public function _bad_state_ex () {} - -} - -/** - * The SplFileObject class offers an object oriented interface for a file. - * @link http://php.net/manual/en/class.splfileobject.php - */ -class SplFileObject extends SplFileInfo implements RecursiveIterator, Traversable, Iterator, SeekableIterator { - const DROP_NEW_LINE = 1; - const READ_AHEAD = 2; - const SKIP_EMPTY = 4; - const READ_CSV = 8; - - - /** - * (PHP 5 >= 5.1.0)
- * Construct a new file object. - * @link http://php.net/manual/en/splfileobject.construct.php - * @param string $filename

- * The file to read. - *

- * A URL can be used as a - * filename with this function if the fopen wrappers have been enabled. - * See fopen for more details on how to specify the - * filename. See the for links to information - * about what abilities the various wrappers have, notes on their usage, - * and information on any predefined variables they may - * provide. - * @param string $open_mode [optional]

- * The mode in which to open the file. See fopen for a list of allowed modes. - *

- * @param bool $use_include_path [optional]

- * Whether to search in the include_path for filename. - *

- * @param resource $context [optional]

- * A valid context resource created with stream_context_create. - *

- */ - public function __construct ($filename, $open_mode = "r", $use_include_path = false, $context = null) {} - - /** - * (PHP 5 >= 5.1.0)
- * Rewind the file to the first line - * @link http://php.net/manual/en/splfileobject.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.1.0)
- * Reached end of file - * @link http://php.net/manual/en/splfileobject.eof.php - * @return bool TRUE if file is at EOF, FALSE otherwise. - */ - public function eof () {} - - /** - * (PHP 5 >= 5.1.0)
- * Not at EOF - * @link http://php.net/manual/en/splfileobject.valid.php - * @return bool TRUE if not reached EOF, FALSE otherwise. - */ - public function valid () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets line from file - * @link http://php.net/manual/en/splfileobject.fgets.php - * @return string a string containing the next line from the file, or FALSE on error. - */ - public function fgets () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets line from file and parse as CSV fields - * @link http://php.net/manual/en/splfileobject.fgetcsv.php - * @param string $delimiter [optional]

- * The field delimiter (one character only). Defaults as a comma or the value set using SplFileObject::setCsvControl. - *

- * @param string $enclosure [optional]

- * The field enclosure character (one character only). Defaults as a double quotation mark or the value set using SplFileObject::setCsvControl. - *

- * @param string $escape [optional]

- * The escape character (one character only). Defaults as a backslash (\) or the value set using SplFileObject::setCsvControl. - *

- * @return array an indexed array containing the fields read, or FALSE on error. - *

- *

- * A blank line in a CSV file will be returned as an array - * comprising a single NULL field unless using SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE, - * in which case empty lines are skipped. - */ - public function fgetcsv ($delimiter = ",", $enclosure = "\"", $escape = "\\") {} - - /** - * (PHP 5 >= 5.4.0)
- * Write a field array as a CSV line - * @link http://php.net/manual/en/splfileobject.fputcsv.php - * @param array $fields

- * An array of values. - *

- * @param string $delimiter [optional]

- * The optional delimiter parameter sets the field - * delimiter (one character only). - *

- * @param string $enclosure [optional]

- * The optional enclosure parameter sets the field - * enclosure (one character only). - *

- * @return int the length of the written string or FALSE on failure. - *

- *

- * Returns FALSE, and does not write the CSV line to the file, if the - * delimiter or enclosure - * parameter is not a single character. - */ - public function fputcsv (array $fields, $delimiter = ',', $enclosure = '"') {} - - /** - * (PHP 5 >= 5.2.0)
- * Set the delimiter and enclosure character for CSV - * @link http://php.net/manual/en/splfileobject.setcsvcontrol.php - * @param string $delimiter [optional]

- * The field delimiter (one character only). - *

- * @param string $enclosure [optional]

- * The field enclosure character (one character only). - *

- * @param string $escape [optional]

- * The field escape character (one character only). - *

- * @return void No value is returned. - */ - public function setCsvControl ($delimiter = ",", $enclosure = "\"", $escape = "\\") {} - - /** - * (PHP 5 >= 5.2.0)
- * Get the delimiter and enclosure character for CSV - * @link http://php.net/manual/en/splfileobject.getcsvcontrol.php - * @return array an indexed array containing the delimiter and enclosure character. - */ - public function getCsvControl () {} - - /** - * (PHP 5 >= 5.1.0)
- * Portable file locking - * @link http://php.net/manual/en/splfileobject.flock.php - * @param int $operation

- * operation is one of the following: - * LOCK_SH to acquire a shared lock (reader). - * @param int $wouldblock [optional]

- * Set to TRUE if the lock would block (EWOULDBLOCK errno condition). - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function flock ($operation, &$wouldblock = null) {} - - /** - * (PHP 5 >= 5.1.0)
- * Flushes the output to the file - * @link http://php.net/manual/en/splfileobject.fflush.php - * @return bool TRUE on success or FALSE on failure. - */ - public function fflush () {} - - /** - * (PHP 5 >= 5.1.0)
- * Return current file position - * @link http://php.net/manual/en/splfileobject.ftell.php - * @return int the position of the file pointer as an integer, or FALSE on error. - */ - public function ftell () {} - - /** - * (PHP 5 >= 5.1.0)
- * Seek to a position - * @link http://php.net/manual/en/splfileobject.fseek.php - * @param int $offset

- * The offset. A negative value can be used to move backwards through the file which - * is useful when SEEK_END is used as the whence value. - *

- * @param int $whence [optional]

- * whence values are: - * SEEK_SET - Set position equal to offset bytes. - * SEEK_CUR - Set position to current location plus offset. - * SEEK_END - Set position to end-of-file plus offset. - *

- *

- * If whence is not specified, it is assumed to be SEEK_SET. - *

- * @return int 0 if the seek was successful, -1 otherwise. Note that seeking - * past EOF is not considered an error. - */ - public function fseek ($offset, $whence = 'SEEK_SET') {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets character from file - * @link http://php.net/manual/en/splfileobject.fgetc.php - * @return string a string containing a single character read from the file or FALSE on EOF. - */ - public function fgetc () {} - - /** - * (PHP 5 >= 5.1.0)
- * Output all remaining data on a file pointer - * @link http://php.net/manual/en/splfileobject.fpassthru.php - * @return int the number of characters read from handle - * and passed through to the output. - */ - public function fpassthru () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets line from file and strip HTML tags - * @link http://php.net/manual/en/splfileobject.fgetss.php - * @param string $allowable_tags [optional]

- * Optional parameter to specify tags which should not be stripped. - *

- * @return string a string containing the next line of the file with HTML and PHP - * code stripped, or FALSE on error. - */ - public function fgetss ($allowable_tags = null) {} - - /** - * (PHP 5 >= 5.1.0)
- * Parses input from file according to a format - * @link http://php.net/manual/en/splfileobject.fscanf.php - * @param string $format

- * The specified format as described in the sprintf documentation. - *

- * @param mixed $_ [optional]

- * The optional assigned values. - *

- * @return mixed If only one parameter is passed to this method, the values parsed will be - * returned as an array. Otherwise, if optional parameters are passed, the - * function will return the number of assigned values. The optional - * parameters must be passed by reference. - */ - public function fscanf ($format, &$_ = null) {} - - /** - * (PHP 5 >= 5.1.0)
- * Write to file - * @link http://php.net/manual/en/splfileobject.fwrite.php - * @param string $str

- * The string to be written to the file. - *

- * @param int $length [optional]

- * If the length argument is given, writing will - * stop after length bytes have been written or - * the end of string is reached, whichever comes - * first. - *

- * @return int the number of bytes written, or NULL on error. - */ - public function fwrite ($str, $length = null) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets information about the file - * @link http://php.net/manual/en/splfileobject.fstat.php - * @return array an array with the statistics of the file; the format of the array - * is described in detail on the stat manual page. - */ - public function fstat () {} - - /** - * (PHP 5 >= 5.1.0)
- * Truncates the file to a given length - * @link http://php.net/manual/en/splfileobject.ftruncate.php - * @param int $size

- * The size to truncate to. - *

- *

- * If size is larger than the file it is extended with null bytes. - *

- *

- * If size is smaller than the file, the extra data will be lost. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function ftruncate ($size) {} - - /** - * (PHP 5 >= 5.1.0)
- * Retrieve current line of file - * @link http://php.net/manual/en/splfileobject.current.php - * @return string|array Retrieves the current line of the file. If the SplFileObject::READ_CSV flag is set, this method returns an array containing the current line parsed as CSV data. - */ - public function current () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get line number - * @link http://php.net/manual/en/splfileobject.key.php - * @return int the current line number. - */ - public function key () {} - - /** - * (PHP 5 >= 5.1.0)
- * Read next line - * @link http://php.net/manual/en/splfileobject.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.1.0)
- * Sets flags for the SplFileObject - * @link http://php.net/manual/en/splfileobject.setflags.php - * @param int $flags

- * Bit mask of the flags to set. See - * SplFileObject constants - * for the available flags. - *

- * @return void No value is returned. - */ - public function setFlags ($flags) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets flags for the SplFileObject - * @link http://php.net/manual/en/splfileobject.getflags.php - * @return int an integer representing the flags. - */ - public function getFlags () {} - - /** - * (PHP 5 >= 5.1.0)
- * Set maximum line length - * @link http://php.net/manual/en/splfileobject.setmaxlinelen.php - * @param int $max_len

- * The maximum length of a line. - *

- * @return void No value is returned. - */ - public function setMaxLineLen ($max_len) {} - - /** - * (PHP 5 >= 5.1.0)
- * Get maximum line length - * @link http://php.net/manual/en/splfileobject.getmaxlinelen.php - * @return int the maximum line length if one has been set with - * SplFileObject::setMaxLineLen, default is 0. - */ - public function getMaxLineLen () {} - - /** - * (PHP 5 >= 5.1.2)
- * SplFileObject does not have children - * @link http://php.net/manual/en/splfileobject.haschildren.php - * @return bool FALSE - */ - public function hasChildren () {} - - /** - * (PHP 5 >= 5.1.0)
- * No purpose - * @link http://php.net/manual/en/splfileobject.getchildren.php - * @return void No value is returned. - */ - public function getChildren () {} - - /** - * (PHP 5 >= 5.1.0)
- * Seek to specified line - * @link http://php.net/manual/en/splfileobject.seek.php - * @param int $line_pos

- * The zero-based line number to seek to. - *

- * @return void No value is returned. - */ - public function seek ($line_pos) {} - - /** - * (PHP 5 >= 5.1.2)
- * Alias of SplFileObject::fgets - * @link http://php.net/manual/en/splfileobject.getcurrentline.php - */ - public function getCurrentLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Alias of SplFileObject::current - * @link http://php.net/manual/en/splfileobject.tostring.php - */ - public function __toString () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the path without filename - * @link http://php.net/manual/en/splfileinfo.getpath.php - * @return string the path to the file. - */ - public function getPath () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the filename - * @link http://php.net/manual/en/splfileinfo.getfilename.php - * @return string The filename. - */ - public function getFilename () {} - - /** - * (PHP 5 >= 5.3.6)
- * Gets the file extension - * @link http://php.net/manual/en/splfileinfo.getextension.php - * @return string a string containing the file extension, or an - * empty string if the file has no extension. - */ - public function getExtension () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets the base name of the file - * @link http://php.net/manual/en/splfileinfo.getbasename.php - * @param string $suffix [optional]

- * Optional suffix to omit from the base name returned. - *

- * @return string the base name without path information. - */ - public function getBasename ($suffix = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the path to the file - * @link http://php.net/manual/en/splfileinfo.getpathname.php - * @return string The path to the file. - */ - public function getPathname () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file permissions - * @link http://php.net/manual/en/splfileinfo.getperms.php - * @return int the file permissions. - */ - public function getPerms () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the inode for the file - * @link http://php.net/manual/en/splfileinfo.getinode.php - * @return int the inode number for the filesystem object. - */ - public function getInode () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file size - * @link http://php.net/manual/en/splfileinfo.getsize.php - * @return int The filesize in bytes. - */ - public function getSize () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the owner of the file - * @link http://php.net/manual/en/splfileinfo.getowner.php - * @return int The owner id in numerical format. - */ - public function getOwner () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the file group - * @link http://php.net/manual/en/splfileinfo.getgroup.php - * @return int The group id in numerical format. - */ - public function getGroup () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets last access time of the file - * @link http://php.net/manual/en/splfileinfo.getatime.php - * @return int the time the file was last accessed. - */ - public function getATime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the last modified time - * @link http://php.net/manual/en/splfileinfo.getmtime.php - * @return int the last modified time for the file, in a Unix timestamp. - */ - public function getMTime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the inode change time - * @link http://php.net/manual/en/splfileinfo.getctime.php - * @return int The last change time, in a Unix timestamp. - */ - public function getCTime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file type - * @link http://php.net/manual/en/splfileinfo.gettype.php - * @return string A string representing the type of the entry. - * May be one of file, link, - * or dir - */ - public function getType () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the entry is writable - * @link http://php.net/manual/en/splfileinfo.iswritable.php - * @return bool TRUE if writable, FALSE otherwise; - */ - public function isWritable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if file is readable - * @link http://php.net/manual/en/splfileinfo.isreadable.php - * @return bool TRUE if readable, FALSE otherwise. - */ - public function isReadable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is executable - * @link http://php.net/manual/en/splfileinfo.isexecutable.php - * @return bool TRUE if executable, FALSE otherwise. - */ - public function isExecutable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the object references a regular file - * @link http://php.net/manual/en/splfileinfo.isfile.php - * @return bool TRUE if the file exists and is a regular file (not a link), FALSE otherwise. - */ - public function isFile () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is a directory - * @link http://php.net/manual/en/splfileinfo.isdir.php - * @return bool TRUE if a directory, FALSE otherwise. - */ - public function isDir () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is a link - * @link http://php.net/manual/en/splfileinfo.islink.php - * @return bool TRUE if the file is a link, FALSE otherwise. - */ - public function isLink () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets the target of a link - * @link http://php.net/manual/en/splfileinfo.getlinktarget.php - * @return string the target of the filesystem link. - */ - public function getLinkTarget () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets absolute path to file - * @link http://php.net/manual/en/splfileinfo.getrealpath.php - * @return string the path to the file. - */ - public function getRealPath () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileInfo object for the file - * @link http://php.net/manual/en/splfileinfo.getfileinfo.php - * @param string $class_name [optional]

- * Name of an SplFileInfo derived class to use. - *

- * @return SplFileInfo An SplFileInfo object created for the file. - */ - public function getFileInfo ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileInfo object for the path - * @link http://php.net/manual/en/splfileinfo.getpathinfo.php - * @param string $class_name [optional]

- * Name of an SplFileInfo derived class to use. - *

- * @return SplFileInfo an SplFileInfo object for the parent path of the file. - */ - public function getPathInfo ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileObject object for the file - * @link http://php.net/manual/en/splfileinfo.openfile.php - * @param string $open_mode [optional]

- * The mode for opening the file. See the fopen - * documentation for descriptions of possible modes. The default - * is read only. - *

- * @param bool $use_include_path [optional]

- * When set to TRUE, the filename is also - * searched for within the include_path - *

- * @param resource $context [optional]

- * Refer to the context - * section of the manual for a description of contexts. - *

- * @return SplFileObject The opened file as an SplFileObject object. - */ - public function openFile ($open_mode = 'r', $use_include_path = false, $context = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets the class name used with SplFileInfo::openFile - * @link http://php.net/manual/en/splfileinfo.setfileclass.php - * @param string $class_name [optional]

- * The class name to use when openFile() is called. - *

- * @return void No value is returned. - */ - public function setFileClass ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets the class used with getFileInfo and getPathInfo - * @link http://php.net/manual/en/splfileinfo.setinfoclass.php - * @param string $class_name [optional]

- * The class name to use. - *

- * @return void No value is returned. - */ - public function setInfoClass ($class_name = null) {} - - final public function _bad_state_ex () {} - -} - -/** - * The SplTempFileObject class offers an object oriented interface for a temporary file. - * @link http://php.net/manual/en/class.spltempfileobject.php - */ -class SplTempFileObject extends SplFileObject implements SeekableIterator, Iterator, Traversable, RecursiveIterator { - const DROP_NEW_LINE = 1; - const READ_AHEAD = 2; - const SKIP_EMPTY = 4; - const READ_CSV = 8; - - - /** - * (PHP 5 >= 5.1.2)
- * Construct a new temporary file object - * @link http://php.net/manual/en/spltempfileobject.construct.php - * @param int $max_memory [optional]

- * The maximum amount of memory (in bytes, default is 2 MB) for - * the temporary file to use. If the temporary file exceeds this - * size, it will be moved to a file in the system's temp directory. - *

- *

- * If max_memory is negative, only memory - * will be used. If max_memory is zero, - * no memory will be used. - *

- */ - public function __construct ($max_memory = null) {} - - /** - * (PHP 5 >= 5.1.0)
- * Rewind the file to the first line - * @link http://php.net/manual/en/splfileobject.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.1.0)
- * Reached end of file - * @link http://php.net/manual/en/splfileobject.eof.php - * @return bool TRUE if file is at EOF, FALSE otherwise. - */ - public function eof () {} - - /** - * (PHP 5 >= 5.1.0)
- * Not at EOF - * @link http://php.net/manual/en/splfileobject.valid.php - * @return bool TRUE if not reached EOF, FALSE otherwise. - */ - public function valid () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets line from file - * @link http://php.net/manual/en/splfileobject.fgets.php - * @return string a string containing the next line from the file, or FALSE on error. - */ - public function fgets () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets line from file and parse as CSV fields - * @link http://php.net/manual/en/splfileobject.fgetcsv.php - * @param string $delimiter [optional]

- * The field delimiter (one character only). Defaults as a comma or the value set using SplFileObject::setCsvControl. - *

- * @param string $enclosure [optional]

- * The field enclosure character (one character only). Defaults as a double quotation mark or the value set using SplFileObject::setCsvControl. - *

- * @param string $escape [optional]

- * The escape character (one character only). Defaults as a backslash (\) or the value set using SplFileObject::setCsvControl. - *

- * @return array an indexed array containing the fields read, or FALSE on error. - *

- *

- * A blank line in a CSV file will be returned as an array - * comprising a single NULL field unless using SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE, - * in which case empty lines are skipped. - */ - public function fgetcsv ($delimiter = ",", $enclosure = "\"", $escape = "\\") {} - - /** - * (PHP 5 >= 5.4.0)
- * Write a field array as a CSV line - * @link http://php.net/manual/en/splfileobject.fputcsv.php - * @param array $fields

- * An array of values. - *

- * @param string $delimiter [optional]

- * The optional delimiter parameter sets the field - * delimiter (one character only). - *

- * @param string $enclosure [optional]

- * The optional enclosure parameter sets the field - * enclosure (one character only). - *

- * @return int the length of the written string or FALSE on failure. - *

- *

- * Returns FALSE, and does not write the CSV line to the file, if the - * delimiter or enclosure - * parameter is not a single character. - */ - public function fputcsv (array $fields, $delimiter = ',', $enclosure = '"') {} - - /** - * (PHP 5 >= 5.2.0)
- * Set the delimiter and enclosure character for CSV - * @link http://php.net/manual/en/splfileobject.setcsvcontrol.php - * @param string $delimiter [optional]

- * The field delimiter (one character only). - *

- * @param string $enclosure [optional]

- * The field enclosure character (one character only). - *

- * @param string $escape [optional]

- * The field escape character (one character only). - *

- * @return void No value is returned. - */ - public function setCsvControl ($delimiter = ",", $enclosure = "\"", $escape = "\\") {} - - /** - * (PHP 5 >= 5.2.0)
- * Get the delimiter and enclosure character for CSV - * @link http://php.net/manual/en/splfileobject.getcsvcontrol.php - * @return array an indexed array containing the delimiter and enclosure character. - */ - public function getCsvControl () {} - - /** - * (PHP 5 >= 5.1.0)
- * Portable file locking - * @link http://php.net/manual/en/splfileobject.flock.php - * @param int $operation

- * operation is one of the following: - * LOCK_SH to acquire a shared lock (reader). - * @param int $wouldblock [optional]

- * Set to TRUE if the lock would block (EWOULDBLOCK errno condition). - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function flock ($operation, &$wouldblock = null) {} - - /** - * (PHP 5 >= 5.1.0)
- * Flushes the output to the file - * @link http://php.net/manual/en/splfileobject.fflush.php - * @return bool TRUE on success or FALSE on failure. - */ - public function fflush () {} - - /** - * (PHP 5 >= 5.1.0)
- * Return current file position - * @link http://php.net/manual/en/splfileobject.ftell.php - * @return int the position of the file pointer as an integer, or FALSE on error. - */ - public function ftell () {} - - /** - * (PHP 5 >= 5.1.0)
- * Seek to a position - * @link http://php.net/manual/en/splfileobject.fseek.php - * @param int $offset

- * The offset. A negative value can be used to move backwards through the file which - * is useful when SEEK_END is used as the whence value. - *

- * @param int $whence [optional]

- * whence values are: - * SEEK_SET - Set position equal to offset bytes. - * SEEK_CUR - Set position to current location plus offset. - * SEEK_END - Set position to end-of-file plus offset. - *

- *

- * If whence is not specified, it is assumed to be SEEK_SET. - *

- * @return int 0 if the seek was successful, -1 otherwise. Note that seeking - * past EOF is not considered an error. - */ - public function fseek ($offset, $whence = 'SEEK_SET') {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets character from file - * @link http://php.net/manual/en/splfileobject.fgetc.php - * @return string a string containing a single character read from the file or FALSE on EOF. - */ - public function fgetc () {} - - /** - * (PHP 5 >= 5.1.0)
- * Output all remaining data on a file pointer - * @link http://php.net/manual/en/splfileobject.fpassthru.php - * @return int the number of characters read from handle - * and passed through to the output. - */ - public function fpassthru () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets line from file and strip HTML tags - * @link http://php.net/manual/en/splfileobject.fgetss.php - * @param string $allowable_tags [optional]

- * Optional parameter to specify tags which should not be stripped. - *

- * @return string a string containing the next line of the file with HTML and PHP - * code stripped, or FALSE on error. - */ - public function fgetss ($allowable_tags = null) {} - - /** - * (PHP 5 >= 5.1.0)
- * Parses input from file according to a format - * @link http://php.net/manual/en/splfileobject.fscanf.php - * @param string $format

- * The specified format as described in the sprintf documentation. - *

- * @param mixed $_ [optional]

- * The optional assigned values. - *

- * @return mixed If only one parameter is passed to this method, the values parsed will be - * returned as an array. Otherwise, if optional parameters are passed, the - * function will return the number of assigned values. The optional - * parameters must be passed by reference. - */ - public function fscanf ($format, &$_ = null) {} - - /** - * (PHP 5 >= 5.1.0)
- * Write to file - * @link http://php.net/manual/en/splfileobject.fwrite.php - * @param string $str

- * The string to be written to the file. - *

- * @param int $length [optional]

- * If the length argument is given, writing will - * stop after length bytes have been written or - * the end of string is reached, whichever comes - * first. - *

- * @return int the number of bytes written, or NULL on error. - */ - public function fwrite ($str, $length = null) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets information about the file - * @link http://php.net/manual/en/splfileobject.fstat.php - * @return array an array with the statistics of the file; the format of the array - * is described in detail on the stat manual page. - */ - public function fstat () {} - - /** - * (PHP 5 >= 5.1.0)
- * Truncates the file to a given length - * @link http://php.net/manual/en/splfileobject.ftruncate.php - * @param int $size

- * The size to truncate to. - *

- *

- * If size is larger than the file it is extended with null bytes. - *

- *

- * If size is smaller than the file, the extra data will be lost. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function ftruncate ($size) {} - - /** - * (PHP 5 >= 5.1.0)
- * Retrieve current line of file - * @link http://php.net/manual/en/splfileobject.current.php - * @return string|array Retrieves the current line of the file. If the SplFileObject::READ_CSV flag is set, this method returns an array containing the current line parsed as CSV data. - */ - public function current () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get line number - * @link http://php.net/manual/en/splfileobject.key.php - * @return int the current line number. - */ - public function key () {} - - /** - * (PHP 5 >= 5.1.0)
- * Read next line - * @link http://php.net/manual/en/splfileobject.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.1.0)
- * Sets flags for the SplFileObject - * @link http://php.net/manual/en/splfileobject.setflags.php - * @param int $flags

- * Bit mask of the flags to set. See - * SplFileObject constants - * for the available flags. - *

- * @return void No value is returned. - */ - public function setFlags ($flags) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets flags for the SplFileObject - * @link http://php.net/manual/en/splfileobject.getflags.php - * @return int an integer representing the flags. - */ - public function getFlags () {} - - /** - * (PHP 5 >= 5.1.0)
- * Set maximum line length - * @link http://php.net/manual/en/splfileobject.setmaxlinelen.php - * @param int $max_len

- * The maximum length of a line. - *

- * @return void No value is returned. - */ - public function setMaxLineLen ($max_len) {} - - /** - * (PHP 5 >= 5.1.0)
- * Get maximum line length - * @link http://php.net/manual/en/splfileobject.getmaxlinelen.php - * @return int the maximum line length if one has been set with - * SplFileObject::setMaxLineLen, default is 0. - */ - public function getMaxLineLen () {} - - /** - * (PHP 5 >= 5.1.2)
- * SplFileObject does not have children - * @link http://php.net/manual/en/splfileobject.haschildren.php - * @return bool FALSE - */ - public function hasChildren () {} - - /** - * (PHP 5 >= 5.1.0)
- * No purpose - * @link http://php.net/manual/en/splfileobject.getchildren.php - * @return void No value is returned. - */ - public function getChildren () {} - - /** - * (PHP 5 >= 5.1.0)
- * Seek to specified line - * @link http://php.net/manual/en/splfileobject.seek.php - * @param int $line_pos

- * The zero-based line number to seek to. - *

- * @return void No value is returned. - */ - public function seek ($line_pos) {} - - /** - * (PHP 5 >= 5.1.2)
- * Alias of SplFileObject::fgets - * @link http://php.net/manual/en/splfileobject.getcurrentline.php - */ - public function getCurrentLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Alias of SplFileObject::current - * @link http://php.net/manual/en/splfileobject.tostring.php - */ - public function __toString () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the path without filename - * @link http://php.net/manual/en/splfileinfo.getpath.php - * @return string the path to the file. - */ - public function getPath () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the filename - * @link http://php.net/manual/en/splfileinfo.getfilename.php - * @return string The filename. - */ - public function getFilename () {} - - /** - * (PHP 5 >= 5.3.6)
- * Gets the file extension - * @link http://php.net/manual/en/splfileinfo.getextension.php - * @return string a string containing the file extension, or an - * empty string if the file has no extension. - */ - public function getExtension () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets the base name of the file - * @link http://php.net/manual/en/splfileinfo.getbasename.php - * @param string $suffix [optional]

- * Optional suffix to omit from the base name returned. - *

- * @return string the base name without path information. - */ - public function getBasename ($suffix = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the path to the file - * @link http://php.net/manual/en/splfileinfo.getpathname.php - * @return string The path to the file. - */ - public function getPathname () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file permissions - * @link http://php.net/manual/en/splfileinfo.getperms.php - * @return int the file permissions. - */ - public function getPerms () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the inode for the file - * @link http://php.net/manual/en/splfileinfo.getinode.php - * @return int the inode number for the filesystem object. - */ - public function getInode () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file size - * @link http://php.net/manual/en/splfileinfo.getsize.php - * @return int The filesize in bytes. - */ - public function getSize () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the owner of the file - * @link http://php.net/manual/en/splfileinfo.getowner.php - * @return int The owner id in numerical format. - */ - public function getOwner () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the file group - * @link http://php.net/manual/en/splfileinfo.getgroup.php - * @return int The group id in numerical format. - */ - public function getGroup () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets last access time of the file - * @link http://php.net/manual/en/splfileinfo.getatime.php - * @return int the time the file was last accessed. - */ - public function getATime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the last modified time - * @link http://php.net/manual/en/splfileinfo.getmtime.php - * @return int the last modified time for the file, in a Unix timestamp. - */ - public function getMTime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets the inode change time - * @link http://php.net/manual/en/splfileinfo.getctime.php - * @return int The last change time, in a Unix timestamp. - */ - public function getCTime () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets file type - * @link http://php.net/manual/en/splfileinfo.gettype.php - * @return string A string representing the type of the entry. - * May be one of file, link, - * or dir - */ - public function getType () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the entry is writable - * @link http://php.net/manual/en/splfileinfo.iswritable.php - * @return bool TRUE if writable, FALSE otherwise; - */ - public function isWritable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if file is readable - * @link http://php.net/manual/en/splfileinfo.isreadable.php - * @return bool TRUE if readable, FALSE otherwise. - */ - public function isReadable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is executable - * @link http://php.net/manual/en/splfileinfo.isexecutable.php - * @return bool TRUE if executable, FALSE otherwise. - */ - public function isExecutable () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the object references a regular file - * @link http://php.net/manual/en/splfileinfo.isfile.php - * @return bool TRUE if the file exists and is a regular file (not a link), FALSE otherwise. - */ - public function isFile () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is a directory - * @link http://php.net/manual/en/splfileinfo.isdir.php - * @return bool TRUE if a directory, FALSE otherwise. - */ - public function isDir () {} - - /** - * (PHP 5 >= 5.1.2)
- * Tells if the file is a link - * @link http://php.net/manual/en/splfileinfo.islink.php - * @return bool TRUE if the file is a link, FALSE otherwise. - */ - public function isLink () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets the target of a link - * @link http://php.net/manual/en/splfileinfo.getlinktarget.php - * @return string the target of the filesystem link. - */ - public function getLinkTarget () {} - - /** - * (PHP 5 >= 5.2.2)
- * Gets absolute path to file - * @link http://php.net/manual/en/splfileinfo.getrealpath.php - * @return string the path to the file. - */ - public function getRealPath () {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileInfo object for the file - * @link http://php.net/manual/en/splfileinfo.getfileinfo.php - * @param string $class_name [optional]

- * Name of an SplFileInfo derived class to use. - *

- * @return SplFileInfo An SplFileInfo object created for the file. - */ - public function getFileInfo ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileInfo object for the path - * @link http://php.net/manual/en/splfileinfo.getpathinfo.php - * @param string $class_name [optional]

- * Name of an SplFileInfo derived class to use. - *

- * @return SplFileInfo an SplFileInfo object for the parent path of the file. - */ - public function getPathInfo ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Gets an SplFileObject object for the file - * @link http://php.net/manual/en/splfileinfo.openfile.php - * @param string $open_mode [optional]

- * The mode for opening the file. See the fopen - * documentation for descriptions of possible modes. The default - * is read only. - *

- * @param bool $use_include_path [optional]

- * When set to TRUE, the filename is also - * searched for within the include_path - *

- * @param resource $context [optional]

- * Refer to the context - * section of the manual for a description of contexts. - *

- * @return SplFileObject The opened file as an SplFileObject object. - */ - public function openFile ($open_mode = 'r', $use_include_path = false, $context = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets the class name used with SplFileInfo::openFile - * @link http://php.net/manual/en/splfileinfo.setfileclass.php - * @param string $class_name [optional]

- * The class name to use when openFile() is called. - *

- * @return void No value is returned. - */ - public function setFileClass ($class_name = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets the class used with getFileInfo and getPathInfo - * @link http://php.net/manual/en/splfileinfo.setinfoclass.php - * @param string $class_name [optional]

- * The class name to use. - *

- * @return void No value is returned. - */ - public function setInfoClass ($class_name = null) {} - - final public function _bad_state_ex () {} - -} - -/** - * The SplDoublyLinkedList class provides the main functionalities of a doubly linked list. - * @link http://php.net/manual/en/class.spldoublylinkedlist.php - */ -class SplDoublyLinkedList implements Iterator, Traversable, Countable, ArrayAccess, Serializable { - const IT_MODE_LIFO = 2; - const IT_MODE_FIFO = 0; - const IT_MODE_DELETE = 1; - const IT_MODE_KEEP = 0; - - - /** - * (PHP 5 >= 5.3.0)
- * Pops a node from the end of the doubly linked list - * @link http://php.net/manual/en/spldoublylinkedlist.pop.php - * @return mixed The value of the popped node. - */ - public function pop () {} - - /** - * (PHP 5 >= 5.3.0)
- * Shifts a node from the beginning of the doubly linked list - * @link http://php.net/manual/en/spldoublylinkedlist.shift.php - * @return mixed The value of the shifted node. - */ - public function shift () {} - - /** - * (PHP 5 >= 5.3.0)
- * Pushes an element at the end of the doubly linked list - * @link http://php.net/manual/en/spldoublylinkedlist.push.php - * @param mixed $value

- * The value to push. - *

- * @return void No value is returned. - */ - public function push ($value) {} - - /** - * (PHP 5 >= 5.3.0)
- * Prepends the doubly linked list with an element - * @link http://php.net/manual/en/spldoublylinkedlist.unshift.php - * @param mixed $value

- * The value to unshift. - *

- * @return void No value is returned. - */ - public function unshift ($value) {} - - /** - * (PHP 5 >= 5.3.0)
- * Peeks at the node from the end of the doubly linked list - * @link http://php.net/manual/en/spldoublylinkedlist.top.php - * @return mixed The value of the last node. - */ - public function top () {} - - /** - * (PHP 5 >= 5.3.0)
- * Peeks at the node from the beginning of the doubly linked list - * @link http://php.net/manual/en/spldoublylinkedlist.bottom.php - * @return mixed The value of the first node. - */ - public function bottom () {} - - /** - * (PHP 5 >= 5.3.0)
- * Checks whether the doubly linked list is empty. - * @link http://php.net/manual/en/spldoublylinkedlist.isempty.php - * @return bool whether the doubly linked list is empty. - */ - public function isEmpty () {} - - /** - * (PHP 5 >= 5.3.0)
- * Sets the mode of iteration - * @link http://php.net/manual/en/spldoublylinkedlist.setiteratormode.php - * @param int $mode

- * There are two orthogonal sets of modes that can be set: - *

- * The direction of the iteration (either one or the other): - * SplDoublyLinkedList::IT_MODE_LIFO (Stack style) - * @return void No value is returned. - */ - public function setIteratorMode ($mode) {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns the mode of iteration - * @link http://php.net/manual/en/spldoublylinkedlist.getiteratormode.php - * @return int the different modes and flags that affect the iteration. - */ - public function getIteratorMode () {} - - /** - * (PHP 5 >= 5.3.0)
- * Counts the number of elements in the doubly linked list. - * @link http://php.net/manual/en/spldoublylinkedlist.count.php - * @return int the number of elements in the doubly linked list. - */ - public function count () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns whether the requested $index exists - * @link http://php.net/manual/en/spldoublylinkedlist.offsetexists.php - * @param mixed $index

- * The index being checked. - *

- * @return bool TRUE if the requested index exists, otherwise FALSE - */ - public function offsetExists ($index) {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns the value at the specified $index - * @link http://php.net/manual/en/spldoublylinkedlist.offsetget.php - * @param mixed $index

- * The index with the value. - *

- * @return mixed The value at the specified index. - */ - public function offsetGet ($index) {} - - /** - * (PHP 5 >= 5.3.0)
- * Sets the value at the specified $index to $newval - * @link http://php.net/manual/en/spldoublylinkedlist.offsetset.php - * @param mixed $index

- * The index being set. - *

- * @param mixed $newval

- * The new value for the index. - *

- * @return void No value is returned. - */ - public function offsetSet ($index, $newval) {} - - /** - * (PHP 5 >= 5.3.0)
- * Unsets the value at the specified $index - * @link http://php.net/manual/en/spldoublylinkedlist.offsetunset.php - * @param mixed $index

- * The index being unset. - *

- * @return void No value is returned. - */ - public function offsetUnset ($index) {} - - /** - * (PHP 5 >= 5.3.0)
- * Rewind iterator back to the start - * @link http://php.net/manual/en/spldoublylinkedlist.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.3.0)
- * Return current array entry - * @link http://php.net/manual/en/spldoublylinkedlist.current.php - * @return mixed The current node value. - */ - public function current () {} - - /** - * (PHP 5 >= 5.3.0)
- * Return current node index - * @link http://php.net/manual/en/spldoublylinkedlist.key.php - * @return mixed The current node index. - */ - public function key () {} - - /** - * (PHP 5 >= 5.3.0)
- * Move to next entry - * @link http://php.net/manual/en/spldoublylinkedlist.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.3.0)
- * Move to previous entry - * @link http://php.net/manual/en/spldoublylinkedlist.prev.php - * @return void No value is returned. - */ - public function prev () {} - - /** - * (PHP 5 >= 5.3.0)
- * Check whether the doubly linked list contains more nodes - * @link http://php.net/manual/en/spldoublylinkedlist.valid.php - * @return bool TRUE if the doubly linked list contains any more nodes, FALSE otherwise. - */ - public function valid () {} - - /** - * (PHP 5 >= 5.4.0)
- * Unserializes the storage - * @link http://php.net/manual/en/spldoublylinkedlist.unserialize.php - * @param string $serialized

- * The serialized string. - *

- * @return void No value is returned. - */ - public function unserialize ($serialized) {} - - /** - * (PHP 5 >= 5.4.0)
- * Serializes the storage - * @link http://php.net/manual/en/spldoublylinkedlist.serialize.php - * @return string The serialized string. - */ - public function serialize () {} - -} - -/** - * The SplQueue class provides the main functionalities of a queue implemented using a doubly linked list. - * @link http://php.net/manual/en/class.splqueue.php - */ -class SplQueue extends SplDoublyLinkedList implements Serializable, ArrayAccess, Countable, Traversable, Iterator { - const IT_MODE_LIFO = 2; - const IT_MODE_FIFO = 0; - const IT_MODE_DELETE = 1; - const IT_MODE_KEEP = 0; - - - /** - * (PHP 5 >= 5.3.0)
- * Adds an element to the queue. - * @link http://php.net/manual/en/splqueue.enqueue.php - * @param mixed $value

- * The value to enqueue. - *

- * @return void No value is returned. - */ - public function enqueue ($value) {} - - /** - * (PHP 5 >= 5.3.0)
- * Dequeues a node from the queue - * @link http://php.net/manual/en/splqueue.dequeue.php - * @return mixed The value of the dequeued node. - */ - public function dequeue () {} - - /** - * (PHP 5 >= 5.3.0)
- * Pops a node from the end of the doubly linked list - * @link http://php.net/manual/en/spldoublylinkedlist.pop.php - * @return mixed The value of the popped node. - */ - public function pop () {} - - /** - * (PHP 5 >= 5.3.0)
- * Shifts a node from the beginning of the doubly linked list - * @link http://php.net/manual/en/spldoublylinkedlist.shift.php - * @return mixed The value of the shifted node. - */ - public function shift () {} - - /** - * (PHP 5 >= 5.3.0)
- * Pushes an element at the end of the doubly linked list - * @link http://php.net/manual/en/spldoublylinkedlist.push.php - * @param mixed $value

- * The value to push. - *

- * @return void No value is returned. - */ - public function push ($value) {} - - /** - * (PHP 5 >= 5.3.0)
- * Prepends the doubly linked list with an element - * @link http://php.net/manual/en/spldoublylinkedlist.unshift.php - * @param mixed $value

- * The value to unshift. - *

- * @return void No value is returned. - */ - public function unshift ($value) {} - - /** - * (PHP 5 >= 5.3.0)
- * Peeks at the node from the end of the doubly linked list - * @link http://php.net/manual/en/spldoublylinkedlist.top.php - * @return mixed The value of the last node. - */ - public function top () {} - - /** - * (PHP 5 >= 5.3.0)
- * Peeks at the node from the beginning of the doubly linked list - * @link http://php.net/manual/en/spldoublylinkedlist.bottom.php - * @return mixed The value of the first node. - */ - public function bottom () {} - - /** - * (PHP 5 >= 5.3.0)
- * Checks whether the doubly linked list is empty. - * @link http://php.net/manual/en/spldoublylinkedlist.isempty.php - * @return bool whether the doubly linked list is empty. - */ - public function isEmpty () {} - - /** - * (PHP 5 >= 5.3.0)
- * Sets the mode of iteration - * @link http://php.net/manual/en/spldoublylinkedlist.setiteratormode.php - * @param int $mode

- * There are two orthogonal sets of modes that can be set: - *

- * The direction of the iteration (either one or the other): - * SplDoublyLinkedList::IT_MODE_LIFO (Stack style) - * @return void No value is returned. - */ - public function setIteratorMode ($mode) {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns the mode of iteration - * @link http://php.net/manual/en/spldoublylinkedlist.getiteratormode.php - * @return int the different modes and flags that affect the iteration. - */ - public function getIteratorMode () {} - - /** - * (PHP 5 >= 5.3.0)
- * Counts the number of elements in the doubly linked list. - * @link http://php.net/manual/en/spldoublylinkedlist.count.php - * @return int the number of elements in the doubly linked list. - */ - public function count () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns whether the requested $index exists - * @link http://php.net/manual/en/spldoublylinkedlist.offsetexists.php - * @param mixed $index

- * The index being checked. - *

- * @return bool TRUE if the requested index exists, otherwise FALSE - */ - public function offsetExists ($index) {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns the value at the specified $index - * @link http://php.net/manual/en/spldoublylinkedlist.offsetget.php - * @param mixed $index

- * The index with the value. - *

- * @return mixed The value at the specified index. - */ - public function offsetGet ($index) {} - - /** - * (PHP 5 >= 5.3.0)
- * Sets the value at the specified $index to $newval - * @link http://php.net/manual/en/spldoublylinkedlist.offsetset.php - * @param mixed $index

- * The index being set. - *

- * @param mixed $newval

- * The new value for the index. - *

- * @return void No value is returned. - */ - public function offsetSet ($index, $newval) {} - - /** - * (PHP 5 >= 5.3.0)
- * Unsets the value at the specified $index - * @link http://php.net/manual/en/spldoublylinkedlist.offsetunset.php - * @param mixed $index

- * The index being unset. - *

- * @return void No value is returned. - */ - public function offsetUnset ($index) {} - - /** - * (PHP 5 >= 5.3.0)
- * Rewind iterator back to the start - * @link http://php.net/manual/en/spldoublylinkedlist.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.3.0)
- * Return current array entry - * @link http://php.net/manual/en/spldoublylinkedlist.current.php - * @return mixed The current node value. - */ - public function current () {} - - /** - * (PHP 5 >= 5.3.0)
- * Return current node index - * @link http://php.net/manual/en/spldoublylinkedlist.key.php - * @return mixed The current node index. - */ - public function key () {} - - /** - * (PHP 5 >= 5.3.0)
- * Move to next entry - * @link http://php.net/manual/en/spldoublylinkedlist.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.3.0)
- * Move to previous entry - * @link http://php.net/manual/en/spldoublylinkedlist.prev.php - * @return void No value is returned. - */ - public function prev () {} - - /** - * (PHP 5 >= 5.3.0)
- * Check whether the doubly linked list contains more nodes - * @link http://php.net/manual/en/spldoublylinkedlist.valid.php - * @return bool TRUE if the doubly linked list contains any more nodes, FALSE otherwise. - */ - public function valid () {} - - /** - * (PHP 5 >= 5.4.0)
- * Unserializes the storage - * @link http://php.net/manual/en/spldoublylinkedlist.unserialize.php - * @param string $serialized

- * The serialized string. - *

- * @return void No value is returned. - */ - public function unserialize ($serialized) {} - - /** - * (PHP 5 >= 5.4.0)
- * Serializes the storage - * @link http://php.net/manual/en/spldoublylinkedlist.serialize.php - * @return string The serialized string. - */ - public function serialize () {} - -} - -/** - * The SplStack class provides the main functionalities of a stack implemented using a doubly linked list. - * @link http://php.net/manual/en/class.splstack.php - */ -class SplStack extends SplDoublyLinkedList implements Serializable, ArrayAccess, Countable, Traversable, Iterator { - const IT_MODE_LIFO = 2; - const IT_MODE_FIFO = 0; - const IT_MODE_DELETE = 1; - const IT_MODE_KEEP = 0; - - - /** - * (PHP 5 >= 5.3.0)
- * Pops a node from the end of the doubly linked list - * @link http://php.net/manual/en/spldoublylinkedlist.pop.php - * @return mixed The value of the popped node. - */ - public function pop () {} - - /** - * (PHP 5 >= 5.3.0)
- * Shifts a node from the beginning of the doubly linked list - * @link http://php.net/manual/en/spldoublylinkedlist.shift.php - * @return mixed The value of the shifted node. - */ - public function shift () {} - - /** - * (PHP 5 >= 5.3.0)
- * Pushes an element at the end of the doubly linked list - * @link http://php.net/manual/en/spldoublylinkedlist.push.php - * @param mixed $value

- * The value to push. - *

- * @return void No value is returned. - */ - public function push ($value) {} - - /** - * (PHP 5 >= 5.3.0)
- * Prepends the doubly linked list with an element - * @link http://php.net/manual/en/spldoublylinkedlist.unshift.php - * @param mixed $value

- * The value to unshift. - *

- * @return void No value is returned. - */ - public function unshift ($value) {} - - /** - * (PHP 5 >= 5.3.0)
- * Peeks at the node from the end of the doubly linked list - * @link http://php.net/manual/en/spldoublylinkedlist.top.php - * @return mixed The value of the last node. - */ - public function top () {} - - /** - * (PHP 5 >= 5.3.0)
- * Peeks at the node from the beginning of the doubly linked list - * @link http://php.net/manual/en/spldoublylinkedlist.bottom.php - * @return mixed The value of the first node. - */ - public function bottom () {} - - /** - * (PHP 5 >= 5.3.0)
- * Checks whether the doubly linked list is empty. - * @link http://php.net/manual/en/spldoublylinkedlist.isempty.php - * @return bool whether the doubly linked list is empty. - */ - public function isEmpty () {} - - /** - * (PHP 5 >= 5.3.0)
- * Sets the mode of iteration - * @link http://php.net/manual/en/spldoublylinkedlist.setiteratormode.php - * @param int $mode

- * There are two orthogonal sets of modes that can be set: - *

- * The direction of the iteration (either one or the other): - * SplDoublyLinkedList::IT_MODE_LIFO (Stack style) - * @return void No value is returned. - */ - public function setIteratorMode ($mode) {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns the mode of iteration - * @link http://php.net/manual/en/spldoublylinkedlist.getiteratormode.php - * @return int the different modes and flags that affect the iteration. - */ - public function getIteratorMode () {} - - /** - * (PHP 5 >= 5.3.0)
- * Counts the number of elements in the doubly linked list. - * @link http://php.net/manual/en/spldoublylinkedlist.count.php - * @return int the number of elements in the doubly linked list. - */ - public function count () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns whether the requested $index exists - * @link http://php.net/manual/en/spldoublylinkedlist.offsetexists.php - * @param mixed $index

- * The index being checked. - *

- * @return bool TRUE if the requested index exists, otherwise FALSE - */ - public function offsetExists ($index) {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns the value at the specified $index - * @link http://php.net/manual/en/spldoublylinkedlist.offsetget.php - * @param mixed $index

- * The index with the value. - *

- * @return mixed The value at the specified index. - */ - public function offsetGet ($index) {} - - /** - * (PHP 5 >= 5.3.0)
- * Sets the value at the specified $index to $newval - * @link http://php.net/manual/en/spldoublylinkedlist.offsetset.php - * @param mixed $index

- * The index being set. - *

- * @param mixed $newval

- * The new value for the index. - *

- * @return void No value is returned. - */ - public function offsetSet ($index, $newval) {} - - /** - * (PHP 5 >= 5.3.0)
- * Unsets the value at the specified $index - * @link http://php.net/manual/en/spldoublylinkedlist.offsetunset.php - * @param mixed $index

- * The index being unset. - *

- * @return void No value is returned. - */ - public function offsetUnset ($index) {} - - /** - * (PHP 5 >= 5.3.0)
- * Rewind iterator back to the start - * @link http://php.net/manual/en/spldoublylinkedlist.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.3.0)
- * Return current array entry - * @link http://php.net/manual/en/spldoublylinkedlist.current.php - * @return mixed The current node value. - */ - public function current () {} - - /** - * (PHP 5 >= 5.3.0)
- * Return current node index - * @link http://php.net/manual/en/spldoublylinkedlist.key.php - * @return mixed The current node index. - */ - public function key () {} - - /** - * (PHP 5 >= 5.3.0)
- * Move to next entry - * @link http://php.net/manual/en/spldoublylinkedlist.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.3.0)
- * Move to previous entry - * @link http://php.net/manual/en/spldoublylinkedlist.prev.php - * @return void No value is returned. - */ - public function prev () {} - - /** - * (PHP 5 >= 5.3.0)
- * Check whether the doubly linked list contains more nodes - * @link http://php.net/manual/en/spldoublylinkedlist.valid.php - * @return bool TRUE if the doubly linked list contains any more nodes, FALSE otherwise. - */ - public function valid () {} - - /** - * (PHP 5 >= 5.4.0)
- * Unserializes the storage - * @link http://php.net/manual/en/spldoublylinkedlist.unserialize.php - * @param string $serialized

- * The serialized string. - *

- * @return void No value is returned. - */ - public function unserialize ($serialized) {} - - /** - * (PHP 5 >= 5.4.0)
- * Serializes the storage - * @link http://php.net/manual/en/spldoublylinkedlist.serialize.php - * @return string The serialized string. - */ - public function serialize () {} - -} - -/** - * The SplHeap class provides the main functionalities of a Heap. - * @link http://php.net/manual/en/class.splheap.php - */ -class SplHeap implements Iterator, Traversable, Countable { - - /** - * (PHP 5 >= 5.3.0)
- * Extracts a node from top of the heap and sift up. - * @link http://php.net/manual/en/splheap.extract.php - * @return mixed The value of the extracted node. - */ - public function extract () {} - - /** - * (PHP 5 >= 5.3.0)
- * Inserts an element in the heap by sifting it up. - * @link http://php.net/manual/en/splheap.insert.php - * @param mixed $value

- * The value to insert. - *

- * @return void No value is returned. - */ - public function insert ($value) {} - - /** - * (PHP 5 >= 5.3.0)
- * Peeks at the node from the top of the heap - * @link http://php.net/manual/en/splheap.top.php - * @return mixed The value of the node on the top. - */ - public function top () {} - - /** - * (PHP 5 >= 5.3.0)
- * Counts the number of elements in the heap. - * @link http://php.net/manual/en/splheap.count.php - * @return int the number of elements in the heap. - */ - public function count () {} - - /** - * (PHP 5 >= 5.3.0)
- * Checks whether the heap is empty. - * @link http://php.net/manual/en/splheap.isempty.php - * @return bool whether the heap is empty. - */ - public function isEmpty () {} - - /** - * (PHP 5 >= 5.3.0)
- * Rewind iterator back to the start (no-op) - * @link http://php.net/manual/en/splheap.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.3.0)
- * Return current node pointed by the iterator - * @link http://php.net/manual/en/splheap.current.php - * @return mixed The current node value. - */ - public function current () {} - - /** - * (PHP 5 >= 5.3.0)
- * Return current node index - * @link http://php.net/manual/en/splheap.key.php - * @return mixed The current node index. - */ - public function key () {} - - /** - * (PHP 5 >= 5.3.0)
- * Move to the next node - * @link http://php.net/manual/en/splheap.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.3.0)
- * Check whether the heap contains more nodes - * @link http://php.net/manual/en/splheap.valid.php - * @return bool TRUE if the heap contains any more nodes, FALSE otherwise. - */ - public function valid () {} - - /** - * (PHP 5 >= 5.3.0)
- * Recover from the corrupted state and allow further actions on the heap. - * @link http://php.net/manual/en/splheap.recoverfromcorruption.php - * @return void No value is returned. - */ - public function recoverFromCorruption () {} - - /** - * (PHP 5 >= 5.3.0)
- * Compare elements in order to place them correctly in the heap while sifting up. - * @link http://php.net/manual/en/splheap.compare.php - * @param mixed $value1

- * The value of the first node being compared. - *

- * @param mixed $value2

- * The value of the second node being compared. - *

- * @return int Result of the comparison, positive integer if value1 is greater than value2, 0 if they are equal, negative integer otherwise. - *

- *

- * Having multiple elements with the same value in a Heap is not recommended. They will end up in an arbitrary relative position. - */ - abstract protected function compare ($value1, $value2); - -} - -/** - * The SplMinHeap class provides the main functionalities of a heap, keeping the minimum on the top. - * @link http://php.net/manual/en/class.splminheap.php - */ -class SplMinHeap extends SplHeap implements Countable, Traversable, Iterator { - - /** - * (PHP 5 >= 5.3.0)
- * Compare elements in order to place them correctly in the heap while sifting up. - * @link http://php.net/manual/en/splminheap.compare.php - * @param mixed $value1

- * The value of the first node being compared. - *

- * @param mixed $value2

- * The value of the second node being compared. - *

- * @return int Result of the comparison, positive integer if value1 is lower than value2, 0 if they are equal, negative integer otherwise. - *

- *

- * Having multiple elements with the same value in a Heap is not recommended. They will end up in an arbitrary relative position. - */ - protected function compare ($value1, $value2) {} - - /** - * (PHP 5 >= 5.3.0)
- * Extracts a node from top of the heap and sift up. - * @link http://php.net/manual/en/splheap.extract.php - * @return mixed The value of the extracted node. - */ - public function extract () {} - - /** - * (PHP 5 >= 5.3.0)
- * Inserts an element in the heap by sifting it up. - * @link http://php.net/manual/en/splheap.insert.php - * @param mixed $value

- * The value to insert. - *

- * @return void No value is returned. - */ - public function insert ($value) {} - - /** - * (PHP 5 >= 5.3.0)
- * Peeks at the node from the top of the heap - * @link http://php.net/manual/en/splheap.top.php - * @return mixed The value of the node on the top. - */ - public function top () {} - - /** - * (PHP 5 >= 5.3.0)
- * Counts the number of elements in the heap. - * @link http://php.net/manual/en/splheap.count.php - * @return int the number of elements in the heap. - */ - public function count () {} - - /** - * (PHP 5 >= 5.3.0)
- * Checks whether the heap is empty. - * @link http://php.net/manual/en/splheap.isempty.php - * @return bool whether the heap is empty. - */ - public function isEmpty () {} - - /** - * (PHP 5 >= 5.3.0)
- * Rewind iterator back to the start (no-op) - * @link http://php.net/manual/en/splheap.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.3.0)
- * Return current node pointed by the iterator - * @link http://php.net/manual/en/splheap.current.php - * @return mixed The current node value. - */ - public function current () {} - - /** - * (PHP 5 >= 5.3.0)
- * Return current node index - * @link http://php.net/manual/en/splheap.key.php - * @return mixed The current node index. - */ - public function key () {} - - /** - * (PHP 5 >= 5.3.0)
- * Move to the next node - * @link http://php.net/manual/en/splheap.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.3.0)
- * Check whether the heap contains more nodes - * @link http://php.net/manual/en/splheap.valid.php - * @return bool TRUE if the heap contains any more nodes, FALSE otherwise. - */ - public function valid () {} - - /** - * (PHP 5 >= 5.3.0)
- * Recover from the corrupted state and allow further actions on the heap. - * @link http://php.net/manual/en/splheap.recoverfromcorruption.php - * @return void No value is returned. - */ - public function recoverFromCorruption () {} - -} - -/** - * The SplMaxHeap class provides the main functionalities of a heap, keeping the maximum on the top. - * @link http://php.net/manual/en/class.splmaxheap.php - */ -class SplMaxHeap extends SplHeap implements Countable, Traversable, Iterator { - - /** - * (PHP 5 >= 5.3.0)
- * Compare elements in order to place them correctly in the heap while sifting up. - * @link http://php.net/manual/en/splmaxheap.compare.php - * @param mixed $value1

- * The value of the first node being compared. - *

- * @param mixed $value2

- * The value of the second node being compared. - *

- * @return int Result of the comparison, positive integer if value1 is greater than value2, 0 if they are equal, negative integer otherwise. - *

- *

- * Having multiple elements with the same value in a Heap is not recommended. They will end up in an arbitrary relative position. - */ - protected function compare ($value1, $value2) {} - - /** - * (PHP 5 >= 5.3.0)
- * Extracts a node from top of the heap and sift up. - * @link http://php.net/manual/en/splheap.extract.php - * @return mixed The value of the extracted node. - */ - public function extract () {} - - /** - * (PHP 5 >= 5.3.0)
- * Inserts an element in the heap by sifting it up. - * @link http://php.net/manual/en/splheap.insert.php - * @param mixed $value

- * The value to insert. - *

- * @return void No value is returned. - */ - public function insert ($value) {} - - /** - * (PHP 5 >= 5.3.0)
- * Peeks at the node from the top of the heap - * @link http://php.net/manual/en/splheap.top.php - * @return mixed The value of the node on the top. - */ - public function top () {} - - /** - * (PHP 5 >= 5.3.0)
- * Counts the number of elements in the heap. - * @link http://php.net/manual/en/splheap.count.php - * @return int the number of elements in the heap. - */ - public function count () {} - - /** - * (PHP 5 >= 5.3.0)
- * Checks whether the heap is empty. - * @link http://php.net/manual/en/splheap.isempty.php - * @return bool whether the heap is empty. - */ - public function isEmpty () {} - - /** - * (PHP 5 >= 5.3.0)
- * Rewind iterator back to the start (no-op) - * @link http://php.net/manual/en/splheap.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.3.0)
- * Return current node pointed by the iterator - * @link http://php.net/manual/en/splheap.current.php - * @return mixed The current node value. - */ - public function current () {} - - /** - * (PHP 5 >= 5.3.0)
- * Return current node index - * @link http://php.net/manual/en/splheap.key.php - * @return mixed The current node index. - */ - public function key () {} - - /** - * (PHP 5 >= 5.3.0)
- * Move to the next node - * @link http://php.net/manual/en/splheap.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.3.0)
- * Check whether the heap contains more nodes - * @link http://php.net/manual/en/splheap.valid.php - * @return bool TRUE if the heap contains any more nodes, FALSE otherwise. - */ - public function valid () {} - - /** - * (PHP 5 >= 5.3.0)
- * Recover from the corrupted state and allow further actions on the heap. - * @link http://php.net/manual/en/splheap.recoverfromcorruption.php - * @return void No value is returned. - */ - public function recoverFromCorruption () {} - -} - -/** - * The SplPriorityQueue class provides the main functionalities of an - * prioritized queue, implemented using a heap. - * @link http://php.net/manual/en/class.splpriorityqueue.php - */ -class SplPriorityQueue implements Iterator, Traversable, Countable { - const EXTR_BOTH = 3; - const EXTR_PRIORITY = 2; - const EXTR_DATA = 1; - - - /** - * (PHP 5 >= 5.3.0)
- * Compare priorities in order to place elements correctly in the heap while sifting up. - * @link http://php.net/manual/en/splpriorityqueue.compare.php - * @param mixed $priority1

- * The priority of the first node being compared. - *

- * @param mixed $priority2

- * The priority of the second node being compared. - *

- * @return int Result of the comparison, positive integer if priority1 is greater than priority2, 0 if they are equal, negative integer otherwise. - *

- *

- * Multiple elements with the same priority will get dequeued in no particular order. - */ - public function compare ($priority1, $priority2) {} - - /** - * (PHP 5 >= 5.3.0)
- * Inserts an element in the queue by sifting it up. - * @link http://php.net/manual/en/splpriorityqueue.insert.php - * @param mixed $value

- * The value to insert. - *

- * @param mixed $priority

- * The associated priority. - *

- * @return void No value is returned. - */ - public function insert ($value, $priority) {} - - /** - * (PHP 5 >= 5.3.0)
- * Sets the mode of extraction - * @link http://php.net/manual/en/splpriorityqueue.setextractflags.php - * @param int $flags

- * Defines what is extracted by SplPriorityQueue::current, - * SplPriorityQueue::top and - * SplPriorityQueue::extract. - *

- * SplPriorityQueue::EXTR_DATA (0x00000001): Extract the data - * @return void No value is returned. - */ - public function setExtractFlags ($flags) {} - - /** - * (PHP 5 >= 5.3.0)
- * Peeks at the node from the top of the queue - * @link http://php.net/manual/en/splpriorityqueue.top.php - * @return mixed The value or priority (or both) of the top node, depending on the extract flag. - */ - public function top () {} - - /** - * (PHP 5 >= 5.3.0)
- * Extracts a node from top of the heap and sift up. - * @link http://php.net/manual/en/splpriorityqueue.extract.php - * @return mixed The value or priority (or both) of the extracted node, depending on the extract flag. - */ - public function extract () {} - - /** - * (PHP 5 >= 5.3.0)
- * Counts the number of elements in the queue. - * @link http://php.net/manual/en/splpriorityqueue.count.php - * @return int the number of elements in the queue. - */ - public function count () {} - - /** - * (PHP 5 >= 5.3.0)
- * Checks whether the queue is empty. - * @link http://php.net/manual/en/splpriorityqueue.isempty.php - * @return bool whether the queue is empty. - */ - public function isEmpty () {} - - /** - * (PHP 5 >= 5.3.0)
- * Rewind iterator back to the start (no-op) - * @link http://php.net/manual/en/splpriorityqueue.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.3.0)
- * Return current node pointed by the iterator - * @link http://php.net/manual/en/splpriorityqueue.current.php - * @return mixed The value or priority (or both) of the current node, depending on the extract flag. - */ - public function current () {} - - /** - * (PHP 5 >= 5.3.0)
- * Return current node index - * @link http://php.net/manual/en/splpriorityqueue.key.php - * @return mixed The current node index. - */ - public function key () {} - - /** - * (PHP 5 >= 5.3.0)
- * Move to the next node - * @link http://php.net/manual/en/splpriorityqueue.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.3.0)
- * Check whether the queue contains more nodes - * @link http://php.net/manual/en/splpriorityqueue.valid.php - * @return bool TRUE if the queue contains any more nodes, FALSE otherwise. - */ - public function valid () {} - - /** - * (PHP 5 >= 5.3.0)
- * Recover from the corrupted state and allow further actions on the queue. - * @link http://php.net/manual/en/splpriorityqueue.recoverfromcorruption.php - * @return void No value is returned. - */ - public function recoverFromCorruption () {} - -} - -/** - * The SplFixedArray class provides the main functionalities of array. The - * main differences between a SplFixedArray and a normal PHP array is that - * the SplFixedArray is of fixed length and allows only integers within - * the range as indexes. The advantage is that it allows a faster array - * implementation. - * @link http://php.net/manual/en/class.splfixedarray.php - */ -class SplFixedArray implements Iterator, Traversable, ArrayAccess, Countable { - - /** - * (PHP 5 >= 5.3.0)
- * Constructs a new fixed array - * @link http://php.net/manual/en/splfixedarray.construct.php - * @param $size [optional] - */ - public function __construct ($size) {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns the size of the array - * @link http://php.net/manual/en/splfixedarray.count.php - * @return int the size of the array. - */ - public function count () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns a PHP array from the fixed array - * @link http://php.net/manual/en/splfixedarray.toarray.php - * @return array a PHP array, similar to the fixed array. - */ - public function toArray () {} - - /** - * (PHP 5 >= 5.3.0)
- * Import a PHP array in a SplFixedArray instance - * @link http://php.net/manual/en/splfixedarray.fromarray.php - * @param array $array

- * The array to import. - *

- * @param bool $save_indexes [optional]

- * Try to save the numeric indexes used in the original array. - *

- * @return SplFixedArray an instance of SplFixedArray - * containing the array content. - */ - public static function fromArray (array $array, $save_indexes = true) {} - - /** - * (PHP 5 >= 5.3.0)
- * Gets the size of the array - * @link http://php.net/manual/en/splfixedarray.getsize.php - * @return int the size of the array, as an integer. - */ - public function getSize () {} - - /** - * (PHP 5 >= 5.3.0)
- * Change the size of an array - * @link http://php.net/manual/en/splfixedarray.setsize.php - * @param int $size

- * The new array size. This should be a value between 0 and PHP_INT_MAX. - *

- * @return int No value is returned. - */ - public function setSize ($size) {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns whether the requested index exists - * @link http://php.net/manual/en/splfixedarray.offsetexists.php - * @param int $index

- * The index being checked. - *

- * @return bool TRUE if the requested index exists, otherwise FALSE - */ - public function offsetExists ($index) {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns the value at the specified index - * @link http://php.net/manual/en/splfixedarray.offsetget.php - * @param int $index

- * The index with the value. - *

- * @return mixed The value at the specified index. - */ - public function offsetGet ($index) {} - - /** - * (PHP 5 >= 5.3.0)
- * Sets a new value at a specified index - * @link http://php.net/manual/en/splfixedarray.offsetset.php - * @param int $index

- * The index being set. - *

- * @param mixed $newval

- * The new value for the index. - *

- * @return void No value is returned. - */ - public function offsetSet ($index, $newval) {} - - /** - * (PHP 5 >= 5.3.0)
- * Unsets the value at the specified $index - * @link http://php.net/manual/en/splfixedarray.offsetunset.php - * @param int $index

- * The index being unset. - *

- * @return void No value is returned. - */ - public function offsetUnset ($index) {} - - /** - * (PHP 5 >= 5.3.0)
- * Rewind iterator back to the start - * @link http://php.net/manual/en/splfixedarray.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.3.0)
- * Return current array entry - * @link http://php.net/manual/en/splfixedarray.current.php - * @return mixed The current element value. - */ - public function current () {} - - /** - * (PHP 5 >= 5.3.0)
- * Return current array index - * @link http://php.net/manual/en/splfixedarray.key.php - * @return int The current array index. - */ - public function key () {} - - /** - * (PHP 5 >= 5.3.0)
- * Move to next entry - * @link http://php.net/manual/en/splfixedarray.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.3.0)
- * Check whether the array contains more elements - * @link http://php.net/manual/en/splfixedarray.valid.php - * @return bool TRUE if the array contains any more elements, FALSE otherwise. - */ - public function valid () {} - -} - -/** - * The SplObserver interface is used alongside - * SplSubject to implement the Observer Design Pattern. - * @link http://php.net/manual/en/class.splobserver.php - */ -interface SplObserver { - - /** - * (PHP 5 >= 5.1.0)
- * Receive update from subject - * @link http://php.net/manual/en/splobserver.update.php - * @param SplSubject $subject

- * The SplSubject notifying the observer of an update. - *

- * @return void No value is returned. - */ - abstract public function update (SplSubject $subject); - -} - -/** - * The SplSubject interface is used alongside - * SplObserver to implement the Observer Design Pattern. - * @link http://php.net/manual/en/class.splsubject.php - */ -interface SplSubject { - - /** - * (PHP 5 >= 5.1.0)
- * Attach an SplObserver - * @link http://php.net/manual/en/splsubject.attach.php - * @param SplObserver $observer

- * The SplObserver to attach. - *

- * @return void No value is returned. - */ - abstract public function attach (SplObserver $observer); - - /** - * (PHP 5 >= 5.1.0)
- * Detach an observer - * @link http://php.net/manual/en/splsubject.detach.php - * @param SplObserver $observer

- * The SplObserver to detach. - *

- * @return void No value is returned. - */ - abstract public function detach (SplObserver $observer); - - /** - * (PHP 5 >= 5.1.0)
- * Notify an observer - * @link http://php.net/manual/en/splsubject.notify.php - * @return void No value is returned. - */ - abstract public function notify (); - -} - -/** - * The SplObjectStorage class provides a map from objects to data or, by - * ignoring data, an object set. This dual purpose can be useful in many - * cases involving the need to uniquely identify objects. - * @link http://php.net/manual/en/class.splobjectstorage.php - */ -class SplObjectStorage implements Countable, Iterator, Traversable, Serializable, ArrayAccess { - - /** - * (PHP 5 >= 5.1.0)
- * Adds an object in the storage - * @link http://php.net/manual/en/splobjectstorage.attach.php - * @param object $object

- * The object to add. - *

- * @param mixed $data [optional]

- * The data to associate with the object. - *

- * @return void No value is returned. - */ - public function attach ($object, $data = null) {} - - /** - * (PHP 5 >= 5.1.0)
- * Removes an object from the storage - * @link http://php.net/manual/en/splobjectstorage.detach.php - * @param object $object

- * The object to remove. - *

- * @return void No value is returned. - */ - public function detach ($object) {} - - /** - * (PHP 5 >= 5.1.0)
- * Checks if the storage contains a specific object - * @link http://php.net/manual/en/splobjectstorage.contains.php - * @param object $object

- * The object to look for. - *

- * @return bool TRUE if the object is in the storage, FALSE otherwise. - */ - public function contains ($object) {} - - /** - * (PHP 5 >= 5.3.0)
- * Adds all objects from another storage - * @link http://php.net/manual/en/splobjectstorage.addall.php - * @param SplObjectStorage $storage

- * The storage you want to import. - *

- * @return void No value is returned. - */ - public function addAll (SplObjectStorage $storage) {} - - /** - * (PHP 5 >= 5.3.0)
- * Removes objects contained in another storage from the current storage - * @link http://php.net/manual/en/splobjectstorage.removeall.php - * @param SplObjectStorage $storage

- * The storage containing the elements to remove. - *

- * @return void No value is returned. - */ - public function removeAll (SplObjectStorage $storage) {} - - /** - * (PHP 5 >= 5.3.6)
- * Removes all objects except for those contained in another storage from the current storage - * @link http://php.net/manual/en/splobjectstorage.removeallexcept.php - * @param SplObjectStorage $storage

- * The storage containing the elements to retain in the current storage. - *

- * @return void No value is returned. - */ - public function removeAllExcept (SplObjectStorage $storage) {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns the data associated with the current iterator entry - * @link http://php.net/manual/en/splobjectstorage.getinfo.php - * @return mixed The data associated with the current iterator position. - */ - public function getInfo () {} - - /** - * (PHP 5 >= 5.3.0)
- * Sets the data associated with the current iterator entry - * @link http://php.net/manual/en/splobjectstorage.setinfo.php - * @param mixed $data

- * The data to associate with the current iterator entry. - *

- * @return void No value is returned. - */ - public function setInfo ($data) {} - - /** - * (PHP 5 >= 5.4.0)
- * Calculate a unique identifier for the contained objects - * @link http://php.net/manual/en/splobjectstorage.gethash.php - * @param object $object

- * The object whose identifier is to be calculated. - *

- * @return string A string with the calculated identifier. - */ - public function getHash ($object) {} - - /** - * (PHP 5 >= 5.1.0)
- * Returns the number of objects in the storage - * @link http://php.net/manual/en/splobjectstorage.count.php - * @return int The number of objects in the storage. - */ - public function count () {} - - /** - * (PHP 5 >= 5.1.0)
- * Rewind the iterator to the first storage element - * @link http://php.net/manual/en/splobjectstorage.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.1.0)
- * Returns if the current iterator entry is valid - * @link http://php.net/manual/en/splobjectstorage.valid.php - * @return bool TRUE if the iterator entry is valid, FALSE otherwise. - */ - public function valid () {} - - /** - * (PHP 5 >= 5.1.0)
- * Returns the index at which the iterator currently is - * @link http://php.net/manual/en/splobjectstorage.key.php - * @return int The index corresponding to the position of the iterator. - */ - public function key () {} - - /** - * (PHP 5 >= 5.1.0)
- * Returns the current storage entry - * @link http://php.net/manual/en/splobjectstorage.current.php - * @return object The object at the current iterator position. - */ - public function current () {} - - /** - * (PHP 5 >= 5.1.0)
- * Move to the next entry - * @link http://php.net/manual/en/splobjectstorage.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.2.2)
- * Unserializes a storage from its string representation - * @link http://php.net/manual/en/splobjectstorage.unserialize.php - * @param string $serialized

- * The serialized representation of a storage. - *

- * @return void No value is returned. - */ - public function unserialize ($serialized) {} - - /** - * (PHP 5 >= 5.2.2)
- * Serializes the storage - * @link http://php.net/manual/en/splobjectstorage.serialize.php - * @return string A string representing the storage. - */ - public function serialize () {} - - /** - * (PHP 5 >= 5.3.0)
- * Checks whether an object exists in the storage - * @link http://php.net/manual/en/splobjectstorage.offsetexists.php - * @param object $object

- * The object to look for. - *

- * @return bool TRUE if the object exists in the storage, - * and FALSE otherwise. - */ - public function offsetExists ($object) {} - - /** - * (PHP 5 >= 5.3.0)
- * Associates data to an object in the storage - * @link http://php.net/manual/en/splobjectstorage.offsetset.php - * @param object $object

- * The object to associate data with. - *

- * @param mixed $data [optional]

- * The data to associate with the object. - *

- * @return void No value is returned. - */ - public function offsetSet ($object, $data = null) {} - - /** - * (PHP 5 >= 5.3.0)
- * Removes an object from the storage - * @link http://php.net/manual/en/splobjectstorage.offsetunset.php - * @param object $object

- * The object to remove. - *

- * @return void No value is returned. - */ - public function offsetUnset ($object) {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns the data associated with an object - * @link http://php.net/manual/en/splobjectstorage.offsetget.php - * @param object $object

- * The object to look for. - *

- * @return mixed The data previously associated with the object in the storage. - */ - public function offsetGet ($object) {} - -} - -/** - * An Iterator that sequentially iterates over all attached iterators - * @link http://php.net/manual/en/class.multipleiterator.php - */ -class MultipleIterator implements Iterator, Traversable { - const MIT_NEED_ANY = 0; - const MIT_NEED_ALL = 1; - const MIT_KEYS_NUMERIC = 0; - const MIT_KEYS_ASSOC = 2; - - - /** - * (PHP 5 >= 5.3.0)
- * Constructs a new MultipleIterator - * @link http://php.net/manual/en/multipleiterator.construct.php - * @param $flags - */ - public function __construct ($flags) {} - - /** - * (PHP 5 >= 5.3.0)
- * Gets the flag information - * @link http://php.net/manual/en/multipleiterator.getflags.php - * @return void Information about the flags, as an integer. - */ - public function getFlags () {} - - /** - * (PHP 5 >= 5.3.0)
- * Sets flags - * @link http://php.net/manual/en/multipleiterator.setflags.php - * @param int $flags

- * The flags to set, according to the - * Flag Constants - *

- * @return void No value is returned. - */ - public function setFlags ($flags) {} - - /** - * (PHP 5 >= 5.3.0)
- * Attaches iterator information - * @link http://php.net/manual/en/multipleiterator.attachiterator.php - * @param Iterator $iterator

- * The new iterator to attach. - *

- * @param string $infos [optional]

- * The associative information for the Iterator, which must be an - * integer, a string, or NULL. - *

- * @return void Description... - */ - public function attachIterator (Iterator $iterator, $infos = null) {} - - /** - * (PHP 5 >= 5.3.0)
- * Detaches an iterator - * @link http://php.net/manual/en/multipleiterator.detachiterator.php - * @param Iterator $iterator

- * The iterator to detach. - *

- * @return void No value is returned. - */ - public function detachIterator (Iterator $iterator) {} - - /** - * (PHP 5 >= 5.3.0)
- * Checks if an iterator is attached - * @link http://php.net/manual/en/multipleiterator.containsiterator.php - * @param Iterator $iterator

- * The iterator to check. - *

- * @return void TRUE on success or FALSE on failure. - */ - public function containsIterator (Iterator $iterator) {} - - /** - * (PHP 5 >= 5.3.0)
- * Gets the number of attached iterator instances - * @link http://php.net/manual/en/multipleiterator.countiterators.php - * @return void The number of attached iterator instances (as an integer). - */ - public function countIterators () {} - - /** - * (PHP 5 >= 5.3.0)
- * Rewinds all attached iterator instances - * @link http://php.net/manual/en/multipleiterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.3.0)
- * Checks the validity of sub iterators - * @link http://php.net/manual/en/multipleiterator.valid.php - * @return void TRUE if one or all sub iterators are valid depending on flags, - * otherwise FALSE - */ - public function valid () {} - - /** - * (PHP 5 >= 5.3.0)
- * Gets the registered iterator instances - * @link http://php.net/manual/en/multipleiterator.key.php - * @return array An array of all registered iterator instances, - * or FALSE if no sub iterator is attached. - */ - public function key () {} - - /** - * (PHP 5 >= 5.3.0)
- * Gets the registered iterator instances - * @link http://php.net/manual/en/multipleiterator.current.php - * @return array An array of all registered iterator instances, - * or FALSE if no sub iterator is attached. - */ - public function current () {} - - /** - * (PHP 5 >= 5.3.0)
- * Moves all attached iterator instances forward - * @link http://php.net/manual/en/multipleiterator.next.php - * @return void No value is returned. - */ - public function next () {} - -} - -/** - * (PHP 5)
- * Return available SPL classes - * @link http://php.net/manual/en/function.spl-classes.php - * @return array an array containing the currently available SPL classes. - */ -function spl_classes () {} - -/** - * (PHP 5 >= 5.1.2)
- * Default implementation for __autoload() - * @link http://php.net/manual/en/function.spl-autoload.php - * @param string $class_name

- * The lowercased name of the class (and namespace) being instantiated. - *

- * @param string $file_extensions [optional]

- * By default it checks all include paths to - * contain filenames built up by the lowercase class name appended by the - * filename extensions .inc and .php. - *

- * @return void No value is returned. - */ -function spl_autoload ($class_name, $file_extensions = 'spl_autoload_extensions()') {} - -/** - * (PHP 5 >= 5.1.2)
- * Register and return default file extensions for spl_autoload - * @link http://php.net/manual/en/function.spl-autoload-extensions.php - * @param string $file_extensions [optional]

- * When calling without an argument, it simply returns the current list - * of extensions each separated by comma. To modify the list of file - * extensions, simply invoke the functions with the new list of file - * extensions to use in a single string with each extensions separated - * by comma. - *

- * @return string A comma delimited list of default file extensions for - * spl_autoload. - */ -function spl_autoload_extensions ($file_extensions = null) {} - -/** - * (PHP 5 >= 5.1.2)
- * Register given function as __autoload() implementation - * @link http://php.net/manual/en/function.spl-autoload-register.php - * @param callable $autoload_function [optional]

- * The autoload function being registered. - * If no parameter is provided, then the default implementation of - * spl_autoload will be registered. - *

- * @param bool $throw [optional]

- * This parameter specifies whether - * spl_autoload_register should throw - * exceptions when the autoload_function - * cannot be registered. - *

- * @param bool $prepend [optional]

- * If true, spl_autoload_register will prepend - * the autoloader on the autoload stack instead of appending it. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function spl_autoload_register (callable $autoload_function = null, $throw = true, $prepend = false) {} - -/** - * (PHP 5 >= 5.1.2)
- * Unregister given function as __autoload() implementation - * @link http://php.net/manual/en/function.spl-autoload-unregister.php - * @param mixed $autoload_function

- * The autoload function being unregistered. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function spl_autoload_unregister ($autoload_function) {} - -/** - * (PHP 5 >= 5.1.2)
- * Return all registered __autoload() functions - * @link http://php.net/manual/en/function.spl-autoload-functions.php - * @return array An array of all registered __autoload functions. - * If the autoload stack is not activated then the return value is FALSE. - * If no function is registered the return value will be an empty array. - */ -function spl_autoload_functions () {} - -/** - * (PHP 5 >= 5.1.2)
- * Try all registered __autoload() function to load the requested class - * @link http://php.net/manual/en/function.spl-autoload-call.php - * @param string $class_name

- * The class name being searched. - *

- * @return void No value is returned. - */ -function spl_autoload_call ($class_name) {} - -/** - * (PHP 5 >= 5.1.0)
- * Return the parent classes of the given class - * @link http://php.net/manual/en/function.class-parents.php - * @param mixed $class

- * An object (class instance) or a string (class name). - *

- * @param bool $autoload [optional]

- * Whether to allow this function to load the class automatically through - * the __autoload magic method. - *

- * @return array An array on success, or FALSE on error. - */ -function class_parents ($class, $autoload = true) {} - -/** - * (PHP 5 >= 5.1.0)
- * Return the interfaces which are implemented by the given class - * @link http://php.net/manual/en/function.class-implements.php - * @param mixed $class

- * An object (class instance) or a string (class name). - *

- * @param bool $autoload [optional]

- * Whether to allow this function to load the class automatically through - * the __autoload magic method. - *

- * @return array An array on success, or FALSE on error. - */ -function class_implements ($class, $autoload = true) {} - -/** - * (PHP 5 >= 5.4.0)
- * Return the traits used by the given class - * @link http://php.net/manual/en/function.class-uses.php - * @param mixed $class

- * An object (class instance) or a string (class name). - *

- * @param bool $autoload [optional]

- * Whether to allow this function to load the class automatically through - * the __autoload magic method. - *

- * @return array An array on success, or FALSE on error. - */ -function class_uses ($class, $autoload = true) {} - -/** - * (PHP 5 >= 5.2.0)
- * Return hash id for given object - * @link http://php.net/manual/en/function.spl-object-hash.php - * @param object $obj - * @return string A string that is unique for each currently existing object and is always - * the same for each object. - */ -function spl_object_hash ($obj) {} - -/** - * (PHP 5 >= 5.1.0)
- * Copy the iterator into an array - * @link http://php.net/manual/en/function.iterator-to-array.php - * @param Traversable $iterator

- * The iterator being copied. - *

- * @param bool $use_keys [optional]

- * Whether to use the iterator element keys as index. - *

- * @return array An array containing the elements of the iterator. - */ -function iterator_to_array (Traversable $iterator, $use_keys = true) {} - -/** - * (PHP 5 >= 5.1.0)
- * Count the elements in an iterator - * @link http://php.net/manual/en/function.iterator-count.php - * @param Traversable $iterator

- * The iterator being counted. - *

- * @return int The number of elements in iterator. - */ -function iterator_count (Traversable $iterator) {} - -/** - * (PHP 5 >= 5.1.0)
- * Call a function for every element in an iterator - * @link http://php.net/manual/en/function.iterator-apply.php - * @param Traversable $iterator

- * The class to iterate over. - *

- * @param callable $function

- * The callback function to call on every element. - * The function must return TRUE in order to - * continue iterating over the iterator. - *

- * @param array $args [optional]

- * Arguments to pass to the callback function. - *

- * @return int the iteration count. - */ -function iterator_apply (Traversable $iterator, callable $function, array $args = null) {} - -// End of SPL v.0.2 -?> diff --git a/phpruntime/SimpleXML.php b/phpruntime/SimpleXML.php deleted file mode 100644 index df153ca..0000000 --- a/phpruntime/SimpleXML.php +++ /dev/null @@ -1,524 +0,0 @@ - - * Creates a new SimpleXMLElement object - * @link http://php.net/manual/en/simplexmlelement.construct.php - * @param $data - * @param $options [optional] - * @param $data_is_url [optional] - * @param $ns [optional] - * @param $is_prefix [optional] - */ - final public function __construct ($data, $options, $data_is_url, $ns, $is_prefix) {} - - /** - * (PHP 5 >= 5.0.1)
- * Return a well-formed XML string based on SimpleXML element - * @link http://php.net/manual/en/simplexmlelement.asxml.php - * @param string $filename [optional]

- * If specified, the function writes the data to the file rather than - * returning it. - *

- * @return mixed If the filename isn't specified, this function - * returns a string on success and FALSE on error. If the - * parameter is specified, it returns TRUE if the file was written - * successfully and FALSE otherwise. - */ - public function asXML ($filename = null) {} - - /** - * (PHP 5 >= 5.2.0)
- * Alias of SimpleXMLElement::asXML - * @link http://php.net/manual/en/simplexmlelement.savexml.php - * @param $filename [optional] - */ - public function saveXML ($filename) {} - - /** - * (PHP 5 >= 5.2.0)
- * Runs XPath query on XML data - * @link http://php.net/manual/en/simplexmlelement.xpath.php - * @param string $path

- * An XPath path - *

- * @return array an array of SimpleXMLElement objects or FALSE in - * case of an error. - */ - public function xpath ($path) {} - - /** - * (PHP 5 >= 5.2.0)
- * Creates a prefix/ns context for the next XPath query - * @link http://php.net/manual/en/simplexmlelement.registerxpathnamespace.php - * @param string $prefix

- * The namespace prefix to use in the XPath query for the namespace given in - * ns. - *

- * @param string $ns

- * The namespace to use for the XPath query. This must match a namespace in - * use by the XML document or the XPath query using - * prefix will not return any results. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function registerXPathNamespace ($prefix, $ns) {} - - /** - * (PHP 5 >= 5.0.1)
- * Identifies an element's attributes - * @link http://php.net/manual/en/simplexmlelement.attributes.php - * @param string $ns [optional]

- * An optional namespace for the retrieved attributes - *

- * @param bool $is_prefix [optional]

- * Default to FALSE - *

- * @return SimpleXMLElement a SimpleXMLElement object that can be - * iterated over to loop through the attributes on the tag. - *

- *

- * Returns NULL if called on a SimpleXMLElement - * object that already represents an attribute and not a tag. - */ - public function attributes ($ns = null, $is_prefix = false) {} - - /** - * (PHP 5 >= 5.0.1)
- * Finds children of given node - * @link http://php.net/manual/en/simplexmlelement.children.php - * @param string $ns [optional]

- * An XML namespace. - *

- * @param bool $is_prefix [optional]

- * If is_prefix is TRUE, - * ns will be regarded as a prefix. If FALSE, - * ns will be regarded as a namespace - * URL. - *

- * @return SimpleXMLElement a SimpleXMLElement element, whether the node - * has children or not. - */ - public function children ($ns = null, $is_prefix = false) {} - - /** - * (PHP 5 >= 5.1.2)
- * Returns namespaces used in document - * @link http://php.net/manual/en/simplexmlelement.getnamespaces.php - * @param bool $recursive [optional]

- * If specified, returns all namespaces used in parent and child nodes. - * Otherwise, returns only namespaces used in root node. - *

- * @return array The getNamespaces method returns an array of - * namespace names with their associated URIs. - */ - public function getNamespaces ($recursive = false) {} - - /** - * (PHP 5 >= 5.1.2)
- * Returns namespaces declared in document - * @link http://php.net/manual/en/simplexmlelement.getdocnamespaces.php - * @param bool $recursive [optional]

- * If specified, returns all namespaces declared in parent and child nodes. - * Otherwise, returns only namespaces declared in root node. - *

- * @return array The getDocNamespaces method returns an array - * of namespace names with their associated URIs. - */ - public function getDocNamespaces ($recursive = false) {} - - /** - * (PHP 5 >= 5.1.3)
- * Gets the name of the XML element - * @link http://php.net/manual/en/simplexmlelement.getname.php - * @return string The getName method returns as a string the - * name of the XML tag referenced by the SimpleXMLElement object. - */ - public function getName () {} - - /** - * (PHP 5 >= 5.1.3)
- * Adds a child element to the XML node - * @link http://php.net/manual/en/simplexmlelement.addchild.php - * @param string $name

- * The name of the child element to add. - *

- * @param string $value [optional]

- * If specified, the value of the child element. - *

- * @param string $namespace [optional]

- * If specified, the namespace to which the child element belongs. - *

- * @return SimpleXMLElement The addChild method returns a SimpleXMLElement - * object representing the child added to the XML node. - */ - public function addChild ($name, $value = null, $namespace = null) {} - - /** - * (PHP 5 >= 5.1.3)
- * Adds an attribute to the SimpleXML element - * @link http://php.net/manual/en/simplexmlelement.addattribute.php - * @param string $name

- * The name of the attribute to add. - *

- * @param string $value [optional]

- * The value of the attribute. - *

- * @param string $namespace [optional]

- * If specified, the namespace to which the attribute belongs. - *

- * @return void No value is returned. - */ - public function addAttribute ($name, $value = null, $namespace = null) {} - - public function __toString () {} - - /** - * (PHP 5 >= 5.3.0)
- * Counts the children of an element - * @link http://php.net/manual/en/simplexmlelement.count.php - * @return int the number of elements of an element. - */ - public function count () {} - -} - -/** - * The SimpleXMLIterator provides recursive iteration over all nodes of a SimpleXMLElement object. - * @link http://php.net/manual/en/class.simplexmliterator.php - */ -class SimpleXMLIterator extends SimpleXMLElement implements Traversable, RecursiveIterator, Iterator, Countable { - - /** - * (PHP 5 >= 5.1.0)
- * Rewind to the first element - * @link http://php.net/manual/en/simplexmliterator.rewind.php - * @return void No value is returned. - */ - public function rewind () {} - - /** - * (PHP 5 >= 5.1.0)
- * Check whether the current element is valid - * @link http://php.net/manual/en/simplexmliterator.valid.php - * @return bool TRUE if the current element is valid, otherwise FALSE - */ - public function valid () {} - - /** - * (PHP 5 >= 5.1.0)
- * Returns the current element - * @link http://php.net/manual/en/simplexmliterator.current.php - * @return mixed the current element as a SimpleXMLIterator object or NULL on failure. - */ - public function current () {} - - /** - * (PHP 5 >= 5.1.0)
- * Return current key - * @link http://php.net/manual/en/simplexmliterator.key.php - * @return mixed the XML tag name of the element referenced by the current SimpleXMLIterator object or FALSE - */ - public function key () {} - - /** - * (PHP 5 >= 5.1.0)
- * Move to next element - * @link http://php.net/manual/en/simplexmliterator.next.php - * @return void No value is returned. - */ - public function next () {} - - /** - * (PHP 5 >= 5.1.0)
- * Checks whether the current element has sub elements. - * @link http://php.net/manual/en/simplexmliterator.haschildren.php - * @return bool TRUE if the current element has sub-elements, otherwise FALSE - */ - public function hasChildren () {} - - /** - * (PHP 5 >= 5.1.0)
- * Returns the sub-elements of the current element - * @link http://php.net/manual/en/simplexmliterator.getchildren.php - * @return SimpleXMLIterator a SimpleXMLIterator object containing - * the sub-elements of the current element. - */ - public function getChildren () {} - - /** - * (PHP 5 >= 5.0.1)
- * Creates a new SimpleXMLElement object - * @link http://php.net/manual/en/simplexmlelement.construct.php - * @param $data - * @param $options [optional] - * @param $data_is_url [optional] - * @param $ns [optional] - * @param $is_prefix [optional] - */ - final public function __construct ($data, $options, $data_is_url, $ns, $is_prefix) {} - - /** - * (PHP 5 >= 5.0.1)
- * Return a well-formed XML string based on SimpleXML element - * @link http://php.net/manual/en/simplexmlelement.asxml.php - * @param string $filename [optional]

- * If specified, the function writes the data to the file rather than - * returning it. - *

- * @return mixed If the filename isn't specified, this function - * returns a string on success and FALSE on error. If the - * parameter is specified, it returns TRUE if the file was written - * successfully and FALSE otherwise. - */ - public function asXML ($filename = null) {} - - /** - * (PHP 5 >= 5.2.0)
- * Alias of SimpleXMLElement::asXML - * @link http://php.net/manual/en/simplexmlelement.savexml.php - * @param $filename [optional] - */ - public function saveXML ($filename) {} - - /** - * (PHP 5 >= 5.2.0)
- * Runs XPath query on XML data - * @link http://php.net/manual/en/simplexmlelement.xpath.php - * @param string $path

- * An XPath path - *

- * @return array an array of SimpleXMLElement objects or FALSE in - * case of an error. - */ - public function xpath ($path) {} - - /** - * (PHP 5 >= 5.2.0)
- * Creates a prefix/ns context for the next XPath query - * @link http://php.net/manual/en/simplexmlelement.registerxpathnamespace.php - * @param string $prefix

- * The namespace prefix to use in the XPath query for the namespace given in - * ns. - *

- * @param string $ns

- * The namespace to use for the XPath query. This must match a namespace in - * use by the XML document or the XPath query using - * prefix will not return any results. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function registerXPathNamespace ($prefix, $ns) {} - - /** - * (PHP 5 >= 5.0.1)
- * Identifies an element's attributes - * @link http://php.net/manual/en/simplexmlelement.attributes.php - * @param string $ns [optional]

- * An optional namespace for the retrieved attributes - *

- * @param bool $is_prefix [optional]

- * Default to FALSE - *

- * @return SimpleXMLElement a SimpleXMLElement object that can be - * iterated over to loop through the attributes on the tag. - *

- *

- * Returns NULL if called on a SimpleXMLElement - * object that already represents an attribute and not a tag. - */ - public function attributes ($ns = null, $is_prefix = false) {} - - /** - * (PHP 5 >= 5.0.1)
- * Finds children of given node - * @link http://php.net/manual/en/simplexmlelement.children.php - * @param string $ns [optional]

- * An XML namespace. - *

- * @param bool $is_prefix [optional]

- * If is_prefix is TRUE, - * ns will be regarded as a prefix. If FALSE, - * ns will be regarded as a namespace - * URL. - *

- * @return SimpleXMLElement a SimpleXMLElement element, whether the node - * has children or not. - */ - public function children ($ns = null, $is_prefix = false) {} - - /** - * (PHP 5 >= 5.1.2)
- * Returns namespaces used in document - * @link http://php.net/manual/en/simplexmlelement.getnamespaces.php - * @param bool $recursive [optional]

- * If specified, returns all namespaces used in parent and child nodes. - * Otherwise, returns only namespaces used in root node. - *

- * @return array The getNamespaces method returns an array of - * namespace names with their associated URIs. - */ - public function getNamespaces ($recursive = false) {} - - /** - * (PHP 5 >= 5.1.2)
- * Returns namespaces declared in document - * @link http://php.net/manual/en/simplexmlelement.getdocnamespaces.php - * @param bool $recursive [optional]

- * If specified, returns all namespaces declared in parent and child nodes. - * Otherwise, returns only namespaces declared in root node. - *

- * @return array The getDocNamespaces method returns an array - * of namespace names with their associated URIs. - */ - public function getDocNamespaces ($recursive = false) {} - - /** - * (PHP 5 >= 5.1.3)
- * Gets the name of the XML element - * @link http://php.net/manual/en/simplexmlelement.getname.php - * @return string The getName method returns as a string the - * name of the XML tag referenced by the SimpleXMLElement object. - */ - public function getName () {} - - /** - * (PHP 5 >= 5.1.3)
- * Adds a child element to the XML node - * @link http://php.net/manual/en/simplexmlelement.addchild.php - * @param string $name

- * The name of the child element to add. - *

- * @param string $value [optional]

- * If specified, the value of the child element. - *

- * @param string $namespace [optional]

- * If specified, the namespace to which the child element belongs. - *

- * @return SimpleXMLElement The addChild method returns a SimpleXMLElement - * object representing the child added to the XML node. - */ - public function addChild ($name, $value = null, $namespace = null) {} - - /** - * (PHP 5 >= 5.1.3)
- * Adds an attribute to the SimpleXML element - * @link http://php.net/manual/en/simplexmlelement.addattribute.php - * @param string $name

- * The name of the attribute to add. - *

- * @param string $value [optional]

- * The value of the attribute. - *

- * @param string $namespace [optional]

- * If specified, the namespace to which the attribute belongs. - *

- * @return void No value is returned. - */ - public function addAttribute ($name, $value = null, $namespace = null) {} - - public function __toString () {} - - /** - * (PHP 5 >= 5.3.0)
- * Counts the children of an element - * @link http://php.net/manual/en/simplexmlelement.count.php - * @return int the number of elements of an element. - */ - public function count () {} - -} - -/** - * (PHP 5)
- * Interprets an XML file into an object - * @link http://php.net/manual/en/function.simplexml-load-file.php - * @param string $filename

- * Path to the XML file - *

- *

- * Libxml 2 unescapes the URI, so if you want to pass e.g. - * b&#38;c as the URI parameter a, - * you have to call - * simplexml_load_file(rawurlencode('http://example.com/?a=' . - * urlencode('b&#38;c'))). Since PHP 5.1.0 you don't need to do - * this because PHP will do it for you. - *

- * @param string $class_name [optional]

- * You may use this optional parameter so that - * simplexml_load_file will return an object of - * the specified class. That class should extend the - * SimpleXMLElement class. - *

- * @param int $options [optional]

- * Since PHP 5.1.0 and Libxml 2.6.0, you may also use the - * options parameter to specify additional Libxml parameters. - *

- * @param string $ns [optional]

- * Namespace prefix or URI. - *

- * @param bool $is_prefix [optional]

- * TRUE if ns is a prefix, FALSE if it's a URI; - * defaults to FALSE. - *

- * @return SimpleXMLElement an object of class SimpleXMLElement with - * properties containing the data held within the XML document, or FALSE on failure. - */ -function simplexml_load_file ($filename, $class_name = "SimpleXMLElement", $options = 0, $ns = "", $is_prefix = false) {} - -/** - * (PHP 5)
- * Interprets a string of XML into an object - * @link http://php.net/manual/en/function.simplexml-load-string.php - * @param string $data

- * A well-formed XML string - *

- * @param string $class_name [optional]

- * You may use this optional parameter so that - * simplexml_load_string will return an object of - * the specified class. That class should extend the - * SimpleXMLElement class. - *

- * @param int $options [optional]

- * Since PHP 5.1.0 and Libxml 2.6.0, you may also use the - * options parameter to specify additional Libxml parameters. - *

- * @param string $ns [optional]

- * Namespace prefix or URI. - *

- * @param bool $is_prefix [optional]

- * TRUE if ns is a prefix, FALSE if it's a URI; - * defaults to FALSE. - *

- * @return SimpleXMLElement an object of class SimpleXMLElement with - * properties containing the data held within the xml document, or FALSE on failure. - */ -function simplexml_load_string ($data, $class_name = "SimpleXMLElement", $options = 0, $ns = "", $is_prefix = false) {} - -/** - * (PHP 5)
- * Get a SimpleXMLElement object from a DOM node. - * @link http://php.net/manual/en/function.simplexml-import-dom.php - * @param DOMNode $node

- * A DOM Element node - *

- * @param string $class_name [optional]

- * You may use this optional parameter so that - * simplexml_import_dom will return an object of - * the specified class. That class should extend the - * SimpleXMLElement class. - *

- * @return SimpleXMLElement a SimpleXMLElement or FALSE on failure. - */ -function simplexml_import_dom (DOMNode $node, $class_name = "SimpleXMLElement") {} - -// End of SimpleXML v.0.1 -?> diff --git a/phpruntime/apc.php b/phpruntime/apc.php deleted file mode 100644 index b4098d5..0000000 --- a/phpruntime/apc.php +++ /dev/null @@ -1,372 +0,0 @@ - - * Retrieves cached information from APC's data store - * @link http://php.net/manual/en/function.apc-cache-info.php - * @param string $cache_type [optional]

- * If cache_type is "user", - * information about the user cache will be returned. - *

- *

- * If cache_type is "filehits", - * information about which files have been served from the bytecode cache - * for the current request will be returned. This feature must be enabled at - * compile time using --enable-filehits. - *

- *

- * If an invalid or no cache_type is specified, information about - * the system cache (cached files) will be returned. - *

- * @param bool $limited [optional]

- * If limited is TRUE, the - * return value will exclude the individual list of cache entries. This - * is useful when trying to optimize calls for statistics gathering. - *

- * @return array Array of cached data (and meta-data) or FALSE on failure - */ -function apc_cache_info ($cache_type = null, $limited = false) {} - -/** - * (PECL apc >= 2.0.0)
- * Clears the APC cache - * @link http://php.net/manual/en/function.apc-clear-cache.php - * @param string $cache_type [optional]

- * If cache_type is "user", the - * user cache will be cleared; otherwise, the system cache (cached files) - * will be cleared. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function apc_clear_cache ($cache_type = null) {} - -/** - * (PECL apc >= 2.0.0)
- * Retrieves APC's Shared Memory Allocation information - * @link http://php.net/manual/en/function.apc-sma-info.php - * @param bool $limited [optional]

- * When set to FALSE (default) apc_sma_info will - * return a detailed information about each segment. - *

- * @return array Array of Shared Memory Allocation data; FALSE on failure. - */ -function apc_sma_info ($limited = false) {} - -/** - * (PECL apc >= 3.0.0)
- * Cache a variable in the data store - * @link http://php.net/manual/en/function.apc-store.php - * @param string $key

- * Store the variable using this name. keys are - * cache-unique, so storing a second value with the same - * key will overwrite the original value. - *

- * @param mixed $var

- * The variable to store - *

- * @param int $ttl [optional]

- * Time To Live; store var in the cache for - * ttl seconds. After the - * ttl has passed, the stored variable will be - * expunged from the cache (on the next request). If no ttl - * is supplied (or if the ttl is - * 0), the value will persist until it is removed from - * the cache manually, or otherwise fails to exist in the cache (clear, - * restart, etc.). - *

- * @return bool TRUE on success or FALSE on failure. - * Second syntax returns array with error keys. - */ -function apc_store ($key, $var, $ttl = 0) {} - -/** - * (PECL apc >= 3.0.0)
- * Fetch a stored variable from the cache - * @link http://php.net/manual/en/function.apc-fetch.php - * @param mixed $key

- * The key used to store the value (with - * apc_store). If an array is passed then each - * element is fetched and returned. - *

- * @param bool $success [optional]

- * Set to TRUE in success and FALSE in failure. - *

- * @return mixed The stored variable or array of variables on success; FALSE on failure - */ -function apc_fetch ($key, &$success = null) {} - -/** - * (PECL apc >= 3.0.0)
- * Removes a stored variable from the cache - * @link http://php.net/manual/en/function.apc-delete.php - * @param string $key

- * The key used to store the value (with - * apc_store). - *

- * @return mixed TRUE on success or FALSE on failure. - */ -function apc_delete ($key) {} - -/** - * (PECL apc >= 3.1.1)
- * Deletes files from the opcode cache - * @link http://php.net/manual/en/function.apc-delete-file.php - * @param mixed $keys

- * The files to be deleted. Accepts a string, - * array of strings, or an APCIterator - * object. - *

- * @return mixed TRUE on success or FALSE on failure. - * Or if keys is an array, then - * an empty array is returned on success, or an array of failed files - * is returned. - */ -function apc_delete_file ($keys) {} - -/** - * (PECL apc >= 3.0.0)
- * Defines a set of constants for retrieval and mass-definition - * @link http://php.net/manual/en/function.apc-define-constants.php - * @param string $key

- * The key serves as the name of the constant set - * being stored. This key is used to retrieve the - * stored constants in apc_load_constants. - *

- * @param array $constants

- * An associative array of constant_name => value - * pairs. The constant_name must follow the normal - * constant naming rules. - * value must evaluate to a scalar value. - *

- * @param bool $case_sensitive [optional]

- * The default behaviour for constants is to be declared case-sensitive; - * i.e. CONSTANT and Constant - * represent different values. If this parameter evaluates to FALSE the - * constants will be declared as case-insensitive symbols. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function apc_define_constants ($key, array $constants, $case_sensitive = true) {} - -/** - * (PECL apc >= 3.0.0)
- * Loads a set of constants from the cache - * @link http://php.net/manual/en/function.apc-load-constants.php - * @param string $key

- * The name of the constant set (that was stored with - * apc_define_constants) to be retrieved. - *

- * @param bool $case_sensitive [optional]

- * The default behaviour for constants is to be declared case-sensitive; - * i.e. CONSTANT and Constant - * represent different values. If this parameter evaluates to FALSE the - * constants will be declared as case-insensitive symbols. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function apc_load_constants ($key, $case_sensitive = true) {} - -/** - * (PECL apc >= 3.0.13)
- * Stores a file in the bytecode cache, bypassing all filters. - * @link http://php.net/manual/en/function.apc-compile-file.php - * @param string $filename

- * Full or relative path to a PHP file that will be compiled and stored in - * the bytecode cache. - *

- * @param bool $atomic [optional] - * @return mixed TRUE on success or FALSE on failure. - */ -function apc_compile_file ($filename, $atomic = true) {} - -/** - * (PECL apc >= 3.0.13)
- * Cache a new variable in the data store - * @link http://php.net/manual/en/function.apc-add.php - * @param string $key

- * Store the variable using this name. keys are - * cache-unique, so attempting to use apc_add to - * store data with a key that already exists will not overwrite the - * existing data, and will instead return FALSE. (This is the only - * difference between apc_add and - * apc_store.) - *

- * @param mixed $var [optional]

- * The variable to store - *

- * @param int $ttl [optional]

- * Time To Live; store var in the cache for - * ttl seconds. After the - * ttl has passed, the stored variable will be - * expunged from the cache (on the next request). If no ttl - * is supplied (or if the ttl is - * 0), the value will persist until it is removed from - * the cache manually, or otherwise fails to exist in the cache (clear, - * restart, etc.). - *

- * @return bool TRUE if something has effectively been added into the cache, FALSE otherwise. - * Second syntax returns array with error keys. - */ -function apc_add ($key, $var = null, $ttl = 0) {} - -/** - * (PECL apc >= 3.1.1)
- * Increase a stored number - * @link http://php.net/manual/en/function.apc-inc.php - * @param string $key

- * The key of the value being increased. - *

- * @param int $step [optional]

- * The step, or value to increase. - *

- * @param bool $success [optional]

- * Optionally pass the success or fail boolean value to - * this referenced variable. - *

- * @return int the current value of key's value on success, - * or FALSE on failure - */ -function apc_inc ($key, $step = 1, &$success = null) {} - -/** - * (PECL apc >= 3.1.1)
- * Decrease a stored number - * @link http://php.net/manual/en/function.apc-dec.php - * @param string $key

- * The key of the value being decreased. - *

- * @param int $step [optional]

- * The step, or value to decrease. - *

- * @param bool $success [optional]

- * Optionally pass the success or fail boolean value to - * this referenced variable. - *

- * @return int the current value of key's value on success, - * or FALSE on failure - */ -function apc_dec ($key, $step = 1, &$success = null) {} - -/** - * (PECL apc >= 3.1.1)
- * Updates an old value with a new value - * @link http://php.net/manual/en/function.apc-cas.php - * @param string $key

- * The key of the value being updated. - *

- * @param int $old

- * The old value (the value currently stored). - *

- * @param int $new

- * The new value to update to. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function apc_cas ($key, $old, $new) {} - -/** - * (PECL apc >= 3.1.4)
- * Get a binary dump of the given files and user variables - * @link http://php.net/manual/en/function.apc-bin-dump.php - * @param array $files [optional]

- * The files. Passing in NULL signals a dump of every entry, while - * passing in array will dump nothing. - *

- * @param array $user_vars [optional]

- * The user vars. Passing in NULL signals a dump of every entry, while - * passing in array will dump nothing. - *

- * @return string a binary dump of the given files and user variables from the APC cache, - * FALSE if APC is not enabled, or NULL if an unknown error is encountered. - */ -function apc_bin_dump (array $files = null, array $user_vars = null) {} - -/** - * (PECL apc >= 3.1.4)
- * Load a binary dump into the APC file/user cache - * @link http://php.net/manual/en/function.apc-bin-load.php - * @param string $data

- * The binary dump being loaded, likely from - * apc_bin_dump. - *

- * @param int $flags [optional]

- * Either APC_BIN_VERIFY_CRC32, APC_BIN_VERIFY_MD5, - * or both. - *

- * @return bool TRUE if the binary dump data was loaded - * with success, otherwise FALSE is returned. FALSE is returned if APC - * is not enabled, or if the data is not a valid APC - * binary dump (e.g., unexpected size). - */ -function apc_bin_load ($data, $flags = 0) {} - -/** - * (PECL apc >= 3.1.4)
- * Output a binary dump of cached files and user variables to a file - * @link http://php.net/manual/en/function.apc-bin-dumpfile.php - * @param array $files

- * The file names being dumped. - *

- * @param array $user_vars

- * The user variables being dumped. - *

- * @param string $filename

- * The filename where the dump is being saved. - *

- * @param int $flags [optional]

- * Flags passed to the filename stream. See the - * file_put_contents documentation for details. - *

- * @param resource $context [optional]

- * The context passed to the filename stream. See the - * file_put_contents documentation for details. - *

- * @return int The number of bytes written to the file, otherwise - * FALSE if APC is not enabled, filename is an invalid file name, - * filename can't be opened, the file dump can't be completed - * (e.g., the hard drive is out of disk space), or an unknown error was encountered. - */ -function apc_bin_dumpfile (array $files, array $user_vars, $filename, $flags = 0, $context = null) {} - -/** - * (PECL apc >= 3.1.4)
- * Load a binary dump from a file into the APC file/user cache - * @link http://php.net/manual/en/function.apc-bin-loadfile.php - * @param string $filename

- * The file name containing the dump, likely from - * apc_bin_dumpfile. - *

- * @param resource $context [optional]

- * The files context. - *

- * @param int $flags [optional]

- * Either APC_BIN_VERIFY_CRC32, APC_BIN_VERIFY_MD5, - * or both. - *

- * @return bool TRUE on success, otherwise FALSE Reasons it may return FALSE include - * APC is not enabled, filename is an invalid file name or empty, - * filename can't be opened, the file dump can't be completed, or - * if the data is not a valid APC binary dump (e.g., unexpected - * size). - */ -function apc_bin_loadfile ($filename, $context = null, $flags = null) {} - -/** - * (PECL apc >= 3.1.4)
- * Checks if APC key exists - * @link http://php.net/manual/en/function.apc-exists.php - * @param mixed $keys

- * A string, or an array of strings, that - * contain keys. - *

- * @return mixed TRUE if the key exists, otherwise FALSE Or if an - * array was passed to keys, then - * an array is returned that contains all existing keys, or an empty - * array if none exist. - */ -function apc_exists ($keys) {} - -// End of apc v.3.1.13 -?> diff --git a/phpruntime/basic.php b/phpruntime/basic.php deleted file mode 100644 index c61eea0..0000000 --- a/phpruntime/basic.php +++ /dev/null @@ -1,107 +0,0 @@ - - * Loads a PHP extension at runtime - * @link http://php.net/manual/en/function.dl.php - * @param string $library

- * This parameter is only the filename of the - * extension to load which also depends on your platform. For example, - * the sockets extension (if compiled - * as a shared module, not the default!) would be called - * sockets.so on Unix platforms whereas it is called - * php_sockets.dll on the Windows platform. - *

- *

- * The directory where the extension is loaded from depends on your - * platform: - *

- *

- * Windows - If not explicitly set in the php.ini, the extension is - * loaded from C:\php4\extensions\ (PHP 4) or - * C:\php5\ (PHP 5) by default. - *

- *

- * Unix - If not explicitly set in the php.ini, the default extension - * directory depends on - * whether PHP has been built with --enable-debug - * or not - * @return bool TRUE on success or FALSE on failure. If the functionality of loading modules is not available - * or has been disabled (either by setting - * enable_dl off or by enabling safe mode - * in php.ini) an E_ERROR is emitted - * and execution is stopped. If dl fails because the - * specified library couldn't be loaded, in addition to FALSE an - * E_WARNING message is emitted. - */ -function dl ($library) {} - - -/** - * The full path and filename of the file. If used inside an include, - * the name of the included file is returned. - * Since PHP 4.0.2, __FILE__ always contains an - * absolute path with symlinks resolved whereas in older versions it contained relative path - * under some circumstances. - * @link http://php.net/manual/en/language.constants.php - */ -define ('__FILE__', null); - -/** - * The current line number of the file. - * @link http://php.net/manual/en/language.constants.php - */ -define ('__LINE__', null); - -/** - * The class name. (Added in PHP 4.3.0) As of PHP 5 this constant - * returns the class name as it was declared (case-sensitive). In PHP - * 4 its value is always lowercased. The class name includes the namespace - * it was declared in (e.g. Foo\Bar). - * Note that as of PHP 5.4 __CLASS__ works also in traits. When used - * in a trait method, __CLASS__ is the name of the class the trait - * is used in. - * @link http://php.net/manual/en/language.constants.php - */ -define ('__CLASS__', ""); - -/** - * The function name. (Added in PHP 4.3.0) As of PHP 5 this constant - * returns the function name as it was declared (case-sensitive). In - * PHP 4 its value is always lowercased. - * @link http://php.net/manual/en/language.constants.php - */ -define ('__FUNCTION__', null); - -/** - * The class method name. (Added in PHP 5.0.0) The method name is - * returned as it was declared (case-sensitive). - * @link http://php.net/manual/en/language.constants.php - */ -define ('__METHOD__', null); - -/** - * The trait name. (Added in PHP 5.4.0) As of PHP 5.4 this constant - * returns the trait as it was declared (case-sensitive). The trait name includes the namespace - * it was declared in (e.g. Foo\Bar). - * @link http://php.net/manual/en/language.constants.php - */ -define ('__TRAIT__', null); - -/** - * The directory of the file. If used inside an include, - * the directory of the included file is returned. This is equivalent - * to dirname(__FILE__). This directory name - * does not have a trailing slash unless it is the root directory. - * (Added in PHP 5.3.0.) - * @link http://php.net/manual/en/language.constants.php - */ -define ('__DIR__', null); - -/** - * The name of the current namespace (case-sensitive). This constant - * is defined in compile-time (Added in PHP 5.3.0). - * @link http://php.net/manual/en/language.constants.php - */ -define ('__NAMESPACE__', null); -?> diff --git a/phpruntime/bcmath.php b/phpruntime/bcmath.php deleted file mode 100644 index 80522af..0000000 --- a/phpruntime/bcmath.php +++ /dev/null @@ -1,161 +0,0 @@ - - * Add two arbitrary precision numbers - * @link http://php.net/manual/en/function.bcadd.php - * @param string $left_operand

- * The left operand, as a string. - *

- * @param string $right_operand

- * The right operand, as a string. - *

- * @param int $scale [optional] - * @return string The sum of the two operands, as a string. - */ -function bcadd ($left_operand, $right_operand, $scale = null) {} - -/** - * (PHP 4, PHP 5)
- * Subtract one arbitrary precision number from another - * @link http://php.net/manual/en/function.bcsub.php - * @param string $left_operand

- * The left operand, as a string. - *

- * @param string $right_operand

- * The right operand, as a string. - *

- * @param int $scale [optional] - * @return string The result of the subtraction, as a string. - */ -function bcsub ($left_operand, $right_operand, $scale = null) {} - -/** - * (PHP 4, PHP 5)
- * Multiply two arbitrary precision number - * @link http://php.net/manual/en/function.bcmul.php - * @param string $left_operand

- * The left operand, as a string. - *

- * @param string $right_operand

- * The right operand, as a string. - *

- * @param int $scale [optional] - * @return string the result as a string. - */ -function bcmul ($left_operand, $right_operand, $scale = null) {} - -/** - * (PHP 4, PHP 5)
- * Divide two arbitrary precision numbers - * @link http://php.net/manual/en/function.bcdiv.php - * @param string $left_operand

- * The left operand, as a string. - *

- * @param string $right_operand

- * The right operand, as a string. - *

- * @param int $scale [optional] - * @return string the result of the division as a string, or NULL if - * right_operand is 0. - */ -function bcdiv ($left_operand, $right_operand, $scale = null) {} - -/** - * (PHP 4, PHP 5)
- * Get modulus of an arbitrary precision number - * @link http://php.net/manual/en/function.bcmod.php - * @param string $left_operand

- * The left operand, as a string. - *

- * @param string $modulus

- * The modulus, as a string. - *

- * @return string the modulus as a string, or NULL if - * modulus is 0. - */ -function bcmod ($left_operand, $modulus) {} - -/** - * (PHP 4, PHP 5)
- * Raise an arbitrary precision number to another - * @link http://php.net/manual/en/function.bcpow.php - * @param string $left_operand

- * The left operand, as a string. - *

- * @param string $right_operand

- * The right operand, as a string. - *

- * @param int $scale [optional] - * @return string the result as a string. - */ -function bcpow ($left_operand, $right_operand, $scale = null) {} - -/** - * (PHP 4, PHP 5)
- * Get the square root of an arbitrary precision number - * @link http://php.net/manual/en/function.bcsqrt.php - * @param string $operand

- * The operand, as a string. - *

- * @param int $scale [optional] - * @return string the square root as a string, or NULL if - * operand is negative. - */ -function bcsqrt ($operand, $scale = null) {} - -/** - * (PHP 4, PHP 5)
- * Set default scale parameter for all bc math functions - * @link http://php.net/manual/en/function.bcscale.php - * @param int $scale

- * The scale factor. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function bcscale ($scale) {} - -/** - * (PHP 4, PHP 5)
- * Compare two arbitrary precision numbers - * @link http://php.net/manual/en/function.bccomp.php - * @param string $left_operand

- * The left operand, as a string. - *

- * @param string $right_operand

- * The right operand, as a string. - *

- * @param int $scale [optional]

- * The optional scale parameter is used to set the - * number of digits after the decimal place which will be used in the - * comparison. - *

- * @return int 0 if the two operands are equal, 1 if the - * left_operand is larger than the - * right_operand, -1 otherwise. - */ -function bccomp ($left_operand, $right_operand, $scale = null) {} - -/** - * (PHP 5)
- * Raise an arbitrary precision number to another, reduced by a specified modulus - * @link http://php.net/manual/en/function.bcpowmod.php - * @param string $left_operand

- * The left operand, as a string. - *

- * @param string $right_operand

- * The right operand, as a string. - *

- * @param string $modulus

- * The modulus, as a string. - *

- * @param int $scale [optional] - * @return string the result as a string, or NULL if modulus - * is 0. - */ -function bcpowmod ($left_operand, $right_operand, $modulus, $scale = null) {} - -// End of bcmath v. -?> diff --git a/phpruntime/bz2.php b/phpruntime/bz2.php deleted file mode 100644 index 86dc949..0000000 --- a/phpruntime/bz2.php +++ /dev/null @@ -1,167 +0,0 @@ - - * Opens a bzip2 compressed file - * @link http://php.net/manual/en/function.bzopen.php - * @param string $filename

- * The name of the file to open. - *

- * @param string $mode

- * Similar to the fopen function, only 'r' (read) - * and 'w' (write) are supported. Everything else will cause bzopen - * to return FALSE. - *

- * @return resource If the open fails, bzopen returns FALSE, otherwise - * it returns a pointer to the newly opened file. - */ -function bzopen ($filename, $mode) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Binary safe bzip2 file read - * @link http://php.net/manual/en/function.bzread.php - * @param resource $bz

- * The file pointer. It must be valid and must point to a file - * successfully opened by bzopen. - *

- * @param int $length [optional]

- * If not specified, bzread will read 1024 - * (uncompressed) bytes at a time. A maximum of 8192 - * uncompressed bytes will be read at a time. - *

- * @return string the uncompressed data, or FALSE on error. - */ -function bzread ($bz, $length = 1024) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Binary safe bzip2 file write - * @link http://php.net/manual/en/function.bzwrite.php - * @param resource $bz

- * The file pointer. It must be valid and must point to a file - * successfully opened by bzopen. - *

- * @param string $data

- * The written data. - *

- * @param int $length [optional]

- * If supplied, writing will stop after length - * (uncompressed) bytes have been written or the end of - * data is reached, whichever comes first. - *

- * @return int the number of bytes written, or FALSE on error. - */ -function bzwrite ($bz, $data, $length = null) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Force a write of all buffered data - * @link http://php.net/manual/en/function.bzflush.php - * @param resource $bz

- * The file pointer. It must be valid and must point to a file - * successfully opened by bzopen. - *

- * @return int TRUE on success or FALSE on failure. - */ -function bzflush ($bz) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Close a bzip2 file - * @link http://php.net/manual/en/function.bzclose.php - * @param resource $bz

- * The file pointer. It must be valid and must point to a file - * successfully opened by bzopen. - *

- * @return int TRUE on success or FALSE on failure. - */ -function bzclose ($bz) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Returns a bzip2 error number - * @link http://php.net/manual/en/function.bzerrno.php - * @param resource $bz

- * The file pointer. It must be valid and must point to a file - * successfully opened by bzopen. - *

- * @return int the error number as an integer. - */ -function bzerrno ($bz) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Returns a bzip2 error string - * @link http://php.net/manual/en/function.bzerrstr.php - * @param resource $bz

- * The file pointer. It must be valid and must point to a file - * successfully opened by bzopen. - *

- * @return string a string containing the error message. - */ -function bzerrstr ($bz) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Returns the bzip2 error number and error string in an array - * @link http://php.net/manual/en/function.bzerror.php - * @param resource $bz

- * The file pointer. It must be valid and must point to a file - * successfully opened by bzopen. - *

- * @return array an associative array, with the error code in the - * errno entry, and the error message in the - * errstr entry. - */ -function bzerror ($bz) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Compress a string into bzip2 encoded data - * @link http://php.net/manual/en/function.bzcompress.php - * @param string $source

- * The string to compress. - *

- * @param int $blocksize [optional]

- * Specifies the blocksize used during compression and should be a number - * from 1 to 9 with 9 giving the best compression, but using more - * resources to do so. - *

- * @param int $workfactor [optional]

- * Controls how the compression phase behaves when presented with worst - * case, highly repetitive, input data. The value can be between 0 and - * 250 with 0 being a special case. - *

- *

- * Regardless of the workfactor, the generated - * output is the same. - *

- * @return mixed The compressed string, or an error number if an error occurred. - */ -function bzcompress ($source, $blocksize = 4, $workfactor = 0) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Decompresses bzip2 encoded data - * @link http://php.net/manual/en/function.bzdecompress.php - * @param string $source

- * The string to decompress. - *

- * @param int $small [optional]

- * If TRUE, an alternative decompression algorithm will be used which - * uses less memory (the maximum memory requirement drops to around 2300K) - * but works at roughly half the speed. - *

- *

- * See the bzip2 documentation for more - * information about this feature. - *

- * @return mixed The decompressed string, or an error number if an error occurred. - */ -function bzdecompress ($source, $small = 0) {} - -// End of bz2 v. -?> diff --git a/phpruntime/calendar.php b/phpruntime/calendar.php deleted file mode 100644 index 8010af9..0000000 --- a/phpruntime/calendar.php +++ /dev/null @@ -1,318 +0,0 @@ - - * Converts Julian Day Count to Gregorian date - * @link http://php.net/manual/en/function.jdtogregorian.php - * @param int $julianday

- * A julian day number as integer - *

- * @return string The gregorian date as a string in the form "month/day/year" - */ -function jdtogregorian ($julianday) {} - -/** - * (PHP 4, PHP 5)
- * Converts a Gregorian date to Julian Day Count - * @link http://php.net/manual/en/function.gregoriantojd.php - * @param int $month

- * The month as a number from 1 (for January) to 12 (for December) - *

- * @param int $day

- * The day as a number from 1 to 31 - *

- * @param int $year

- * The year as a number between -4714 and 9999 - *

- * @return int The julian day for the given gregorian date as an integer. - */ -function gregoriantojd ($month, $day, $year) {} - -/** - * (PHP 4, PHP 5)
- * Converts a Julian Day Count to a Julian Calendar Date - * @link http://php.net/manual/en/function.jdtojulian.php - * @param int $julianday

- * A julian day number as integer - *

- * @return string The julian date as a string in the form "month/day/year" - */ -function jdtojulian ($julianday) {} - -/** - * (PHP 4, PHP 5)
- * Converts a Julian Calendar date to Julian Day Count - * @link http://php.net/manual/en/function.juliantojd.php - * @param int $month

- * The month as a number from 1 (for January) to 12 (for December) - *

- * @param int $day

- * The day as a number from 1 to 31 - *

- * @param int $year

- * The year as a number between -4713 and 9999 - *

- * @return int The julian day for the given julian date as an integer. - */ -function juliantojd ($month, $day, $year) {} - -/** - * (PHP 4, PHP 5)
- * Converts a Julian day count to a Jewish calendar date - * @link http://php.net/manual/en/function.jdtojewish.php - * @param int $juliandaycount - * @param bool $hebrew [optional]

- * If the hebrew parameter is set to TRUE, the - * fl parameter is used for Hebrew, string based, - * output format. - *

- * @param int $fl [optional]

- * The available formats are: - * CAL_JEWISH_ADD_ALAFIM_GERESH, - * CAL_JEWISH_ADD_ALAFIM, - * CAL_JEWISH_ADD_GERESHAYIM. - *

- * @return string The jewish date as a string in the form "month/day/year" - */ -function jdtojewish ($juliandaycount, $hebrew = false, $fl = 0) {} - -/** - * (PHP 4, PHP 5)
- * Converts a date in the Jewish Calendar to Julian Day Count - * @link http://php.net/manual/en/function.jewishtojd.php - * @param int $month

- * The month as a number from 1 to 13 - *

- * @param int $day

- * The day as a number from 1 to 30 - *

- * @param int $year

- * The year as a number between 1 and 9999 - *

- * @return int The julian day for the given jewish date as an integer. - */ -function jewishtojd ($month, $day, $year) {} - -/** - * (PHP 4, PHP 5)
- * Converts a Julian Day Count to the French Republican Calendar - * @link http://php.net/manual/en/function.jdtofrench.php - * @param int $juliandaycount - * @return string The french revolution date as a string in the form "month/day/year" - */ -function jdtofrench ($juliandaycount) {} - -/** - * (PHP 4, PHP 5)
- * Converts a date from the French Republican Calendar to a Julian Day Count - * @link http://php.net/manual/en/function.frenchtojd.php - * @param int $month

- * The month as a number from 1 (for Vendémiaire) to 13 (for the period of 5-6 days at the end of each year) - *

- * @param int $day

- * The day as a number from 1 to 30 - *

- * @param int $year

- * The year as a number between 1 and 14 - *

- * @return int The julian day for the given french revolution date as an integer. - */ -function frenchtojd ($month, $day, $year) {} - -/** - * (PHP 4, PHP 5)
- * Returns the day of the week - * @link http://php.net/manual/en/function.jddayofweek.php - * @param int $julianday

- * A julian day number as integer - *

- * @param int $mode [optional] - * Calendar week modes - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
ModeMeaning
0 (Default) - * Return the day number as an int (0=Sunday, 1=Monday, etc) - *
1 - * Returns string containing the day of week - * (English-Gregorian) - *
2 - * Return a string containing the abbreviated day of week - * (English-Gregorian) - *
- * @return mixed The gregorian weekday as either an integer or string. - */ -function jddayofweek ($julianday, $mode = 'CAL_DOW_DAYNO') {} - -/** - * (PHP 4, PHP 5)
- * Returns a month name - * @link http://php.net/manual/en/function.jdmonthname.php - * @param int $julianday - * @param int $mode - * @return string The month name for the given Julian Day and calendar. - */ -function jdmonthname ($julianday, $mode) {} - -/** - * (PHP 4, PHP 5)
- * Get Unix timestamp for midnight on Easter of a given year - * @link http://php.net/manual/en/function.easter-date.php - * @param int $year [optional]

- * The year as a number between 1970 an 2037 - *

- * @return int The easter date as a unix timestamp. - */ -function easter_date ($year = null) {} - -/** - * (PHP 4, PHP 5)
- * Get number of days after March 21 on which Easter falls for a given year - * @link http://php.net/manual/en/function.easter-days.php - * @param int $year [optional]

- * The year as a positive number - *

- * @param int $method [optional]

- * Allows to calculate easter dates based - * on the Gregorian calendar during the years 1582 - 1752 when set to - * CAL_EASTER_ROMAN. See the calendar constants for more valid - * constants. - *

- * @return int The number of days after March 21st that the Easter Sunday - * is in the given year. - */ -function easter_days ($year = null, $method = 'CAL_EASTER_DEFAULT') {} - -/** - * (PHP 4, PHP 5)
- * Convert Unix timestamp to Julian Day - * @link http://php.net/manual/en/function.unixtojd.php - * @param int $timestamp [optional]

- * A unix timestamp to convert. - *

- * @return int A julian day number as integer. - */ -function unixtojd ($timestamp = 'time()') {} - -/** - * (PHP 4, PHP 5)
- * Convert Julian Day to Unix timestamp - * @link http://php.net/manual/en/function.jdtounix.php - * @param int $jday

- * A julian day number between 2440588 and 2465342. - *

- * @return int The unix timestamp for the start of the given julian day. - */ -function jdtounix ($jday) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Converts from a supported calendar to Julian Day Count - * @link http://php.net/manual/en/function.cal-to-jd.php - * @param int $calendar

- * Calendar to convert from, one of - * CAL_GREGORIAN, - * CAL_JULIAN, - * CAL_JEWISH or - * CAL_FRENCH. - *

- * @param int $month

- * The month as a number, the valid range depends - * on the calendar - *

- * @param int $day

- * The day as a number, the valid range depends - * on the calendar - *

- * @param int $year

- * The year as a number, the valid range depends - * on the calendar - *

- * @return int A Julian Day number. - */ -function cal_to_jd ($calendar, $month, $day, $year) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Converts from Julian Day Count to a supported calendar - * @link http://php.net/manual/en/function.cal-from-jd.php - * @param int $jd

- * Julian day as integer - *

- * @param int $calendar

- * Calendar to convert to - *

- * @return array an array containing calendar information like month, day, year, - * day of week, abbreviated and full names of weekday and month and the - * date in string form "month/day/year". - */ -function cal_from_jd ($jd, $calendar) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Return the number of days in a month for a given year and calendar - * @link http://php.net/manual/en/function.cal-days-in-month.php - * @param int $calendar

- * Calendar to use for calculation - *

- * @param int $month

- * Month in the selected calendar - *

- * @param int $year

- * Year in the selected calendar - *

- * @return int The length in days of the selected month in the given calendar - */ -function cal_days_in_month ($calendar, $month, $year) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Returns information about a particular calendar - * @link http://php.net/manual/en/function.cal-info.php - * @param int $calendar [optional]

- * Calendar to return information for. If no calendar is specified - * information about all calendars is returned. - *

- * @return array - */ -function cal_info ($calendar = -1) {} - -define ('CAL_GREGORIAN', 0); -define ('CAL_JULIAN', 1); -define ('CAL_JEWISH', 2); -define ('CAL_FRENCH', 3); -define ('CAL_NUM_CALS', 4); -define ('CAL_DOW_DAYNO', 0); -define ('CAL_DOW_SHORT', 1); -define ('CAL_DOW_LONG', 2); -define ('CAL_MONTH_GREGORIAN_SHORT', 0); -define ('CAL_MONTH_GREGORIAN_LONG', 1); -define ('CAL_MONTH_JULIAN_SHORT', 2); -define ('CAL_MONTH_JULIAN_LONG', 3); -define ('CAL_MONTH_JEWISH', 4); -define ('CAL_MONTH_FRENCH', 5); -define ('CAL_EASTER_DEFAULT', 0); -define ('CAL_EASTER_ROMAN', 1); -define ('CAL_EASTER_ALWAYS_GREGORIAN', 2); -define ('CAL_EASTER_ALWAYS_JULIAN', 3); -define ('CAL_JEWISH_ADD_ALAFIM_GERESH', 2); -define ('CAL_JEWISH_ADD_ALAFIM', 4); -define ('CAL_JEWISH_ADD_GERESHAYIM', 8); - -// End of calendar v. -?> diff --git a/phpruntime/ctype.php b/phpruntime/ctype.php deleted file mode 100644 index 50a5f7e..0000000 --- a/phpruntime/ctype.php +++ /dev/null @@ -1,145 +0,0 @@ - - * Check for alphanumeric character(s) - * @link http://php.net/manual/en/function.ctype-alnum.php - * @param string $text

- * The tested string. - *

- * @return bool TRUE if every character in text is either - * a letter or a digit, FALSE otherwise. - */ -function ctype_alnum ($text) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Check for alphabetic character(s) - * @link http://php.net/manual/en/function.ctype-alpha.php - * @param string $text

- * The tested string. - *

- * @return bool TRUE if every character in text is - * a letter from the current locale, FALSE otherwise. - */ -function ctype_alpha ($text) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Check for control character(s) - * @link http://php.net/manual/en/function.ctype-cntrl.php - * @param string $text

- * The tested string. - *

- * @return bool TRUE if every character in text is - * a control character from the current locale, FALSE otherwise. - */ -function ctype_cntrl ($text) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Check for numeric character(s) - * @link http://php.net/manual/en/function.ctype-digit.php - * @param string $text

- * The tested string. - *

- * @return bool TRUE if every character in the string - * text is a decimal digit, FALSE otherwise. - */ -function ctype_digit ($text) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Check for lowercase character(s) - * @link http://php.net/manual/en/function.ctype-lower.php - * @param string $text

- * The tested string. - *

- * @return bool TRUE if every character in text is - * a lowercase letter in the current locale. - */ -function ctype_lower ($text) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Check for any printable character(s) except space - * @link http://php.net/manual/en/function.ctype-graph.php - * @param string $text

- * The tested string. - *

- * @return bool TRUE if every character in text is - * printable and actually creates visible output (no white space), FALSE - * otherwise. - */ -function ctype_graph ($text) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Check for printable character(s) - * @link http://php.net/manual/en/function.ctype-print.php - * @param string $text

- * The tested string. - *

- * @return bool TRUE if every character in text - * will actually create output (including blanks). Returns FALSE if - * text contains control characters or characters - * that do not have any output or control function at all. - */ -function ctype_print ($text) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Check for any printable character which is not whitespace or an -alphanumeric character - * @link http://php.net/manual/en/function.ctype-punct.php - * @param string $text

- * The tested string. - *

- * @return bool TRUE if every character in text - * is printable, but neither letter, digit or blank, FALSE otherwise. - */ -function ctype_punct ($text) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Check for whitespace character(s) - * @link http://php.net/manual/en/function.ctype-space.php - * @param string $text

- * The tested string. - *

- * @return bool TRUE if every character in text - * creates some sort of white space, FALSE otherwise. Besides the - * blank character this also includes tab, vertical tab, line feed, - * carriage return and form feed characters. - */ -function ctype_space ($text) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Check for uppercase character(s) - * @link http://php.net/manual/en/function.ctype-upper.php - * @param string $text

- * The tested string. - *

- * @return bool TRUE if every character in text is - * an uppercase letter in the current locale. - */ -function ctype_upper ($text) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Check for character(s) representing a hexadecimal digit - * @link http://php.net/manual/en/function.ctype-xdigit.php - * @param string $text

- * The tested string. - *

- * @return bool TRUE if every character in text is - * a hexadecimal 'digit', that is a decimal digit or a character from - * [A-Fa-f] , FALSE otherwise. - */ -function ctype_xdigit ($text) {} - -// End of ctype v. -?> diff --git a/phpruntime/curl.php b/phpruntime/curl.php deleted file mode 100644 index f3a8cf5..0000000 --- a/phpruntime/curl.php +++ /dev/null @@ -1,1692 +0,0 @@ - - * Initialize a cURL session - * @link http://php.net/manual/en/function.curl-init.php - * @param string $url [optional]

- * If provided, the CURLOPT_URL option will be set - * to its value. You can manually set this using the - * curl_setopt function. - *

- *

- * The file protocol is disabled by cURL if - * open_basedir is set. - *

- * @return resource a cURL handle on success, FALSE on errors. - */ -function curl_init ($url = null) {} - -/** - * (PHP 5)
- * Copy a cURL handle along with all of its preferences - * @link http://php.net/manual/en/function.curl-copy-handle.php - * @param resource $ch - * @return resource a new cURL handle. - */ -function curl_copy_handle ($ch) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Gets cURL version information - * @link http://php.net/manual/en/function.curl-version.php - * @param int $age [optional] - * @return array an associative array with the following elements: - * - * Indice - * Value description - * - * - * version_number - * cURL 24 bit version number - * - * - * version - * cURL version number, as a string - * - * - * ssl_version_number - * OpenSSL 24 bit version number - * - * - * ssl_version - * OpenSSL version number, as a string - * - * - * libz_version - * zlib version number, as a string - * - * - * host - * Information about the host where cURL was built - * - * - * age - * - * - * - * features - * A bitmask of the CURL_VERSION_XXX constants - * - * - * protocols - * An array of protocols names supported by cURL - * - */ -function curl_version ($age = 'CURLVERSION_NOW') {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Set an option for a cURL transfer - * @link http://php.net/manual/en/function.curl-setopt.php - * @param resource $ch - * @param int $option

- * The CURLOPT_XXX option to set. - *

- * @param mixed $value

- * The value to be set on option. - *

- *

- * value should be a bool for the - * following values of the option parameter: - * - * Option - * Set value to - * Notes - * - * - * CURLOPT_AUTOREFERER - * TRUE to automatically set the Referer: field in - * requests where it follows a Location: redirect. - * - * - * - * - * CURLOPT_BINARYTRANSFER - * TRUE to return the raw output when - * CURLOPT_RETURNTRANSFER is used. - * - * From PHP 5.1.3, this option has no effect: the raw output will - * always be returned when - * CURLOPT_RETURNTRANSFER is used. - * - * - * - * CURLOPT_COOKIESESSION - * TRUE to mark this as a new cookie "session". It will force libcurl - * to ignore all cookies it is about to load that are "session cookies" - * from the previous session. By default, libcurl always stores and - * loads all cookies, independent if they are session cookies or not. - * Session cookies are cookies without expiry date and they are meant - * to be alive and existing for this "session" only. - * - * - * - * - * CURLOPT_CERTINFO - * TRUE to output SSL certification information to STDERR - * on secure transfers. - * - * Added in cURL 7.19.1. - * Available since PHP 5.3.2. - * Requires CURLOPT_VERBOSE to be on to have an effect. - * - * - * - * CURLOPT_CRLF - * TRUE to convert Unix newlines to CRLF newlines - * on transfers. - * - * - * - * - * CURLOPT_DNS_USE_GLOBAL_CACHE - * TRUE to use a global DNS cache. This option is - * not thread-safe and is enabled by default. - * - * - * - * - * CURLOPT_FAILONERROR - * TRUE to fail silently if the HTTP code returned - * is greater than or equal to 400. The default behavior is to return - * the page normally, ignoring the code. - * - * - * - * - * CURLOPT_FILETIME - * TRUE to attempt to retrieve the modification - * date of the remote document. This value can be retrieved using - * the CURLINFO_FILETIME option with - * curl_getinfo. - * - * - * - * - * CURLOPT_FOLLOWLOCATION - * TRUE to follow any - * "Location: " header that the server sends as - * part of the HTTP header (note this is recursive, PHP will follow as - * many "Location: " headers that it is sent, - * unless CURLOPT_MAXREDIRS is set). - * - * - * - * - * CURLOPT_FORBID_REUSE - * TRUE to force the connection to explicitly - * close when it has finished processing, and not be pooled for reuse. - * - * - * - * - * CURLOPT_FRESH_CONNECT - * TRUE to force the use of a new connection - * instead of a cached one. - * - * - * - * - * CURLOPT_FTP_USE_EPRT - * TRUE to use EPRT (and LPRT) when doing active - * FTP downloads. Use FALSE to disable EPRT and LPRT and use PORT - * only. - * - * - * - * - * CURLOPT_FTP_USE_EPSV - * TRUE to first try an EPSV command for FTP - * transfers before reverting back to PASV. Set to FALSE - * to disable EPSV. - * - * - * - * - * CURLOPT_FTP_CREATE_MISSING_DIRS - * TRUE to create missing directories when an FTP operation - * encounters a path that currently doesn't exist. - * - * - * - * - * CURLOPT_FTPAPPEND - * TRUE to append to the remote file instead of - * overwriting it. - * - * - * - * - * CURLOPT_FTPASCII - * An alias of - * CURLOPT_TRANSFERTEXT. Use that instead. - * - * - * - * - * CURLOPT_FTPLISTONLY - * TRUE to only list the names of an FTP - * directory. - * - * - * - * - * CURLOPT_HEADER - * TRUE to include the header in the output. - * - * - * - * - * CURLINFO_HEADER_OUT - * TRUE to track the handle's request string. - * - * Available since PHP 5.1.3. The CURLINFO_ - * prefix is intentional. - * - * - * - * CURLOPT_HTTPGET - * TRUE to reset the HTTP request method to GET. - * Since GET is the default, this is only necessary if the request - * method has been changed. - * - * - * - * - * CURLOPT_HTTPPROXYTUNNEL - * TRUE to tunnel through a given HTTP proxy. - * - * - * - * - * CURLOPT_MUTE - * TRUE to be completely silent with regards to - * the cURL functions. - * - * - * - * - * CURLOPT_NETRC - * TRUE to scan the ~/.netrc - * file to find a username and password for the remote site that - * a connection is being established with. - * - * - * - * - * CURLOPT_NOBODY - * TRUE to exclude the body from the output. - * Request method is then set to HEAD. Changing this to FALSE does - * not change it to GET. - * - * - * - * - * CURLOPT_NOPROGRESS - *

- * TRUE to disable the progress meter for cURL transfers. - *

- * PHP automatically sets this option to TRUE, this should only be - * changed for debugging purposes. - *

- *

- * - * - * - * CURLOPT_NOSIGNAL - * TRUE to ignore any cURL function that causes a - * signal to be sent to the PHP process. This is turned on by default - * in multi-threaded SAPIs so timeout options can still be used. - * - * Added in cURL 7.10. - * - * - * - * CURLOPT_POST - * TRUE to do a regular HTTP POST. This POST is the - * normal application/x-www-form-urlencoded kind, - * most commonly used by HTML forms. - * - * - * - * - * CURLOPT_PUT - * TRUE to HTTP PUT a file. The file to PUT must - * be set with CURLOPT_INFILE and - * CURLOPT_INFILESIZE. - * - * - * - * - * CURLOPT_RETURNTRANSFER - * TRUE to return the transfer as a string of the - * return value of curl_exec instead of outputting - * it out directly. - * - * - * - * - * CURLOPT_SSL_VERIFYPEER - * FALSE to stop cURL from verifying the peer's - * certificate. Alternate certificates to verify against can be - * specified with the CURLOPT_CAINFO option - * or a certificate directory can be specified with the - * CURLOPT_CAPATH option. - * - * TRUE by default as of cURL 7.10. Default bundle installed as of - * cURL 7.10. - * - * - * - * CURLOPT_TRANSFERTEXT - * TRUE to use ASCII mode for FTP transfers. - * For LDAP, it retrieves data in plain text instead of HTML. On - * Windows systems, it will not set STDOUT to binary - * mode. - * - * - * - * - * CURLOPT_UNRESTRICTED_AUTH - * TRUE to keep sending the username and password - * when following locations (using - * CURLOPT_FOLLOWLOCATION), even when the - * hostname has changed. - * - * - * - * - * CURLOPT_UPLOAD - * TRUE to prepare for an upload. - * - * - * - * - * CURLOPT_VERBOSE - * TRUE to output verbose information. Writes - * output to STDERR, or the file specified using - * CURLOPT_STDERR. - * - * - * - *

- *

- * value should be an integer for the - * following values of the option parameter: - * - * Option - * Set value to - * Notes - * - * - * CURLOPT_BUFFERSIZE - * The size of the buffer to use for each read. There is no guarantee - * this request will be fulfilled, however. - * - * Added in cURL 7.10. - * - * - * - * CURLOPT_CLOSEPOLICY - * Either - * CURLCLOSEPOLICY_LEAST_RECENTLY_USED or - * CURLCLOSEPOLICY_OLDEST. - * There are three other CURLCLOSEPOLICY_ - * constants, but cURL does not support them yet. - * - * - * - * - * CURLOPT_CONNECTTIMEOUT - * The number of seconds to wait while trying to connect. Use 0 to - * wait indefinitely. - * - * - * - * - * CURLOPT_CONNECTTIMEOUT_MS - * The number of milliseconds to wait while trying to connect. Use 0 to - * wait indefinitely. - * If libcurl is built to use the standard system name resolver, that - * portion of the connect will still use full-second resolution for - * timeouts with a minimum timeout allowed of one second. - * - * Added in cURL 7.16.2. Available since PHP 5.2.3. - * - * - * - * CURLOPT_DNS_CACHE_TIMEOUT - * The number of seconds to keep DNS entries in memory. This - * option is set to 120 (2 minutes) by default. - * - * - * - * - * CURLOPT_FTPSSLAUTH - * The FTP authentication method (when is activated): - * CURLFTPAUTH_SSL (try SSL first), - * CURLFTPAUTH_TLS (try TLS first), or - * CURLFTPAUTH_DEFAULT (let cURL decide). - * - * Added in cURL 7.12.2. - * - * - * - * CURLOPT_HTTP_VERSION - * CURL_HTTP_VERSION_NONE (default, lets CURL - * decide which version to use), - * CURL_HTTP_VERSION_1_0 (forces HTTP/1.0), - * or CURL_HTTP_VERSION_1_1 (forces HTTP/1.1). - * - * - * - * - * CURLOPT_HTTPAUTH - *

- * The HTTP authentication method(s) to use. The options are: - * CURLAUTH_BASIC, - * CURLAUTH_DIGEST, - * CURLAUTH_GSSNEGOTIATE, - * CURLAUTH_NTLM, - * CURLAUTH_ANY, and - * CURLAUTH_ANYSAFE. - *

- *

- * The bitwise | (or) operator can be used to combine - * more than one method. If this is done, cURL will poll the server to see - * what methods it supports and pick the best one. - *

- *

- * CURLAUTH_ANY is an alias for - * CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM. - *

- *

- * CURLAUTH_ANYSAFE is an alias for - * CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM. - *

- * - * - * - * - * CURLOPT_INFILESIZE - * The expected size, in bytes, of the file when uploading a file to - * a remote site. Note that using this option will not stop libcurl - * from sending more data, as exactly what is sent depends on - * CURLOPT_READFUNCTION. - * - * - * - * - * CURLOPT_LOW_SPEED_LIMIT - * The transfer speed, in bytes per second, that the transfer should be - * below during the count of CURLOPT_LOW_SPEED_TIME - * seconds before PHP considers the transfer too slow and aborts. - * - * - * - * - * CURLOPT_LOW_SPEED_TIME - * The number of seconds the transfer speed should be below - * CURLOPT_LOW_SPEED_LIMIT before PHP considers - * the transfer too slow and aborts. - * - * - * - * - * CURLOPT_MAXCONNECTS - * The maximum amount of persistent connections that are allowed. - * When the limit is reached, - * CURLOPT_CLOSEPOLICY is used to determine - * which connection to close. - * - * - * - * - * CURLOPT_MAXREDIRS - * The maximum amount of HTTP redirections to follow. Use this option - * alongside CURLOPT_FOLLOWLOCATION. - * - * - * - * - * CURLOPT_PORT - * An alternative port number to connect to. - * - * - * - * - * CURLOPT_PROTOCOLS - *

- * Bitmask of CURLPROTO_* values. If used, this bitmask - * limits what protocols libcurl may use in the transfer. This allows you to have - * a libcurl built to support a wide range of protocols but still limit specific - * transfers to only be allowed to use a subset of them. By default libcurl will - * accept all protocols it supports. - * See also CURLOPT_REDIR_PROTOCOLS. - *

- *

- * Valid protocol options are: - * CURLPROTO_HTTP, - * CURLPROTO_HTTPS, - * CURLPROTO_FTP, - * CURLPROTO_FTPS, - * CURLPROTO_SCP, - * CURLPROTO_SFTP, - * CURLPROTO_TELNET, - * CURLPROTO_LDAP, - * CURLPROTO_LDAPS, - * CURLPROTO_DICT, - * CURLPROTO_FILE, - * CURLPROTO_TFTP, - * CURLPROTO_ALL - *

- * - * Added in cURL 7.19.4. - * - * - * - * CURLOPT_PROXYAUTH - * The HTTP authentication method(s) to use for the proxy connection. - * Use the same bitmasks as described in - * CURLOPT_HTTPAUTH. For proxy authentication, - * only CURLAUTH_BASIC and - * CURLAUTH_NTLM are currently supported. - * - * Added in cURL 7.10.7. - * - * - * - * CURLOPT_PROXYPORT - * The port number of the proxy to connect to. This port number can - * also be set in CURLOPT_PROXY. - * - * - * - * - * CURLOPT_PROXYTYPE - * Either CURLPROXY_HTTP (default) or - * CURLPROXY_SOCKS5. - * - * Added in cURL 7.10. - * - * - * - * CURLOPT_REDIR_PROTOCOLS - * Bitmask of CURLPROTO_* values. If used, this bitmask - * limits what protocols libcurl may use in a transfer that it follows to in - * a redirect when CURLOPT_FOLLOWLOCATION is enabled. - * This allows you to limit specific transfers to only be allowed to use a subset - * of protocols in redirections. By default libcurl will allow all protocols - * except for FILE and SCP. This is a difference compared to pre-7.19.4 versions - * which unconditionally would follow to all protocols supported. - * See also CURLOPT_PROTOCOLS for protocol constant values. - * - * Added in cURL 7.19.4. - * - * - * - * CURLOPT_RESUME_FROM - * The offset, in bytes, to resume a transfer from. - * - * - * - * - * CURLOPT_SSL_VERIFYHOST - * 1 to check the existence of a common name in the - * SSL peer certificate. 2 to check the existence of - * a common name and also verify that it matches the hostname - * provided. In production environments the value of this option - * should be kept at 2 (default value). - * - * - * - * - * CURLOPT_SSLVERSION - * The SSL version (2 or 3) to use. By default PHP will try to determine - * this itself, although in some cases this must be set manually. - * - * - * - * - * CURLOPT_TIMECONDITION - * How CURLOPT_TIMEVALUE is treated. - * Use CURL_TIMECOND_IFMODSINCE to return the - * page only if it has been modified since the time specified in - * CURLOPT_TIMEVALUE. If it hasn't been modified, - * a "304 Not Modified" header will be returned - * assuming CURLOPT_HEADER is TRUE. - * Use CURL_TIMECOND_IFUNMODSINCE for the reverse - * effect. CURL_TIMECOND_IFMODSINCE is the - * default. - * - * - * - * - * CURLOPT_TIMEOUT - * The maximum number of seconds to allow cURL functions to execute. - * - * - * - * - * CURLOPT_TIMEOUT_MS - * The maximum number of milliseconds to allow cURL functions to - * execute. - * If libcurl is built to use the standard system name resolver, that - * portion of the connect will still use full-second resolution for - * timeouts with a minimum timeout allowed of one second. - * - * Added in cURL 7.16.2. Available since PHP 5.2.3. - * - * - * - * CURLOPT_TIMEVALUE - * The time in seconds since January 1st, 1970. The time will be used - * by CURLOPT_TIMECONDITION. By default, - * CURL_TIMECOND_IFMODSINCE is used. - * - * - * - * - * CURLOPT_MAX_RECV_SPEED_LARGE - * If a download exceeds this speed (counted in bytes per second) on - * cumulative average during the transfer, the transfer will pause to - * keep the average rate less than or equal to the parameter value. - * Defaults to unlimited speed. - * - * Added in cURL 7.15.5. Available since PHP 5.4.0. - * - * - * - * CURLOPT_MAX_SEND_SPEED_LARGE - * If an upload exceeds this speed (counted in bytes per second) on - * cumulative average during the transfer, the transfer will pause to - * keep the average rate less than or equal to the parameter value. - * Defaults to unlimited speed. - * - * Added in cURL 7.15.5. Available since PHP 5.4.0. - * - * - * - * CURLOPT_SSH_AUTH_TYPES - * A bitmask consisting of one or more of - * CURLSSH_AUTH_PUBLICKEY, - * CURLSSH_AUTH_PASSWORD, - * CURLSSH_AUTH_HOST, - * CURLSSH_AUTH_KEYBOARD. Set to - * CURLSSH_AUTH_ANY to let libcurl pick one. - * - * Added in cURL 7.16.1. - * - * - *

- *

- * value should be a string for the - * following values of the option parameter: - * - * Option - * Set value to - * Notes - * - * - * CURLOPT_CAINFO - * The name of a file holding one or more certificates to verify the - * peer with. This only makes sense when used in combination with - * CURLOPT_SSL_VERIFYPEER. - * - * Requires absolute path. - * - * - * - * CURLOPT_CAPATH - * A directory that holds multiple CA certificates. Use this option - * alongside CURLOPT_SSL_VERIFYPEER. - * - * - * - * - * CURLOPT_COOKIE - * The contents of the "Cookie: " header to be - * used in the HTTP request. - * Note that multiple cookies are separated with a semicolon followed - * by a space (e.g., "fruit=apple; colour=red") - * - * - * - * - * CURLOPT_COOKIEFILE - * The name of the file containing the cookie data. The cookie file can - * be in Netscape format, or just plain HTTP-style headers dumped into - * a file. - * If the name is an empty string, no cookies are loaded, but cookie - * handling is still enabled. - * - * - * - * - * CURLOPT_COOKIEJAR - * The name of a file to save all internal cookies to when the handle is closed, - * e.g. after a call to curl_close. - * - * - * - * - * CURLOPT_CUSTOMREQUEST - *

- * A custom request method to use instead of - * "GET" or "HEAD" when doing - * a HTTP request. This is useful for doing - * "DELETE" or other, more obscure HTTP requests. - * Valid values are things like "GET", - * "POST", "CONNECT" and so on; - * i.e. Do not enter a whole HTTP request line here. For instance, - * entering "GET /index.html HTTP/1.0\r\n\r\n" - * would be incorrect. - *

- * Don't do this without making sure the server supports the custom - * request method first. - *

- *

- * - * - * - * CURLOPT_EGDSOCKET - * Like CURLOPT_RANDOM_FILE, except a filename - * to an Entropy Gathering Daemon socket. - * - * - * - * - * CURLOPT_ENCODING - * The contents of the "Accept-Encoding: " header. - * This enables decoding of the response. Supported encodings are - * "identity", "deflate", and - * "gzip". If an empty string, "", - * is set, a header containing all supported encoding types is sent. - * - * Added in cURL 7.10. - * - * - * - * CURLOPT_FTPPORT - * The value which will be used to get the IP address to use - * for the FTP "POST" instruction. The "POST" instruction tells - * the remote server to connect to our specified IP address. The - * string may be a plain IP address, a hostname, a network - * interface name (under Unix), or just a plain '-' to use the - * systems default IP address. - * - * - * - * - * CURLOPT_INTERFACE - * The name of the outgoing network interface to use. This can be an - * interface name, an IP address or a host name. - * - * - * - * - * CURLOPT_KEYPASSWD - * The password required to use the CURLOPT_SSLKEY - * or CURLOPT_SSH_PRIVATE_KEYFILE private key. - * - * Added in cURL 7.16.1. - * - * - * - * CURLOPT_KRB4LEVEL - * The KRB4 (Kerberos 4) security level. Any of the following values - * (in order from least to most powerful) are valid: - * "clear", - * "safe", - * "confidential", - * "private".. - * If the string does not match one of these, - * "private" is used. Setting this option to NULL - * will disable KRB4 security. Currently KRB4 security only works - * with FTP transactions. - * - * - * - * - * CURLOPT_POSTFIELDS - * The full data to post in a HTTP "POST" operation. - * To post a file, prepend a filename with @ and - * use the full path. The filetype can be explicitly specified by - * following the filename with the type in the format - * ';type=mimetype'. This parameter can either be - * passed as a urlencoded string like 'para1=val1&#38;para2=val2&#38;...' - * or as an array with the field name as key and field data as value. - * If value is an array, the - * Content-Type header will be set to - * multipart/form-data. - * As of PHP 5.2.0, value must be an array if - * files are passed to this option with the @ prefix. - * - * - * - * - * CURLOPT_PROXY - * The HTTP proxy to tunnel requests through. - * - * - * - * - * CURLOPT_PROXYUSERPWD - * A username and password formatted as - * "[username]:[password]" to use for the - * connection to the proxy. - * - * - * - * - * CURLOPT_RANDOM_FILE - * A filename to be used to seed the random number generator for SSL. - * - * - * - * - * CURLOPT_RANGE - * Range(s) of data to retrieve in the format - * "X-Y" where X or Y are optional. HTTP transfers - * also support several intervals, separated with commas in the format - * "X-Y,N-M". - * - * - * - * - * CURLOPT_REFERER - * The contents of the "Referer: " header to be used - * in a HTTP request. - * - * - * - * - * CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 - * A string containing 32 hexadecimal digits. The string should be the - * MD5 checksum of the remote host's public key, and libcurl will reject - * the connection to the host unless the md5sums match. - * This option is only for SCP and SFTP transfers. - * - * Added in cURL 7.17.1. - * - * - * - * CURLOPT_SSH_PUBLIC_KEYFILE - * The file name for your public key. If not used, libcurl defaults to - * $HOME/.ssh/id_dsa.pub if the HOME environment variable is set, - * and just "id_dsa.pub" in the current directory if HOME is not set. - * - * Added in cURL 7.16.1. - * - * - * - * CURLOPT_SSH_PRIVATE_KEYFILE - * The file name for your private key. If not used, libcurl defaults to - * $HOME/.ssh/id_dsa if the HOME environment variable is set, - * and just "id_dsa" in the current directory if HOME is not set. - * If the file is password-protected, set the password with - * CURLOPT_KEYPASSWD. - * - * Added in cURL 7.16.1. - * - * - * - * CURLOPT_SSL_CIPHER_LIST - * A list of ciphers to use for SSL. For example, - * RC4-SHA and TLSv1 are valid - * cipher lists. - * - * - * - * - * CURLOPT_SSLCERT - * The name of a file containing a PEM formatted certificate. - * - * - * - * - * CURLOPT_SSLCERTPASSWD - * The password required to use the - * CURLOPT_SSLCERT certificate. - * - * - * - * - * CURLOPT_SSLCERTTYPE - * The format of the certificate. Supported formats are - * "PEM" (default), "DER", - * and "ENG". - * - * Added in cURL 7.9.3. - * - * - * - * CURLOPT_SSLENGINE - * The identifier for the crypto engine of the private SSL key - * specified in CURLOPT_SSLKEY. - * - * - * - * - * CURLOPT_SSLENGINE_DEFAULT - * The identifier for the crypto engine used for asymmetric crypto - * operations. - * - * - * - * - * CURLOPT_SSLKEY - * The name of a file containing a private SSL key. - * - * - * - * - * CURLOPT_SSLKEYPASSWD - *

- * The secret password needed to use the private SSL key specified in - * CURLOPT_SSLKEY. - *

- * Since this option contains a sensitive password, remember to keep - * the PHP script it is contained within safe. - *

- *

- * - * - * - * CURLOPT_SSLKEYTYPE - * The key type of the private SSL key specified in - * CURLOPT_SSLKEY. Supported key types are - * "PEM" (default), "DER", - * and "ENG". - * - * - * - * - * CURLOPT_URL - * The URL to fetch. This can also be set when initializing a - * session with curl_init. - * - * - * - * - * CURLOPT_USERAGENT - * The contents of the "User-Agent: " header to be - * used in a HTTP request. - * - * - * - * - * CURLOPT_USERPWD - * A username and password formatted as - * "[username]:[password]" to use for the - * connection. - * - * - * - *

- *

- * value should be an array for the - * following values of the option parameter: - * - * Option - * Set value to - * Notes - * - * - * CURLOPT_HTTP200ALIASES - * An array of HTTP 200 responses that will be treated as valid - * responses and not as errors. - * - * Added in cURL 7.10.3. - * - * - * - * CURLOPT_HTTPHEADER - * An array of HTTP header fields to set, in the format - * array('Content-type: text/plain', 'Content-length: 100') - * - * - * - * - * CURLOPT_POSTQUOTE - * An array of FTP commands to execute on the server after the FTP - * request has been performed. - * - * - * - * - * CURLOPT_QUOTE - * An array of FTP commands to execute on the server prior to the FTP - * request. - * - * - * - *

- *

- * value should be a stream resource (using - * fopen, for example) for the following values of the - * option parameter: - * - * Option - * Set value to - * - * - * CURLOPT_FILE - * The file that the transfer should be written to. The default - * is STDOUT (the browser window). - * - * - * - * CURLOPT_INFILE - * The file that the transfer should be read from when uploading. - * - * - * - * CURLOPT_STDERR - * An alternative location to output errors to instead of - * STDERR. - * - * - * - * CURLOPT_WRITEHEADER - * The file that the header part of the transfer is written to. - * - * - *

- *

- * value should be a string that is the name of a valid - * callback function for the following values of the - * option parameter: - * - * Option - * Set value to - * - * - * CURLOPT_HEADERFUNCTION - * The name of a callback function where the callback function takes - * two parameters. The first is the cURL resource, the second is a - * string with the header data to be written. The header data must - * be written when using this callback function. Return the number of - * bytes written. - * - * - * - * CURLOPT_PASSWDFUNCTION - * The name of a callback function where the callback function takes - * three parameters. The first is the cURL resource, the second is a - * string containing a password prompt, and the third is the maximum - * password length. Return the string containing the password. - * - * - * - * CURLOPT_PROGRESSFUNCTION - * The name of a callback function where the callback function takes - * three parameters. The first is the cURL resource, the second is a - * file-descriptor resource, and the third is length. Return the - * string containing the data. - * - * - * - * CURLOPT_READFUNCTION - * The name of a callback function where the callback function takes - * three parameters. The first is the cURL resource, the second is a - * stream resource provided to cURL through the option - * CURLOPT_INFILE, and the third is the maximum - * amount of data to be read. The callback function must return a string - * with a length equal or smaller than the amount of data requested, - * typically by reading it from the passed stream resource. It should - * return an empty string to signal EOF. - * - * - * - * CURLOPT_WRITEFUNCTION - * The name of a callback function where the callback function takes - * two parameters. The first is the cURL resource, and the second is a - * string with the data to be written. The data must be saved by using - * this callback function. It must return the exact number of bytes written - * or the transfer will be aborted with an error. - * - * - *

- * @return bool TRUE on success or FALSE on failure. - */ -function curl_setopt ($ch, $option, $value) {} - -/** - * (PHP 5 >= 5.1.3)
- * Set multiple options for a cURL transfer - * @link http://php.net/manual/en/function.curl-setopt-array.php - * @param resource $ch - * @param array $options

- * An array specifying which options to set and their values. - * The keys should be valid curl_setopt constants or - * their integer equivalents. - *

- * @return bool TRUE if all options were successfully set. If an option could - * not be successfully set, FALSE is immediately returned, ignoring any - * future options in the options array. - */ -function curl_setopt_array ($ch, array $options) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Perform a cURL session - * @link http://php.net/manual/en/function.curl-exec.php - * @param resource $ch - * @return mixed TRUE on success or FALSE on failure. However, if the CURLOPT_RETURNTRANSFER - * option is set, it will return - * the result on success, FALSE on failure. - */ -function curl_exec ($ch) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Get information regarding a specific transfer - * @link http://php.net/manual/en/function.curl-getinfo.php - * @param resource $ch - * @param int $opt [optional]

- * This may be one of the following constants: - * CURLINFO_EFFECTIVE_URL - Last effective URL - * @return mixed If opt is given, returns its value as a string. - * Otherwise, returns an associative array with the following elements - * (which correspond to opt), or FALSE on failure: - * "url" - * "content_type" - * "http_code" - * "header_size" - * "request_size" - * "filetime" - * "ssl_verify_result" - * "redirect_count" - * "total_time" - * "namelookup_time" - * "connect_time" - * "pretransfer_time" - * "size_upload" - * "size_download" - * "speed_download" - * "speed_upload" - * "download_content_length" - * "upload_content_length" - * "starttransfer_time" - * "redirect_time" - * "certinfo" - * "request_header" (This is only set if the CURLINFO_HEADER_OUT - * is set by a previous call to curl_setopt) - */ -function curl_getinfo ($ch, $opt = 0) {} - -/** - * (PHP 4 >= 4.0.3, PHP 5)
- * Return a string containing the last error for the current session - * @link http://php.net/manual/en/function.curl-error.php - * @param resource $ch - * @return string the error message or '' (the empty string) if no - * error occurred. - */ -function curl_error ($ch) {} - -/** - * (PHP 4 >= 4.0.3, PHP 5)
- * Return the last error number - * @link http://php.net/manual/en/function.curl-errno.php - * @param resource $ch - * @return int the error number or 0 (zero) if no error - * occurred. - */ -function curl_errno ($ch) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Close a cURL session - * @link http://php.net/manual/en/function.curl-close.php - * @param resource $ch - * @return void No value is returned. - */ -function curl_close ($ch) {} - -/** - * (PHP 5)
- * Returns a new cURL multi handle - * @link http://php.net/manual/en/function.curl-multi-init.php - * @return resource a cURL multi handle resource on success, FALSE on failure. - */ -function curl_multi_init () {} - -/** - * (PHP 5)
- * Add a normal cURL handle to a cURL multi handle - * @link http://php.net/manual/en/function.curl-multi-add-handle.php - * @param resource $mh - * @param resource $ch - * @return int 0 on success, or one of the CURLM_XXX errors - * code. - */ -function curl_multi_add_handle ($mh, $ch) {} - -/** - * (PHP 5)
- * Remove a multi handle from a set of cURL handles - * @link http://php.net/manual/en/function.curl-multi-remove-handle.php - * @param resource $mh - * @param resource $ch - * @return int 0 on success, or one of the CURLM_XXX error - * codes. - */ -function curl_multi_remove_handle ($mh, $ch) {} - -/** - * (PHP 5)
- * Wait for activity on any curl_multi connection - * @link http://php.net/manual/en/function.curl-multi-select.php - * @param resource $mh - * @param float $timeout [optional]

- * Time, in seconds, to wait for a response. - *

- * @return int On success, returns the number of descriptors contained in - * the descriptor sets. On failure, this function will return -1 on a select failure or timeout (from the underlying select system call). - */ -function curl_multi_select ($mh, $timeout = 1.0) {} - -/** - * (PHP 5)
- * Run the sub-connections of the current cURL handle - * @link http://php.net/manual/en/function.curl-multi-exec.php - * @param resource $mh - * @param int $still_running

- * A reference to a flag to tell whether the operations are still running. - *

- * @return int A cURL code defined in the cURL Predefined Constants. - *

- *

- * This only returns errors regarding the whole multi stack. There might still have - * occurred problems on individual transfers even when this function returns - * CURLM_OK. - */ -function curl_multi_exec ($mh, &$still_running) {} - -/** - * (PHP 5)
- * Return the content of a cURL handle if CURLOPT_RETURNTRANSFER is set - * @link http://php.net/manual/en/function.curl-multi-getcontent.php - * @param resource $ch - * @return string Return the content of a cURL handle if CURLOPT_RETURNTRANSFER is set. - */ -function curl_multi_getcontent ($ch) {} - -/** - * (PHP 5)
- * Get information about the current transfers - * @link http://php.net/manual/en/function.curl-multi-info-read.php - * @param resource $mh - * @param int $msgs_in_queue [optional]

- * Number of messages that are still in the queue - *

- * @return array On success, returns an associative array for the message, FALSE on failure. - *

- *

- * - * Contents of the returned array - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Key:Value:
msgThe CURLMSG_DONE constant. Other return values - * are currently not available.
resultOne of the CURLE_* constants. If everything is - * OK, the CURLE_OK will be the result.
handleResource of type curl indicates the handle which it concerns.
- */ -function curl_multi_info_read ($mh, &$msgs_in_queue = null) {} - -/** - * (PHP 5)
- * Close a set of cURL handles - * @link http://php.net/manual/en/function.curl-multi-close.php - * @param resource $mh - * @return void No value is returned. - */ -function curl_multi_close ($mh) {} - -define ('CURLOPT_IPRESOLVE', 113); -define ('CURL_IPRESOLVE_WHATEVER', 0); -define ('CURL_IPRESOLVE_V4', 1); -define ('CURL_IPRESOLVE_V6', 2); -define ('CURLOPT_DNS_USE_GLOBAL_CACHE', 91); -define ('CURLOPT_DNS_CACHE_TIMEOUT', 92); -define ('CURLOPT_PORT', 3); -define ('CURLOPT_FILE', 10001); -define ('CURLOPT_READDATA', 10009); -define ('CURLOPT_INFILE', 10009); -define ('CURLOPT_INFILESIZE', 14); -define ('CURLOPT_URL', 10002); -define ('CURLOPT_PROXY', 10004); -define ('CURLOPT_VERBOSE', 41); -define ('CURLOPT_HEADER', 42); -define ('CURLOPT_HTTPHEADER', 10023); -define ('CURLOPT_NOPROGRESS', 43); - -/** - * Available since PHP 5.3.0 - * @link http://php.net/manual/en/curl.constants.php - */ -define ('CURLOPT_PROGRESSFUNCTION', 20056); -define ('CURLOPT_NOBODY', 44); -define ('CURLOPT_FAILONERROR', 45); -define ('CURLOPT_UPLOAD', 46); -define ('CURLOPT_POST', 47); -define ('CURLOPT_FTPLISTONLY', 48); -define ('CURLOPT_FTPAPPEND', 50); -define ('CURLOPT_NETRC', 51); - -/** - * This constant is not available when open_basedir - * or safe_mode are enabled. - * @link http://php.net/manual/en/curl.constants.php - */ -define ('CURLOPT_FOLLOWLOCATION', 52); -define ('CURLOPT_PUT', 54); -define ('CURLOPT_USERPWD', 10005); -define ('CURLOPT_PROXYUSERPWD', 10006); -define ('CURLOPT_RANGE', 10007); -define ('CURLOPT_TIMEOUT', 13); -define ('CURLOPT_TIMEOUT_MS', 155); -define ('CURLOPT_POSTFIELDS', 10015); -define ('CURLOPT_REFERER', 10016); -define ('CURLOPT_USERAGENT', 10018); -define ('CURLOPT_FTPPORT', 10017); -define ('CURLOPT_FTP_USE_EPSV', 85); -define ('CURLOPT_LOW_SPEED_LIMIT', 19); -define ('CURLOPT_LOW_SPEED_TIME', 20); -define ('CURLOPT_RESUME_FROM', 21); -define ('CURLOPT_COOKIE', 10022); - -/** - * Available since PHP 5.1.0 - * @link http://php.net/manual/en/curl.constants.php - */ -define ('CURLOPT_COOKIESESSION', 96); - -/** - * Available since PHP 5.1.0 - * @link http://php.net/manual/en/curl.constants.php - */ -define ('CURLOPT_AUTOREFERER', 58); -define ('CURLOPT_SSLCERT', 10025); -define ('CURLOPT_SSLCERTPASSWD', 10026); -define ('CURLOPT_WRITEHEADER', 10029); -define ('CURLOPT_SSL_VERIFYHOST', 81); -define ('CURLOPT_COOKIEFILE', 10031); -define ('CURLOPT_SSLVERSION', 32); -define ('CURLOPT_TIMECONDITION', 33); -define ('CURLOPT_TIMEVALUE', 34); -define ('CURLOPT_CUSTOMREQUEST', 10036); -define ('CURLOPT_STDERR', 10037); -define ('CURLOPT_TRANSFERTEXT', 53); -define ('CURLOPT_RETURNTRANSFER', 19913); -define ('CURLOPT_QUOTE', 10028); -define ('CURLOPT_POSTQUOTE', 10039); -define ('CURLOPT_INTERFACE', 10062); -define ('CURLOPT_KRB4LEVEL', 10063); -define ('CURLOPT_HTTPPROXYTUNNEL', 61); -define ('CURLOPT_FILETIME', 69); -define ('CURLOPT_WRITEFUNCTION', 20011); -define ('CURLOPT_READFUNCTION', 20012); -define ('CURLOPT_HEADERFUNCTION', 20079); -define ('CURLOPT_MAXREDIRS', 68); -define ('CURLOPT_MAXCONNECTS', 71); -define ('CURLOPT_CLOSEPOLICY', 72); -define ('CURLOPT_FRESH_CONNECT', 74); -define ('CURLOPT_FORBID_REUSE', 75); -define ('CURLOPT_RANDOM_FILE', 10076); -define ('CURLOPT_EGDSOCKET', 10077); -define ('CURLOPT_CONNECTTIMEOUT', 78); -define ('CURLOPT_CONNECTTIMEOUT_MS', 156); -define ('CURLOPT_SSL_VERIFYPEER', 64); -define ('CURLOPT_CAINFO', 10065); -define ('CURLOPT_CAPATH', 10097); -define ('CURLOPT_COOKIEJAR', 10082); -define ('CURLOPT_SSL_CIPHER_LIST', 10083); -define ('CURLOPT_BINARYTRANSFER', 19914); -define ('CURLOPT_NOSIGNAL', 99); -define ('CURLOPT_PROXYTYPE', 101); -define ('CURLOPT_BUFFERSIZE', 98); -define ('CURLOPT_HTTPGET', 80); -define ('CURLOPT_HTTP_VERSION', 84); -define ('CURLOPT_SSLKEY', 10087); -define ('CURLOPT_SSLKEYTYPE', 10088); -define ('CURLOPT_SSLKEYPASSWD', 10026); -define ('CURLOPT_SSLENGINE', 10089); -define ('CURLOPT_SSLENGINE_DEFAULT', 90); -define ('CURLOPT_SSLCERTTYPE', 10086); -define ('CURLOPT_CRLF', 27); -define ('CURLOPT_ENCODING', 10102); -define ('CURLOPT_PROXYPORT', 59); -define ('CURLOPT_UNRESTRICTED_AUTH', 105); -define ('CURLOPT_FTP_USE_EPRT', 106); - -/** - * Available since PHP 5.2.1 - * @link http://php.net/manual/en/curl.constants.php - */ -define ('CURLOPT_TCP_NODELAY', 121); -define ('CURLOPT_HTTP200ALIASES', 10104); -define ('CURL_TIMECOND_IFMODSINCE', 1); -define ('CURL_TIMECOND_IFUNMODSINCE', 2); -define ('CURL_TIMECOND_LASTMOD', 3); - -/** - * Available since PHP 5.4.0 and cURL 7.15.5 - * @link http://php.net/manual/en/curl.constants.php - */ -define ('CURLOPT_MAX_RECV_SPEED_LARGE', 30146); - -/** - * Available since PHP 5.4.0 and cURL 7.15.5 - * @link http://php.net/manual/en/curl.constants.php - */ -define ('CURLOPT_MAX_SEND_SPEED_LARGE', 30145); -define ('CURLOPT_HTTPAUTH', 107); -define ('CURLAUTH_BASIC', 1); -define ('CURLAUTH_DIGEST', 2); -define ('CURLAUTH_GSSNEGOTIATE', 4); -define ('CURLAUTH_NTLM', 8); -define ('CURLAUTH_ANY', -17); -define ('CURLAUTH_ANYSAFE', -18); -define ('CURLOPT_PROXYAUTH', 111); -define ('CURLOPT_FTP_CREATE_MISSING_DIRS', 110); - -/** - * Available since PHP 5.2.4 - * @link http://php.net/manual/en/curl.constants.php - */ -define ('CURLOPT_PRIVATE', 10103); -define ('CURLCLOSEPOLICY_LEAST_RECENTLY_USED', 2); -define ('CURLCLOSEPOLICY_LEAST_TRAFFIC', 3); -define ('CURLCLOSEPOLICY_SLOWEST', 4); -define ('CURLCLOSEPOLICY_CALLBACK', 5); -define ('CURLCLOSEPOLICY_OLDEST', 1); -define ('CURLINFO_EFFECTIVE_URL', 1048577); -define ('CURLINFO_HTTP_CODE', 2097154); -define ('CURLINFO_HEADER_SIZE', 2097163); -define ('CURLINFO_REQUEST_SIZE', 2097164); -define ('CURLINFO_TOTAL_TIME', 3145731); -define ('CURLINFO_NAMELOOKUP_TIME', 3145732); -define ('CURLINFO_CONNECT_TIME', 3145733); -define ('CURLINFO_PRETRANSFER_TIME', 3145734); -define ('CURLINFO_SIZE_UPLOAD', 3145735); -define ('CURLINFO_SIZE_DOWNLOAD', 3145736); -define ('CURLINFO_SPEED_DOWNLOAD', 3145737); -define ('CURLINFO_SPEED_UPLOAD', 3145738); -define ('CURLINFO_FILETIME', 2097166); -define ('CURLINFO_SSL_VERIFYRESULT', 2097165); -define ('CURLINFO_CONTENT_LENGTH_DOWNLOAD', 3145743); -define ('CURLINFO_CONTENT_LENGTH_UPLOAD', 3145744); -define ('CURLINFO_STARTTRANSFER_TIME', 3145745); -define ('CURLINFO_CONTENT_TYPE', 1048594); -define ('CURLINFO_REDIRECT_TIME', 3145747); -define ('CURLINFO_REDIRECT_COUNT', 2097172); - -/** - * Available since PHP 5.1.3 - * @link http://php.net/manual/en/curl.constants.php - */ -define ('CURLINFO_HEADER_OUT', 2); - -/** - * Available since PHP 5.2.4 - * @link http://php.net/manual/en/curl.constants.php - */ -define ('CURLINFO_PRIVATE', 1048597); -define ('CURLINFO_CERTINFO', 4194338); -define ('CURLINFO_REDIRECT_URL', 1048607); -define ('CURL_VERSION_IPV6', 1); -define ('CURL_VERSION_KERBEROS4', 2); -define ('CURL_VERSION_SSL', 4); -define ('CURL_VERSION_LIBZ', 8); -define ('CURLVERSION_NOW', 3); -define ('CURLE_OK', 0); -define ('CURLE_UNSUPPORTED_PROTOCOL', 1); -define ('CURLE_FAILED_INIT', 2); -define ('CURLE_URL_MALFORMAT', 3); -define ('CURLE_URL_MALFORMAT_USER', 4); -define ('CURLE_COULDNT_RESOLVE_PROXY', 5); -define ('CURLE_COULDNT_RESOLVE_HOST', 6); -define ('CURLE_COULDNT_CONNECT', 7); -define ('CURLE_FTP_WEIRD_SERVER_REPLY', 8); -define ('CURLE_FTP_ACCESS_DENIED', 9); -define ('CURLE_FTP_USER_PASSWORD_INCORRECT', 10); -define ('CURLE_FTP_WEIRD_PASS_REPLY', 11); -define ('CURLE_FTP_WEIRD_USER_REPLY', 12); -define ('CURLE_FTP_WEIRD_PASV_REPLY', 13); -define ('CURLE_FTP_WEIRD_227_FORMAT', 14); -define ('CURLE_FTP_CANT_GET_HOST', 15); -define ('CURLE_FTP_CANT_RECONNECT', 16); -define ('CURLE_FTP_COULDNT_SET_BINARY', 17); -define ('CURLE_PARTIAL_FILE', 18); -define ('CURLE_FTP_COULDNT_RETR_FILE', 19); -define ('CURLE_FTP_WRITE_ERROR', 20); -define ('CURLE_FTP_QUOTE_ERROR', 21); -define ('CURLE_HTTP_NOT_FOUND', 22); -define ('CURLE_WRITE_ERROR', 23); -define ('CURLE_MALFORMAT_USER', 24); -define ('CURLE_FTP_COULDNT_STOR_FILE', 25); -define ('CURLE_READ_ERROR', 26); -define ('CURLE_OUT_OF_MEMORY', 27); -define ('CURLE_OPERATION_TIMEOUTED', 28); -define ('CURLE_FTP_COULDNT_SET_ASCII', 29); -define ('CURLE_FTP_PORT_FAILED', 30); -define ('CURLE_FTP_COULDNT_USE_REST', 31); -define ('CURLE_FTP_COULDNT_GET_SIZE', 32); -define ('CURLE_HTTP_RANGE_ERROR', 33); -define ('CURLE_HTTP_POST_ERROR', 34); -define ('CURLE_SSL_CONNECT_ERROR', 35); -define ('CURLE_FTP_BAD_DOWNLOAD_RESUME', 36); -define ('CURLE_FILE_COULDNT_READ_FILE', 37); -define ('CURLE_LDAP_CANNOT_BIND', 38); -define ('CURLE_LDAP_SEARCH_FAILED', 39); -define ('CURLE_LIBRARY_NOT_FOUND', 40); -define ('CURLE_FUNCTION_NOT_FOUND', 41); -define ('CURLE_ABORTED_BY_CALLBACK', 42); -define ('CURLE_BAD_FUNCTION_ARGUMENT', 43); -define ('CURLE_BAD_CALLING_ORDER', 44); -define ('CURLE_HTTP_PORT_FAILED', 45); -define ('CURLE_BAD_PASSWORD_ENTERED', 46); -define ('CURLE_TOO_MANY_REDIRECTS', 47); -define ('CURLE_UNKNOWN_TELNET_OPTION', 48); -define ('CURLE_TELNET_OPTION_SYNTAX', 49); -define ('CURLE_OBSOLETE', 50); -define ('CURLE_SSL_PEER_CERTIFICATE', 51); -define ('CURLE_GOT_NOTHING', 52); -define ('CURLE_SSL_ENGINE_NOTFOUND', 53); -define ('CURLE_SSL_ENGINE_SETFAILED', 54); -define ('CURLE_SEND_ERROR', 55); -define ('CURLE_RECV_ERROR', 56); -define ('CURLE_SHARE_IN_USE', 57); -define ('CURLE_SSL_CERTPROBLEM', 58); -define ('CURLE_SSL_CIPHER', 59); -define ('CURLE_SSL_CACERT', 60); -define ('CURLE_BAD_CONTENT_ENCODING', 61); -define ('CURLE_LDAP_INVALID_URL', 62); -define ('CURLE_FILESIZE_EXCEEDED', 63); -define ('CURLE_FTP_SSL_FAILED', 64); -define ('CURLPROXY_HTTP', 0); -define ('CURLPROXY_SOCKS4', 4); -define ('CURLPROXY_SOCKS5', 5); -define ('CURL_NETRC_OPTIONAL', 1); -define ('CURL_NETRC_IGNORED', 0); -define ('CURL_NETRC_REQUIRED', 2); -define ('CURL_HTTP_VERSION_NONE', 0); -define ('CURL_HTTP_VERSION_1_0', 1); -define ('CURL_HTTP_VERSION_1_1', 2); -define ('CURLM_CALL_MULTI_PERFORM', -1); -define ('CURLM_OK', 0); -define ('CURLM_BAD_HANDLE', 1); -define ('CURLM_BAD_EASY_HANDLE', 2); -define ('CURLM_OUT_OF_MEMORY', 3); -define ('CURLM_INTERNAL_ERROR', 4); -define ('CURLMSG_DONE', 1); - -/** - * Available since PHP 5.1.0 - * @link http://php.net/manual/en/curl.constants.php - */ -define ('CURLOPT_FTPSSLAUTH', 129); - -/** - * Available since PHP 5.1.0 - * @link http://php.net/manual/en/curl.constants.php - */ -define ('CURLFTPAUTH_DEFAULT', 0); - -/** - * Available since PHP 5.1.0 - * @link http://php.net/manual/en/curl.constants.php - */ -define ('CURLFTPAUTH_SSL', 1); - -/** - * Available since PHP 5.1.0 - * @link http://php.net/manual/en/curl.constants.php - */ -define ('CURLFTPAUTH_TLS', 2); - -/** - * Available since PHP 5.2.0 - * @link http://php.net/manual/en/curl.constants.php - */ -define ('CURLOPT_FTP_SSL', 119); - -/** - * Available since PHP 5.2.0 - * @link http://php.net/manual/en/curl.constants.php - */ -define ('CURLFTPSSL_NONE', 0); - -/** - * Available since PHP 5.2.0 - * @link http://php.net/manual/en/curl.constants.php - */ -define ('CURLFTPSSL_TRY', 1); - -/** - * Available since PHP 5.2.0 - * @link http://php.net/manual/en/curl.constants.php - */ -define ('CURLFTPSSL_CONTROL', 2); - -/** - * Available since PHP 5.2.0 - * @link http://php.net/manual/en/curl.constants.php - */ -define ('CURLFTPSSL_ALL', 3); -define ('CURLOPT_CERTINFO', 172); -define ('CURLOPT_POSTREDIR', 161); -define ('CURLSSH_AUTH_NONE', 0); -define ('CURLSSH_AUTH_PUBLICKEY', 1); -define ('CURLSSH_AUTH_PASSWORD', 2); -define ('CURLSSH_AUTH_HOST', 4); -define ('CURLSSH_AUTH_KEYBOARD', 8); -define ('CURLSSH_AUTH_DEFAULT', -1); -define ('CURLOPT_SSH_AUTH_TYPES', 151); -define ('CURLOPT_KEYPASSWD', 10026); -define ('CURLOPT_SSH_PUBLIC_KEYFILE', 10152); -define ('CURLOPT_SSH_PRIVATE_KEYFILE', 10153); -define ('CURLOPT_SSH_HOST_PUBLIC_KEY_MD5', 10162); -define ('CURLE_SSH', 79); -define ('CURLOPT_REDIR_PROTOCOLS', 182); -define ('CURLOPT_PROTOCOLS', 181); -define ('CURLPROTO_HTTP', 1); -define ('CURLPROTO_HTTPS', 2); -define ('CURLPROTO_FTP', 4); -define ('CURLPROTO_FTPS', 8); -define ('CURLPROTO_SCP', 16); -define ('CURLPROTO_SFTP', 32); -define ('CURLPROTO_TELNET', 64); -define ('CURLPROTO_LDAP', 128); -define ('CURLPROTO_LDAPS', 256); -define ('CURLPROTO_DICT', 512); -define ('CURLPROTO_FILE', 1024); -define ('CURLPROTO_TFTP', 2048); -define ('CURLPROTO_ALL', -1); -define ('CURLOPT_FTP_FILEMETHOD', 138); -define ('CURLOPT_FTP_SKIP_PASV_IP', 137); -define ('CURLFTPMETHOD_MULTICWD', 1); -define ('CURLFTPMETHOD_NOCWD', 2); -define ('CURLFTPMETHOD_SINGLECWD', 3); - -// End of curl v. -?> diff --git a/phpruntime/date.php b/phpruntime/date.php deleted file mode 100644 index aa7ee48..0000000 --- a/phpruntime/date.php +++ /dev/null @@ -1,1652 +0,0 @@ - - * Number of years. - *

- * @var integer - */ - public $y; - /** - *

- * Number of months. - *

- * @var integer - */ - public $m; - /** - *

- * Number of days. - *

- * @var integer - */ - public $d; - /** - *

- * Number of hours. - *

- * @var integer - */ - public $h; - /** - *

- * Number of minutes. - *

- * @var integer - */ - public $i; - /** - *

- * Number of seconds. - *

- * @var integer - */ - public $s; - /** - *

- * Is 1 if the interval is inverted and - * 0 otherwise. See - * DateInterval::format(). - *

- * @var integer - */ - public $invert; - /** - *

- * If the DateInterval object was created by - * DateTime::diff(), then this is the total number of - * days between the start and end dates. Otherwise, - * days will be FALSE. - *

- * @var mixed - */ - public $days; - - - /** - * @param $interval_spec [optional] - */ - public function __construct ($interval_spec) {} - - public function __wakeup () {} - - public static function __set_state () {} - - /** - * @param $format - */ - public function format ($format) {} - - /** - * @param $time - */ - public static function createFromDateString ($time) {} - -} - -class DatePeriod implements Traversable { - const EXCLUDE_START_DATE = 1; - - - /** - * @param $start - * @param $interval - * @param $end - */ - public function __construct ($start, $interval, $end) {} - -} - -/** - * (PHP 4, PHP 5)
- * Parse about any English textual datetime description into a Unix timestamp - * @link http://php.net/manual/en/function.strtotime.php - * @param string $time

A date/time string. Valid formats are explained in Date and Time Formats.

- * @param int $now [optional]

- * The timestamp which is used as a base for the calculation of relative - * dates. - *

- * @return int a timestamp on success, FALSE otherwise. Previous to PHP 5.1.0, - * this function would return -1 on failure. - */ -function strtotime ($time, $now = 'time()') {} - -/** - * (PHP 4, PHP 5)
- * Format a local time/date - * @link http://php.net/manual/en/function.date.php - * @param string $format

- * The format of the outputted date string. See the formatting - * options below. There are also several - * predefined date constants - * that may be used instead, so for example DATE_RSS - * contains the format string 'D, d M Y H:i:s'. - *

- *

- * - * The following characters are recognized in the - * format parameter string - * - * - * - * - * - * - * Day - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * Week - * - * - * - * - * - * - * - * - * - * Month - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * Year - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * Time - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * Timezone - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * Full Date/Time - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
format characterDescriptionExample returned values
------
dDay of the month, 2 digits with leading zeros01 to 31
DA textual representation of a day, three lettersMon through Sun
jDay of the month without leading zeros1 to 31
l (lowercase 'L')A full textual representation of the day of the weekSunday through Saturday
NISO-8601 numeric representation of the day of the week (added in - * PHP 5.1.0)1 (for Monday) through 7 (for Sunday)
SEnglish ordinal suffix for the day of the month, 2 characters - * st, nd, rd or - * th. Works well with j - *
wNumeric representation of the day of the week0 (for Sunday) through 6 (for Saturday)
zThe day of the year (starting from 0)0 through 365
------
WISO-8601 week number of year, weeks starting on Monday (added in PHP 4.1.0)Example: 42 (the 42nd week in the year)
------
FA full textual representation of a month, such as January or MarchJanuary through December
mNumeric representation of a month, with leading zeros01 through 12
MA short textual representation of a month, three lettersJan through Dec
nNumeric representation of a month, without leading zeros1 through 12
tNumber of days in the given month28 through 31
------
LWhether it's a leap year1 if it is a leap year, 0 otherwise.
oISO-8601 year number. This has the same value as - * Y, except that if the ISO week number - * (W) belongs to the previous or next year, that year - * is used instead. (added in PHP 5.1.0)Examples: 1999 or 2003
YA full numeric representation of a year, 4 digitsExamples: 1999 or 2003
yA two digit representation of a yearExamples: 99 or 03
------
aLowercase Ante meridiem and Post meridiemam or pm
AUppercase Ante meridiem and Post meridiemAM or PM
BSwatch Internet time000 through 999
g12-hour format of an hour without leading zeros1 through 12
G24-hour format of an hour without leading zeros0 through 23
h12-hour format of an hour with leading zeros01 through 12
H24-hour format of an hour with leading zeros00 through 23
iMinutes with leading zeros00 to 59
sSeconds, with leading zeros00 through 59
u - * Microseconds (added in PHP 5.2.2). Note that - * date will always generate - * 000000 since it takes an integer - * parameter, whereas DateTime::format does - * support microseconds. - * Example: 654321
------
eTimezone identifier (added in PHP 5.1.0)Examples: UTC, GMT, Atlantic/Azores
I (capital i)Whether or not the date is in daylight saving time1 if Daylight Saving Time, 0 otherwise.
ODifference to Greenwich time (GMT) in hoursExample: +0200
PDifference to Greenwich time (GMT) with colon between hours and minutes (added in PHP 5.1.3)Example: +02:00
TTimezone abbreviationExamples: EST, MDT ...
ZTimezone offset in seconds. The offset for timezones west of UTC is always - * negative, and for those east of UTC is always positive.-43200 through 50400
------
cISO 8601 date (added in PHP 5)2004-02-12T15:19:21+00:00
rRFC 2822 formatted dateExample: Thu, 21 Dec 2000 16:01:07 +0200
USeconds since the Unix Epoch (January 1 1970 00:00:00 GMT)See also time
- *

- *

- * Unrecognized characters in the format string will be printed - * as-is. The Z format will always return - * 0 when using gmdate. - *

- *

- * Since this function only accepts integer timestamps the - * u format character is only useful when using the - * date_format function with user based timestamps - * created with date_create. - *

- * @param int $timestamp [optional] - * @return string a formatted date string. If a non-numeric value is used for - * timestamp, FALSE is returned and an - * E_WARNING level error is emitted. - */ -function date ($format, $timestamp = 'time()') {} - -/** - * (PHP 5)
- * Format a local time/date as integer - * @link http://php.net/manual/en/function.idate.php - * @param string $format

- * - * The following characters are recognized in the - * format parameter string - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
format characterDescription
BSwatch Beat/Internet Time
dDay of the month
hHour (12 hour format)
HHour (24 hour format)
iMinutes
I (uppercase i)returns 1 if DST is activated, - * 0 otherwise
L (uppercase l)returns 1 for leap year, - * 0 otherwise
mMonth number
sSeconds
tDays in current month
USeconds since the Unix Epoch - January 1 1970 00:00:00 UTC - - * this is the same as time
wDay of the week (0 on Sunday)
WISO-8601 week number of year, weeks starting on - * Monday
yYear (1 or 2 digits - check note below)
YYear (4 digits)
zDay of the year
ZTimezone offset in seconds
- *

- * @param int $timestamp [optional] - * @return int an integer. - *

- *

- * As idate always returns an integer and - * as they can't start with a "0", idate may return - * fewer digits than you would expect. See the example below. - */ -function idate ($format, $timestamp = 'time()') {} - -/** - * (PHP 4, PHP 5)
- * Format a GMT/UTC date/time - * @link http://php.net/manual/en/function.gmdate.php - * @param string $format

- * The format of the outputted date string. See the formatting - * options for the date function. - *

- * @param int $timestamp [optional] - * @return string a formatted date string. If a non-numeric value is used for - * timestamp, FALSE is returned and an - * E_WARNING level error is emitted. - */ -function gmdate ($format, $timestamp = 'time()') {} - -/** - * (PHP 4, PHP 5)
- * Get Unix timestamp for a date - * @link http://php.net/manual/en/function.mktime.php - * @param int $hour [optional]

- * The number of the hour relative to the start of the day determined by - * month, day and year. - * Negative values reference the hour before midnight of the day in question. - * Values greater than 23 reference the appropriate hour in the following day(s). - *

- * @param int $minute [optional]

- * The number of the minute relative to the start of the hour. - * Negative values reference the minute in the previous hour. - * Values greater than 59 reference the appropriate minute in the following hour(s). - *

- * @param int $second [optional]

- * The number of seconds relative to the start of the minute. - * Negative values reference the second in the previous minute. - * Values greater than 59 reference the appropriate second in the following minute(s). - *

- * @param int $month [optional]

- * The number of the month relative to the end of the previous year. - * Values 1 to 12 reference the normal calendar months of the year in question. - * Values less than 1 (including negative values) reference the months in the previous year in reverse order, so 0 is December, -1 is November, etc. - * Values greater than 12 reference the appropriate month in the following year(s). - *

- * @param int $day [optional]

- * The number of the day relative to the end of the previous month. - * Values 1 to 28, 29, 30 or 31 (depending upon the month) reference the normal days in the relevant month. - * Values less than 1 (including negative values) reference the days in the previous month, so 0 is the last day of the previous month, -1 is the day before that, etc. - * Values greater than the number of days in the relevant month reference the appropriate day in the following month(s). - *

- * @param int $year [optional]

- * The number of the year, may be a two or four digit value, - * with values between 0-69 mapping to 2000-2069 and 70-100 to - * 1970-2000. On systems where time_t is a 32bit signed integer, as - * most common today, the valid range for year - * is somewhere between 1901 and 2038. However, before PHP 5.1.0 this - * range was limited from 1970 to 2038 on some systems (e.g. Windows). - *

- * @param int $is_dst [optional]

- * This parameter can be set to 1 if the time is during daylight savings time (DST), - * 0 if it is not, or -1 (the default) if it is unknown whether the time is within - * daylight savings time or not. If it's unknown, PHP tries to figure it out itself. - * This can cause unexpected (but not incorrect) results. - * Some times are invalid if DST is enabled on the system PHP is running on or - * is_dst is set to 1. If DST is enabled in e.g. 2:00, all times - * between 2:00 and 3:00 are invalid and mktime returns an undefined - * (usually negative) value. - * Some systems (e.g. Solaris 8) enable DST at midnight so time 0:30 of the day when DST - * is enabled is evaluated as 23:30 of the previous day. - *

- *

- * As of PHP 5.1.0, this parameter became deprecated. As a result, the - * new timezone handling features should be used instead. - *

- * @return int mktime returns the Unix timestamp of the arguments - * given. - * If the arguments are invalid, the function returns FALSE (before PHP 5.1 - * it returned -1). - */ -function mktime ($hour = 'date("H")', $minute = 'date("i")', $second = 'date("s")', $month = 'date("n")', $day = 'date("j")', $year = 'date("Y")', $is_dst = -1) {} - -/** - * (PHP 4, PHP 5)
- * Get Unix timestamp for a GMT date - * @link http://php.net/manual/en/function.gmmktime.php - * @param int $hour [optional]

- * The number of the hour relative to the start of the day determined by - * month, day and year. - * Negative values reference the hour before midnight of the day in question. - * Values greater than 23 reference the appropriate hour in the following day(s). - *

- * @param int $minute [optional]

- * The number of the minute relative to the start of the hour. - * Negative values reference the minute in the previous hour. - * Values greater than 59 reference the appropriate minute in the following hour(s). - *

- * @param int $second [optional]

- * The number of seconds relative to the start of the minute. - * Negative values reference the second in the previous minute. - * Values greater than 59 reference the appropriate second in the following minute(s). - *

- * @param int $month [optional]

- * The number of the month relative to the end of the previous year. - * Values 1 to 12 reference the normal calendar months of the year in question. - * Values less than 1 (including negative values) reference the months in the previous year in reverse order, so 0 is December, -1 is November, etc. - * Values greater than 12 reference the appropriate month in the following year(s). - *

- * @param int $day [optional]

- * The number of the day relative to the end of the previous month. - * Values 1 to 28, 29, 30 or 31 (depending upon the month) reference the normal days in the relevant month. - * Values less than 1 (including negative values) reference the days in the previous month, so 0 is the last day of the previous month, -1 is the day before that, etc. - * Values greater than the number of days in the relevant month reference the appropriate day in the following month(s). - *

- * @param int $year [optional]

- * The year - *

- * @param int $is_dst [optional]

- * Parameters always represent a GMT date so is_dst - * doesn't influence the result. - *

- * @return int a integer Unix timestamp. - */ -function gmmktime ($hour = 'gmdate("H")', $minute = 'gmdate("i")', $second = 'gmdate("s")', $month = 'gmdate("n")', $day = 'gmdate("j")', $year = 'gmdate("Y")', $is_dst = -1) {} - -/** - * (PHP 4, PHP 5)
- * Validate a Gregorian date - * @link http://php.net/manual/en/function.checkdate.php - * @param int $month

- * The month is between 1 and 12 inclusive. - *

- * @param int $day

- * The day is within the allowed number of days for the given - * month. Leap years - * are taken into consideration. - *

- * @param int $year

- * The year is between 1 and 32767 inclusive. - *

- * @return bool TRUE if the date given is valid; otherwise returns FALSE. - */ -function checkdate ($month, $day, $year) {} - -/** - * (PHP 4, PHP 5)
- * Format a local time/date according to locale settings - * @link http://php.net/manual/en/function.strftime.php - * @param string $format

- * - * The following characters are recognized in the - * format parameter string - * - * - * - * - * - * - * Day - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * Week - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * Month - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * Year - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * Time - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * Time and Date Stamps - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * Miscellaneous - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
formatDescriptionExample returned values
------
%aAn abbreviated textual representation of the daySun through Sat
%AA full textual representation of the daySunday through Saturday
%dTwo-digit day of the month (with leading zeros)01 to 31
%e - * Day of the month, with a space preceding single digits. Not - * implemented as described on Windows. See below for more information. - * 1 to 31
%jDay of the year, 3 digits with leading zeros001 to 366
%uISO-8601 numeric representation of the day of the week1 (for Monday) though 7 (for Sunday)
%wNumeric representation of the day of the week0 (for Sunday) through 6 (for Saturday)
------
%UWeek number of the given year, starting with the first - * Sunday as the first week13 (for the 13th full week of the year)
%VISO-8601:1988 week number of the given year, starting with - * the first week of the year with at least 4 weekdays, with Monday - * being the start of the week01 through 53 (where 53 - * accounts for an overlapping week)
%WA numeric representation of the week of the year, starting - * with the first Monday as the first week46 (for the 46th week of the year beginning - * with a Monday)
------
%bAbbreviated month name, based on the localeJan through Dec
%BFull month name, based on the localeJanuary through December
%hAbbreviated month name, based on the locale (an alias of %b)Jan through Dec
%mTwo digit representation of the month01 (for January) through 12 (for December)
------
%CTwo digit representation of the century (year divided by 100, truncated to an integer)19 for the 20th Century
%gTwo digit representation of the year going by ISO-8601:1988 standards (see %V)Example: 09 for the week of January 6, 2009
%GThe full four-digit version of %gExample: 2008 for the week of January 3, 2009
%yTwo digit representation of the yearExample: 09 for 2009, 79 for 1979
%YFour digit representation for the yearExample: 2038
------
%HTwo digit representation of the hour in 24-hour format00 through 23
%kTwo digit representation of the hour in 24-hour format, with - * a space preceding single digits 0 through 23
%ITwo digit representation of the hour in 12-hour format01 through 12
%l (lower-case 'L')Hour in 12-hour format, with a space preceding single digits 1 through 12
%MTwo digit representation of the minute00 through 59
%pUPPER-CASE 'AM' or 'PM' based on the given timeExample: AM for 00:31, PM for 22:23
%Plower-case 'am' or 'pm' based on the given timeExample: am for 00:31, pm for 22:23
%rSame as "%I:%M:%S %p"Example: 09:34:17 PM for 21:34:17
%RSame as "%H:%M"Example: 00:35 for 12:35 AM, 16:44 for 4:44 PM
%STwo digit representation of the second00 through 59
%TSame as "%H:%M:%S"Example: 21:34:17 for 09:34:17 PM
%XPreferred time representation based on locale, without the dateExample: 03:59:16 or 15:59:16
%zThe time zone offset. Not implemented as described on - * Windows. See below for more information.Example: -0500 for US Eastern Time
%ZThe time zone abbreviation. Not implemented as described on - * Windows. See below for more information.Example: EST for Eastern Time
------
%cPreferred date and time stamp based on localeExample: Tue Feb 5 00:45:10 2009 for - * February 5, 2009 at 12:45:10 AM
%DSame as "%m/%d/%y"Example: 02/05/09 for February 5, 2009
%FSame as "%Y-%m-%d" (commonly used in database datestamps)Example: 2009-02-05 for February 5, 2009
%sUnix Epoch Time timestamp (same as the time - * function)Example: 305815200 for September 10, 1979 08:40:00 AM
%xPreferred date representation based on locale, without the timeExample: 02/05/09 for February 5, 2009
------
%nA newline character ("\n")---
%tA Tab character ("\t")---
%%A literal percentage character ("%")---
- *

- *

- * Maximum length of this parameter is 1023 characters. - *

- * Contrary to ISO-9899:1999, Sun Solaris starts with Sunday as 1. As a - * result, %u may not function as described in this - * manual. - *

- * Windows only: - *

- *

- * The %e modifier is not supported in the Windows - * implementation of this function. To achieve this value, the - * %#d modifier can be used instead. The example below - * illustrates how to write a cross platform compatible function. - *

- *

- * The %z and %Z modifiers both - * return the time zone name instead of the offset or abbreviation. - *

- * Mac OS X only: The %P modifier - * is not supported in the Mac OS X implementation of this function. - * @param int $timestamp [optional] - * @return string a string formatted according format - * using the given timestamp or the current - * local time if no timestamp is given. Month and weekday names and - * other language-dependent strings respect the current locale set - * with setlocale. - */ -function strftime ($format, $timestamp = 'time()') {} - -/** - * (PHP 4, PHP 5)
- * Format a GMT/UTC time/date according to locale settings - * @link http://php.net/manual/en/function.gmstrftime.php - * @param string $format

- * See description in strftime. - *

- * @param int $timestamp [optional] - * @return string a string formatted according to the given format string - * using the given timestamp or the current - * local time if no timestamp is given. Month and weekday names and - * other language dependent strings respect the current locale set - * with setlocale. - */ -function gmstrftime ($format, $timestamp = 'time()') {} - -/** - * (PHP 4, PHP 5)
- * Return current Unix timestamp - * @link http://php.net/manual/en/function.time.php - * @return int - */ -function time () {} - -/** - * (PHP 4, PHP 5)
- * Get the local time - * @link http://php.net/manual/en/function.localtime.php - * @param int $timestamp [optional] - * @param bool $is_associative [optional]

- * If set to FALSE or not supplied then the array is returned as a regular, - * numerically indexed array. If the argument is set to TRUE then - * localtime returns an associative array containing - * all the different elements of the structure returned by the C - * function call to localtime. The names of the different keys of - * the associative array are as follows: - *

- *

- * "tm_sec" - seconds, 0 to 59 - * @return array - */ -function localtime ($timestamp = 'time()', $is_associative = false) {} - -/** - * (PHP 4, PHP 5)
- * Get date/time information - * @link http://php.net/manual/en/function.getdate.php - * @param int $timestamp [optional] - * @return array an associative array of information related to - * the timestamp. Elements from the returned - * associative array are as follows: - *

- *

- * - * Key elements of the returned associative array - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
KeyDescriptionExample returned values
"seconds"Numeric representation of seconds0 to 59
"minutes"Numeric representation of minutes0 to 59
"hours"Numeric representation of hours0 to 23
"mday"Numeric representation of the day of the month1 to 31
"wday"Numeric representation of the day of the week0 (for Sunday) through 6 (for Saturday)
"mon"Numeric representation of a month1 through 12
"year"A full numeric representation of a year, 4 digitsExamples: 1999 or 2003
"yday"Numeric representation of the day of the year0 through 365
"weekday"A full textual representation of the day of the weekSunday through Saturday
"month"A full textual representation of a month, such as January or MarchJanuary through December
0 - * Seconds since the Unix Epoch, similar to the values returned by - * time and used by date. - * - * System Dependent, typically -2147483648 through - * 2147483647. - *
- */ -function getdate ($timestamp = 'time()') {} - -/** - * (PHP 5 >= 5.2.0)
- * Alias of DateTime::__construct - * @link http://php.net/manual/en/function.date-create.php - * @param $time [optional] - * @param $object [optional] - */ -function date_create ($time, $object) {} - -/** - * (PHP 5 >= 5.3.0)
- * Alias of DateTime::createFromFormat - * @link http://php.net/manual/en/function.date-create-from-format.php - * @param $format - * @param $time - * @param $object [optional] - */ -function date_create_from_format ($format, $time, $object) {} - -/** - * (PHP 5 >= 5.2.0)
- * Returns associative array with detailed info about given date - * @link http://php.net/manual/en/function.date-parse.php - * @param string $date

- * Date in format accepted by strtotime. - *

- * @return array array with information about the parsed date - * on success or FALSE on failure. - */ -function date_parse ($date) {} - -/** - * (PHP 5 >= 5.3.0)
- * Get info about given date formatted according to the specified format - * @link http://php.net/manual/en/function.date-parse-from-format.php - * @param string $format

- * Format accepted by DateTime::createFromFormat. - *

- * @param string $date

- * String representing the date. - *

- * @return array associative array with detailed info about given date. - */ -function date_parse_from_format ($format, $date) {} - -/** - * (PHP 5 >= 5.3.0)
- * Alias of DateTime::getLastErrors - * @link http://php.net/manual/en/function.date-get-last-errors.php - */ -function date_get_last_errors () {} - -/** - * (PHP 5 >= 5.2.0)
- * Alias of DateTime::format - * @link http://php.net/manual/en/function.date-format.php - * @param $object - * @param $format - */ -function date_format ($object, $format) {} - -/** - * (PHP 5 >= 5.2.0)
- * Alias of DateTime::modify - * @link http://php.net/manual/en/function.date-modify.php - * @param $object - * @param $modify - */ -function date_modify ($object, $modify) {} - -/** - * (PHP 5 >= 5.3.0)
- * Alias of DateTime::add - * @link http://php.net/manual/en/function.date-add.php - * @param $object - * @param $interval - */ -function date_add ($object, $interval) {} - -/** - * (PHP 5 >= 5.3.0)
- * Alias of DateTime::sub - * @link http://php.net/manual/en/function.date-sub.php - * @param $object - * @param $interval - */ -function date_sub ($object, $interval) {} - -/** - * (PHP 5 >= 5.2.0)
- * Alias of DateTime::getTimezone - * @link http://php.net/manual/en/function.date-timezone-get.php - * @param $object - */ -function date_timezone_get ($object) {} - -/** - * (PHP 5 >= 5.2.0)
- * Alias of DateTime::setTimezone - * @link http://php.net/manual/en/function.date-timezone-set.php - * @param $object - * @param $timezone - */ -function date_timezone_set ($object, $timezone) {} - -/** - * (PHP 5 >= 5.2.0)
- * Alias of DateTime::getOffset - * @link http://php.net/manual/en/function.date-offset-get.php - * @param $object - */ -function date_offset_get ($object) {} - -/** - * (PHP 5 >= 5.3.0)
- * Alias of DateTime::diff - * @link http://php.net/manual/en/function.date-diff.php - * @param $object - * @param $object2 - * @param $absolute [optional] - */ -function date_diff ($object, $object2, $absolute) {} - -/** - * (PHP 5 >= 5.2.0)
- * Alias of DateTime::setTime - * @link http://php.net/manual/en/function.date-time-set.php - * @param $object - * @param $hour - * @param $minute - * @param $second [optional] - */ -function date_time_set ($object, $hour, $minute, $second) {} - -/** - * (PHP 5 >= 5.2.0)
- * Alias of DateTime::setDate - * @link http://php.net/manual/en/function.date-date-set.php - * @param $object - * @param $year - * @param $month - * @param $day - */ -function date_date_set ($object, $year, $month, $day) {} - -/** - * (PHP 5 >= 5.2.0)
- * Alias of DateTime::setISODate - * @link http://php.net/manual/en/function.date-isodate-set.php - * @param $object - * @param $year - * @param $week - * @param $day [optional] - */ -function date_isodate_set ($object, $year, $week, $day) {} - -/** - * (PHP 5 >= 5.3.0)
- * Alias of DateTime::setTimestamp - * @link http://php.net/manual/en/function.date-timestamp-set.php - * @param $object - * @param $unixtimestamp - */ -function date_timestamp_set ($object, $unixtimestamp) {} - -/** - * (PHP 5 >= 5.3.0)
- * Alias of DateTime::getTimestamp - * @link http://php.net/manual/en/function.date-timestamp-get.php - * @param $object - */ -function date_timestamp_get ($object) {} - -/** - * (PHP 5 >= 5.2.0)
- * Alias of DateTimeZone::__construct - * @link http://php.net/manual/en/function.timezone-open.php - * @param $timezone - */ -function timezone_open ($timezone) {} - -/** - * (PHP 5 >= 5.2.0)
- * Alias of DateTimeZone::getName - * @link http://php.net/manual/en/function.timezone-name-get.php - * @param $object - */ -function timezone_name_get ($object) {} - -/** - * (PHP 5 >= 5.1.3)
- * Returns the timezone name from abbreviation - * @link http://php.net/manual/en/function.timezone-name-from-abbr.php - * @param string $abbr

- * Time zone abbreviation. - *

- * @param int $gmtOffset [optional]

- * Offset from GMT in seconds. Defaults to -1 which means that first found - * time zone corresponding to abbr is returned. - * Otherwise exact offset is searched and only if not found then the first - * time zone with any offset is returned. - *

- * @param int $isdst [optional]

- * Daylight saving time indicator. Defaults to -1, which means that - * whether the time zone has daylight saving or not is not taken into - * consideration when searching. If this is set to 1, then the - * gmtOffset is assumed to be an offset with - * daylight saving in effect; if 0, then gmtOffset - * is assumed to be an offset without daylight saving in effect. If - * abbr doesn't exist then the time zone is - * searched solely by the gmtOffset and - * isdst. - *

- * @return string time zone name on success or FALSE on failure. - */ -function timezone_name_from_abbr ($abbr, $gmtOffset = -1, $isdst = -1) {} - -/** - * (PHP 5 >= 5.2.0)
- * Alias of DateTimeZone::getOffset - * @link http://php.net/manual/en/function.timezone-offset-get.php - * @param $object - * @param $datetime - */ -function timezone_offset_get ($object, $datetime) {} - -/** - * (PHP 5 >= 5.2.0)
- * Alias of DateTimeZone::getTransitions - * @link http://php.net/manual/en/function.timezone-transitions-get.php - * @param $object - * @param $timestamp_begin [optional] - * @param $timestamp_end [optional] - */ -function timezone_transitions_get ($object, $timestamp_begin, $timestamp_end) {} - -/** - * (PHP 5 >= 5.3.0)
- * Alias of DateTimeZone::getLocation - * @link http://php.net/manual/en/function.timezone-location-get.php - * @param $object - */ -function timezone_location_get ($object) {} - -/** - * (PHP 5 >= 5.2.0)
- * Alias of DateTimeZone::listIdentifiers - * @link http://php.net/manual/en/function.timezone-identifiers-list.php - * @param $what [optional] - * @param $country [optional] - */ -function timezone_identifiers_list ($what, $country) {} - -/** - * (PHP 5 >= 5.2.0)
- * Alias of DateTimeZone::listAbbreviations - * @link http://php.net/manual/en/function.timezone-abbreviations-list.php - */ -function timezone_abbreviations_list () {} - -/** - * (PHP 5 >= 5.3.0)
- * Gets the version of the timezonedb - * @link http://php.net/manual/en/function.timezone-version-get.php - * @return string a string. - */ -function timezone_version_get () {} - -/** - * (PHP 5 >= 5.3.0)
- * Alias of DateInterval::createFromDateString - * @link http://php.net/manual/en/function.date-interval-create-from-date-string.php - * @param $time - */ -function date_interval_create_from_date_string ($time) {} - -/** - * (PHP 5 >= 5.3.0)
- * Alias of DateInterval::format - * @link http://php.net/manual/en/function.date-interval-format.php - * @param $object - * @param $format - */ -function date_interval_format ($object, $format) {} - -/** - * (PHP 5 >= 5.1.0)
- * Sets the default timezone used by all date/time functions in a script - * @link http://php.net/manual/en/function.date-default-timezone-set.php - * @param string $timezone_identifier

- * The timezone identifier, like UTC or - * Europe/Lisbon. The list of valid identifiers is - * available in the . - *

- * @return bool This function returns FALSE if the - * timezone_identifier isn't valid, or TRUE - * otherwise. - */ -function date_default_timezone_set ($timezone_identifier) {} - -/** - * (PHP 5 >= 5.1.0)
- * Gets the default timezone used by all date/time functions in a script - * @link http://php.net/manual/en/function.date-default-timezone-get.php - * @return string a string. - */ -function date_default_timezone_get () {} - -/** - * (PHP 5)
- * Returns time of sunrise for a given day and location - * @link http://php.net/manual/en/function.date-sunrise.php - * @param int $timestamp

- * The timestamp of the day from which the sunrise - * time is taken. - *

- * @param int $format [optional]

- * - * format constants - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
constantdescriptionexample
SUNFUNCS_RET_STRINGreturns the result as string16:46
SUNFUNCS_RET_DOUBLEreturns the result as float16.78243132
SUNFUNCS_RET_TIMESTAMPreturns the result as integer (timestamp)1095034606
- *

- * @param float $latitude [optional]

- * Defaults to North, pass in a negative value for South. - * See also: date.default_latitude - *

- * @param float $longitude [optional]

- * Defaults to East, pass in a negative value for West. - * See also: date.default_longitude - *

- * @param float $zenith [optional]

- * Default: date.sunrise_zenith - *

- * @param float $gmt_offset [optional] - * @return mixed the sunrise time in a specified format on - * success or FALSE on failure. - */ -function date_sunrise ($timestamp, $format = 'SUNFUNCS_RET_STRING', $latitude = 'ini_get("date.default_latitude")', $longitude = 'ini_get("date.default_longitude")', $zenith = 'ini_get("date.sunrise_zenith")', $gmt_offset = 0) {} - -/** - * (PHP 5)
- * Returns time of sunset for a given day and location - * @link http://php.net/manual/en/function.date-sunset.php - * @param int $timestamp

- * The timestamp of the day from which the sunset - * time is taken. - *

- * @param int $format [optional]

- * - * format constants - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
constantdescriptionexample
SUNFUNCS_RET_STRINGreturns the result as string16:46
SUNFUNCS_RET_DOUBLEreturns the result as float16.78243132
SUNFUNCS_RET_TIMESTAMPreturns the result as integer (timestamp)1095034606
- *

- * @param float $latitude [optional]

- * Defaults to North, pass in a negative value for South. - * See also: date.default_latitude - *

- * @param float $longitude [optional]

- * Defaults to East, pass in a negative value for West. - * See also: date.default_longitude - *

- * @param float $zenith [optional]

- * Default: date.sunset_zenith - *

- * @param float $gmt_offset [optional] - * @return mixed the sunset time in a specified format on - * success or FALSE on failure. - */ -function date_sunset ($timestamp, $format = 'SUNFUNCS_RET_STRING', $latitude = 'ini_get("date.default_latitude")', $longitude = 'ini_get("date.default_longitude")', $zenith = 'ini_get("date.sunset_zenith")', $gmt_offset = 0) {} - -/** - * (PHP 5 >= 5.1.2)
- * Returns an array with information about sunset/sunrise and twilight begin/end - * @link http://php.net/manual/en/function.date-sun-info.php - * @param int $time

- * Timestamp. - *

- * @param float $latitude

- * Latitude in degrees. - *

- * @param float $longitude

- * Longitude in degrees. - *

- * @return array array on success or FALSE on failure. - */ -function date_sun_info ($time, $latitude, $longitude) {} - -define ('DATE_ATOM', "Y-m-d\TH:i:sP"); -define ('DATE_COOKIE', "l, d-M-y H:i:s T"); -define ('DATE_ISO8601', "Y-m-d\TH:i:sO"); -define ('DATE_RFC822', "D, d M y H:i:s O"); -define ('DATE_RFC850', "l, d-M-y H:i:s T"); -define ('DATE_RFC1036', "D, d M y H:i:s O"); -define ('DATE_RFC1123', "D, d M Y H:i:s O"); -define ('DATE_RFC2822', "D, d M Y H:i:s O"); -define ('DATE_RFC3339', "Y-m-d\TH:i:sP"); -define ('DATE_RSS', "D, d M Y H:i:s O"); -define ('DATE_W3C', "Y-m-d\TH:i:sP"); - -/** - * Timestamp - * @link http://php.net/manual/en/datetime.constants.php - */ -define ('SUNFUNCS_RET_TIMESTAMP', 0); - -/** - * Hours:minutes (example: 08:02) - * @link http://php.net/manual/en/datetime.constants.php - */ -define ('SUNFUNCS_RET_STRING', 1); - -/** - * Hours as floating point number (example 8.75) - * @link http://php.net/manual/en/datetime.constants.php - */ -define ('SUNFUNCS_RET_DOUBLE', 2); - -// End of date v.5.4.6-1ubuntu1.1 -?> diff --git a/phpruntime/dba.php b/phpruntime/dba.php deleted file mode 100644 index 6a4ccc5..0000000 --- a/phpruntime/dba.php +++ /dev/null @@ -1,338 +0,0 @@ - - * Open database - * @link http://php.net/manual/en/function.dba-open.php - * @param string $path

- * Commonly a regular path in your filesystem. - *

- * @param string $mode

- * It is r for read access, w for - * read/write access to an already existing database, c - * for read/write access and database creation if it doesn't currently exist, - * and n for create, truncate and read/write access. - * The database is created in BTree mode, other modes (like Hash or Queue) - * are not supported. - *

- *

- * Additionally you can set the database lock method with the next char. - * Use l to lock the database with a .lck - * file or d to lock the databasefile itself. It is - * important that all of your applications do this consistently. - *

- *

- * If you want to test the access and do not want to wait for the lock - * you can add t as third character. When you are - * absolutely sure that you do not require database locking you can do - * so by using - instead of l or - * d. When none of d, - * l or - is used, dba will lock - * on the database file as it would with d. - *

- *

- * There can only be one writer for one database file. When you use dba on - * a web server and more than one request requires write operations they can - * only be done one after another. Also read during write is not allowed. - * The dba extension uses locks to prevent this. See the following table: - * - * DBA locking - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
already openmode = "rl"mode = "rlt"mode = "wl"mode = "wlt"mode = "rd"mode = "rdt"mode = "wd"mode = "wdt"
not openokokokokokokokok
mode = "rl"okokwaitfalseillegalillegalillegalillegal
mode = "wl"waitfalsewaitfalseillegalillegalillegalillegal
mode = "rd"illegalillegalillegalillegalokokwaitfalse
mode = "wd"illegalillegalillegalillegalwaitfalsewaitfalse
- * ok: the second call will be successfull. - * wait: the second call waits until dba_close is called for the first. - * false: the second call returns false. - * illegal: you must not mix "l" and "d" modifiers for mode parameter. - *

- * @param string $handler [optional]

- * The name of the handler which - * shall be used for accessing path. It is passed - * all optional parameters given to dba_open and - * can act on behalf of them. - *

- * @param mixed $_ [optional] - * @return resource a positive handle on success or FALSE on failure. - */ -function dba_open ($path, $mode, $handler = null, $_ = null) {} - -/** - * (PHP 4, PHP 5)
- * Open database persistently - * @link http://php.net/manual/en/function.dba-popen.php - * @param string $path

- * Commonly a regular path in your filesystem. - *

- * @param string $mode

- * It is r for read access, w for - * read/write access to an already existing database, c - * for read/write access and database creation if it doesn't currently exist, - * and n for create, truncate and read/write access. - *

- * @param string $handler [optional]

- * The name of the handler which - * shall be used for accessing path. It is passed - * all optional parameters given to dba_popen and - * can act on behalf of them. - *

- * @param mixed $_ [optional] - * @return resource a positive handle on success or FALSE on failure. - */ -function dba_popen ($path, $mode, $handler = null, $_ = null) {} - -/** - * (PHP 4, PHP 5)
- * Close a DBA database - * @link http://php.net/manual/en/function.dba-close.php - * @param resource $handle

- * The database handler, returned by dba_open or - * dba_popen. - *

- * @return void No value is returned. - */ -function dba_close ($handle) {} - -/** - * (PHP 4, PHP 5)
- * Delete DBA entry specified by key - * @link http://php.net/manual/en/function.dba-delete.php - * @param string $key

- * The key of the entry which is deleted. - *

- * @param resource $handle

- * The database handler, returned by dba_open or - * dba_popen. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function dba_delete ($key, $handle) {} - -/** - * (PHP 4, PHP 5)
- * Check whether key exists - * @link http://php.net/manual/en/function.dba-exists.php - * @param string $key

- * The key the check is performed for. - *

- * @param resource $handle

- * The database handler, returned by dba_open or - * dba_popen. - *

- * @return bool TRUE if the key exists, FALSE otherwise. - */ -function dba_exists ($key, $handle) {} - -/** - * (PHP 4, PHP 5)
- * Fetch data specified by key - * @link http://php.net/manual/en/function.dba-fetch.php - * @param string $key

- * The key the data is specified by. - *

- *

- * When working with inifiles this function accepts arrays as keys - * where index 0 is the group and index 1 is the value name. See: - * dba_key_split. - *

- * @param resource $handle

- * The database handler, returned by dba_open or - * dba_popen. - *

- * @return string the associated string if the key/data pair is found, FALSE - * otherwise. - */ -function dba_fetch ($key, $handle) {} - -/** - * (PHP 4, PHP 5)
- * Insert entry - * @link http://php.net/manual/en/function.dba-insert.php - * @param string $key

- * The key of the entry to be inserted. If this key already exist in the - * database, this function will fail. Use dba_replace - * if you need to replace an existent key. - *

- * @param string $value

- * The value to be inserted. - *

- * @param resource $handle

- * The database handler, returned by dba_open or - * dba_popen. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function dba_insert ($key, $value, $handle) {} - -/** - * (PHP 4, PHP 5)
- * Replace or insert entry - * @link http://php.net/manual/en/function.dba-replace.php - * @param string $key

- * The key of the entry to be replaced. - *

- * @param string $value

- * The value to be replaced. - *

- * @param resource $handle

- * The database handler, returned by dba_open or - * dba_popen. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function dba_replace ($key, $value, $handle) {} - -/** - * (PHP 4, PHP 5)
- * Fetch first key - * @link http://php.net/manual/en/function.dba-firstkey.php - * @param resource $handle

- * The database handler, returned by dba_open or - * dba_popen. - *

- * @return string the key on success or FALSE on failure. - */ -function dba_firstkey ($handle) {} - -/** - * (PHP 4, PHP 5)
- * Fetch next key - * @link http://php.net/manual/en/function.dba-nextkey.php - * @param resource $handle

- * The database handler, returned by dba_open or - * dba_popen. - *

- * @return string the key on success or FALSE on failure. - */ -function dba_nextkey ($handle) {} - -/** - * (PHP 4, PHP 5)
- * Optimize database - * @link http://php.net/manual/en/function.dba-optimize.php - * @param resource $handle

- * The database handler, returned by dba_open or - * dba_popen. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function dba_optimize ($handle) {} - -/** - * (PHP 4, PHP 5)
- * Synchronize database - * @link http://php.net/manual/en/function.dba-sync.php - * @param resource $handle

- * The database handler, returned by dba_open or - * dba_popen. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function dba_sync ($handle) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * List all the handlers available - * @link http://php.net/manual/en/function.dba-handlers.php - * @param bool $full_info [optional]

- * Turns on/off full information display in the result. - *

- * @return array an array of database handlers. If full_info - * is set to TRUE, the array will be associative with the handlers names as - * keys, and their version information as value. Otherwise, the result will be - * an indexed array of handlers names. - *

- *

- * When the internal cdb library is used you will see - * cdb and cdb_make. - */ -function dba_handlers ($full_info = false) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * List all open database files - * @link http://php.net/manual/en/function.dba-list.php - * @return array An associative array, in the form resourceid => filename. - */ -function dba_list () {} - -/** - * (PHP 5)
- * Splits a key in string representation into array representation - * @link http://php.net/manual/en/function.dba-key-split.php - * @param mixed $key

- * The key in string representation. - *

- * @return mixed an array of the form array(0 => group, 1 => - * value_name). This function will return FALSE if - * key is NULL or FALSE. - */ -function dba_key_split ($key) {} - -// End of dba v. -?> diff --git a/phpruntime/dom.php b/phpruntime/dom.php deleted file mode 100644 index 88d8e8b..0000000 --- a/phpruntime/dom.php +++ /dev/null @@ -1,5708 +0,0 @@ - - * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -class DOMStringList { - - /** - * @param $index - */ - public function item ($index) {} - -} - -/** - * @link http://php.net/manual/en/book.dom.php - */ -class DOMNameList { - - /** - * @param $index - */ - public function getName ($index) {} - - /** - * @param $index - */ - public function getNamespaceURI ($index) {} - -} - -class DOMImplementationList { - - /** - * @param $index - */ - public function item ($index) {} - -} - -class DOMImplementationSource { - - /** - * @param $features - */ - public function getDomimplementation ($features) {} - - /** - * @param $features - */ - public function getDomimplementations ($features) {} - -} - -/** - * The DOMImplementation interface provides a number - * of methods for performing operations that are independent of any - * particular instance of the document object model. - * @link http://php.net/manual/en/class.domimplementation.php - */ -class DOMImplementation { - - /** - * @param $feature - * @param $version - */ - public function getFeature ($feature, $version) {} - - /** - * (PHP 5)
- * Test if the DOM implementation implements a specific feature - * @link http://php.net/manual/en/domimplementation.hasfeature.php - * @param string $feature

- * The feature to test. - *

- * @param string $version

- * The version number of the feature to test. In - * level 2, this can be either 2.0 or - * 1.0. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function hasFeature ($feature, $version) {} - - /** - * (PHP 5)
- * Creates an empty DOMDocumentType object - * @link http://php.net/manual/en/domimplementation.createdocumenttype.php - * @param string $qualifiedName [optional]

- * The qualified name of the document type to create. - *

- * @param string $publicId [optional]

- * The external subset public identifier. - *

- * @param string $systemId [optional]

- * The external subset system identifier. - *

- * @return DOMDocumentType A new DOMDocumentType node with its - * ownerDocument set to NULL. - */ - public function createDocumentType ($qualifiedName = null, $publicId = null, $systemId = null) {} - - /** - * (PHP 5)
- * Creates a DOMDocument object of the specified type with its document element - * @link http://php.net/manual/en/domimplementation.createdocument.php - * @param string $namespaceURI [optional]

- * The namespace URI of the document element to create. - *

- * @param string $qualifiedName [optional]

- * The qualified name of the document element to create. - *

- * @param DOMDocumentType $doctype [optional]

- * The type of document to create or NULL. - *

- * @return DOMDocument A new DOMDocument object. If - * namespaceURI, qualifiedName, - * and doctype are null, the returned - * DOMDocument is empty with no document element - */ - public function createDocument ($namespaceURI = null, $qualifiedName = null, DOMDocumentType $doctype = null) {} - -} - -/** - * @link http://php.net/manual/en/class.domnode.php - */ -class DOMNode { - /** - *

Returns the most accurate name for the current node type

- * @var string - */ - public $nodeName; - /** - *

The value of this node, depending on its type

- * @var string - */ - public $nodeValue; - /** - *

Gets the type of the node. One of the predefined XML_xxx_NODE constants

- * @var int - */ - public $nodeType; - /** - *

The parent of this node

- * @var DOMNode - */ - public $parentNode; - /** - *

- * A DOMNodeList that contains all - * children of this node. If there are no children, this is an empty - * DOMNodeList. - *

- * @var DOMNodeList - */ - public $childNodes; - /** - *

- * The first child of this node. If there is no such node, this - * returns NULL. - *

- * @var DOMNode - */ - public $firstChild; - /** - *

The last child of this node. If there is no such node, this returns NULL.

- * @var DOMNode - */ - public $lastChild; - /** - *

- * The node immediately preceding this node. If there is no such - * node, this returns NULL. - *

- * @var DOMNode - */ - public $previousSibling; - /** - *

- * The node immediately following this node. If there is no such - * node, this returns NULL. - *

- * @var DOMNode - */ - public $nextSibling; - /** - *

- * A DOMNamedNodeMap containing the - * attributes of this node (if it is a DOMElement) - * or NULL otherwise. - *

- * @var DOMNamedNodeMap - */ - public $attributes; - /** - *

The DOMDocument object associated with this node.

- * @var DOMDocument - */ - public $ownerDocument; - /** - *

The namespace URI of this node, or NULL if it is unspecified.

- * @var string - */ - public $namespaceURI; - /** - *

The namespace prefix of this node, or NULL if it is unspecified.

- * @var string - */ - public $prefix; - /** - *

Returns the local part of the qualified name of this node.

- * @var string - */ - public $localName; - /** - *

- * The absolute base URI of this node or NULL if the implementation - * wasn't able to obtain an absolute URI. - *

- * @var string - */ - public $baseURI; - /** - *

This attribute returns the text content of this node and its descendants.

- * @var string - */ - public $textContent; - - - /** - * (PHP 5)
- * Adds a new child before a reference node - * @link http://php.net/manual/en/domnode.insertbefore.php - * @param DOMNode $newnode

- * The new node. - *

- * @param DOMNode $refnode [optional]

- * The reference node. If not supplied, newnode is - * appended to the children. - *

- * @return DOMNode The inserted node. - */ - public function insertBefore (DOMNode $newnode, DOMNode $refnode = null) {} - - /** - * (PHP 5)
- * Replaces a child - * @link http://php.net/manual/en/domnode.replacechild.php - * @param DOMNode $newnode

- * The new node. It must be a member of the target document, i.e. - * created by one of the DOMDocument->createXXX() methods or imported in - * the document by . - *

- * @param DOMNode $oldnode

- * The old node. - *

- * @return DOMNode The old node or FALSE if an error occur. - */ - public function replaceChild (DOMNode $newnode, DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Removes child from list of children - * @link http://php.net/manual/en/domnode.removechild.php - * @param DOMNode $oldnode

- * The removed child. - *

- * @return DOMNode If the child could be removed the function returns the old child. - */ - public function removeChild (DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Adds new child at the end of the children - * @link http://php.net/manual/en/domnode.appendchild.php - * @param DOMNode $newnode

- * The appended child. - *

- * @return DOMNode The node added. - */ - public function appendChild (DOMNode $newnode) {} - - /** - * (PHP 5)
- * Checks if node has children - * @link http://php.net/manual/en/domnode.haschildnodes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasChildNodes () {} - - /** - * (PHP 5)
- * Clones a node - * @link http://php.net/manual/en/domnode.clonenode.php - * @param bool $deep [optional]

- * Indicates whether to copy all descendant nodes. This parameter is - * defaulted to FALSE. - *

- * @return DOMNode The cloned node. - */ - public function cloneNode ($deep = null) {} - - /** - * (PHP 5)
- * Normalizes the node - * @link http://php.net/manual/en/domnode.normalize.php - * @return void No value is returned. - */ - public function normalize () {} - - /** - * (PHP 5)
- * Checks if feature is supported for specified version - * @link http://php.net/manual/en/domnode.issupported.php - * @param string $feature

- * The feature to test. See the example of - * DOMImplementation::hasFeature for a - * list of features. - *

- * @param string $version

- * The version number of the feature to test. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSupported ($feature, $version) {} - - /** - * (PHP 5)
- * Checks if node has attributes - * @link http://php.net/manual/en/domnode.hasattributes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasAttributes () {} - - /** - * @param DOMNode $other - */ - public function compareDocumentPosition (DOMNode $other) {} - - /** - * (PHP 5)
- * Indicates if two nodes are the same node - * @link http://php.net/manual/en/domnode.issamenode.php - * @param DOMNode $node

- * The compared node. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSameNode (DOMNode $node) {} - - /** - * (PHP 5)
- * Gets the namespace prefix of the node based on the namespace URI - * @link http://php.net/manual/en/domnode.lookupprefix.php - * @param string $namespaceURI

- * The namespace URI. - *

- * @return string The prefix of the namespace. - */ - public function lookupPrefix ($namespaceURI) {} - - /** - * (PHP 5)
- * Checks if the specified namespaceURI is the default namespace or not - * @link http://php.net/manual/en/domnode.isdefaultnamespace.php - * @param string $namespaceURI

- * The namespace URI to look for. - *

- * @return bool Return TRUE if namespaceURI is the default - * namespace, FALSE otherwise. - */ - public function isDefaultNamespace ($namespaceURI) {} - - /** - * (PHP 5)
- * Gets the namespace URI of the node based on the prefix - * @link http://php.net/manual/en/domnode.lookupnamespaceuri.php - * @param string $prefix

- * The prefix of the namespace. - *

- * @return string The namespace URI of the node. - */ - public function lookupNamespaceUri ($prefix) {} - - /** - * @param DOMNode $arg - */ - public function isEqualNode (DOMNode $arg) {} - - /** - * @param $feature - * @param $version - */ - public function getFeature ($feature, $version) {} - - /** - * @param $key - * @param $data - * @param $handler - */ - public function setUserData ($key, $data, $handler) {} - - /** - * @param $key - */ - public function getUserData ($key) {} - - /** - * (PHP 5 >= 5.2.0)
- * Get an XPath for a node - * @link http://php.net/manual/en/domnode.getnodepath.php - * @return string a string containing the XPath, or NULL in case of an error. - */ - public function getNodePath () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get line number for a node - * @link http://php.net/manual/en/domnode.getlineno.php - * @return int Always returns the line number where the node was defined in. - */ - public function getLineNo () {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a string - * @link http://php.net/manual/en/domnode.c14n.php - * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return string canonicalized nodes as a string or FALSE on failure - */ - public function C14N ($exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a file - * @link http://php.net/manual/en/domnode.c14nfile.php - * @param string $uri

- * Path to write the output to. - *

- * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return int Number of bytes written or FALSE on failure - */ - public function C14NFile ($uri, $exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - -} - -class DOMNameSpaceNode { -} - -/** - * @link http://php.net/manual/en/class.domdocumentfragment.php - */ -class DOMDocumentFragment extends DOMNode { - - public function __construct () {} - - /** - * (PHP 5 >= 5.1.0)
- * Append raw XML data - * @link http://php.net/manual/en/domdocumentfragment.appendxml.php - * @param string $data

- * XML to append. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function appendXML ($data) {} - - /** - * (PHP 5)
- * Adds a new child before a reference node - * @link http://php.net/manual/en/domnode.insertbefore.php - * @param DOMNode $newnode

- * The new node. - *

- * @param DOMNode $refnode [optional]

- * The reference node. If not supplied, newnode is - * appended to the children. - *

- * @return DOMNode The inserted node. - */ - public function insertBefore (DOMNode $newnode, DOMNode $refnode = null) {} - - /** - * (PHP 5)
- * Replaces a child - * @link http://php.net/manual/en/domnode.replacechild.php - * @param DOMNode $newnode

- * The new node. It must be a member of the target document, i.e. - * created by one of the DOMDocument->createXXX() methods or imported in - * the document by . - *

- * @param DOMNode $oldnode

- * The old node. - *

- * @return DOMNode The old node or FALSE if an error occur. - */ - public function replaceChild (DOMNode $newnode, DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Removes child from list of children - * @link http://php.net/manual/en/domnode.removechild.php - * @param DOMNode $oldnode

- * The removed child. - *

- * @return DOMNode If the child could be removed the function returns the old child. - */ - public function removeChild (DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Adds new child at the end of the children - * @link http://php.net/manual/en/domnode.appendchild.php - * @param DOMNode $newnode

- * The appended child. - *

- * @return DOMNode The node added. - */ - public function appendChild (DOMNode $newnode) {} - - /** - * (PHP 5)
- * Checks if node has children - * @link http://php.net/manual/en/domnode.haschildnodes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasChildNodes () {} - - /** - * (PHP 5)
- * Clones a node - * @link http://php.net/manual/en/domnode.clonenode.php - * @param bool $deep [optional]

- * Indicates whether to copy all descendant nodes. This parameter is - * defaulted to FALSE. - *

- * @return DOMNode The cloned node. - */ - public function cloneNode ($deep = null) {} - - /** - * (PHP 5)
- * Normalizes the node - * @link http://php.net/manual/en/domnode.normalize.php - * @return void No value is returned. - */ - public function normalize () {} - - /** - * (PHP 5)
- * Checks if feature is supported for specified version - * @link http://php.net/manual/en/domnode.issupported.php - * @param string $feature

- * The feature to test. See the example of - * DOMImplementation::hasFeature for a - * list of features. - *

- * @param string $version

- * The version number of the feature to test. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSupported ($feature, $version) {} - - /** - * (PHP 5)
- * Checks if node has attributes - * @link http://php.net/manual/en/domnode.hasattributes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasAttributes () {} - - /** - * @param DOMNode $other - */ - public function compareDocumentPosition (DOMNode $other) {} - - /** - * (PHP 5)
- * Indicates if two nodes are the same node - * @link http://php.net/manual/en/domnode.issamenode.php - * @param DOMNode $node

- * The compared node. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSameNode (DOMNode $node) {} - - /** - * (PHP 5)
- * Gets the namespace prefix of the node based on the namespace URI - * @link http://php.net/manual/en/domnode.lookupprefix.php - * @param string $namespaceURI

- * The namespace URI. - *

- * @return string The prefix of the namespace. - */ - public function lookupPrefix ($namespaceURI) {} - - /** - * (PHP 5)
- * Checks if the specified namespaceURI is the default namespace or not - * @link http://php.net/manual/en/domnode.isdefaultnamespace.php - * @param string $namespaceURI

- * The namespace URI to look for. - *

- * @return bool Return TRUE if namespaceURI is the default - * namespace, FALSE otherwise. - */ - public function isDefaultNamespace ($namespaceURI) {} - - /** - * (PHP 5)
- * Gets the namespace URI of the node based on the prefix - * @link http://php.net/manual/en/domnode.lookupnamespaceuri.php - * @param string $prefix

- * The prefix of the namespace. - *

- * @return string The namespace URI of the node. - */ - public function lookupNamespaceUri ($prefix) {} - - /** - * @param DOMNode $arg - */ - public function isEqualNode (DOMNode $arg) {} - - /** - * @param $feature - * @param $version - */ - public function getFeature ($feature, $version) {} - - /** - * @param $key - * @param $data - * @param $handler - */ - public function setUserData ($key, $data, $handler) {} - - /** - * @param $key - */ - public function getUserData ($key) {} - - /** - * (PHP 5 >= 5.2.0)
- * Get an XPath for a node - * @link http://php.net/manual/en/domnode.getnodepath.php - * @return string a string containing the XPath, or NULL in case of an error. - */ - public function getNodePath () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get line number for a node - * @link http://php.net/manual/en/domnode.getlineno.php - * @return int Always returns the line number where the node was defined in. - */ - public function getLineNo () {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a string - * @link http://php.net/manual/en/domnode.c14n.php - * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return string canonicalized nodes as a string or FALSE on failure - */ - public function C14N ($exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a file - * @link http://php.net/manual/en/domnode.c14nfile.php - * @param string $uri

- * Path to write the output to. - *

- * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return int Number of bytes written or FALSE on failure - */ - public function C14NFile ($uri, $exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - -} - -/** - * Represents an entire HTML or XML document; serves as the root of the - * document tree. - * @link http://php.net/manual/en/class.domdocument.php - */ -class DOMDocument extends DOMNode { - /** - *

- * Deprecated. Actual encoding of the document, - * is a readonly equivalent to - * encoding. - *

- * @var string - */ - public $actualEncoding; - /** - *

- * Deprecated. Configuration used when - * DOMDocument::normalizeDocument() is - * invoked. - *

- * @var DOMConfiguration - */ - public $config; - /** - *

The Document Type Declaration associated with this document.

- * @var DOMDocumentType - */ - public $doctype; - /** - *

- * This is a convenience attribute that allows direct access to the - * child node that is the document element of the document. - *

- * @var DOMElement - */ - public $documentElement; - /** - *

The location of the document or NULL if undefined.

- * @var string - */ - public $documentURI; - /** - *

- * Encoding of the document, as specified by the XML declaration. This - * attribute is not present in the final DOM Level 3 specification, but - * is the only way of manipulating XML document encoding in this - * implementation. - *

- * @var string - */ - public $encoding; - /** - *

Nicely formats output with indentation and extra space.

- * @var bool - */ - public $formatOutput; - /** - *

- * The DOMImplementation object that handles - * this document. - *

- * @var DOMImplementation - */ - public $implementation; - /** - *

Do not remove redundant white space. Default to TRUE.

- * @var bool - */ - public $preserveWhiteSpace; - /** - *

- * Proprietary. Enables recovery mode, i.e. trying - * to parse non-well formed documents. This attribute is not part of - * the DOM specification and is specific to libxml. - *

- * @var bool - */ - public $recover; - /** - *

- * Set it to TRUE to load external entities from a doctype - * declaration. This is useful for including character entities in - * your XML document. - *

- * @var bool - */ - public $resolveExternals; - /** - *

- * Deprecated. Whether or not the document is - * standalone, as specified by the XML declaration, corresponds to - * xmlStandalone. - *

- * @var bool - */ - public $standalone; - /** - *

Throws DOMException on errors. Default to TRUE.

- * @var bool - */ - public $strictErrorChecking; - /** - *

- * Proprietary. Whether or not to substitute - * entities. This attribute is not part of - * the DOM specification and is specific to libxml. - *

- * @var bool - */ - public $substituteEntities; - /** - *

Loads and validates against the DTD. Default to FALSE.

- * @var bool - */ - public $validateOnParse; - /** - *

- * Deprecated. Version of XML, corresponds to - * xmlVersion. - *

- * @var string - */ - public $version; - /** - *

- * An attribute specifying, as part of the XML declaration, the - * encoding of this document. This is NULL when unspecified or when it - * is not known, such as when the Document was created in memory. - *

- * @var string - */ - public $xmlEncoding; - /** - *

- * An attribute specifying, as part of the XML declaration, whether - * this document is standalone. This is FALSE when unspecified. - *

- * @var bool - */ - public $xmlStandalone; - /** - *

- * An attribute specifying, as part of the XML declaration, the - * version number of this document. If there is no declaration and if - * this document supports the "XML" feature, the value is "1.0". - *

- * @var string - */ - public $xmlVersion; - - - /** - * (PHP 5)
- * Create new element node - * @link http://php.net/manual/en/domdocument.createelement.php - * @param string $name

- * The tag name of the element. - *

- * @param string $value [optional]

- * The value of the element. By default, an empty element will be created. - * The value can also be set later with DOMElement::$nodeValue. - *

- * @return DOMElement a new instance of class DOMElement or FALSE - * if an error occured. - */ - public function createElement ($name, $value = null) {} - - /** - * (PHP 5)
- * Create new document fragment - * @link http://php.net/manual/en/domdocument.createdocumentfragment.php - * @return DOMDocumentFragment The new DOMDocumentFragment or FALSE if an error occured. - */ - public function createDocumentFragment () {} - - /** - * (PHP 5)
- * Create new text node - * @link http://php.net/manual/en/domdocument.createtextnode.php - * @param string $content

- * The content of the text. - *

- * @return DOMText The new DOMText or FALSE if an error occured. - */ - public function createTextNode ($content) {} - - /** - * (PHP 5)
- * Create new comment node - * @link http://php.net/manual/en/domdocument.createcomment.php - * @param string $data

- * The content of the comment. - *

- * @return DOMComment The new DOMComment or FALSE if an error occured. - */ - public function createComment ($data) {} - - /** - * (PHP 5)
- * Create new cdata node - * @link http://php.net/manual/en/domdocument.createcdatasection.php - * @param string $data

- * The content of the cdata. - *

- * @return DOMCDATASection The new DOMCDATASection or FALSE if an error occured. - */ - public function createCDATASection ($data) {} - - /** - * (PHP 5)
- * Creates new PI node - * @link http://php.net/manual/en/domdocument.createprocessinginstruction.php - * @param string $target

- * The target of the processing instruction. - *

- * @param string $data [optional]

- * The content of the processing instruction. - *

- * @return DOMProcessingInstruction The new DOMProcessingInstruction or FALSE if an error occured. - */ - public function createProcessingInstruction ($target, $data = null) {} - - /** - * (PHP 5)
- * Create new attribute - * @link http://php.net/manual/en/domdocument.createattribute.php - * @param string $name

- * The name of the attribute. - *

- * @return DOMAttr The new DOMAttr or FALSE if an error occured. - */ - public function createAttribute ($name) {} - - /** - * (PHP 5)
- * Create new entity reference node - * @link http://php.net/manual/en/domdocument.createentityreference.php - * @param string $name

- * The content of the entity reference, e.g. the entity reference minus - * the leading &#38; and the trailing - * ; characters. - *

- * @return DOMEntityReference The new DOMEntityReference or FALSE if an error - * occured. - */ - public function createEntityReference ($name) {} - - /** - * (PHP 5)
- * Searches for all elements with given local tag name - * @link http://php.net/manual/en/domdocument.getelementsbytagname.php - * @param string $name

- * The local name (without namespace) of the tag to match on. The special value * - * matches all tags. - *

- * @return DOMNodeList A new DOMNodeList object containing all the matched - * elements. - */ - public function getElementsByTagName ($name) {} - - /** - * (PHP 5)
- * Import node into current document - * @link http://php.net/manual/en/domdocument.importnode.php - * @param DOMNode $importedNode

- * The node to import. - *

- * @param bool $deep [optional]

- * If set to TRUE, this method will recursively import the subtree under - * the importedNode. - *

- *

- * To copy the nodes attributes deep needs to be set to TRUE - *

- * @return DOMNode The copied node or FALSE, if it cannot be copied. - */ - public function importNode (DOMNode $importedNode, $deep = null) {} - - /** - * (PHP 5)
- * Create new element node with an associated namespace - * @link http://php.net/manual/en/domdocument.createelementns.php - * @param string $namespaceURI

- * The URI of the namespace. - *

- * @param string $qualifiedName

- * The qualified name of the element, as prefix:tagname. - *

- * @param string $value [optional]

- * The value of the element. By default, an empty element will be created. - * You can also set the value later with DOMElement::$nodeValue. - *

- * @return DOMElement The new DOMElement or FALSE if an error occured. - */ - public function createElementNS ($namespaceURI, $qualifiedName, $value = null) {} - - /** - * (PHP 5)
- * Create new attribute node with an associated namespace - * @link http://php.net/manual/en/domdocument.createattributens.php - * @param string $namespaceURI

- * The URI of the namespace. - *

- * @param string $qualifiedName

- * The tag name and prefix of the attribute, as prefix:tagname. - *

- * @return DOMAttr The new DOMAttr or FALSE if an error occured. - */ - public function createAttributeNS ($namespaceURI, $qualifiedName) {} - - /** - * (PHP 5)
- * Searches for all elements with given tag name in specified namespace - * @link http://php.net/manual/en/domdocument.getelementsbytagnamens.php - * @param string $namespaceURI

- * The namespace URI of the elements to match on. - * The special value * matches all namespaces. - *

- * @param string $localName

- * The local name of the elements to match on. - * The special value * matches all local names. - *

- * @return DOMNodeList A new DOMNodeList object containing all the matched - * elements. - */ - public function getElementsByTagNameNS ($namespaceURI, $localName) {} - - /** - * (PHP 5)
- * Searches for an element with a certain id - * @link http://php.net/manual/en/domdocument.getelementbyid.php - * @param string $elementId

- * The unique id value for an element. - *

- * @return DOMElement the DOMElement or NULL if the element is - * not found. - */ - public function getElementById ($elementId) {} - - /** - * @param DOMNode $source - */ - public function adoptNode (DOMNode $source) {} - - /** - * (PHP 5)
- * Normalizes the document - * @link http://php.net/manual/en/domdocument.normalizedocument.php - * @return void No value is returned. - */ - public function normalizeDocument () {} - - /** - * @param DOMNode $node - * @param $namespaceURI - * @param $qualifiedName - */ - public function renameNode (DOMNode $node, $namespaceURI, $qualifiedName) {} - - /** - * (PHP 5)
- * Load XML from a file - * @link http://php.net/manual/en/domdocument.load.php - * @param string $filename

- * The path to the XML document. - *

- * @param int $options [optional]

- * Bitwise OR - * of the libxml option constants. - *

- * @return mixed TRUE on success or FALSE on failure. If called statically, returns a - * DOMDocument or FALSE on failure. - */ - public function load ($filename, $options = 0) {} - - /** - * (PHP 5)
- * Dumps the internal XML tree back into a file - * @link http://php.net/manual/en/domdocument.save.php - * @param string $filename

- * The path to the saved XML document. - *

- * @param int $options [optional]

- * Additional Options. Currently only LIBXML_NOEMPTYTAG is supported. - *

- * @return int the number of bytes written or FALSE if an error occurred. - */ - public function save ($filename, $options = null) {} - - /** - * (PHP 5)
- * Load XML from a string - * @link http://php.net/manual/en/domdocument.loadxml.php - * @param string $source

- * The string containing the XML. - *

- * @param int $options [optional]

- * Bitwise OR - * of the libxml option constants. - *

- * @return mixed TRUE on success or FALSE on failure. If called statically, returns a - * DOMDocument or FALSE on failure. - */ - public function loadXML ($source, $options = 0) {} - - /** - * (PHP 5)
- * Dumps the internal XML tree back into a string - * @link http://php.net/manual/en/domdocument.savexml.php - * @param DOMNode $node [optional]

- * Use this parameter to output only a specific node without XML declaration - * rather than the entire document. - *

- * @param int $options [optional]

- * Additional Options. Currently only LIBXML_NOEMPTYTAG is supported. - *

- * @return string the XML, or FALSE if an error occurred. - */ - public function saveXML (DOMNode $node = null, $options = null) {} - - /** - * (PHP 5)
- * Creates a new DOMDocument object - * @link http://php.net/manual/en/domdocument.construct.php - * @param string $version [optional]

- * The version number of the document as part of the XML declaration. - *

- * @param string $encoding [optional]

- * The encoding of the document as part of the XML declaration. - *

- */ - public function __construct ($version = null, $encoding = null) {} - - /** - * (PHP 5)
- * Validates the document based on its DTD - * @link http://php.net/manual/en/domdocument.validate.php - * @return bool TRUE on success or FALSE on failure. - * If the document have no DTD attached, this method will return FALSE. - */ - public function validate () {} - - /** - * (PHP 5)
- * Substitutes XIncludes in a DOMDocument Object - * @link http://php.net/manual/en/domdocument.xinclude.php - * @param int $options [optional]

- * libxml parameters. Available - * since PHP 5.1.0 and Libxml 2.6.7. - *

- * @return int the number of XIncludes in the document, -1 if some processing failed, - * or FALSE if there were no substitutions. - */ - public function xinclude ($options = null) {} - - /** - * (PHP 5)
- * Load HTML from a string - * @link http://php.net/manual/en/domdocument.loadhtml.php - * @param string $source

- * The HTML string. - *

- * @return bool TRUE on success or FALSE on failure. If called statically, returns a - * DOMDocument or FALSE on failure. - */ - public function loadHTML ($source) {} - - /** - * (PHP 5)
- * Load HTML from a file - * @link http://php.net/manual/en/domdocument.loadhtmlfile.php - * @param string $filename

- * The path to the HTML file. - *

- * @return bool TRUE on success or FALSE on failure. If called statically, returns a - * DOMDocument or FALSE on failure. - */ - public function loadHTMLFile ($filename) {} - - /** - * (PHP 5)
- * Dumps the internal document into a string using HTML formatting - * @link http://php.net/manual/en/domdocument.savehtml.php - * @param DOMNode $node [optional]

- * Optional parameter to output a subset of the document. - *

- * @return string the HTML, or FALSE if an error occurred. - */ - public function saveHTML (DOMNode $node = NULL) {} - - /** - * (PHP 5)
- * Dumps the internal document into a file using HTML formatting - * @link http://php.net/manual/en/domdocument.savehtmlfile.php - * @param string $filename

- * The path to the saved HTML document. - *

- * @return int the number of bytes written or FALSE if an error occurred. - */ - public function saveHTMLFile ($filename) {} - - /** - * (PHP 5)
- * Validates a document based on a schema - * @link http://php.net/manual/en/domdocument.schemavalidate.php - * @param string $filename

- * The path to the schema. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function schemaValidate ($filename) {} - - /** - * (PHP 5)
- * Validates a document based on a schema - * @link http://php.net/manual/en/domdocument.schemavalidatesource.php - * @param string $source

- * A string containing the schema. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function schemaValidateSource ($source) {} - - /** - * (PHP 5)
- * Performs relaxNG validation on the document - * @link http://php.net/manual/en/domdocument.relaxngvalidate.php - * @param string $filename

- * The RNG file. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function relaxNGValidate ($filename) {} - - /** - * (PHP 5)
- * Performs relaxNG validation on the document - * @link http://php.net/manual/en/domdocument.relaxngvalidatesource.php - * @param string $source

- * A string containing the RNG schema. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function relaxNGValidateSource ($source) {} - - /** - * (PHP 5 >= 5.2.0)
- * Register extended class used to create base node type - * @link http://php.net/manual/en/domdocument.registernodeclass.php - * @param string $baseclass

- * The DOM class that you want to extend. You can find a list of these - * classes in the chapter introduction. - *

- * @param string $extendedclass

- * Your extended class name. If NULL is provided, any previously - * registered class extending baseclass will - * be removed. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function registerNodeClass ($baseclass, $extendedclass) {} - - /** - * (PHP 5)
- * Adds a new child before a reference node - * @link http://php.net/manual/en/domnode.insertbefore.php - * @param DOMNode $newnode

- * The new node. - *

- * @param DOMNode $refnode [optional]

- * The reference node. If not supplied, newnode is - * appended to the children. - *

- * @return DOMNode The inserted node. - */ - public function insertBefore (DOMNode $newnode, DOMNode $refnode = null) {} - - /** - * (PHP 5)
- * Replaces a child - * @link http://php.net/manual/en/domnode.replacechild.php - * @param DOMNode $newnode

- * The new node. It must be a member of the target document, i.e. - * created by one of the DOMDocument->createXXX() methods or imported in - * the document by . - *

- * @param DOMNode $oldnode

- * The old node. - *

- * @return DOMNode The old node or FALSE if an error occur. - */ - public function replaceChild (DOMNode $newnode, DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Removes child from list of children - * @link http://php.net/manual/en/domnode.removechild.php - * @param DOMNode $oldnode

- * The removed child. - *

- * @return DOMNode If the child could be removed the function returns the old child. - */ - public function removeChild (DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Adds new child at the end of the children - * @link http://php.net/manual/en/domnode.appendchild.php - * @param DOMNode $newnode

- * The appended child. - *

- * @return DOMNode The node added. - */ - public function appendChild (DOMNode $newnode) {} - - /** - * (PHP 5)
- * Checks if node has children - * @link http://php.net/manual/en/domnode.haschildnodes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasChildNodes () {} - - /** - * (PHP 5)
- * Clones a node - * @link http://php.net/manual/en/domnode.clonenode.php - * @param bool $deep [optional]

- * Indicates whether to copy all descendant nodes. This parameter is - * defaulted to FALSE. - *

- * @return DOMNode The cloned node. - */ - public function cloneNode ($deep = null) {} - - /** - * (PHP 5)
- * Normalizes the node - * @link http://php.net/manual/en/domnode.normalize.php - * @return void No value is returned. - */ - public function normalize () {} - - /** - * (PHP 5)
- * Checks if feature is supported for specified version - * @link http://php.net/manual/en/domnode.issupported.php - * @param string $feature

- * The feature to test. See the example of - * DOMImplementation::hasFeature for a - * list of features. - *

- * @param string $version

- * The version number of the feature to test. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSupported ($feature, $version) {} - - /** - * (PHP 5)
- * Checks if node has attributes - * @link http://php.net/manual/en/domnode.hasattributes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasAttributes () {} - - /** - * @param DOMNode $other - */ - public function compareDocumentPosition (DOMNode $other) {} - - /** - * (PHP 5)
- * Indicates if two nodes are the same node - * @link http://php.net/manual/en/domnode.issamenode.php - * @param DOMNode $node

- * The compared node. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSameNode (DOMNode $node) {} - - /** - * (PHP 5)
- * Gets the namespace prefix of the node based on the namespace URI - * @link http://php.net/manual/en/domnode.lookupprefix.php - * @param string $namespaceURI

- * The namespace URI. - *

- * @return string The prefix of the namespace. - */ - public function lookupPrefix ($namespaceURI) {} - - /** - * (PHP 5)
- * Checks if the specified namespaceURI is the default namespace or not - * @link http://php.net/manual/en/domnode.isdefaultnamespace.php - * @param string $namespaceURI

- * The namespace URI to look for. - *

- * @return bool Return TRUE if namespaceURI is the default - * namespace, FALSE otherwise. - */ - public function isDefaultNamespace ($namespaceURI) {} - - /** - * (PHP 5)
- * Gets the namespace URI of the node based on the prefix - * @link http://php.net/manual/en/domnode.lookupnamespaceuri.php - * @param string $prefix

- * The prefix of the namespace. - *

- * @return string The namespace URI of the node. - */ - public function lookupNamespaceUri ($prefix) {} - - /** - * @param DOMNode $arg - */ - public function isEqualNode (DOMNode $arg) {} - - /** - * @param $feature - * @param $version - */ - public function getFeature ($feature, $version) {} - - /** - * @param $key - * @param $data - * @param $handler - */ - public function setUserData ($key, $data, $handler) {} - - /** - * @param $key - */ - public function getUserData ($key) {} - - /** - * (PHP 5 >= 5.2.0)
- * Get an XPath for a node - * @link http://php.net/manual/en/domnode.getnodepath.php - * @return string a string containing the XPath, or NULL in case of an error. - */ - public function getNodePath () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get line number for a node - * @link http://php.net/manual/en/domnode.getlineno.php - * @return int Always returns the line number where the node was defined in. - */ - public function getLineNo () {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a string - * @link http://php.net/manual/en/domnode.c14n.php - * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return string canonicalized nodes as a string or FALSE on failure - */ - public function C14N ($exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a file - * @link http://php.net/manual/en/domnode.c14nfile.php - * @param string $uri

- * Path to write the output to. - *

- * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return int Number of bytes written or FALSE on failure - */ - public function C14NFile ($uri, $exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - -} - -/** - * @link http://php.net/manual/en/class.domnodelist.php - */ -class DOMNodeList implements Traversable { - /** - *

- * The number of nodes in the list. The range of valid child node - * indices is 0 to length - 1 inclusive. - *

- * @var int - */ - public $length; - - - /** - * (PHP 5)
- * Retrieves a node specified by index - * @link http://php.net/manual/en/domnodelist.item.php - * @param int $index

- * Index of the node into the collection. - *

- * @return DOMNode The node at the indexth position in the - * DOMNodeList, or NULL if that is not a valid - * index. - */ - public function item ($index) {} - -} - -/** - * @link http://php.net/manual/en/class.domnamednodemap.php - */ -class DOMNamedNodeMap implements Traversable { - /** - *

- * The number of nodes in the map. The range of valid child node - * indices is 0 to length - 1 inclusive. - *

- * @var int - */ - public $length; - - - /** - * (PHP 5)
- * Retrieves a node specified by name - * @link http://php.net/manual/en/domnamednodemap.getnameditem.php - * @param string $name

- * The nodeName of the node to retrieve. - *

- * @return DOMNode A node (of any type) with the specified nodeName, or - * NULL if no node is found. - */ - public function getNamedItem ($name) {} - - /** - * @param DOMNode $arg - */ - public function setNamedItem (DOMNode $arg) {} - - /** - * @param $name [optional] - */ - public function removeNamedItem ($name) {} - - /** - * (PHP 5)
- * Retrieves a node specified by index - * @link http://php.net/manual/en/domnamednodemap.item.php - * @param int $index

- * Index into this map. - *

- * @return DOMNode The node at the indexth position in the map, or NULL - * if that is not a valid index (greater than or equal to the number of nodes - * in this map). - */ - public function item ($index) {} - - /** - * (PHP 5)
- * Retrieves a node specified by local name and namespace URI - * @link http://php.net/manual/en/domnamednodemap.getnameditemns.php - * @param string $namespaceURI

- * The namespace URI of the node to retrieve. - *

- * @param string $localName

- * The local name of the node to retrieve. - *

- * @return DOMNode A node (of any type) with the specified local name and namespace URI, or - * NULL if no node is found. - */ - public function getNamedItemNS ($namespaceURI, $localName) {} - - /** - * @param DOMNode $arg [optional] - */ - public function setNamedItemNS (DOMNode $arg) {} - - /** - * @param $namespaceURI [optional] - * @param $localName [optional] - */ - public function removeNamedItemNS ($namespaceURI, $localName) {} - -} - -/** - * Represents nodes with character data. No nodes directly correspond to - * this class, but other nodes do inherit from it. - * @link http://php.net/manual/en/class.domcharacterdata.php - */ -class DOMCharacterData extends DOMNode { - /** - *

The contents of the node.

- * @var string - */ - public $data; - /** - *

The length of the contents.

- * @var int - */ - public $length; - - - /** - * (PHP 5)
- * Extracts a range of data from the node - * @link http://php.net/manual/en/domcharacterdata.substringdata.php - * @param int $offset

- * Start offset of substring to extract. - *

- * @param int $count

- * The number of characters to extract. - *

- * @return string The specified substring. If the sum of offset - * and count exceeds the length, then all 16-bit units - * to the end of the data are returned. - */ - public function substringData ($offset, $count) {} - - /** - * (PHP 5)
- * Append the string to the end of the character data of the node - * @link http://php.net/manual/en/domcharacterdata.appenddata.php - * @param string $data

- * The string to append. - *

- * @return void No value is returned. - */ - public function appendData ($data) {} - - /** - * (PHP 5)
- * Insert a string at the specified 16-bit unit offset - * @link http://php.net/manual/en/domcharacterdata.insertdata.php - * @param int $offset

- * The character offset at which to insert. - *

- * @param string $data

- * The string to insert. - *

- * @return void No value is returned. - */ - public function insertData ($offset, $data) {} - - /** - * (PHP 5)
- * Remove a range of characters from the node - * @link http://php.net/manual/en/domcharacterdata.deletedata.php - * @param int $offset

- * The offset from which to start removing. - *

- * @param int $count

- * The number of characters to delete. If the sum of - * offset and count exceeds - * the length, then all characters to the end of the data are deleted. - *

- * @return void No value is returned. - */ - public function deleteData ($offset, $count) {} - - /** - * (PHP 5)
- * Replace a substring within the DOMCharacterData node - * @link http://php.net/manual/en/domcharacterdata.replacedata.php - * @param int $offset

- * The offset from which to start replacing. - *

- * @param int $count

- * The number of characters to replace. If the sum of - * offset and count exceeds - * the length, then all characters to the end of the data are replaced. - *

- * @param string $data

- * The string with which the range must be replaced. - *

- * @return void No value is returned. - */ - public function replaceData ($offset, $count, $data) {} - - /** - * (PHP 5)
- * Adds a new child before a reference node - * @link http://php.net/manual/en/domnode.insertbefore.php - * @param DOMNode $newnode

- * The new node. - *

- * @param DOMNode $refnode [optional]

- * The reference node. If not supplied, newnode is - * appended to the children. - *

- * @return DOMNode The inserted node. - */ - public function insertBefore (DOMNode $newnode, DOMNode $refnode = null) {} - - /** - * (PHP 5)
- * Replaces a child - * @link http://php.net/manual/en/domnode.replacechild.php - * @param DOMNode $newnode

- * The new node. It must be a member of the target document, i.e. - * created by one of the DOMDocument->createXXX() methods or imported in - * the document by . - *

- * @param DOMNode $oldnode

- * The old node. - *

- * @return DOMNode The old node or FALSE if an error occur. - */ - public function replaceChild (DOMNode $newnode, DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Removes child from list of children - * @link http://php.net/manual/en/domnode.removechild.php - * @param DOMNode $oldnode

- * The removed child. - *

- * @return DOMNode If the child could be removed the function returns the old child. - */ - public function removeChild (DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Adds new child at the end of the children - * @link http://php.net/manual/en/domnode.appendchild.php - * @param DOMNode $newnode

- * The appended child. - *

- * @return DOMNode The node added. - */ - public function appendChild (DOMNode $newnode) {} - - /** - * (PHP 5)
- * Checks if node has children - * @link http://php.net/manual/en/domnode.haschildnodes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasChildNodes () {} - - /** - * (PHP 5)
- * Clones a node - * @link http://php.net/manual/en/domnode.clonenode.php - * @param bool $deep [optional]

- * Indicates whether to copy all descendant nodes. This parameter is - * defaulted to FALSE. - *

- * @return DOMNode The cloned node. - */ - public function cloneNode ($deep = null) {} - - /** - * (PHP 5)
- * Normalizes the node - * @link http://php.net/manual/en/domnode.normalize.php - * @return void No value is returned. - */ - public function normalize () {} - - /** - * (PHP 5)
- * Checks if feature is supported for specified version - * @link http://php.net/manual/en/domnode.issupported.php - * @param string $feature

- * The feature to test. See the example of - * DOMImplementation::hasFeature for a - * list of features. - *

- * @param string $version

- * The version number of the feature to test. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSupported ($feature, $version) {} - - /** - * (PHP 5)
- * Checks if node has attributes - * @link http://php.net/manual/en/domnode.hasattributes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasAttributes () {} - - /** - * @param DOMNode $other - */ - public function compareDocumentPosition (DOMNode $other) {} - - /** - * (PHP 5)
- * Indicates if two nodes are the same node - * @link http://php.net/manual/en/domnode.issamenode.php - * @param DOMNode $node

- * The compared node. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSameNode (DOMNode $node) {} - - /** - * (PHP 5)
- * Gets the namespace prefix of the node based on the namespace URI - * @link http://php.net/manual/en/domnode.lookupprefix.php - * @param string $namespaceURI

- * The namespace URI. - *

- * @return string The prefix of the namespace. - */ - public function lookupPrefix ($namespaceURI) {} - - /** - * (PHP 5)
- * Checks if the specified namespaceURI is the default namespace or not - * @link http://php.net/manual/en/domnode.isdefaultnamespace.php - * @param string $namespaceURI

- * The namespace URI to look for. - *

- * @return bool Return TRUE if namespaceURI is the default - * namespace, FALSE otherwise. - */ - public function isDefaultNamespace ($namespaceURI) {} - - /** - * (PHP 5)
- * Gets the namespace URI of the node based on the prefix - * @link http://php.net/manual/en/domnode.lookupnamespaceuri.php - * @param string $prefix

- * The prefix of the namespace. - *

- * @return string The namespace URI of the node. - */ - public function lookupNamespaceUri ($prefix) {} - - /** - * @param DOMNode $arg - */ - public function isEqualNode (DOMNode $arg) {} - - /** - * @param $feature - * @param $version - */ - public function getFeature ($feature, $version) {} - - /** - * @param $key - * @param $data - * @param $handler - */ - public function setUserData ($key, $data, $handler) {} - - /** - * @param $key - */ - public function getUserData ($key) {} - - /** - * (PHP 5 >= 5.2.0)
- * Get an XPath for a node - * @link http://php.net/manual/en/domnode.getnodepath.php - * @return string a string containing the XPath, or NULL in case of an error. - */ - public function getNodePath () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get line number for a node - * @link http://php.net/manual/en/domnode.getlineno.php - * @return int Always returns the line number where the node was defined in. - */ - public function getLineNo () {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a string - * @link http://php.net/manual/en/domnode.c14n.php - * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return string canonicalized nodes as a string or FALSE on failure - */ - public function C14N ($exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a file - * @link http://php.net/manual/en/domnode.c14nfile.php - * @param string $uri

- * Path to write the output to. - *

- * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return int Number of bytes written or FALSE on failure - */ - public function C14NFile ($uri, $exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - -} - -/** - * DOMAttr represents an attribute in the - * DOMElement object. - * @link http://php.net/manual/en/class.domattr.php - */ -class DOMAttr extends DOMNode { - /** - *

The name of the attribute

- * @var string - */ - public $name; - /** - *

The element which contains the attribute

- * @var DOMElement - */ - public $ownerElement; - /** - *

Not implemented yet, always is NULL

- * @var bool - */ - public $schemaTypeInfo; - /** - *

Not implemented yet, always is NULL

- * @var bool - */ - public $specified; - /** - *

The value of the attribute

- * @var string - */ - public $value; - - - /** - * (PHP 5)
- * Checks if attribute is a defined ID - * @link http://php.net/manual/en/domattr.isid.php - * @return bool TRUE on success or FALSE on failure. - */ - public function isId () {} - - /** - * (PHP 5)
- * Creates a new DOMAttr object - * @link http://php.net/manual/en/domattr.construct.php - * @param string $name

- * The tag name of the attribute. - *

- * @param string $value [optional]

- * The value of the attribute. - *

- */ - public function __construct ($name, $value = null) {} - - /** - * (PHP 5)
- * Adds a new child before a reference node - * @link http://php.net/manual/en/domnode.insertbefore.php - * @param DOMNode $newnode

- * The new node. - *

- * @param DOMNode $refnode [optional]

- * The reference node. If not supplied, newnode is - * appended to the children. - *

- * @return DOMNode The inserted node. - */ - public function insertBefore (DOMNode $newnode, DOMNode $refnode = null) {} - - /** - * (PHP 5)
- * Replaces a child - * @link http://php.net/manual/en/domnode.replacechild.php - * @param DOMNode $newnode

- * The new node. It must be a member of the target document, i.e. - * created by one of the DOMDocument->createXXX() methods or imported in - * the document by . - *

- * @param DOMNode $oldnode

- * The old node. - *

- * @return DOMNode The old node or FALSE if an error occur. - */ - public function replaceChild (DOMNode $newnode, DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Removes child from list of children - * @link http://php.net/manual/en/domnode.removechild.php - * @param DOMNode $oldnode

- * The removed child. - *

- * @return DOMNode If the child could be removed the function returns the old child. - */ - public function removeChild (DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Adds new child at the end of the children - * @link http://php.net/manual/en/domnode.appendchild.php - * @param DOMNode $newnode

- * The appended child. - *

- * @return DOMNode The node added. - */ - public function appendChild (DOMNode $newnode) {} - - /** - * (PHP 5)
- * Checks if node has children - * @link http://php.net/manual/en/domnode.haschildnodes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasChildNodes () {} - - /** - * (PHP 5)
- * Clones a node - * @link http://php.net/manual/en/domnode.clonenode.php - * @param bool $deep [optional]

- * Indicates whether to copy all descendant nodes. This parameter is - * defaulted to FALSE. - *

- * @return DOMNode The cloned node. - */ - public function cloneNode ($deep = null) {} - - /** - * (PHP 5)
- * Normalizes the node - * @link http://php.net/manual/en/domnode.normalize.php - * @return void No value is returned. - */ - public function normalize () {} - - /** - * (PHP 5)
- * Checks if feature is supported for specified version - * @link http://php.net/manual/en/domnode.issupported.php - * @param string $feature

- * The feature to test. See the example of - * DOMImplementation::hasFeature for a - * list of features. - *

- * @param string $version

- * The version number of the feature to test. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSupported ($feature, $version) {} - - /** - * (PHP 5)
- * Checks if node has attributes - * @link http://php.net/manual/en/domnode.hasattributes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasAttributes () {} - - /** - * @param DOMNode $other - */ - public function compareDocumentPosition (DOMNode $other) {} - - /** - * (PHP 5)
- * Indicates if two nodes are the same node - * @link http://php.net/manual/en/domnode.issamenode.php - * @param DOMNode $node

- * The compared node. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSameNode (DOMNode $node) {} - - /** - * (PHP 5)
- * Gets the namespace prefix of the node based on the namespace URI - * @link http://php.net/manual/en/domnode.lookupprefix.php - * @param string $namespaceURI

- * The namespace URI. - *

- * @return string The prefix of the namespace. - */ - public function lookupPrefix ($namespaceURI) {} - - /** - * (PHP 5)
- * Checks if the specified namespaceURI is the default namespace or not - * @link http://php.net/manual/en/domnode.isdefaultnamespace.php - * @param string $namespaceURI

- * The namespace URI to look for. - *

- * @return bool Return TRUE if namespaceURI is the default - * namespace, FALSE otherwise. - */ - public function isDefaultNamespace ($namespaceURI) {} - - /** - * (PHP 5)
- * Gets the namespace URI of the node based on the prefix - * @link http://php.net/manual/en/domnode.lookupnamespaceuri.php - * @param string $prefix

- * The prefix of the namespace. - *

- * @return string The namespace URI of the node. - */ - public function lookupNamespaceUri ($prefix) {} - - /** - * @param DOMNode $arg - */ - public function isEqualNode (DOMNode $arg) {} - - /** - * @param $feature - * @param $version - */ - public function getFeature ($feature, $version) {} - - /** - * @param $key - * @param $data - * @param $handler - */ - public function setUserData ($key, $data, $handler) {} - - /** - * @param $key - */ - public function getUserData ($key) {} - - /** - * (PHP 5 >= 5.2.0)
- * Get an XPath for a node - * @link http://php.net/manual/en/domnode.getnodepath.php - * @return string a string containing the XPath, or NULL in case of an error. - */ - public function getNodePath () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get line number for a node - * @link http://php.net/manual/en/domnode.getlineno.php - * @return int Always returns the line number where the node was defined in. - */ - public function getLineNo () {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a string - * @link http://php.net/manual/en/domnode.c14n.php - * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return string canonicalized nodes as a string or FALSE on failure - */ - public function C14N ($exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a file - * @link http://php.net/manual/en/domnode.c14nfile.php - * @param string $uri

- * Path to write the output to. - *

- * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return int Number of bytes written or FALSE on failure - */ - public function C14NFile ($uri, $exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - -} - -/** - * @link http://php.net/manual/en/class.domelement.php - */ -class DOMElement extends DOMNode { - /** - *

Not implemented yet, always return NULL

- * @var bool - */ - public $schemaTypeInfo; - /** - *

The element name

- * @var string - */ - public $tagName; - - - /** - * (PHP 5)
- * Returns value of attribute - * @link http://php.net/manual/en/domelement.getattribute.php - * @param string $name

- * The name of the attribute. - *

- * @return string The value of the attribute, or an empty string if no attribute with the - * given name is found. - */ - public function getAttribute ($name) {} - - /** - * (PHP 5)
- * Adds new attribute - * @link http://php.net/manual/en/domelement.setattribute.php - * @param string $name

- * The name of the attribute. - *

- * @param string $value

- * The value of the attribute. - *

- * @return DOMAttr The new DOMAttr or FALSE if an error occured. - */ - public function setAttribute ($name, $value) {} - - /** - * (PHP 5)
- * Removes attribute - * @link http://php.net/manual/en/domelement.removeattribute.php - * @param string $name

- * The name of the attribute. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function removeAttribute ($name) {} - - /** - * (PHP 5)
- * Returns attribute node - * @link http://php.net/manual/en/domelement.getattributenode.php - * @param string $name

- * The name of the attribute. - *

- * @return DOMAttr The attribute node. - */ - public function getAttributeNode ($name) {} - - /** - * (PHP 5)
- * Adds new attribute node to element - * @link http://php.net/manual/en/domelement.setattributenode.php - * @param DOMAttr $attr

- * The attribute node. - *

- * @return DOMAttr old node if the attribute has been replaced or NULL. - */ - public function setAttributeNode (DOMAttr $attr) {} - - /** - * (PHP 5)
- * Removes attribute - * @link http://php.net/manual/en/domelement.removeattributenode.php - * @param DOMAttr $oldnode

- * The attribute node. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function removeAttributeNode (DOMAttr $oldnode) {} - - /** - * (PHP 5)
- * Gets elements by tagname - * @link http://php.net/manual/en/domelement.getelementsbytagname.php - * @param string $name

- * The tag name. Use * to return all elements within - * the element tree. - *

- * @return DOMNodeList This function returns a new instance of the class - * DOMNodeList of all matched elements. - */ - public function getElementsByTagName ($name) {} - - /** - * (PHP 5)
- * Returns value of attribute - * @link http://php.net/manual/en/domelement.getattributens.php - * @param string $namespaceURI

- * The namespace URI. - *

- * @param string $localName

- * The local name. - *

- * @return string The value of the attribute, or an empty string if no attribute with the - * given localName and namespaceURI - * is found. - */ - public function getAttributeNS ($namespaceURI, $localName) {} - - /** - * (PHP 5)
- * Adds new attribute - * @link http://php.net/manual/en/domelement.setattributens.php - * @param string $namespaceURI

- * The namespace URI. - *

- * @param string $qualifiedName

- * The qualified name of the attribute, as prefix:tagname. - *

- * @param string $value

- * The value of the attribute. - *

- * @return void No value is returned. - */ - public function setAttributeNS ($namespaceURI, $qualifiedName, $value) {} - - /** - * (PHP 5)
- * Removes attribute - * @link http://php.net/manual/en/domelement.removeattributens.php - * @param string $namespaceURI

- * The namespace URI. - *

- * @param string $localName

- * The local name. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function removeAttributeNS ($namespaceURI, $localName) {} - - /** - * (PHP 5)
- * Returns attribute node - * @link http://php.net/manual/en/domelement.getattributenodens.php - * @param string $namespaceURI

- * The namespace URI. - *

- * @param string $localName

- * The local name. - *

- * @return DOMAttr The attribute node. - */ - public function getAttributeNodeNS ($namespaceURI, $localName) {} - - /** - * (PHP 5)
- * Adds new attribute node to element - * @link http://php.net/manual/en/domelement.setattributenodens.php - * @param DOMAttr $attr

- * The attribute node. - *

- * @return DOMAttr the old node if the attribute has been replaced. - */ - public function setAttributeNodeNS (DOMAttr $attr) {} - - /** - * (PHP 5)
- * Get elements by namespaceURI and localName - * @link http://php.net/manual/en/domelement.getelementsbytagnamens.php - * @param string $namespaceURI

- * The namespace URI. - *

- * @param string $localName

- * The local name. Use * to return all elements within - * the element tree. - *

- * @return DOMNodeList This function returns a new instance of the class - * DOMNodeList of all matched elements in the order in - * which they are encountered in a preorder traversal of this element tree. - */ - public function getElementsByTagNameNS ($namespaceURI, $localName) {} - - /** - * (PHP 5)
- * Checks to see if attribute exists - * @link http://php.net/manual/en/domelement.hasattribute.php - * @param string $name

- * The attribute name. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function hasAttribute ($name) {} - - /** - * (PHP 5)
- * Checks to see if attribute exists - * @link http://php.net/manual/en/domelement.hasattributens.php - * @param string $namespaceURI

- * The namespace URI. - *

- * @param string $localName

- * The local name. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function hasAttributeNS ($namespaceURI, $localName) {} - - /** - * (PHP 5)
- * Declares the attribute specified by name to be of type ID - * @link http://php.net/manual/en/domelement.setidattribute.php - * @param string $name

- * The name of the attribute. - *

- * @param bool $isId

- * Set it to TRUE if you want name to be of type - * ID, FALSE otherwise. - *

- * @return void No value is returned. - */ - public function setIdAttribute ($name, $isId) {} - - /** - * (PHP 5)
- * Declares the attribute specified by local name and namespace URI to be of type ID - * @link http://php.net/manual/en/domelement.setidattributens.php - * @param string $namespaceURI

- * The namespace URI of the attribute. - *

- * @param string $localName

- * The local name of the attribute, as prefix:tagname. - *

- * @param bool $isId

- * Set it to TRUE if you want name to be of type - * ID, FALSE otherwise. - *

- * @return void No value is returned. - */ - public function setIdAttributeNS ($namespaceURI, $localName, $isId) {} - - /** - * (PHP 5)
- * Declares the attribute specified by node to be of type ID - * @link http://php.net/manual/en/domelement.setidattributenode.php - * @param DOMAttr $attr

- * The attribute node. - *

- * @param bool $isId

- * Set it to TRUE if you want name to be of type - * ID, FALSE otherwise. - *

- * @return void No value is returned. - */ - public function setIdAttributeNode (DOMAttr $attr, $isId) {} - - /** - * (PHP 5)
- * Creates a new DOMElement object - * @link http://php.net/manual/en/domelement.construct.php - * @param string $name

- * The tag name of the element. When also passing in namespaceURI, the element name - * may take a prefix to be associated with the URI. - *

- * @param string $value [optional]

- * The value of the element. - *

- * @param string $namespaceURI [optional]

- * A namespace URI to create the element within a specific namespace. - *

- */ - public function __construct ($name, $value = null, $namespaceURI = null) {} - - /** - * (PHP 5)
- * Adds a new child before a reference node - * @link http://php.net/manual/en/domnode.insertbefore.php - * @param DOMNode $newnode

- * The new node. - *

- * @param DOMNode $refnode [optional]

- * The reference node. If not supplied, newnode is - * appended to the children. - *

- * @return DOMNode The inserted node. - */ - public function insertBefore (DOMNode $newnode, DOMNode $refnode = null) {} - - /** - * (PHP 5)
- * Replaces a child - * @link http://php.net/manual/en/domnode.replacechild.php - * @param DOMNode $newnode

- * The new node. It must be a member of the target document, i.e. - * created by one of the DOMDocument->createXXX() methods or imported in - * the document by . - *

- * @param DOMNode $oldnode

- * The old node. - *

- * @return DOMNode The old node or FALSE if an error occur. - */ - public function replaceChild (DOMNode $newnode, DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Removes child from list of children - * @link http://php.net/manual/en/domnode.removechild.php - * @param DOMNode $oldnode

- * The removed child. - *

- * @return DOMNode If the child could be removed the function returns the old child. - */ - public function removeChild (DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Adds new child at the end of the children - * @link http://php.net/manual/en/domnode.appendchild.php - * @param DOMNode $newnode

- * The appended child. - *

- * @return DOMNode The node added. - */ - public function appendChild (DOMNode $newnode) {} - - /** - * (PHP 5)
- * Checks if node has children - * @link http://php.net/manual/en/domnode.haschildnodes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasChildNodes () {} - - /** - * (PHP 5)
- * Clones a node - * @link http://php.net/manual/en/domnode.clonenode.php - * @param bool $deep [optional]

- * Indicates whether to copy all descendant nodes. This parameter is - * defaulted to FALSE. - *

- * @return DOMNode The cloned node. - */ - public function cloneNode ($deep = null) {} - - /** - * (PHP 5)
- * Normalizes the node - * @link http://php.net/manual/en/domnode.normalize.php - * @return void No value is returned. - */ - public function normalize () {} - - /** - * (PHP 5)
- * Checks if feature is supported for specified version - * @link http://php.net/manual/en/domnode.issupported.php - * @param string $feature

- * The feature to test. See the example of - * DOMImplementation::hasFeature for a - * list of features. - *

- * @param string $version

- * The version number of the feature to test. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSupported ($feature, $version) {} - - /** - * (PHP 5)
- * Checks if node has attributes - * @link http://php.net/manual/en/domnode.hasattributes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasAttributes () {} - - /** - * @param DOMNode $other - */ - public function compareDocumentPosition (DOMNode $other) {} - - /** - * (PHP 5)
- * Indicates if two nodes are the same node - * @link http://php.net/manual/en/domnode.issamenode.php - * @param DOMNode $node

- * The compared node. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSameNode (DOMNode $node) {} - - /** - * (PHP 5)
- * Gets the namespace prefix of the node based on the namespace URI - * @link http://php.net/manual/en/domnode.lookupprefix.php - * @param string $namespaceURI

- * The namespace URI. - *

- * @return string The prefix of the namespace. - */ - public function lookupPrefix ($namespaceURI) {} - - /** - * (PHP 5)
- * Checks if the specified namespaceURI is the default namespace or not - * @link http://php.net/manual/en/domnode.isdefaultnamespace.php - * @param string $namespaceURI

- * The namespace URI to look for. - *

- * @return bool Return TRUE if namespaceURI is the default - * namespace, FALSE otherwise. - */ - public function isDefaultNamespace ($namespaceURI) {} - - /** - * (PHP 5)
- * Gets the namespace URI of the node based on the prefix - * @link http://php.net/manual/en/domnode.lookupnamespaceuri.php - * @param string $prefix

- * The prefix of the namespace. - *

- * @return string The namespace URI of the node. - */ - public function lookupNamespaceUri ($prefix) {} - - /** - * @param DOMNode $arg - */ - public function isEqualNode (DOMNode $arg) {} - - /** - * @param $feature - * @param $version - */ - public function getFeature ($feature, $version) {} - - /** - * @param $key - * @param $data - * @param $handler - */ - public function setUserData ($key, $data, $handler) {} - - /** - * @param $key - */ - public function getUserData ($key) {} - - /** - * (PHP 5 >= 5.2.0)
- * Get an XPath for a node - * @link http://php.net/manual/en/domnode.getnodepath.php - * @return string a string containing the XPath, or NULL in case of an error. - */ - public function getNodePath () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get line number for a node - * @link http://php.net/manual/en/domnode.getlineno.php - * @return int Always returns the line number where the node was defined in. - */ - public function getLineNo () {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a string - * @link http://php.net/manual/en/domnode.c14n.php - * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return string canonicalized nodes as a string or FALSE on failure - */ - public function C14N ($exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a file - * @link http://php.net/manual/en/domnode.c14nfile.php - * @param string $uri

- * Path to write the output to. - *

- * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return int Number of bytes written or FALSE on failure - */ - public function C14NFile ($uri, $exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - -} - -/** - * The DOMText class inherits from - * DOMCharacterData and represents the textual - * content of a DOMElement or - * DOMAttr. - * @link http://php.net/manual/en/class.domtext.php - */ -class DOMText extends DOMCharacterData { - /** - *

- * Holds all the text of logically-adjacent (not separated by Element, - * Comment or Processing Instruction) Text nodes. - *

- * @var string - */ - public $wholeText; - - - /** - * (PHP 5)
- * Breaks this node into two nodes at the specified offset - * @link http://php.net/manual/en/domtext.splittext.php - * @param int $offset

- * The offset at which to split, starting from 0. - *

- * @return DOMText The new node of the same type, which contains all the content at and after the - * offset. - */ - public function splitText ($offset) {} - - /** - * (PHP 5)
- * Indicates whether this text node contains whitespace - * @link http://php.net/manual/en/domtext.iswhitespaceinelementcontent.php - * @return bool TRUE on success or FALSE on failure. - */ - public function isWhitespaceInElementContent () {} - - public function isElementContentWhitespace () {} - - /** - * @param $content - */ - public function replaceWholeText ($content) {} - - /** - * (PHP 5)
- * Creates a new DOMText object - * @link http://php.net/manual/en/domtext.construct.php - * @param $value [optional] - */ - public function __construct ($value) {} - - /** - * (PHP 5)
- * Extracts a range of data from the node - * @link http://php.net/manual/en/domcharacterdata.substringdata.php - * @param int $offset

- * Start offset of substring to extract. - *

- * @param int $count

- * The number of characters to extract. - *

- * @return string The specified substring. If the sum of offset - * and count exceeds the length, then all 16-bit units - * to the end of the data are returned. - */ - public function substringData ($offset, $count) {} - - /** - * (PHP 5)
- * Append the string to the end of the character data of the node - * @link http://php.net/manual/en/domcharacterdata.appenddata.php - * @param string $data

- * The string to append. - *

- * @return void No value is returned. - */ - public function appendData ($data) {} - - /** - * (PHP 5)
- * Insert a string at the specified 16-bit unit offset - * @link http://php.net/manual/en/domcharacterdata.insertdata.php - * @param int $offset

- * The character offset at which to insert. - *

- * @param string $data

- * The string to insert. - *

- * @return void No value is returned. - */ - public function insertData ($offset, $data) {} - - /** - * (PHP 5)
- * Remove a range of characters from the node - * @link http://php.net/manual/en/domcharacterdata.deletedata.php - * @param int $offset

- * The offset from which to start removing. - *

- * @param int $count

- * The number of characters to delete. If the sum of - * offset and count exceeds - * the length, then all characters to the end of the data are deleted. - *

- * @return void No value is returned. - */ - public function deleteData ($offset, $count) {} - - /** - * (PHP 5)
- * Replace a substring within the DOMCharacterData node - * @link http://php.net/manual/en/domcharacterdata.replacedata.php - * @param int $offset

- * The offset from which to start replacing. - *

- * @param int $count

- * The number of characters to replace. If the sum of - * offset and count exceeds - * the length, then all characters to the end of the data are replaced. - *

- * @param string $data

- * The string with which the range must be replaced. - *

- * @return void No value is returned. - */ - public function replaceData ($offset, $count, $data) {} - - /** - * (PHP 5)
- * Adds a new child before a reference node - * @link http://php.net/manual/en/domnode.insertbefore.php - * @param DOMNode $newnode

- * The new node. - *

- * @param DOMNode $refnode [optional]

- * The reference node. If not supplied, newnode is - * appended to the children. - *

- * @return DOMNode The inserted node. - */ - public function insertBefore (DOMNode $newnode, DOMNode $refnode = null) {} - - /** - * (PHP 5)
- * Replaces a child - * @link http://php.net/manual/en/domnode.replacechild.php - * @param DOMNode $newnode

- * The new node. It must be a member of the target document, i.e. - * created by one of the DOMDocument->createXXX() methods or imported in - * the document by . - *

- * @param DOMNode $oldnode

- * The old node. - *

- * @return DOMNode The old node or FALSE if an error occur. - */ - public function replaceChild (DOMNode $newnode, DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Removes child from list of children - * @link http://php.net/manual/en/domnode.removechild.php - * @param DOMNode $oldnode

- * The removed child. - *

- * @return DOMNode If the child could be removed the function returns the old child. - */ - public function removeChild (DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Adds new child at the end of the children - * @link http://php.net/manual/en/domnode.appendchild.php - * @param DOMNode $newnode

- * The appended child. - *

- * @return DOMNode The node added. - */ - public function appendChild (DOMNode $newnode) {} - - /** - * (PHP 5)
- * Checks if node has children - * @link http://php.net/manual/en/domnode.haschildnodes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasChildNodes () {} - - /** - * (PHP 5)
- * Clones a node - * @link http://php.net/manual/en/domnode.clonenode.php - * @param bool $deep [optional]

- * Indicates whether to copy all descendant nodes. This parameter is - * defaulted to FALSE. - *

- * @return DOMNode The cloned node. - */ - public function cloneNode ($deep = null) {} - - /** - * (PHP 5)
- * Normalizes the node - * @link http://php.net/manual/en/domnode.normalize.php - * @return void No value is returned. - */ - public function normalize () {} - - /** - * (PHP 5)
- * Checks if feature is supported for specified version - * @link http://php.net/manual/en/domnode.issupported.php - * @param string $feature

- * The feature to test. See the example of - * DOMImplementation::hasFeature for a - * list of features. - *

- * @param string $version

- * The version number of the feature to test. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSupported ($feature, $version) {} - - /** - * (PHP 5)
- * Checks if node has attributes - * @link http://php.net/manual/en/domnode.hasattributes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasAttributes () {} - - /** - * @param DOMNode $other - */ - public function compareDocumentPosition (DOMNode $other) {} - - /** - * (PHP 5)
- * Indicates if two nodes are the same node - * @link http://php.net/manual/en/domnode.issamenode.php - * @param DOMNode $node

- * The compared node. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSameNode (DOMNode $node) {} - - /** - * (PHP 5)
- * Gets the namespace prefix of the node based on the namespace URI - * @link http://php.net/manual/en/domnode.lookupprefix.php - * @param string $namespaceURI

- * The namespace URI. - *

- * @return string The prefix of the namespace. - */ - public function lookupPrefix ($namespaceURI) {} - - /** - * (PHP 5)
- * Checks if the specified namespaceURI is the default namespace or not - * @link http://php.net/manual/en/domnode.isdefaultnamespace.php - * @param string $namespaceURI

- * The namespace URI to look for. - *

- * @return bool Return TRUE if namespaceURI is the default - * namespace, FALSE otherwise. - */ - public function isDefaultNamespace ($namespaceURI) {} - - /** - * (PHP 5)
- * Gets the namespace URI of the node based on the prefix - * @link http://php.net/manual/en/domnode.lookupnamespaceuri.php - * @param string $prefix

- * The prefix of the namespace. - *

- * @return string The namespace URI of the node. - */ - public function lookupNamespaceUri ($prefix) {} - - /** - * @param DOMNode $arg - */ - public function isEqualNode (DOMNode $arg) {} - - /** - * @param $feature - * @param $version - */ - public function getFeature ($feature, $version) {} - - /** - * @param $key - * @param $data - * @param $handler - */ - public function setUserData ($key, $data, $handler) {} - - /** - * @param $key - */ - public function getUserData ($key) {} - - /** - * (PHP 5 >= 5.2.0)
- * Get an XPath for a node - * @link http://php.net/manual/en/domnode.getnodepath.php - * @return string a string containing the XPath, or NULL in case of an error. - */ - public function getNodePath () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get line number for a node - * @link http://php.net/manual/en/domnode.getlineno.php - * @return int Always returns the line number where the node was defined in. - */ - public function getLineNo () {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a string - * @link http://php.net/manual/en/domnode.c14n.php - * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return string canonicalized nodes as a string or FALSE on failure - */ - public function C14N ($exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a file - * @link http://php.net/manual/en/domnode.c14nfile.php - * @param string $uri

- * Path to write the output to. - *

- * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return int Number of bytes written or FALSE on failure - */ - public function C14NFile ($uri, $exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - -} - -/** - * Represents comment nodes, characters delimited by <!-- - * and -->. - * @link http://php.net/manual/en/class.domcomment.php - */ -class DOMComment extends DOMCharacterData { - - /** - * (PHP 5)
- * Creates a new DOMComment object - * @link http://php.net/manual/en/domcomment.construct.php - * @param string $value [optional]

- * The value of the comment. - *

- */ - public function __construct ($value = null) {} - - /** - * (PHP 5)
- * Extracts a range of data from the node - * @link http://php.net/manual/en/domcharacterdata.substringdata.php - * @param int $offset

- * Start offset of substring to extract. - *

- * @param int $count

- * The number of characters to extract. - *

- * @return string The specified substring. If the sum of offset - * and count exceeds the length, then all 16-bit units - * to the end of the data are returned. - */ - public function substringData ($offset, $count) {} - - /** - * (PHP 5)
- * Append the string to the end of the character data of the node - * @link http://php.net/manual/en/domcharacterdata.appenddata.php - * @param string $data

- * The string to append. - *

- * @return void No value is returned. - */ - public function appendData ($data) {} - - /** - * (PHP 5)
- * Insert a string at the specified 16-bit unit offset - * @link http://php.net/manual/en/domcharacterdata.insertdata.php - * @param int $offset

- * The character offset at which to insert. - *

- * @param string $data

- * The string to insert. - *

- * @return void No value is returned. - */ - public function insertData ($offset, $data) {} - - /** - * (PHP 5)
- * Remove a range of characters from the node - * @link http://php.net/manual/en/domcharacterdata.deletedata.php - * @param int $offset

- * The offset from which to start removing. - *

- * @param int $count

- * The number of characters to delete. If the sum of - * offset and count exceeds - * the length, then all characters to the end of the data are deleted. - *

- * @return void No value is returned. - */ - public function deleteData ($offset, $count) {} - - /** - * (PHP 5)
- * Replace a substring within the DOMCharacterData node - * @link http://php.net/manual/en/domcharacterdata.replacedata.php - * @param int $offset

- * The offset from which to start replacing. - *

- * @param int $count

- * The number of characters to replace. If the sum of - * offset and count exceeds - * the length, then all characters to the end of the data are replaced. - *

- * @param string $data

- * The string with which the range must be replaced. - *

- * @return void No value is returned. - */ - public function replaceData ($offset, $count, $data) {} - - /** - * (PHP 5)
- * Adds a new child before a reference node - * @link http://php.net/manual/en/domnode.insertbefore.php - * @param DOMNode $newnode

- * The new node. - *

- * @param DOMNode $refnode [optional]

- * The reference node. If not supplied, newnode is - * appended to the children. - *

- * @return DOMNode The inserted node. - */ - public function insertBefore (DOMNode $newnode, DOMNode $refnode = null) {} - - /** - * (PHP 5)
- * Replaces a child - * @link http://php.net/manual/en/domnode.replacechild.php - * @param DOMNode $newnode

- * The new node. It must be a member of the target document, i.e. - * created by one of the DOMDocument->createXXX() methods or imported in - * the document by . - *

- * @param DOMNode $oldnode

- * The old node. - *

- * @return DOMNode The old node or FALSE if an error occur. - */ - public function replaceChild (DOMNode $newnode, DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Removes child from list of children - * @link http://php.net/manual/en/domnode.removechild.php - * @param DOMNode $oldnode

- * The removed child. - *

- * @return DOMNode If the child could be removed the function returns the old child. - */ - public function removeChild (DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Adds new child at the end of the children - * @link http://php.net/manual/en/domnode.appendchild.php - * @param DOMNode $newnode

- * The appended child. - *

- * @return DOMNode The node added. - */ - public function appendChild (DOMNode $newnode) {} - - /** - * (PHP 5)
- * Checks if node has children - * @link http://php.net/manual/en/domnode.haschildnodes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasChildNodes () {} - - /** - * (PHP 5)
- * Clones a node - * @link http://php.net/manual/en/domnode.clonenode.php - * @param bool $deep [optional]

- * Indicates whether to copy all descendant nodes. This parameter is - * defaulted to FALSE. - *

- * @return DOMNode The cloned node. - */ - public function cloneNode ($deep = null) {} - - /** - * (PHP 5)
- * Normalizes the node - * @link http://php.net/manual/en/domnode.normalize.php - * @return void No value is returned. - */ - public function normalize () {} - - /** - * (PHP 5)
- * Checks if feature is supported for specified version - * @link http://php.net/manual/en/domnode.issupported.php - * @param string $feature

- * The feature to test. See the example of - * DOMImplementation::hasFeature for a - * list of features. - *

- * @param string $version

- * The version number of the feature to test. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSupported ($feature, $version) {} - - /** - * (PHP 5)
- * Checks if node has attributes - * @link http://php.net/manual/en/domnode.hasattributes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasAttributes () {} - - /** - * @param DOMNode $other - */ - public function compareDocumentPosition (DOMNode $other) {} - - /** - * (PHP 5)
- * Indicates if two nodes are the same node - * @link http://php.net/manual/en/domnode.issamenode.php - * @param DOMNode $node

- * The compared node. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSameNode (DOMNode $node) {} - - /** - * (PHP 5)
- * Gets the namespace prefix of the node based on the namespace URI - * @link http://php.net/manual/en/domnode.lookupprefix.php - * @param string $namespaceURI

- * The namespace URI. - *

- * @return string The prefix of the namespace. - */ - public function lookupPrefix ($namespaceURI) {} - - /** - * (PHP 5)
- * Checks if the specified namespaceURI is the default namespace or not - * @link http://php.net/manual/en/domnode.isdefaultnamespace.php - * @param string $namespaceURI

- * The namespace URI to look for. - *

- * @return bool Return TRUE if namespaceURI is the default - * namespace, FALSE otherwise. - */ - public function isDefaultNamespace ($namespaceURI) {} - - /** - * (PHP 5)
- * Gets the namespace URI of the node based on the prefix - * @link http://php.net/manual/en/domnode.lookupnamespaceuri.php - * @param string $prefix

- * The prefix of the namespace. - *

- * @return string The namespace URI of the node. - */ - public function lookupNamespaceUri ($prefix) {} - - /** - * @param DOMNode $arg - */ - public function isEqualNode (DOMNode $arg) {} - - /** - * @param $feature - * @param $version - */ - public function getFeature ($feature, $version) {} - - /** - * @param $key - * @param $data - * @param $handler - */ - public function setUserData ($key, $data, $handler) {} - - /** - * @param $key - */ - public function getUserData ($key) {} - - /** - * (PHP 5 >= 5.2.0)
- * Get an XPath for a node - * @link http://php.net/manual/en/domnode.getnodepath.php - * @return string a string containing the XPath, or NULL in case of an error. - */ - public function getNodePath () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get line number for a node - * @link http://php.net/manual/en/domnode.getlineno.php - * @return int Always returns the line number where the node was defined in. - */ - public function getLineNo () {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a string - * @link http://php.net/manual/en/domnode.c14n.php - * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return string canonicalized nodes as a string or FALSE on failure - */ - public function C14N ($exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a file - * @link http://php.net/manual/en/domnode.c14nfile.php - * @param string $uri

- * Path to write the output to. - *

- * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return int Number of bytes written or FALSE on failure - */ - public function C14NFile ($uri, $exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - -} - -class DOMTypeinfo { -} - -class DOMUserDataHandler { - - public function handle () {} - -} - -class DOMDomError { -} - -class DOMErrorHandler { - - /** - * @param DOMError $error - */ - public function handleError (DOMError $error) {} - -} - -class DOMLocator { -} - -class DOMConfiguration { - - /** - * @param $name - * @param $value - */ - public function setParameter ($name, $value) {} - - /** - * @param $name [optional] - */ - public function getParameter ($name) {} - - /** - * @param $name [optional] - * @param $value [optional] - */ - public function canSetParameter ($name, $value) {} - -} - -/** - * The DOMCdataSection inherits from - * DOMText for textural representation - * of CData constructs. - * @link http://php.net/manual/en/class.domcdatasection.php - */ -class DOMCdataSection extends DOMText { - - /** - * (PHP 5)
- * Constructs a new DOMCdataSection object - * @link http://php.net/manual/en/domcdatasection.construct.php - * @param $value - */ - public function __construct ($value) {} - - /** - * (PHP 5)
- * Breaks this node into two nodes at the specified offset - * @link http://php.net/manual/en/domtext.splittext.php - * @param int $offset

- * The offset at which to split, starting from 0. - *

- * @return DOMText The new node of the same type, which contains all the content at and after the - * offset. - */ - public function splitText ($offset) {} - - /** - * (PHP 5)
- * Indicates whether this text node contains whitespace - * @link http://php.net/manual/en/domtext.iswhitespaceinelementcontent.php - * @return bool TRUE on success or FALSE on failure. - */ - public function isWhitespaceInElementContent () {} - - public function isElementContentWhitespace () {} - - /** - * @param $content - */ - public function replaceWholeText ($content) {} - - /** - * (PHP 5)
- * Extracts a range of data from the node - * @link http://php.net/manual/en/domcharacterdata.substringdata.php - * @param int $offset

- * Start offset of substring to extract. - *

- * @param int $count

- * The number of characters to extract. - *

- * @return string The specified substring. If the sum of offset - * and count exceeds the length, then all 16-bit units - * to the end of the data are returned. - */ - public function substringData ($offset, $count) {} - - /** - * (PHP 5)
- * Append the string to the end of the character data of the node - * @link http://php.net/manual/en/domcharacterdata.appenddata.php - * @param string $data

- * The string to append. - *

- * @return void No value is returned. - */ - public function appendData ($data) {} - - /** - * (PHP 5)
- * Insert a string at the specified 16-bit unit offset - * @link http://php.net/manual/en/domcharacterdata.insertdata.php - * @param int $offset

- * The character offset at which to insert. - *

- * @param string $data

- * The string to insert. - *

- * @return void No value is returned. - */ - public function insertData ($offset, $data) {} - - /** - * (PHP 5)
- * Remove a range of characters from the node - * @link http://php.net/manual/en/domcharacterdata.deletedata.php - * @param int $offset

- * The offset from which to start removing. - *

- * @param int $count

- * The number of characters to delete. If the sum of - * offset and count exceeds - * the length, then all characters to the end of the data are deleted. - *

- * @return void No value is returned. - */ - public function deleteData ($offset, $count) {} - - /** - * (PHP 5)
- * Replace a substring within the DOMCharacterData node - * @link http://php.net/manual/en/domcharacterdata.replacedata.php - * @param int $offset

- * The offset from which to start replacing. - *

- * @param int $count

- * The number of characters to replace. If the sum of - * offset and count exceeds - * the length, then all characters to the end of the data are replaced. - *

- * @param string $data

- * The string with which the range must be replaced. - *

- * @return void No value is returned. - */ - public function replaceData ($offset, $count, $data) {} - - /** - * (PHP 5)
- * Adds a new child before a reference node - * @link http://php.net/manual/en/domnode.insertbefore.php - * @param DOMNode $newnode

- * The new node. - *

- * @param DOMNode $refnode [optional]

- * The reference node. If not supplied, newnode is - * appended to the children. - *

- * @return DOMNode The inserted node. - */ - public function insertBefore (DOMNode $newnode, DOMNode $refnode = null) {} - - /** - * (PHP 5)
- * Replaces a child - * @link http://php.net/manual/en/domnode.replacechild.php - * @param DOMNode $newnode

- * The new node. It must be a member of the target document, i.e. - * created by one of the DOMDocument->createXXX() methods or imported in - * the document by . - *

- * @param DOMNode $oldnode

- * The old node. - *

- * @return DOMNode The old node or FALSE if an error occur. - */ - public function replaceChild (DOMNode $newnode, DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Removes child from list of children - * @link http://php.net/manual/en/domnode.removechild.php - * @param DOMNode $oldnode

- * The removed child. - *

- * @return DOMNode If the child could be removed the function returns the old child. - */ - public function removeChild (DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Adds new child at the end of the children - * @link http://php.net/manual/en/domnode.appendchild.php - * @param DOMNode $newnode

- * The appended child. - *

- * @return DOMNode The node added. - */ - public function appendChild (DOMNode $newnode) {} - - /** - * (PHP 5)
- * Checks if node has children - * @link http://php.net/manual/en/domnode.haschildnodes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasChildNodes () {} - - /** - * (PHP 5)
- * Clones a node - * @link http://php.net/manual/en/domnode.clonenode.php - * @param bool $deep [optional]

- * Indicates whether to copy all descendant nodes. This parameter is - * defaulted to FALSE. - *

- * @return DOMNode The cloned node. - */ - public function cloneNode ($deep = null) {} - - /** - * (PHP 5)
- * Normalizes the node - * @link http://php.net/manual/en/domnode.normalize.php - * @return void No value is returned. - */ - public function normalize () {} - - /** - * (PHP 5)
- * Checks if feature is supported for specified version - * @link http://php.net/manual/en/domnode.issupported.php - * @param string $feature

- * The feature to test. See the example of - * DOMImplementation::hasFeature for a - * list of features. - *

- * @param string $version

- * The version number of the feature to test. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSupported ($feature, $version) {} - - /** - * (PHP 5)
- * Checks if node has attributes - * @link http://php.net/manual/en/domnode.hasattributes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasAttributes () {} - - /** - * @param DOMNode $other - */ - public function compareDocumentPosition (DOMNode $other) {} - - /** - * (PHP 5)
- * Indicates if two nodes are the same node - * @link http://php.net/manual/en/domnode.issamenode.php - * @param DOMNode $node

- * The compared node. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSameNode (DOMNode $node) {} - - /** - * (PHP 5)
- * Gets the namespace prefix of the node based on the namespace URI - * @link http://php.net/manual/en/domnode.lookupprefix.php - * @param string $namespaceURI

- * The namespace URI. - *

- * @return string The prefix of the namespace. - */ - public function lookupPrefix ($namespaceURI) {} - - /** - * (PHP 5)
- * Checks if the specified namespaceURI is the default namespace or not - * @link http://php.net/manual/en/domnode.isdefaultnamespace.php - * @param string $namespaceURI

- * The namespace URI to look for. - *

- * @return bool Return TRUE if namespaceURI is the default - * namespace, FALSE otherwise. - */ - public function isDefaultNamespace ($namespaceURI) {} - - /** - * (PHP 5)
- * Gets the namespace URI of the node based on the prefix - * @link http://php.net/manual/en/domnode.lookupnamespaceuri.php - * @param string $prefix

- * The prefix of the namespace. - *

- * @return string The namespace URI of the node. - */ - public function lookupNamespaceUri ($prefix) {} - - /** - * @param DOMNode $arg - */ - public function isEqualNode (DOMNode $arg) {} - - /** - * @param $feature - * @param $version - */ - public function getFeature ($feature, $version) {} - - /** - * @param $key - * @param $data - * @param $handler - */ - public function setUserData ($key, $data, $handler) {} - - /** - * @param $key - */ - public function getUserData ($key) {} - - /** - * (PHP 5 >= 5.2.0)
- * Get an XPath for a node - * @link http://php.net/manual/en/domnode.getnodepath.php - * @return string a string containing the XPath, or NULL in case of an error. - */ - public function getNodePath () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get line number for a node - * @link http://php.net/manual/en/domnode.getlineno.php - * @return int Always returns the line number where the node was defined in. - */ - public function getLineNo () {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a string - * @link http://php.net/manual/en/domnode.c14n.php - * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return string canonicalized nodes as a string or FALSE on failure - */ - public function C14N ($exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a file - * @link http://php.net/manual/en/domnode.c14nfile.php - * @param string $uri

- * Path to write the output to. - *

- * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return int Number of bytes written or FALSE on failure - */ - public function C14NFile ($uri, $exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - -} - -/** - * Each DOMDocument has a doctype - * attribute whose value is either NULL or a DOMDocumentType object. - * @link http://php.net/manual/en/class.domdocumenttype.php - */ -class DOMDocumentType extends DOMNode { - /** - *

The public identifier of the external subset.

- * @var string - */ - public $publicId; - /** - *

- * The system identifier of the external subset. This may be an - * absolute URI or not. - *

- * @var string - */ - public $systemId; - /** - *

- * The name of DTD; i.e., the name immediately following the - * DOCTYPE keyword. - *

- * @var string - */ - public $name; - /** - *

- * A DOMNamedNodeMap containing the general - * entities, both external and internal, declared in the DTD. - *

- * @var DOMNamedNodeMap - */ - public $entities; - /** - *

- * A DOMNamedNodeMap containing the notations - * declared in the DTD. - *

- * @var DOMNamedNodeMap - */ - public $notations; - /** - *

- * The internal subset as a string, or null if there is none. This is - * does not contain the delimiting square brackets. - *

- * @var string - */ - public $internalSubset; - - - /** - * (PHP 5)
- * Adds a new child before a reference node - * @link http://php.net/manual/en/domnode.insertbefore.php - * @param DOMNode $newnode

- * The new node. - *

- * @param DOMNode $refnode [optional]

- * The reference node. If not supplied, newnode is - * appended to the children. - *

- * @return DOMNode The inserted node. - */ - public function insertBefore (DOMNode $newnode, DOMNode $refnode = null) {} - - /** - * (PHP 5)
- * Replaces a child - * @link http://php.net/manual/en/domnode.replacechild.php - * @param DOMNode $newnode

- * The new node. It must be a member of the target document, i.e. - * created by one of the DOMDocument->createXXX() methods or imported in - * the document by . - *

- * @param DOMNode $oldnode

- * The old node. - *

- * @return DOMNode The old node or FALSE if an error occur. - */ - public function replaceChild (DOMNode $newnode, DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Removes child from list of children - * @link http://php.net/manual/en/domnode.removechild.php - * @param DOMNode $oldnode

- * The removed child. - *

- * @return DOMNode If the child could be removed the function returns the old child. - */ - public function removeChild (DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Adds new child at the end of the children - * @link http://php.net/manual/en/domnode.appendchild.php - * @param DOMNode $newnode

- * The appended child. - *

- * @return DOMNode The node added. - */ - public function appendChild (DOMNode $newnode) {} - - /** - * (PHP 5)
- * Checks if node has children - * @link http://php.net/manual/en/domnode.haschildnodes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasChildNodes () {} - - /** - * (PHP 5)
- * Clones a node - * @link http://php.net/manual/en/domnode.clonenode.php - * @param bool $deep [optional]

- * Indicates whether to copy all descendant nodes. This parameter is - * defaulted to FALSE. - *

- * @return DOMNode The cloned node. - */ - public function cloneNode ($deep = null) {} - - /** - * (PHP 5)
- * Normalizes the node - * @link http://php.net/manual/en/domnode.normalize.php - * @return void No value is returned. - */ - public function normalize () {} - - /** - * (PHP 5)
- * Checks if feature is supported for specified version - * @link http://php.net/manual/en/domnode.issupported.php - * @param string $feature

- * The feature to test. See the example of - * DOMImplementation::hasFeature for a - * list of features. - *

- * @param string $version

- * The version number of the feature to test. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSupported ($feature, $version) {} - - /** - * (PHP 5)
- * Checks if node has attributes - * @link http://php.net/manual/en/domnode.hasattributes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasAttributes () {} - - /** - * @param DOMNode $other - */ - public function compareDocumentPosition (DOMNode $other) {} - - /** - * (PHP 5)
- * Indicates if two nodes are the same node - * @link http://php.net/manual/en/domnode.issamenode.php - * @param DOMNode $node

- * The compared node. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSameNode (DOMNode $node) {} - - /** - * (PHP 5)
- * Gets the namespace prefix of the node based on the namespace URI - * @link http://php.net/manual/en/domnode.lookupprefix.php - * @param string $namespaceURI

- * The namespace URI. - *

- * @return string The prefix of the namespace. - */ - public function lookupPrefix ($namespaceURI) {} - - /** - * (PHP 5)
- * Checks if the specified namespaceURI is the default namespace or not - * @link http://php.net/manual/en/domnode.isdefaultnamespace.php - * @param string $namespaceURI

- * The namespace URI to look for. - *

- * @return bool Return TRUE if namespaceURI is the default - * namespace, FALSE otherwise. - */ - public function isDefaultNamespace ($namespaceURI) {} - - /** - * (PHP 5)
- * Gets the namespace URI of the node based on the prefix - * @link http://php.net/manual/en/domnode.lookupnamespaceuri.php - * @param string $prefix

- * The prefix of the namespace. - *

- * @return string The namespace URI of the node. - */ - public function lookupNamespaceUri ($prefix) {} - - /** - * @param DOMNode $arg - */ - public function isEqualNode (DOMNode $arg) {} - - /** - * @param $feature - * @param $version - */ - public function getFeature ($feature, $version) {} - - /** - * @param $key - * @param $data - * @param $handler - */ - public function setUserData ($key, $data, $handler) {} - - /** - * @param $key - */ - public function getUserData ($key) {} - - /** - * (PHP 5 >= 5.2.0)
- * Get an XPath for a node - * @link http://php.net/manual/en/domnode.getnodepath.php - * @return string a string containing the XPath, or NULL in case of an error. - */ - public function getNodePath () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get line number for a node - * @link http://php.net/manual/en/domnode.getlineno.php - * @return int Always returns the line number where the node was defined in. - */ - public function getLineNo () {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a string - * @link http://php.net/manual/en/domnode.c14n.php - * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return string canonicalized nodes as a string or FALSE on failure - */ - public function C14N ($exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a file - * @link http://php.net/manual/en/domnode.c14nfile.php - * @param string $uri

- * Path to write the output to. - *

- * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return int Number of bytes written or FALSE on failure - */ - public function C14NFile ($uri, $exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - -} - -/** - * @link http://php.net/manual/en/class.domnotation.php - */ -class DOMNotation extends DOMNode { - /** - *

Prop description

- * @var string - */ - public $publicId; - /** - *

Prop description

- * @var string - */ - public $systemId; - - - /** - * (PHP 5)
- * Adds a new child before a reference node - * @link http://php.net/manual/en/domnode.insertbefore.php - * @param DOMNode $newnode

- * The new node. - *

- * @param DOMNode $refnode [optional]

- * The reference node. If not supplied, newnode is - * appended to the children. - *

- * @return DOMNode The inserted node. - */ - public function insertBefore (DOMNode $newnode, DOMNode $refnode = null) {} - - /** - * (PHP 5)
- * Replaces a child - * @link http://php.net/manual/en/domnode.replacechild.php - * @param DOMNode $newnode

- * The new node. It must be a member of the target document, i.e. - * created by one of the DOMDocument->createXXX() methods or imported in - * the document by . - *

- * @param DOMNode $oldnode

- * The old node. - *

- * @return DOMNode The old node or FALSE if an error occur. - */ - public function replaceChild (DOMNode $newnode, DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Removes child from list of children - * @link http://php.net/manual/en/domnode.removechild.php - * @param DOMNode $oldnode

- * The removed child. - *

- * @return DOMNode If the child could be removed the function returns the old child. - */ - public function removeChild (DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Adds new child at the end of the children - * @link http://php.net/manual/en/domnode.appendchild.php - * @param DOMNode $newnode

- * The appended child. - *

- * @return DOMNode The node added. - */ - public function appendChild (DOMNode $newnode) {} - - /** - * (PHP 5)
- * Checks if node has children - * @link http://php.net/manual/en/domnode.haschildnodes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasChildNodes () {} - - /** - * (PHP 5)
- * Clones a node - * @link http://php.net/manual/en/domnode.clonenode.php - * @param bool $deep [optional]

- * Indicates whether to copy all descendant nodes. This parameter is - * defaulted to FALSE. - *

- * @return DOMNode The cloned node. - */ - public function cloneNode ($deep = null) {} - - /** - * (PHP 5)
- * Normalizes the node - * @link http://php.net/manual/en/domnode.normalize.php - * @return void No value is returned. - */ - public function normalize () {} - - /** - * (PHP 5)
- * Checks if feature is supported for specified version - * @link http://php.net/manual/en/domnode.issupported.php - * @param string $feature

- * The feature to test. See the example of - * DOMImplementation::hasFeature for a - * list of features. - *

- * @param string $version

- * The version number of the feature to test. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSupported ($feature, $version) {} - - /** - * (PHP 5)
- * Checks if node has attributes - * @link http://php.net/manual/en/domnode.hasattributes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasAttributes () {} - - /** - * @param DOMNode $other - */ - public function compareDocumentPosition (DOMNode $other) {} - - /** - * (PHP 5)
- * Indicates if two nodes are the same node - * @link http://php.net/manual/en/domnode.issamenode.php - * @param DOMNode $node

- * The compared node. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSameNode (DOMNode $node) {} - - /** - * (PHP 5)
- * Gets the namespace prefix of the node based on the namespace URI - * @link http://php.net/manual/en/domnode.lookupprefix.php - * @param string $namespaceURI

- * The namespace URI. - *

- * @return string The prefix of the namespace. - */ - public function lookupPrefix ($namespaceURI) {} - - /** - * (PHP 5)
- * Checks if the specified namespaceURI is the default namespace or not - * @link http://php.net/manual/en/domnode.isdefaultnamespace.php - * @param string $namespaceURI

- * The namespace URI to look for. - *

- * @return bool Return TRUE if namespaceURI is the default - * namespace, FALSE otherwise. - */ - public function isDefaultNamespace ($namespaceURI) {} - - /** - * (PHP 5)
- * Gets the namespace URI of the node based on the prefix - * @link http://php.net/manual/en/domnode.lookupnamespaceuri.php - * @param string $prefix

- * The prefix of the namespace. - *

- * @return string The namespace URI of the node. - */ - public function lookupNamespaceUri ($prefix) {} - - /** - * @param DOMNode $arg - */ - public function isEqualNode (DOMNode $arg) {} - - /** - * @param $feature - * @param $version - */ - public function getFeature ($feature, $version) {} - - /** - * @param $key - * @param $data - * @param $handler - */ - public function setUserData ($key, $data, $handler) {} - - /** - * @param $key - */ - public function getUserData ($key) {} - - /** - * (PHP 5 >= 5.2.0)
- * Get an XPath for a node - * @link http://php.net/manual/en/domnode.getnodepath.php - * @return string a string containing the XPath, or NULL in case of an error. - */ - public function getNodePath () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get line number for a node - * @link http://php.net/manual/en/domnode.getlineno.php - * @return int Always returns the line number where the node was defined in. - */ - public function getLineNo () {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a string - * @link http://php.net/manual/en/domnode.c14n.php - * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return string canonicalized nodes as a string or FALSE on failure - */ - public function C14N ($exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a file - * @link http://php.net/manual/en/domnode.c14nfile.php - * @param string $uri

- * Path to write the output to. - *

- * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return int Number of bytes written or FALSE on failure - */ - public function C14NFile ($uri, $exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - -} - -/** - * This interface represents a known entity, either parsed or unparsed, in an XML document. - * @link http://php.net/manual/en/class.domentity.php - */ -class DOMEntity extends DOMNode { - /** - *

- * The public identifier associated with the entity if specified, and - * NULL otherwise. - *

- * @var string - */ - public $publicId; - /** - *

- * The system identifier associated with the entity if specified, and - * NULL otherwise. This may be an absolute URI or not. - *

- * @var string - */ - public $systemId; - /** - *

- * For unparsed entities, the name of the notation for the entity. For - * parsed entities, this is NULL. - *

- * @var string - */ - public $notationName; - /** - *

- * An attribute specifying the encoding used for this entity at the - * time of parsing, when it is an external parsed entity. This is - * NULL if it an entity from the internal subset or if it is not - * known. - *

- * @var string - */ - public $actualEncoding; - /** - *

- * An attribute specifying, as part of the text declaration, the - * encoding of this entity, when it is an external parsed entity. This - * is NULL otherwise. - *

- * @var string - */ - public $encoding; - /** - *

- * An attribute specifying, as part of the text declaration, the - * version number of this entity, when it is an external parsed - * entity. This is NULL otherwise. - *

- * @var string - */ - public $version; - - - /** - * (PHP 5)
- * Adds a new child before a reference node - * @link http://php.net/manual/en/domnode.insertbefore.php - * @param DOMNode $newnode

- * The new node. - *

- * @param DOMNode $refnode [optional]

- * The reference node. If not supplied, newnode is - * appended to the children. - *

- * @return DOMNode The inserted node. - */ - public function insertBefore (DOMNode $newnode, DOMNode $refnode = null) {} - - /** - * (PHP 5)
- * Replaces a child - * @link http://php.net/manual/en/domnode.replacechild.php - * @param DOMNode $newnode

- * The new node. It must be a member of the target document, i.e. - * created by one of the DOMDocument->createXXX() methods or imported in - * the document by . - *

- * @param DOMNode $oldnode

- * The old node. - *

- * @return DOMNode The old node or FALSE if an error occur. - */ - public function replaceChild (DOMNode $newnode, DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Removes child from list of children - * @link http://php.net/manual/en/domnode.removechild.php - * @param DOMNode $oldnode

- * The removed child. - *

- * @return DOMNode If the child could be removed the function returns the old child. - */ - public function removeChild (DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Adds new child at the end of the children - * @link http://php.net/manual/en/domnode.appendchild.php - * @param DOMNode $newnode

- * The appended child. - *

- * @return DOMNode The node added. - */ - public function appendChild (DOMNode $newnode) {} - - /** - * (PHP 5)
- * Checks if node has children - * @link http://php.net/manual/en/domnode.haschildnodes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasChildNodes () {} - - /** - * (PHP 5)
- * Clones a node - * @link http://php.net/manual/en/domnode.clonenode.php - * @param bool $deep [optional]

- * Indicates whether to copy all descendant nodes. This parameter is - * defaulted to FALSE. - *

- * @return DOMNode The cloned node. - */ - public function cloneNode ($deep = null) {} - - /** - * (PHP 5)
- * Normalizes the node - * @link http://php.net/manual/en/domnode.normalize.php - * @return void No value is returned. - */ - public function normalize () {} - - /** - * (PHP 5)
- * Checks if feature is supported for specified version - * @link http://php.net/manual/en/domnode.issupported.php - * @param string $feature

- * The feature to test. See the example of - * DOMImplementation::hasFeature for a - * list of features. - *

- * @param string $version

- * The version number of the feature to test. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSupported ($feature, $version) {} - - /** - * (PHP 5)
- * Checks if node has attributes - * @link http://php.net/manual/en/domnode.hasattributes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasAttributes () {} - - /** - * @param DOMNode $other - */ - public function compareDocumentPosition (DOMNode $other) {} - - /** - * (PHP 5)
- * Indicates if two nodes are the same node - * @link http://php.net/manual/en/domnode.issamenode.php - * @param DOMNode $node

- * The compared node. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSameNode (DOMNode $node) {} - - /** - * (PHP 5)
- * Gets the namespace prefix of the node based on the namespace URI - * @link http://php.net/manual/en/domnode.lookupprefix.php - * @param string $namespaceURI

- * The namespace URI. - *

- * @return string The prefix of the namespace. - */ - public function lookupPrefix ($namespaceURI) {} - - /** - * (PHP 5)
- * Checks if the specified namespaceURI is the default namespace or not - * @link http://php.net/manual/en/domnode.isdefaultnamespace.php - * @param string $namespaceURI

- * The namespace URI to look for. - *

- * @return bool Return TRUE if namespaceURI is the default - * namespace, FALSE otherwise. - */ - public function isDefaultNamespace ($namespaceURI) {} - - /** - * (PHP 5)
- * Gets the namespace URI of the node based on the prefix - * @link http://php.net/manual/en/domnode.lookupnamespaceuri.php - * @param string $prefix

- * The prefix of the namespace. - *

- * @return string The namespace URI of the node. - */ - public function lookupNamespaceUri ($prefix) {} - - /** - * @param DOMNode $arg - */ - public function isEqualNode (DOMNode $arg) {} - - /** - * @param $feature - * @param $version - */ - public function getFeature ($feature, $version) {} - - /** - * @param $key - * @param $data - * @param $handler - */ - public function setUserData ($key, $data, $handler) {} - - /** - * @param $key - */ - public function getUserData ($key) {} - - /** - * (PHP 5 >= 5.2.0)
- * Get an XPath for a node - * @link http://php.net/manual/en/domnode.getnodepath.php - * @return string a string containing the XPath, or NULL in case of an error. - */ - public function getNodePath () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get line number for a node - * @link http://php.net/manual/en/domnode.getlineno.php - * @return int Always returns the line number where the node was defined in. - */ - public function getLineNo () {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a string - * @link http://php.net/manual/en/domnode.c14n.php - * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return string canonicalized nodes as a string or FALSE on failure - */ - public function C14N ($exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a file - * @link http://php.net/manual/en/domnode.c14nfile.php - * @param string $uri

- * Path to write the output to. - *

- * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return int Number of bytes written or FALSE on failure - */ - public function C14NFile ($uri, $exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - -} - -/** - * @link http://php.net/manual/en/class.domentityreference.php - */ -class DOMEntityReference extends DOMNode { - - /** - * (PHP 5)
- * Creates a new DOMEntityReference object - * @link http://php.net/manual/en/domentityreference.construct.php - * @param string $name

- * The name of the entity reference. - *

- */ - public function __construct ($name) {} - - /** - * (PHP 5)
- * Adds a new child before a reference node - * @link http://php.net/manual/en/domnode.insertbefore.php - * @param DOMNode $newnode

- * The new node. - *

- * @param DOMNode $refnode [optional]

- * The reference node. If not supplied, newnode is - * appended to the children. - *

- * @return DOMNode The inserted node. - */ - public function insertBefore (DOMNode $newnode, DOMNode $refnode = null) {} - - /** - * (PHP 5)
- * Replaces a child - * @link http://php.net/manual/en/domnode.replacechild.php - * @param DOMNode $newnode

- * The new node. It must be a member of the target document, i.e. - * created by one of the DOMDocument->createXXX() methods or imported in - * the document by . - *

- * @param DOMNode $oldnode

- * The old node. - *

- * @return DOMNode The old node or FALSE if an error occur. - */ - public function replaceChild (DOMNode $newnode, DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Removes child from list of children - * @link http://php.net/manual/en/domnode.removechild.php - * @param DOMNode $oldnode

- * The removed child. - *

- * @return DOMNode If the child could be removed the function returns the old child. - */ - public function removeChild (DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Adds new child at the end of the children - * @link http://php.net/manual/en/domnode.appendchild.php - * @param DOMNode $newnode

- * The appended child. - *

- * @return DOMNode The node added. - */ - public function appendChild (DOMNode $newnode) {} - - /** - * (PHP 5)
- * Checks if node has children - * @link http://php.net/manual/en/domnode.haschildnodes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasChildNodes () {} - - /** - * (PHP 5)
- * Clones a node - * @link http://php.net/manual/en/domnode.clonenode.php - * @param bool $deep [optional]

- * Indicates whether to copy all descendant nodes. This parameter is - * defaulted to FALSE. - *

- * @return DOMNode The cloned node. - */ - public function cloneNode ($deep = null) {} - - /** - * (PHP 5)
- * Normalizes the node - * @link http://php.net/manual/en/domnode.normalize.php - * @return void No value is returned. - */ - public function normalize () {} - - /** - * (PHP 5)
- * Checks if feature is supported for specified version - * @link http://php.net/manual/en/domnode.issupported.php - * @param string $feature

- * The feature to test. See the example of - * DOMImplementation::hasFeature for a - * list of features. - *

- * @param string $version

- * The version number of the feature to test. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSupported ($feature, $version) {} - - /** - * (PHP 5)
- * Checks if node has attributes - * @link http://php.net/manual/en/domnode.hasattributes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasAttributes () {} - - /** - * @param DOMNode $other - */ - public function compareDocumentPosition (DOMNode $other) {} - - /** - * (PHP 5)
- * Indicates if two nodes are the same node - * @link http://php.net/manual/en/domnode.issamenode.php - * @param DOMNode $node

- * The compared node. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSameNode (DOMNode $node) {} - - /** - * (PHP 5)
- * Gets the namespace prefix of the node based on the namespace URI - * @link http://php.net/manual/en/domnode.lookupprefix.php - * @param string $namespaceURI

- * The namespace URI. - *

- * @return string The prefix of the namespace. - */ - public function lookupPrefix ($namespaceURI) {} - - /** - * (PHP 5)
- * Checks if the specified namespaceURI is the default namespace or not - * @link http://php.net/manual/en/domnode.isdefaultnamespace.php - * @param string $namespaceURI

- * The namespace URI to look for. - *

- * @return bool Return TRUE if namespaceURI is the default - * namespace, FALSE otherwise. - */ - public function isDefaultNamespace ($namespaceURI) {} - - /** - * (PHP 5)
- * Gets the namespace URI of the node based on the prefix - * @link http://php.net/manual/en/domnode.lookupnamespaceuri.php - * @param string $prefix

- * The prefix of the namespace. - *

- * @return string The namespace URI of the node. - */ - public function lookupNamespaceUri ($prefix) {} - - /** - * @param DOMNode $arg - */ - public function isEqualNode (DOMNode $arg) {} - - /** - * @param $feature - * @param $version - */ - public function getFeature ($feature, $version) {} - - /** - * @param $key - * @param $data - * @param $handler - */ - public function setUserData ($key, $data, $handler) {} - - /** - * @param $key - */ - public function getUserData ($key) {} - - /** - * (PHP 5 >= 5.2.0)
- * Get an XPath for a node - * @link http://php.net/manual/en/domnode.getnodepath.php - * @return string a string containing the XPath, or NULL in case of an error. - */ - public function getNodePath () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get line number for a node - * @link http://php.net/manual/en/domnode.getlineno.php - * @return int Always returns the line number where the node was defined in. - */ - public function getLineNo () {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a string - * @link http://php.net/manual/en/domnode.c14n.php - * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return string canonicalized nodes as a string or FALSE on failure - */ - public function C14N ($exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a file - * @link http://php.net/manual/en/domnode.c14nfile.php - * @param string $uri

- * Path to write the output to. - *

- * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return int Number of bytes written or FALSE on failure - */ - public function C14NFile ($uri, $exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - -} - -/** - * @link http://php.net/manual/en/class.domprocessinginstruction.php - */ -class DOMProcessingInstruction extends DOMNode { - /** - *

Prop description

- * @var string - */ - public $target; - /** - *

Prop description

- * @var string - */ - public $data; - - - /** - * (PHP 5)
- * Creates a new DOMProcessingInstruction object - * @link http://php.net/manual/en/domprocessinginstruction.construct.php - * @param string $name

- * The tag name of the processing instruction. - *

- * @param string $value [optional]

- * The value of the processing instruction. - *

- */ - public function __construct ($name, $value = null) {} - - /** - * (PHP 5)
- * Adds a new child before a reference node - * @link http://php.net/manual/en/domnode.insertbefore.php - * @param DOMNode $newnode

- * The new node. - *

- * @param DOMNode $refnode [optional]

- * The reference node. If not supplied, newnode is - * appended to the children. - *

- * @return DOMNode The inserted node. - */ - public function insertBefore (DOMNode $newnode, DOMNode $refnode = null) {} - - /** - * (PHP 5)
- * Replaces a child - * @link http://php.net/manual/en/domnode.replacechild.php - * @param DOMNode $newnode

- * The new node. It must be a member of the target document, i.e. - * created by one of the DOMDocument->createXXX() methods or imported in - * the document by . - *

- * @param DOMNode $oldnode

- * The old node. - *

- * @return DOMNode The old node or FALSE if an error occur. - */ - public function replaceChild (DOMNode $newnode, DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Removes child from list of children - * @link http://php.net/manual/en/domnode.removechild.php - * @param DOMNode $oldnode

- * The removed child. - *

- * @return DOMNode If the child could be removed the function returns the old child. - */ - public function removeChild (DOMNode $oldnode) {} - - /** - * (PHP 5)
- * Adds new child at the end of the children - * @link http://php.net/manual/en/domnode.appendchild.php - * @param DOMNode $newnode

- * The appended child. - *

- * @return DOMNode The node added. - */ - public function appendChild (DOMNode $newnode) {} - - /** - * (PHP 5)
- * Checks if node has children - * @link http://php.net/manual/en/domnode.haschildnodes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasChildNodes () {} - - /** - * (PHP 5)
- * Clones a node - * @link http://php.net/manual/en/domnode.clonenode.php - * @param bool $deep [optional]

- * Indicates whether to copy all descendant nodes. This parameter is - * defaulted to FALSE. - *

- * @return DOMNode The cloned node. - */ - public function cloneNode ($deep = null) {} - - /** - * (PHP 5)
- * Normalizes the node - * @link http://php.net/manual/en/domnode.normalize.php - * @return void No value is returned. - */ - public function normalize () {} - - /** - * (PHP 5)
- * Checks if feature is supported for specified version - * @link http://php.net/manual/en/domnode.issupported.php - * @param string $feature

- * The feature to test. See the example of - * DOMImplementation::hasFeature for a - * list of features. - *

- * @param string $version

- * The version number of the feature to test. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSupported ($feature, $version) {} - - /** - * (PHP 5)
- * Checks if node has attributes - * @link http://php.net/manual/en/domnode.hasattributes.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasAttributes () {} - - /** - * @param DOMNode $other - */ - public function compareDocumentPosition (DOMNode $other) {} - - /** - * (PHP 5)
- * Indicates if two nodes are the same node - * @link http://php.net/manual/en/domnode.issamenode.php - * @param DOMNode $node

- * The compared node. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function isSameNode (DOMNode $node) {} - - /** - * (PHP 5)
- * Gets the namespace prefix of the node based on the namespace URI - * @link http://php.net/manual/en/domnode.lookupprefix.php - * @param string $namespaceURI

- * The namespace URI. - *

- * @return string The prefix of the namespace. - */ - public function lookupPrefix ($namespaceURI) {} - - /** - * (PHP 5)
- * Checks if the specified namespaceURI is the default namespace or not - * @link http://php.net/manual/en/domnode.isdefaultnamespace.php - * @param string $namespaceURI

- * The namespace URI to look for. - *

- * @return bool Return TRUE if namespaceURI is the default - * namespace, FALSE otherwise. - */ - public function isDefaultNamespace ($namespaceURI) {} - - /** - * (PHP 5)
- * Gets the namespace URI of the node based on the prefix - * @link http://php.net/manual/en/domnode.lookupnamespaceuri.php - * @param string $prefix

- * The prefix of the namespace. - *

- * @return string The namespace URI of the node. - */ - public function lookupNamespaceUri ($prefix) {} - - /** - * @param DOMNode $arg - */ - public function isEqualNode (DOMNode $arg) {} - - /** - * @param $feature - * @param $version - */ - public function getFeature ($feature, $version) {} - - /** - * @param $key - * @param $data - * @param $handler - */ - public function setUserData ($key, $data, $handler) {} - - /** - * @param $key - */ - public function getUserData ($key) {} - - /** - * (PHP 5 >= 5.2.0)
- * Get an XPath for a node - * @link http://php.net/manual/en/domnode.getnodepath.php - * @return string a string containing the XPath, or NULL in case of an error. - */ - public function getNodePath () {} - - /** - * (PHP 5 >= 5.3.0)
- * Get line number for a node - * @link http://php.net/manual/en/domnode.getlineno.php - * @return int Always returns the line number where the node was defined in. - */ - public function getLineNo () {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a string - * @link http://php.net/manual/en/domnode.c14n.php - * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return string canonicalized nodes as a string or FALSE on failure - */ - public function C14N ($exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - - /** - * (PHP 5 >= 5.2.0)
- * Canonicalize nodes to a file - * @link http://php.net/manual/en/domnode.c14nfile.php - * @param string $uri

- * Path to write the output to. - *

- * @param bool $exclusive [optional]

- * Enable exclusive parsing of only the nodes matched by the provided - * xpath or namespace prefixes. - *

- * @param bool $with_comments [optional]

- * Retain comments in output. - *

- * @param array $xpath [optional]

- * An array of xpaths to filter the nodes by. - *

- * @param array $ns_prefixes [optional]

- * An array of namespace prefixes to filter the nodes by. - *

- * @return int Number of bytes written or FALSE on failure - */ - public function C14NFile ($uri, $exclusive = null, $with_comments = null, array $xpath = null, array $ns_prefixes = null) {} - -} - -class DOMStringExtend { - - /** - * @param $offset32 - */ - public function findOffset16 ($offset32) {} - - /** - * @param $offset16 - */ - public function findOffset32 ($offset16) {} - -} - -/** - * Supports XPath 1.0 - * @link http://php.net/manual/en/class.domxpath.php - */ -class DOMXPath { - /** - *

Prop description

- * @var DOMDocument - */ - public $document; - - - /** - * (PHP 5)
- * Creates a new DOMXPath object - * @link http://php.net/manual/en/domxpath.construct.php - * @param DOMDocument $doc

- * The DOMDocument associated with the - * DOMXPath. - *

- */ - public function __construct (DOMDocument $doc) {} - - /** - * (PHP 5)
- * Registers the namespace with the DOMXPath object - * @link http://php.net/manual/en/domxpath.registernamespace.php - * @param string $prefix

- * The prefix. - *

- * @param string $namespaceURI

- * The URI of the namespace. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function registerNamespace ($prefix, $namespaceURI) {} - - /** - * (PHP 5)
- * Evaluates the given XPath expression - * @link http://php.net/manual/en/domxpath.query.php - * @param string $expression

- * The XPath expression to execute. - *

- * @param DOMNode $contextnode [optional]

- * The optional contextnode can be specified for - * doing relative XPath queries. By default, the queries are relative to - * the root element. - *

- * @param bool $registerNodeNS [optional]

- * The optional registerNodeNS can be specified to - * disable automatic registration of the context node. - *

- * @return DOMNodeList a DOMNodeList containing all nodes matching - * the given XPath expression. Any expression which - * does not return nodes will return an empty - * DOMNodeList. - *

- *

- * If the expression is malformed or the - * contextnode is invalid, - * DOMXPath::query returns FALSE. - */ - public function query ($expression, DOMNode $contextnode = null, $registerNodeNS = true) {} - - /** - * (PHP 5 >= 5.1.0)
- * Evaluates the given XPath expression and returns a typed result if possible - * @link http://php.net/manual/en/domxpath.evaluate.php - * @param string $expression

- * The XPath expression to execute. - *

- * @param DOMNode $contextnode [optional]

- * The optional contextnode can be specified for - * doing relative XPath queries. By default, the queries are relative to - * the root element. - *

- * @param bool $registerNodeNS [optional]

- * The optional registerNodeNS can be specified to - * disable automatic registration of the context node. - *

- * @return mixed a typed result if possible or a DOMNodeList - * containing all nodes matching the given XPath expression. - *

- *

- * If the expression is malformed or the - * contextnode is invalid, - * DOMXPath::evaluate returns FALSE. - */ - public function evaluate ($expression, DOMNode $contextnode = null, $registerNodeNS = true) {} - - /** - * (PHP 5 >= 5.3.0)
- * Register PHP functions as XPath functions - * @link http://php.net/manual/en/domxpath.registerphpfunctions.php - * @param mixed $restrict [optional]

- * Use this parameter to only allow certain functions to be called from XPath. - *

- *

- * This parameter can be either a string (a function name) or - * an array of function names. - *

- * @return void No value is returned. - */ - public function registerPhpFunctions ($restrict = null) {} - -} - -/** - * (PHP 5)
- * Gets a DOMElement object from a -SimpleXMLElement object - * @link http://php.net/manual/en/function.dom-import-simplexml.php - * @param SimpleXMLElement $node

- * The SimpleXMLElement node. - *

- * @return DOMElement The DOMElement node added or FALSE if any errors occur. - */ -function dom_import_simplexml (SimpleXMLElement $node) {} - - -/** - * Node is a DOMElement - * @link http://php.net/manual/en/dom.constants.php - */ -define ('XML_ELEMENT_NODE', 1); - -/** - * Node is a DOMAttr - * @link http://php.net/manual/en/dom.constants.php - */ -define ('XML_ATTRIBUTE_NODE', 2); - -/** - * Node is a DOMText - * @link http://php.net/manual/en/dom.constants.php - */ -define ('XML_TEXT_NODE', 3); - -/** - * Node is a DOMCharacterData - * @link http://php.net/manual/en/dom.constants.php - */ -define ('XML_CDATA_SECTION_NODE', 4); - -/** - * Node is a DOMEntityReference - * @link http://php.net/manual/en/dom.constants.php - */ -define ('XML_ENTITY_REF_NODE', 5); - -/** - * Node is a DOMEntity - * @link http://php.net/manual/en/dom.constants.php - */ -define ('XML_ENTITY_NODE', 6); - -/** - * Node is a DOMProcessingInstruction - * @link http://php.net/manual/en/dom.constants.php - */ -define ('XML_PI_NODE', 7); - -/** - * Node is a DOMComment - * @link http://php.net/manual/en/dom.constants.php - */ -define ('XML_COMMENT_NODE', 8); - -/** - * Node is a DOMDocument - * @link http://php.net/manual/en/dom.constants.php - */ -define ('XML_DOCUMENT_NODE', 9); - -/** - * Node is a DOMDocumentType - * @link http://php.net/manual/en/dom.constants.php - */ -define ('XML_DOCUMENT_TYPE_NODE', 10); - -/** - * Node is a DOMDocumentFragment - * @link http://php.net/manual/en/dom.constants.php - */ -define ('XML_DOCUMENT_FRAG_NODE', 11); - -/** - * Node is a DOMNotation - * @link http://php.net/manual/en/dom.constants.php - */ -define ('XML_NOTATION_NODE', 12); -define ('XML_HTML_DOCUMENT_NODE', 13); -define ('XML_DTD_NODE', 14); -define ('XML_ELEMENT_DECL_NODE', 15); -define ('XML_ATTRIBUTE_DECL_NODE', 16); -define ('XML_ENTITY_DECL_NODE', 17); -define ('XML_NAMESPACE_DECL_NODE', 18); -define ('XML_LOCAL_NAMESPACE', 18); -define ('XML_ATTRIBUTE_CDATA', 1); -define ('XML_ATTRIBUTE_ID', 2); -define ('XML_ATTRIBUTE_IDREF', 3); -define ('XML_ATTRIBUTE_IDREFS', 4); -define ('XML_ATTRIBUTE_ENTITY', 6); -define ('XML_ATTRIBUTE_NMTOKEN', 7); -define ('XML_ATTRIBUTE_NMTOKENS', 8); -define ('XML_ATTRIBUTE_ENUMERATION', 9); -define ('XML_ATTRIBUTE_NOTATION', 10); - -/** - * Error code not part of the DOM specification. Meant for PHP errors. - * @link http://php.net/manual/en/dom.constants.php - */ -define ('DOM_PHP_ERR', 0); - -/** - * If index or size is negative, or greater than the allowed value. - * @link http://php.net/manual/en/dom.constants.php - */ -define ('DOM_INDEX_SIZE_ERR', 1); - -/** - * If the specified range of text does not fit into a - * DOMString. - * @link http://php.net/manual/en/dom.constants.php - */ -define ('DOMSTRING_SIZE_ERR', 2); - -/** - * If any node is inserted somewhere it doesn't belong - * @link http://php.net/manual/en/dom.constants.php - */ -define ('DOM_HIERARCHY_REQUEST_ERR', 3); - -/** - * If a node is used in a different document than the one that created it. - * @link http://php.net/manual/en/dom.constants.php - */ -define ('DOM_WRONG_DOCUMENT_ERR', 4); - -/** - * If an invalid or illegal character is specified, such as in a name. - * @link http://php.net/manual/en/dom.constants.php - */ -define ('DOM_INVALID_CHARACTER_ERR', 5); - -/** - * If data is specified for a node which does not support data. - * @link http://php.net/manual/en/dom.constants.php - */ -define ('DOM_NO_DATA_ALLOWED_ERR', 6); - -/** - * If an attempt is made to modify an object where modifications are not allowed. - * @link http://php.net/manual/en/dom.constants.php - */ -define ('DOM_NO_MODIFICATION_ALLOWED_ERR', 7); - -/** - * If an attempt is made to reference a node in a context where it does not exist. - * @link http://php.net/manual/en/dom.constants.php - */ -define ('DOM_NOT_FOUND_ERR', 8); - -/** - * If the implementation does not support the requested type of object or operation. - * @link http://php.net/manual/en/dom.constants.php - */ -define ('DOM_NOT_SUPPORTED_ERR', 9); - -/** - * If an attempt is made to add an attribute that is already in use elsewhere. - * @link http://php.net/manual/en/dom.constants.php - */ -define ('DOM_INUSE_ATTRIBUTE_ERR', 10); - -/** - * If an attempt is made to use an object that is not, or is no longer, usable. - * @link http://php.net/manual/en/dom.constants.php - */ -define ('DOM_INVALID_STATE_ERR', 11); - -/** - * If an invalid or illegal string is specified. - * @link http://php.net/manual/en/dom.constants.php - */ -define ('DOM_SYNTAX_ERR', 12); - -/** - * If an attempt is made to modify the type of the underlying object. - * @link http://php.net/manual/en/dom.constants.php - */ -define ('DOM_INVALID_MODIFICATION_ERR', 13); - -/** - * If an attempt is made to create or change an object in a way which is - * incorrect with regard to namespaces. - * @link http://php.net/manual/en/dom.constants.php - */ -define ('DOM_NAMESPACE_ERR', 14); - -/** - * If a parameter or an operation is not supported by the underlying object. - * @link http://php.net/manual/en/dom.constants.php - */ -define ('DOM_INVALID_ACCESS_ERR', 15); - -/** - * If a call to a method such as insertBefore or removeChild would make the Node - * invalid with respect to "partial validity", this exception would be raised and - * the operation would not be done. - * @link http://php.net/manual/en/dom.constants.php - */ -define ('DOM_VALIDATION_ERR', 16); - -// End of dom v.20031129 -?> diff --git a/phpruntime/enchant.php b/phpruntime/enchant.php deleted file mode 100644 index a3b7d60..0000000 --- a/phpruntime/enchant.php +++ /dev/null @@ -1,273 +0,0 @@ - - * create a new broker object capable of requesting - * @link http://php.net/manual/en/function.enchant-broker-init.php - * @return resource a broker resource on success or FALSE. - */ -function enchant_broker_init () {} - -/** - * (PHP 5 >= 5.3.0, PECL enchant >= 0.1.0 )
- * Free the broker resource and its dictionnaries - * @link http://php.net/manual/en/function.enchant-broker-free.php - * @param resource $broker

- * Broker resource - *

- * @return bool TRUE on success or FALSE on failure. - */ -function enchant_broker_free ($broker) {} - -/** - * (PHP 5 >= 5.3.0, PECL enchant >= 0.1.0 )
- * Returns the last error of the broker - * @link http://php.net/manual/en/function.enchant-broker-get-error.php - * @param resource $broker

- * Broker resource. - *

- * @return string Return the msg string if an error was found or FALSE - */ -function enchant_broker_get_error ($broker) {} - -/** - * @param $broker - * @param $name - * @param $value - */ -function enchant_broker_set_dict_path ($broker, $name, $value) {} - -/** - * @param $broker - * @param $name - */ -function enchant_broker_get_dict_path ($broker, $name) {} - -/** - * (PHP 5 >= 5.3.0, PECL enchant >= 1.0.1)
- * Returns a list of available dictionaries - * @link http://php.net/manual/en/function.enchant-broker-list-dicts.php - * @param resource $broker

- * Broker resource - *

- * @return mixed TRUE on success or FALSE on failure. - */ -function enchant_broker_list_dicts ($broker) {} - -/** - * (PHP 5 >= 5.3.0, PECL enchant >= 0.1.0 )
- * create a new dictionary using a tag - * @link http://php.net/manual/en/function.enchant-broker-request-dict.php - * @param resource $broker

- * Broker resource - *

- * @param string $tag

- * A tag describing the locale, for example en_US, de_DE - *

- * @return resource a dictionary resource on success or FALSE on failure. - */ -function enchant_broker_request_dict ($broker, $tag) {} - -/** - * (PHP 5 >= 5.3.0, PECL enchant >= 0.1.0 )
- * creates a dictionary using a PWL file - * @link http://php.net/manual/en/function.enchant-broker-request-pwl-dict.php - * @param resource $broker

- * Broker resource - *

- * @param string $filename

- * Path to the PWL file. - *

- * @return resource a dictionary resource on success or FALSE on failure. - */ -function enchant_broker_request_pwl_dict ($broker, $filename) {} - -/** - * (PHP 5 >= 5.3.0, PECL enchant >= 0.1.0 )
- * Free a dictionary resource - * @link http://php.net/manual/en/function.enchant-broker-free-dict.php - * @param resource $dict

- * Dictionary resource. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function enchant_broker_free_dict ($dict) {} - -/** - * (PHP 5 >= 5.3.0, PECL enchant >= 0.1.0 )
- * Whether a dictionary exists or not. Using non-empty tag - * @link http://php.net/manual/en/function.enchant-broker-dict-exists.php - * @param resource $broker

- * Broker resource - *

- * @param string $tag

- * non-empty tag in the LOCALE format, ex: us_US, ch_DE, etc. - *

- * @return bool TRUE when the tag exist or FALSE when not. - */ -function enchant_broker_dict_exists ($broker, $tag) {} - -/** - * (PHP 5 >= 5.3.0, PECL enchant >= 0.1.0 )
- * Declares a preference of dictionaries to use for the language - * @link http://php.net/manual/en/function.enchant-broker-set-ordering.php - * @param resource $broker

- * Broker resource - *

- * @param string $tag

- * Language tag. The special "*" tag can be used as a language tag - * to declare a default ordering for any language that does not - * explicitly declare an ordering. - *

- * @param string $ordering

- * Comma delimited list of provider names - *

- * @return bool TRUE on success or FALSE on failure. - */ -function enchant_broker_set_ordering ($broker, $tag, $ordering) {} - -/** - * (PHP 5 >= 5.3.0, PECL enchant >= 0.1.0)
- * Enumerates the Enchant providers - * @link http://php.net/manual/en/function.enchant-broker-describe.php - * @param resource $broker

- * Broker resource - *

- * @return array TRUE on success or FALSE on failure. - */ -function enchant_broker_describe ($broker) {} - -/** - * (PHP 5 >= 5.3.0, PECL enchant >= 0.1.0 )
- * Check whether a word is correctly spelled or not - * @link http://php.net/manual/en/function.enchant-dict-check.php - * @param resource $dict

- * Dictionary resource - *

- * @param string $word

- * The word to check - *

- * @return bool TRUE if the word is spelled correctly, FALSE if not. - */ -function enchant_dict_check ($dict, $word) {} - -/** - * (PHP 5 >= 5.3.0, PECL enchant >= 0.1.0 )
- * Will return a list of values if any of those pre-conditions are not met - * @link http://php.net/manual/en/function.enchant-dict-suggest.php - * @param resource $dict

- * Dictionary resource - *

- * @param string $word

- * Word to use for the suggestions. - *

- * @return array Will returns an array of suggestions if the word is bad spelled. - */ -function enchant_dict_suggest ($dict, $word) {} - -/** - * (PHP 5 >= 5.3.0, PECL enchant >= 0.1.0 )
- * add a word to personal word list - * @link http://php.net/manual/en/function.enchant-dict-add-to-personal.php - * @param resource $dict

- * Dictionary resource - *

- * @param string $word

- * The word to add - *

- * @return void TRUE on success or FALSE on failure. - */ -function enchant_dict_add_to_personal ($dict, $word) {} - -/** - * (PHP 5 >= 5.3.0, PECL enchant >= 0.1.0 )
- * add 'word' to this spell-checking session - * @link http://php.net/manual/en/function.enchant-dict-add-to-session.php - * @param resource $dict

- * Dictionary resource - *

- * @param string $word

- * The word to add - *

- * @return void TRUE on success or FALSE on failure. - */ -function enchant_dict_add_to_session ($dict, $word) {} - -/** - * (PHP 5 >= 5.3.0, PECL enchant >= 0.1.0 )
- * whether or not 'word' exists in this spelling-session - * @link http://php.net/manual/en/function.enchant-dict-is-in-session.php - * @param resource $dict

- * Dictionary resource - *

- * @param string $word

- * The word to lookup - *

- * @return bool TRUE if the word exists or FALSE - */ -function enchant_dict_is_in_session ($dict, $word) {} - -/** - * (PHP 5 >= 5.3.0, PECL enchant >= 0.1.0 )
- * Add a correction for a word - * @link http://php.net/manual/en/function.enchant-dict-store-replacement.php - * @param resource $dict

- * Dictionary resource - *

- * @param string $mis

- * The work to fix - *

- * @param string $cor

- * The correct word - *

- * @return void TRUE on success or FALSE on failure. - */ -function enchant_dict_store_replacement ($dict, $mis, $cor) {} - -/** - * (PHP 5 >= 5.3.0, PECL enchant >= 0.1.0 )
- * Returns the last error of the current spelling-session - * @link http://php.net/manual/en/function.enchant-dict-get-error.php - * @param resource $dict

- * Dictinaray resource - *

- * @return string the error message as string or FALSE if no error occurred. - */ -function enchant_dict_get_error ($dict) {} - -/** - * (PHP 5 >= 5.3.0, PECL enchant >= 0.1.0 )
- * Describes an individual dictionary - * @link http://php.net/manual/en/function.enchant-dict-describe.php - * @param resource $dict

- * Dictinaray resource - *

- * @return mixed TRUE on success or FALSE on failure. - */ -function enchant_dict_describe ($dict) {} - -/** - * (PHP 5 >= 5.3.0, PECL enchant:0.2.0-1.0.1)
- * Check the word is correctly spelled and provide suggestions - * @link http://php.net/manual/en/function.enchant-dict-quick-check.php - * @param resource $dict

- * Dictionary resource - *

- * @param string $word

- * The word to check - *

- * @param array $suggestions [optional]

- * If the word is not correctly spelled, this variable will - * contain an array of suggestions. - *

- * @return bool TRUE if the word is correctly spelled or FALSE - */ -function enchant_dict_quick_check ($dict, $word, array &$suggestions = null) {} - -define ('ENCHANT_MYSPELL', 1); -define ('ENCHANT_ISPELL', 2); - -// End of enchant v.1.1.0 -?> diff --git a/phpruntime/ereg.php b/phpruntime/ereg.php deleted file mode 100644 index 032ab1d..0000000 --- a/phpruntime/ereg.php +++ /dev/null @@ -1,216 +0,0 @@ - - * Regular expression match - * @link http://php.net/manual/en/function.ereg.php - * @param string $pattern

- * Case sensitive regular expression. - *

- * @param string $string

- * The input string. - *

- * @param array $regs [optional]

- * If matches are found for parenthesized substrings of - * pattern and the function is called with the - * third argument regs, the matches will be stored - * in the elements of the array regs. - *

- *

- * $regs[1] will contain the substring which starts at - * the first left parenthesis; $regs[2] will contain - * the substring starting at the second, and so on. - * $regs[0] will contain a copy of the complete string - * matched. - *

- * @return int the length of the matched string if a match for - * pattern was found in string, - * or FALSE if no matches were found or an error occurred. - *

- *

- * If the optional parameter regs was not passed or - * the length of the matched string is 0, this function returns 1. - */ -function ereg ($pattern, $string, array &$regs = null) {} - -/** - * (PHP 4, PHP 5)
- * Replace regular expression - * @link http://php.net/manual/en/function.ereg-replace.php - * @param string $pattern

- * A POSIX extended regular expression. - *

- * @param string $replacement

- * If pattern contains parenthesized substrings, - * replacement may contain substrings of the form - * \digit, which will be - * replaced by the text matching the digit'th parenthesized substring; - * \0 will produce the entire contents of string. - * Up to nine substrings may be used. Parentheses may be nested, in which - * case they are counted by the opening parenthesis. - *

- * @param string $string

- * The input string. - *

- * @return string The modified string is returned. If no matches are found in - * string, then it will be returned unchanged. - */ -function ereg_replace ($pattern, $replacement, $string) {} - -/** - * (PHP 4, PHP 5)
- * Case insensitive regular expression match - * @link http://php.net/manual/en/function.eregi.php - * @param string $pattern

- * Case insensitive regular expression. - *

- * @param string $string

- * The input string. - *

- * @param array $regs [optional]

- * If matches are found for parenthesized substrings of - * pattern and the function is called with the - * third argument regs, the matches will be stored - * in the elements of the array regs. - *

- *

- * $regs[1] will contain the substring which starts at the first left - * parenthesis; $regs[2] will contain the substring starting at the - * second, and so on. $regs[0] will contain a copy of the complete string - * matched. - *

- * @return int the length of the matched string if a match for - * pattern was found in string, - * or FALSE if no matches were found or an error occurred. - *

- *

- * If the optional parameter regs was not passed or - * the length of the matched string is 0, this function returns 1. - */ -function eregi ($pattern, $string, array &$regs = null) {} - -/** - * (PHP 4, PHP 5)
- * Replace regular expression case insensitive - * @link http://php.net/manual/en/function.eregi-replace.php - * @param string $pattern

- * A POSIX extended regular expression. - *

- * @param string $replacement

- * If pattern contains parenthesized substrings, - * replacement may contain substrings of the form - * \digit, which will be - * replaced by the text matching the digit'th parenthesized substring; - * \0 will produce the entire contents of string. - * Up to nine substrings may be used. Parentheses may be nested, in which - * case they are counted by the opening parenthesis. - *

- * @param string $string

- * The input string. - *

- * @return string The modified string is returned. If no matches are found in - * string, then it will be returned unchanged. - */ -function eregi_replace ($pattern, $replacement, $string) {} - -/** - * (PHP 4, PHP 5)
- * Split string into array by regular expression - * @link http://php.net/manual/en/function.split.php - * @param string $pattern

- * Case sensitive regular expression. - *

- *

- * If you want to split on any of the characters which are considered - * special by regular expressions, you'll need to escape them first. If - * you think split (or any other regex function, for - * that matter) is doing something weird, please read the file - * regex.7, included in the - * regex/ subdirectory of the PHP distribution. It's - * in manpage format, so you'll want to do something along the lines of - * man /usr/local/src/regex/regex.7 in order to read it. - *

- * @param string $string

- * The input string. - *

- * @param int $limit [optional]

- * If limit is set, the returned array will - * contain a maximum of limit elements with the - * last element containing the whole rest of - * string. - *

- * @return array an array of strings, each of which is a substring of - * string formed by splitting it on boundaries formed - * by the case-sensitive regular expression pattern. - *

- *

- * If there are n occurrences of - * pattern, the returned array will contain - * n+1 items. For example, if - * there is no occurrence of pattern, an array with - * only one element will be returned. Of course, this is also true if - * string is empty. If an error occurs, - * split returns FALSE. - */ -function split ($pattern, $string, $limit = -1) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Split string into array by regular expression case insensitive - * @link http://php.net/manual/en/function.spliti.php - * @param string $pattern

- * Case insensitive regular expression. - *

- *

- * If you want to split on any of the characters which are considered - * special by regular expressions, you'll need to escape them first. If - * you think spliti (or any other regex function, for - * that matter) is doing something weird, please read the file - * regex.7, included in the - * regex/ subdirectory of the PHP distribution. It's - * in manpage format, so you'll want to do something along the lines of - * man /usr/local/src/regex/regex.7 in order to read it. - *

- * @param string $string

- * The input string. - *

- * @param int $limit [optional]

- * If limit is set, the returned array will - * contain a maximum of limit elements with the - * last element containing the whole rest of - * string. - *

- * @return array an array of strings, each of which is a substring of - * string formed by splitting it on boundaries formed - * by the case insensitive regular expression pattern. - *

- *

- * If there are n occurrences of - * pattern, the returned array will contain - * n+1 items. For example, if - * there is no occurrence of pattern, an array with - * only one element will be returned. Of course, this is also true if - * string is empty. If an error occurs, - * spliti returns FALSE. - */ -function spliti ($pattern, $string, $limit = -1) {} - -/** - * (PHP 4, PHP 5)
- * Make regular expression for case insensitive match - * @link http://php.net/manual/en/function.sql-regcase.php - * @param string $string

- * The input string. - *

- * @return string a valid regular expression which will match - * string, ignoring case. This expression is - * string with each alphabetic character converted to - * a bracket expression; this bracket expression contains that character's - * uppercase and lowercase form. Other characters remain unchanged. - */ -function sql_regcase ($string) {} - -// End of ereg v. -?> diff --git a/phpruntime/exif.php b/phpruntime/exif.php deleted file mode 100644 index c7eec50..0000000 --- a/phpruntime/exif.php +++ /dev/null @@ -1,147 +0,0 @@ - - * Reads the EXIF headers from JPEG or TIFF - * @link http://php.net/manual/en/function.exif-read-data.php - * @param string $filename

- * The name of the image file being read. This cannot be an - * URL. - *

- * @param string $sections [optional]

- * Is a comma separated list of sections that need to be present in file - * to produce a result array. If none of the requested - * sections could be found the return value is FALSE. - * - * FILE - * FileName, FileSize, FileDateTime, SectionsFound - * - * - * COMPUTED - * - * html, Width, Height, IsColor, and more if available. Height and - * Width are computed the same way getimagesize - * does so their values must not be part of any header returned. - * Also, html is a height/width text string to be used inside normal - * HTML. - * - * - * - * ANY_TAG - * Any information that has a Tag e.g. IFD0, EXIF, ... - * - * - * IFD0 - * - * All tagged data of IFD0. In normal imagefiles this contains - * image size and so forth. - * - * - * - * THUMBNAIL - * - * A file is supposed to contain a thumbnail if it has a second IFD. - * All tagged information about the embedded thumbnail is stored in - * this section. - * - * - * - * COMMENT - * Comment headers of JPEG images. - * - * - * EXIF - * - * The EXIF section is a sub section of IFD0. It contains - * more detailed information about an image. Most of these entries - * are digital camera related. - * - * - *

- * @param bool $arrays [optional]

- * Specifies whether or not each section becomes an array. The - * sections COMPUTED, - * THUMBNAIL, and COMMENT - * always become arrays as they may contain values whose names conflict - * with other sections. - *

- * @param bool $thumbnail [optional]

- * When set to TRUE the thumbnail itself is read. Otherwise, only the - * tagged data is read. - *

- * @return array It returns an associative array where the array indexes are - * the header names and the array values are the values associated with - * those headers. If no data can be returned, - * exif_read_data will return FALSE. - */ -function exif_read_data ($filename, $sections = null, $arrays = false, $thumbnail = false) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Alias of exif_read_data - * @link http://php.net/manual/en/function.read-exif-data.php - * @param $filename - * @param $sections_needed [optional] - * @param $sub_arrays [optional] - * @param $read_thumbnail [optional] - */ -function read_exif_data ($filename, $sections_needed, $sub_arrays, $read_thumbnail) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Get the header name for an index - * @link http://php.net/manual/en/function.exif-tagname.php - * @param int $index

- * The Tag ID for which a Tag Name will be looked up. - *

- * @return string the header name, or FALSE if index is - * not a defined EXIF tag id. - */ -function exif_tagname ($index) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Retrieve the embedded thumbnail of a TIFF or JPEG image - * @link http://php.net/manual/en/function.exif-thumbnail.php - * @param string $filename

- * The name of the image file being read. This image contains an - * embedded thumbnail. - *

- * @param int $width [optional]

- * The return width of the returned thumbnail. - *

- * @param int $height [optional]

- * The returned height of the returned thumbnail. - *

- * @param int $imagetype [optional]

- * The returned image type of the returned thumbnail. This is either - * TIFF or JPEG. - *

- * @return string the embedded thumbnail, or FALSE if the image contains no - * thumbnail. - */ -function exif_thumbnail ($filename, &$width = null, &$height = null, &$imagetype = null) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Determine the type of an image - * @link http://php.net/manual/en/function.exif-imagetype.php - * @param string $filename The image being checked. - * @return int When a correct signature is found, the appropriate constant value will be - * returned otherwise the return value is FALSE. The return value is the - * same value that getimagesize returns in index 2 but - * exif_imagetype is much faster. - *

- *

- * exif_imagetype will emit an E_NOTICE - * and return FALSE if it is unable to read enough bytes from the file to - * determine the image type. - */ -function exif_imagetype ($filename) {} - -define ('EXIF_USE_MBSTRING', 1); - -// End of exif v.1.4 $Id$ -?> diff --git a/phpruntime/fileinfo.php b/phpruntime/fileinfo.php deleted file mode 100644 index 45f1b0c..0000000 --- a/phpruntime/fileinfo.php +++ /dev/null @@ -1,190 +0,0 @@ - - * Set libmagic configuration options - * @link http://php.net/manual/en/function.finfo-set-flags.php - * @param int $options

- * One or disjunction of more Fileinfo - * constants. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function set_flags ($options) {} - - /** - * (PHP >= 5.3.0, PECL fileinfo >= 0.1.0)
- * Return information about a file - * @link http://php.net/manual/en/function.finfo-file.php - * @param string $file_name [optional]

- * Name of a file to be checked. - *

- * @param int $options [optional]

- * One or disjunction of more Fileinfo - * constants. - *

- * @param resource $context [optional]

- * For a description of contexts, refer to . - *

- * @return string a textual description of the contents of the - * filename argument, or FALSE if an error occurred. - */ - public function file ($file_name = null, $options = 'FILEINFO_NONE', $context = null) {} - - /** - * (PHP 5 >= 5.3.0, PECL fileinfo >= 0.1.0)
- * Return information about a string buffer - * @link http://php.net/manual/en/function.finfo-buffer.php - * @param string $string [optional]

- * Content of a file to be checked. - *

- * @param int $options [optional]

- * One or disjunction of more Fileinfo - * constants. - *

- * @param resource $context [optional] - * @return string a textual description of the string - * argument, or FALSE if an error occurred. - */ - public function buffer ($string = null, $options = 'FILEINFO_NONE', $context = null) {} - -} - -/** - * (PHP >= 5.3.0, PECL fileinfo >= 0.1.0)
- * Create a new fileinfo resource - * @link http://php.net/manual/en/function.finfo-open.php - * @param $options [optional] - * @param $arg [optional] - * @return mixed (Procedural style only) - * Returns a magic database resource on success or FALSE on failure. - */ -function finfo_open ($options, $arg) {} - -/** - * (PHP >= 5.3.0, PECL fileinfo >= 0.1.0)
- * Close fileinfo resource - * @link http://php.net/manual/en/function.finfo-close.php - * @param $finfo - * @return mixed TRUE on success or FALSE on failure. - */ -function finfo_close ($finfo) {} - -/** - * (PHP >= 5.3.0, PECL fileinfo >= 0.1.0)
- * Set libmagic configuration options - * @link http://php.net/manual/en/function.finfo-set-flags.php - * @param $finfo - * @param $options - * @return mixed TRUE on success or FALSE on failure. - */ -function finfo_set_flags ($finfo, $options) {} - -/** - * (PHP >= 5.3.0, PECL fileinfo >= 0.1.0)
- * Return information about a file - * @link http://php.net/manual/en/function.finfo-file.php - * @param $finfo - * @param $filename - * @param $options [optional] - * @param $context [optional] - * @return mixed a textual description of the contents of the - * filename argument, or FALSE if an error occurred. - */ -function finfo_file ($finfo, $filename, $options, $context) {} - -/** - * (PHP 5 >= 5.3.0, PECL fileinfo >= 0.1.0)
- * Return information about a string buffer - * @link http://php.net/manual/en/function.finfo-buffer.php - * @param $finfo - * @param $string - * @param $options [optional] - * @param $context [optional] - * @return mixed a textual description of the string - * argument, or FALSE if an error occurred. - */ -function finfo_buffer ($finfo, $string, $options, $context) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Detect MIME Content-type for a file (deprecated) - * @link http://php.net/manual/en/function.mime-content-type.php - * @param string $filename

- * Path to the tested file. - *

- * @return string the content type in MIME format, like - * text/plain or application/octet-stream. - */ -function mime_content_type ($filename) {} - - -/** - * No special handling. - * @link http://php.net/manual/en/fileinfo.constants.php - */ -define ('FILEINFO_NONE', 0); - -/** - * Follow symlinks. - * @link http://php.net/manual/en/fileinfo.constants.php - */ -define ('FILEINFO_SYMLINK', 2); - -/** - * Return the mime type and mime encoding as defined by RFC 2045. - * @link http://php.net/manual/en/fileinfo.constants.php - */ -define ('FILEINFO_MIME', 1040); - -/** - * Return the mime type. - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/fileinfo.constants.php - */ -define ('FILEINFO_MIME_TYPE', 16); - -/** - * Return the mime encoding of the file. - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/fileinfo.constants.php - */ -define ('FILEINFO_MIME_ENCODING', 1024); - -/** - * Look at the contents of blocks or character special devices. - * @link http://php.net/manual/en/fileinfo.constants.php - */ -define ('FILEINFO_DEVICES', 8); - -/** - * Return all matches, not just the first. - * @link http://php.net/manual/en/fileinfo.constants.php - */ -define ('FILEINFO_CONTINUE', 32); - -/** - * If possible preserve the original access time. - * @link http://php.net/manual/en/fileinfo.constants.php - */ -define ('FILEINFO_PRESERVE_ATIME', 128); - -/** - * Don't translate unprintable characters to a \ooo octal - * representation. - * @link http://php.net/manual/en/fileinfo.constants.php - */ -define ('FILEINFO_RAW', 256); - -// End of fileinfo v.1.0.5 -?> diff --git a/phpruntime/filter.php b/phpruntime/filter.php deleted file mode 100644 index 25be31f..0000000 --- a/phpruntime/filter.php +++ /dev/null @@ -1,487 +0,0 @@ - - * Gets a specific external variable by name and optionally filters it - * @link http://php.net/manual/en/function.filter-input.php - * @param int $type

- * One of INPUT_GET, INPUT_POST, - * INPUT_COOKIE, INPUT_SERVER, or - * INPUT_ENV. - *

- * @param string $variable_name

- * Name of a variable to get. - *

- * @param int $filter [optional]

- * The ID of the filter to apply. The - * manual page lists the available filters. - *

- * @param mixed $options [optional]

- * Associative array of options or bitwise disjunction of flags. If filter - * accepts options, flags can be provided in "flags" field of array. - *

- * @return mixed Value of the requested variable on success, FALSE if the filter fails, - * or NULL if the variable_name variable is not set. - * If the flag FILTER_NULL_ON_FAILURE is used, it - * returns FALSE if the variable is not set and NULL if the filter fails. - */ -function filter_input ($type, $variable_name, $filter = 'FILTER_DEFAULT', $options = null) {} - -/** - * (PHP 5 >= 5.2.0)
- * Filters a variable with a specified filter - * @link http://php.net/manual/en/function.filter-var.php - * @param mixed $variable

- * Value to filter. - *

- * @param int $filter [optional]

- * The ID of the filter to apply. The - * manual page lists the available filters. - *

- * @param mixed $options [optional]

- * Associative array of options or bitwise disjunction of flags. If filter - * accepts options, flags can be provided in "flags" field of array. For - * the "callback" filter, callable type should be passed. The - * callback must accept one argument, the value to be filtered, and return - * the value after filtering/sanitizing it. - *

- *

- * - * // for filters that accept options, use this format - * $options = array( - * 'options' => array( - * 'default' => 3, // value to return if the filter fails - * // other options here - * 'min_range' => 0 - * ), - * 'flags' => FILTER_FLAG_ALLOW_OCTAL, - * ); - * $var = filter_var('0755', FILTER_VALIDATE_INT, $options); - * // for filter that only accept flags, you can pass them directly - * $var = filter_var('oops', FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); - * // for filter that only accept flags, you can also pass as an array - * $var = filter_var('oops', FILTER_VALIDATE_BOOLEAN, - * array('flags' => FILTER_NULL_ON_FAILURE)); - * // callback validate filter - * function foo($value) - * { - * // Expected format: Surname, GivenNames - * if (strpos($value, ", ") === false) return false; - * list($surname, $givennames) = explode(", ", $value, 2); - * $empty = (empty($surname) || empty($givennames)); - * $notstrings = (!is_string($surname) || !is_string($givennames)); - * if ($empty || $notstrings) { - * return false; - * } else { - * return $value; - * } - * } - * $var = filter_var('Doe, Jane Sue', FILTER_CALLBACK, array('options' => 'foo')); - * - *

- * @return mixed the filtered data, or FALSE if the filter fails. - */ -function filter_var ($variable, $filter = 'FILTER_DEFAULT', $options = null) {} - -/** - * (PHP 5 >= 5.2.0)
- * Gets external variables and optionally filters them - * @link http://php.net/manual/en/function.filter-input-array.php - * @param int $type

- * One of INPUT_GET, INPUT_POST, - * INPUT_COOKIE, INPUT_SERVER, or - * INPUT_ENV. - *

- * @param mixed $definition [optional]

- * An array defining the arguments. A valid key is a string - * containing a variable name and a valid value is either a filter type, or an array - * optionally specifying the filter, flags and options. If the value is an - * array, valid keys are filter which specifies the - * filter type, - * flags which specifies any flags that apply to the - * filter, and options which specifies any options that - * apply to the filter. See the example below for a better understanding. - *

- *

- * This parameter can be also an integer holding a filter constant. Then all values in the - * input array are filtered by this filter. - *

- * @return mixed An array containing the values of the requested variables on success, or FALSE - * on failure. An array value will be FALSE if the filter fails, or NULL if - * the variable is not set. Or if the flag FILTER_NULL_ON_FAILURE - * is used, it returns FALSE if the variable is not set and NULL if the filter - * fails. - */ -function filter_input_array ($type, $definition = null) {} - -/** - * (PHP 5 >= 5.2.0)
- * Gets multiple variables and optionally filters them - * @link http://php.net/manual/en/function.filter-var-array.php - * @param array $data

- * An array with string keys containing the data to filter. - *

- * @param mixed $definition [optional]

- * An array defining the arguments. A valid key is a string - * containing a variable name and a valid value is either a - * filter type, or an - * array optionally specifying the filter, flags and options. - * If the value is an array, valid keys are filter - * which specifies the filter type, - * flags which specifies any flags that apply to the - * filter, and options which specifies any options that - * apply to the filter. See the example below for a better understanding. - *

- *

- * This parameter can be also an integer holding a filter constant. Then all values in the - * input array are filtered by this filter. - *

- * @return mixed An array containing the values of the requested variables on success, or FALSE - * on failure. An array value will be FALSE if the filter fails, or NULL if - * the variable is not set. - */ -function filter_var_array (array $data, $definition = null) {} - -/** - * (PHP 5 >= 5.2.0)
- * Returns a list of all supported filters - * @link http://php.net/manual/en/function.filter-list.php - * @return array an array of names of all supported filters, empty array if there - * are no such filters. Indexes of this array are not filter IDs, they can be - * obtained with filter_id from a name instead. - */ -function filter_list () {} - -/** - * (PHP 5 >= 5.2.0)
- * Checks if variable of specified type exists - * @link http://php.net/manual/en/function.filter-has-var.php - * @param int $type

- * One of INPUT_GET, INPUT_POST, - * INPUT_COOKIE, INPUT_SERVER, or - * INPUT_ENV. - *

- * @param string $variable_name

- * Name of a variable to check. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function filter_has_var ($type, $variable_name) {} - -/** - * (PHP 5 >= 5.2.0)
- * Returns the filter ID belonging to a named filter - * @link http://php.net/manual/en/function.filter-id.php - * @param string $filtername

- * Name of a filter to get. - *

- * @return int ID of a filter on success or FALSE if filter doesn't exist. - */ -function filter_id ($filtername) {} - - -/** - * POST variables. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('INPUT_POST', 0); - -/** - * GET variables. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('INPUT_GET', 1); - -/** - * COOKIE variables. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('INPUT_COOKIE', 2); - -/** - * ENV variables. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('INPUT_ENV', 4); - -/** - * SERVER variables. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('INPUT_SERVER', 5); - -/** - * SESSION variables. - * (not implemented yet) - * @link http://php.net/manual/en/filter.constants.php - */ -define ('INPUT_SESSION', 6); - -/** - * REQUEST variables. - * (not implemented yet) - * @link http://php.net/manual/en/filter.constants.php - */ -define ('INPUT_REQUEST', 99); - -/** - * No flags. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_FLAG_NONE', 0); - -/** - * Flag used to require scalar as input - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_REQUIRE_SCALAR', 33554432); - -/** - * Require an array as input. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_REQUIRE_ARRAY', 16777216); - -/** - * Always returns an array. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_FORCE_ARRAY', 67108864); - -/** - * Use NULL instead of FALSE on failure. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_NULL_ON_FAILURE', 134217728); - -/** - * ID of "int" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_VALIDATE_INT', 257); - -/** - * ID of "boolean" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_VALIDATE_BOOLEAN', 258); - -/** - * ID of "float" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_VALIDATE_FLOAT', 259); - -/** - * ID of "validate_regexp" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_VALIDATE_REGEXP', 272); - -/** - * ID of "validate_url" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_VALIDATE_URL', 273); - -/** - * ID of "validate_email" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_VALIDATE_EMAIL', 274); - -/** - * ID of "validate_ip" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_VALIDATE_IP', 275); - -/** - * ID of default ("string") filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_DEFAULT', 516); - -/** - * ID of "unsafe_raw" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_UNSAFE_RAW', 516); - -/** - * ID of "string" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_SANITIZE_STRING', 513); - -/** - * ID of "stripped" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_SANITIZE_STRIPPED', 513); - -/** - * ID of "encoded" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_SANITIZE_ENCODED', 514); - -/** - * ID of "special_chars" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_SANITIZE_SPECIAL_CHARS', 515); -define ('FILTER_SANITIZE_FULL_SPECIAL_CHARS', 515); - -/** - * ID of "email" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_SANITIZE_EMAIL', 517); - -/** - * ID of "url" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_SANITIZE_URL', 518); - -/** - * ID of "number_int" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_SANITIZE_NUMBER_INT', 519); - -/** - * ID of "number_float" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_SANITIZE_NUMBER_FLOAT', 520); - -/** - * ID of "magic_quotes" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_SANITIZE_MAGIC_QUOTES', 521); - -/** - * ID of "callback" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_CALLBACK', 1024); - -/** - * Allow octal notation (0[0-7]+) in "int" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_FLAG_ALLOW_OCTAL', 1); - -/** - * Allow hex notation (0x[0-9a-fA-F]+) in "int" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_FLAG_ALLOW_HEX', 2); - -/** - * Strip characters with ASCII value less than 32. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_FLAG_STRIP_LOW', 4); - -/** - * Strip characters with ASCII value greater than 127. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_FLAG_STRIP_HIGH', 8); -define ('FILTER_FLAG_STRIP_BACKTICK', 512); - -/** - * Encode characters with ASCII value less than 32. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_FLAG_ENCODE_LOW', 16); - -/** - * Encode characters with ASCII value greater than 127. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_FLAG_ENCODE_HIGH', 32); - -/** - * Encode &#38;. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_FLAG_ENCODE_AMP', 64); - -/** - * Don't encode ' and ". - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_FLAG_NO_ENCODE_QUOTES', 128); - -/** - * (No use for now.) - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_FLAG_EMPTY_STRING_NULL', 256); - -/** - * Allow fractional part in "number_float" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_FLAG_ALLOW_FRACTION', 4096); - -/** - * Allow thousand separator (,) in "number_float" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_FLAG_ALLOW_THOUSAND', 8192); - -/** - * Allow scientific notation (e, E) in - * "number_float" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_FLAG_ALLOW_SCIENTIFIC', 16384); -define ('FILTER_FLAG_SCHEME_REQUIRED', 65536); -define ('FILTER_FLAG_HOST_REQUIRED', 131072); - -/** - * Require path in "validate_url" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_FLAG_PATH_REQUIRED', 262144); - -/** - * Require query in "validate_url" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_FLAG_QUERY_REQUIRED', 524288); - -/** - * Allow only IPv4 address in "validate_ip" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_FLAG_IPV4', 1048576); - -/** - * Allow only IPv6 address in "validate_ip" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_FLAG_IPV6', 2097152); - -/** - * Deny reserved addresses in "validate_ip" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_FLAG_NO_RES_RANGE', 4194304); - -/** - * Deny private addresses in "validate_ip" filter. - * @link http://php.net/manual/en/filter.constants.php - */ -define ('FILTER_FLAG_NO_PRIV_RANGE', 8388608); - -// End of filter v.0.11.0 -?> diff --git a/phpruntime/ftp.php b/phpruntime/ftp.php deleted file mode 100644 index 2de8f02..0000000 --- a/phpruntime/ftp.php +++ /dev/null @@ -1,702 +0,0 @@ - - * Opens an FTP connection - * @link http://php.net/manual/en/function.ftp-connect.php - * @param string $host

- * The FTP server address. This parameter shouldn't have any trailing - * slashes and shouldn't be prefixed with ftp://. - *

- * @param int $port [optional]

- * This parameter specifies an alternate port to connect to. If it is - * omitted or set to zero, then the default FTP port, 21, will be used. - *

- * @param int $timeout [optional]

- * This parameter specifies the timeout for all subsequent network operations. - * If omitted, the default value is 90 seconds. The timeout can be changed and - * queried at any time with ftp_set_option and - * ftp_get_option. - *

- * @return resource a FTP stream on success or FALSE on error. - */ -function ftp_connect ($host, $port = 21, $timeout = 90) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Opens an Secure SSL-FTP connection - * @link http://php.net/manual/en/function.ftp-ssl-connect.php - * @param string $host

- * The FTP server address. This parameter shouldn't have any trailing - * slashes and shouldn't be prefixed with ftp://. - *

- * @param int $port [optional]

- * This parameter specifies an alternate port to connect to. If it is - * omitted or set to zero, then the default FTP port, 21, will be used. - *

- * @param int $timeout [optional]

- * This parameter specifies the timeout for all subsequent network operations. - * If omitted, the default value is 90 seconds. The timeout can be changed and - * queried at any time with ftp_set_option and - * ftp_get_option. - *

- * @return resource a SSL-FTP stream on success or FALSE on error. - */ -function ftp_ssl_connect ($host, $port = 21, $timeout = 90) {} - -/** - * (PHP 4, PHP 5)
- * Logs in to an FTP connection - * @link http://php.net/manual/en/function.ftp-login.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param string $username

- * The username (USER). - *

- * @param string $password

- * The password (PASS). - *

- * @return bool TRUE on success or FALSE on failure. - * If login fails, PHP will also throw a warning. - */ -function ftp_login ($ftp_stream, $username, $password) {} - -/** - * (PHP 4, PHP 5)
- * Returns the current directory name - * @link http://php.net/manual/en/function.ftp-pwd.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @return string the current directory name or FALSE on error. - */ -function ftp_pwd ($ftp_stream) {} - -/** - * (PHP 4, PHP 5)
- * Changes to the parent directory - * @link http://php.net/manual/en/function.ftp-cdup.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ftp_cdup ($ftp_stream) {} - -/** - * (PHP 4, PHP 5)
- * Changes the current directory on a FTP server - * @link http://php.net/manual/en/function.ftp-chdir.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param string $directory

- * The target directory. - *

- * @return bool TRUE on success or FALSE on failure. - * If changing directory fails, PHP will also throw a warning. - */ -function ftp_chdir ($ftp_stream, $directory) {} - -/** - * (PHP 4 >= 4.0.3, PHP 5)
- * Requests execution of a command on the FTP server - * @link http://php.net/manual/en/function.ftp-exec.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param string $command

- * The command to execute. - *

- * @return bool TRUE if the command was successful (server sent response code: - * 200); otherwise returns FALSE. - */ -function ftp_exec ($ftp_stream, $command) {} - -/** - * (PHP 5)
- * Sends an arbitrary command to an FTP server - * @link http://php.net/manual/en/function.ftp-raw.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param string $command

- * The command to execute. - *

- * @return array the server's response as an array of strings. - * No parsing is performed on the response string, nor does - * ftp_raw determine if the command succeeded. - */ -function ftp_raw ($ftp_stream, $command) {} - -/** - * (PHP 4, PHP 5)
- * Creates a directory - * @link http://php.net/manual/en/function.ftp-mkdir.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param string $directory

- * The name of the directory that will be created. - *

- * @return string the newly created directory name on success or FALSE on error. - */ -function ftp_mkdir ($ftp_stream, $directory) {} - -/** - * (PHP 4, PHP 5)
- * Removes a directory - * @link http://php.net/manual/en/function.ftp-rmdir.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param string $directory

- * The directory to delete. This must be either an absolute or relative - * path to an empty directory. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ftp_rmdir ($ftp_stream, $directory) {} - -/** - * (PHP 5)
- * Set permissions on a file via FTP - * @link http://php.net/manual/en/function.ftp-chmod.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param int $mode

- * The new permissions, given as an octal value. - *

- * @param string $filename

- * The remote file. - *

- * @return int the new file permissions on success or FALSE on error. - */ -function ftp_chmod ($ftp_stream, $mode, $filename) {} - -/** - * (PHP 5)
- * Allocates space for a file to be uploaded - * @link http://php.net/manual/en/function.ftp-alloc.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param int $filesize

- * The number of bytes to allocate. - *

- * @param string $result [optional]

- * A textual representation of the servers response will be returned by - * reference in result if a variable is provided. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ftp_alloc ($ftp_stream, $filesize, &$result = null) {} - -/** - * (PHP 4, PHP 5)
- * Returns a list of files in the given directory - * @link http://php.net/manual/en/function.ftp-nlist.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param string $directory

- * The directory to be listed. This parameter can also include arguments, eg. - * ftp_nlist($conn_id, "-la /your/dir"); - * Note that this parameter isn't escaped so there may be some issues with - * filenames containing spaces and other characters. - *

- * @return array an array of filenames from the specified directory on success or - * FALSE on error. - */ -function ftp_nlist ($ftp_stream, $directory) {} - -/** - * (PHP 4, PHP 5)
- * Returns a detailed list of files in the given directory - * @link http://php.net/manual/en/function.ftp-rawlist.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param string $directory

- * The directory path. May include arguments for the LIST - * command. - *

- * @param bool $recursive [optional]

- * If set to TRUE, the issued command will be LIST -R. - *

- * @return array an array where each element corresponds to one line of text. - *

- *

- * The output is not parsed in any way. The system type identifier returned by - * ftp_systype can be used to determine how the results - * should be interpreted. - */ -function ftp_rawlist ($ftp_stream, $directory, $recursive = false) {} - -/** - * (PHP 4, PHP 5)
- * Returns the system type identifier of the remote FTP server - * @link http://php.net/manual/en/function.ftp-systype.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @return string the remote system type, or FALSE on error. - */ -function ftp_systype ($ftp_stream) {} - -/** - * (PHP 4, PHP 5)
- * Turns passive mode on or off - * @link http://php.net/manual/en/function.ftp-pasv.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param bool $pasv

- * If TRUE, the passive mode is turned on, else it's turned off. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ftp_pasv ($ftp_stream, $pasv) {} - -/** - * (PHP 4, PHP 5)
- * Downloads a file from the FTP server - * @link http://php.net/manual/en/function.ftp-get.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param string $local_file

- * The local file path (will be overwritten if the file already exists). - *

- * @param string $remote_file

- * The remote file path. - *

- * @param int $mode

- * The transfer mode. Must be either FTP_ASCII or - * FTP_BINARY. - *

- * @param int $resumepos [optional]

- * The position in the remote file to start downloading from. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ftp_get ($ftp_stream, $local_file, $remote_file, $mode, $resumepos = 0) {} - -/** - * (PHP 4, PHP 5)
- * Downloads a file from the FTP server and saves to an open file - * @link http://php.net/manual/en/function.ftp-fget.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param resource $handle

- * An open file pointer in which we store the data. - *

- * @param string $remote_file

- * The remote file path. - *

- * @param int $mode

- * The transfer mode. Must be either FTP_ASCII or - * FTP_BINARY. - *

- * @param int $resumepos [optional]

- * The position in the remote file to start downloading from. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ftp_fget ($ftp_stream, $handle, $remote_file, $mode, $resumepos = 0) {} - -/** - * (PHP 4, PHP 5)
- * Uploads a file to the FTP server - * @link http://php.net/manual/en/function.ftp-put.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param string $remote_file

- * The remote file path. - *

- * @param string $local_file

- * The local file path. - *

- * @param int $mode

- * The transfer mode. Must be either FTP_ASCII or - * FTP_BINARY. - *

- * @param int $startpos [optional]

The position in the remote file to start uploading to.

- * @return bool TRUE on success or FALSE on failure. - */ -function ftp_put ($ftp_stream, $remote_file, $local_file, $mode, $startpos = 0) {} - -/** - * (PHP 4, PHP 5)
- * Uploads from an open file to the FTP server - * @link http://php.net/manual/en/function.ftp-fput.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param string $remote_file

- * The remote file path. - *

- * @param resource $handle

- * An open file pointer on the local file. Reading stops at end of file. - *

- * @param int $mode

- * The transfer mode. Must be either FTP_ASCII or - * FTP_BINARY. - *

- * @param int $startpos [optional]

The position in the remote file to start uploading to.

- * @return bool TRUE on success or FALSE on failure. - */ -function ftp_fput ($ftp_stream, $remote_file, $handle, $mode, $startpos = 0) {} - -/** - * (PHP 4, PHP 5)
- * Returns the size of the given file - * @link http://php.net/manual/en/function.ftp-size.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param string $remote_file

- * The remote file. - *

- * @return int the file size on success, or -1 on error. - */ -function ftp_size ($ftp_stream, $remote_file) {} - -/** - * (PHP 4, PHP 5)
- * Returns the last modified time of the given file - * @link http://php.net/manual/en/function.ftp-mdtm.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param string $remote_file

- * The file from which to extract the last modification time. - *

- * @return int the last modified time as a Unix timestamp on success, or -1 on - * error. - */ -function ftp_mdtm ($ftp_stream, $remote_file) {} - -/** - * (PHP 4, PHP 5)
- * Renames a file or a directory on the FTP server - * @link http://php.net/manual/en/function.ftp-rename.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param string $oldname

- * The old file/directory name. - *

- * @param string $newname

- * The new name. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ftp_rename ($ftp_stream, $oldname, $newname) {} - -/** - * (PHP 4, PHP 5)
- * Deletes a file on the FTP server - * @link http://php.net/manual/en/function.ftp-delete.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param string $path

- * The file to delete. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ftp_delete ($ftp_stream, $path) {} - -/** - * (PHP 4, PHP 5)
- * Sends a SITE command to the server - * @link http://php.net/manual/en/function.ftp-site.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param string $command

- * The SITE command. Note that this parameter isn't escaped so there may - * be some issues with filenames containing spaces and other characters. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ftp_site ($ftp_stream, $command) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Closes an FTP connection - * @link http://php.net/manual/en/function.ftp-close.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ftp_close ($ftp_stream) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Set miscellaneous runtime FTP options - * @link http://php.net/manual/en/function.ftp-set-option.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param int $option

- * Currently, the following options are supported: - * - * Supported runtime FTP options - * - * - * - * - * - * - * - * - *
FTP_TIMEOUT_SEC - * Changes the timeout in seconds used for all network related - * functions. value must be an integer that - * is greater than 0. The default timeout is 90 seconds. - *
FTP_AUTOSEEK - * When enabled, GET or PUT requests with a - * resumepos or startpos - * parameter will first seek to the requested position within the file. - * This is enabled by default. - *
- *

- * @param mixed $value

- * This parameter depends on which option is chosen - * to be altered. - *

- * @return bool TRUE if the option could be set; FALSE if not. A warning - * message will be thrown if the option is not - * supported or the passed value doesn't match the - * expected value for the given option. - */ -function ftp_set_option ($ftp_stream, $option, $value) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Retrieves various runtime behaviours of the current FTP stream - * @link http://php.net/manual/en/function.ftp-get-option.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param int $option

- * Currently, the following options are supported: - * - * Supported runtime FTP options - * - * - * - * - * - * - * - * - *
FTP_TIMEOUT_SEC - * Returns the current timeout used for network related operations. - *
FTP_AUTOSEEK - * Returns TRUE if this option is on, FALSE otherwise. - *
- *

- * @return mixed the value on success or FALSE if the given - * option is not supported. In the latter case, a - * warning message is also thrown. - */ -function ftp_get_option ($ftp_stream, $option) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Retrieves a file from the FTP server and writes it to an open file (non-blocking) - * @link http://php.net/manual/en/function.ftp-nb-fget.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param resource $handle

- * An open file pointer in which we store the data. - *

- * @param string $remote_file

- * The remote file path. - *

- * @param int $mode

- * The transfer mode. Must be either FTP_ASCII or - * FTP_BINARY. - *

- * @param int $resumepos [optional]

The position in the remote file to start downloading from.

- * @return int FTP_FAILED or FTP_FINISHED - * or FTP_MOREDATA. - */ -function ftp_nb_fget ($ftp_stream, $handle, $remote_file, $mode, $resumepos = 0) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Retrieves a file from the FTP server and writes it to a local file (non-blocking) - * @link http://php.net/manual/en/function.ftp-nb-get.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param string $local_file

- * The local file path (will be overwritten if the file already exists). - *

- * @param string $remote_file

- * The remote file path. - *

- * @param int $mode

- * The transfer mode. Must be either FTP_ASCII or - * FTP_BINARY. - *

- * @param int $resumepos [optional]

The position in the remote file to start downloading from.

- * @return int FTP_FAILED or FTP_FINISHED - * or FTP_MOREDATA. - */ -function ftp_nb_get ($ftp_stream, $local_file, $remote_file, $mode, $resumepos = 0) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Continues retrieving/sending a file (non-blocking) - * @link http://php.net/manual/en/function.ftp-nb-continue.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @return int FTP_FAILED or FTP_FINISHED - * or FTP_MOREDATA. - */ -function ftp_nb_continue ($ftp_stream) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Stores a file on the FTP server (non-blocking) - * @link http://php.net/manual/en/function.ftp-nb-put.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param string $remote_file

- * The remote file path. - *

- * @param string $local_file

- * The local file path. - *

- * @param int $mode

- * The transfer mode. Must be either FTP_ASCII or - * FTP_BINARY. - *

- * @param int $startpos [optional]

The position in the remote file to start uploading to.

- * @return int FTP_FAILED or FTP_FINISHED - * or FTP_MOREDATA. - */ -function ftp_nb_put ($ftp_stream, $remote_file, $local_file, $mode, $startpos = 0) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Stores a file from an open file to the FTP server (non-blocking) - * @link http://php.net/manual/en/function.ftp-nb-fput.php - * @param resource $ftp_stream

- * The link identifier of the FTP connection. - *

- * @param string $remote_file

- * The remote file path. - *

- * @param resource $handle

- * An open file pointer on the local file. Reading stops at end of file. - *

- * @param int $mode

- * The transfer mode. Must be either FTP_ASCII or - * FTP_BINARY. - *

- * @param int $startpos [optional]

The position in the remote file to start uploading to.

- * @return int FTP_FAILED or FTP_FINISHED - * or FTP_MOREDATA. - */ -function ftp_nb_fput ($ftp_stream, $remote_file, $handle, $mode, $startpos = 0) {} - -/** - * (PHP 4, PHP 5)
- * Alias of ftp_close - * @link http://php.net/manual/en/function.ftp-quit.php - * @param $ftp - */ -function ftp_quit ($ftp) {} - - -/** - *

- * @link http://php.net/manual/en/ftp.constants.php - */ -define ('FTP_ASCII', 1); - -/** - *

- * @link http://php.net/manual/en/ftp.constants.php - */ -define ('FTP_TEXT', 1); - -/** - *

- * @link http://php.net/manual/en/ftp.constants.php - */ -define ('FTP_BINARY', 2); - -/** - *

- * @link http://php.net/manual/en/ftp.constants.php - */ -define ('FTP_IMAGE', 2); - -/** - *

- * Automatically determine resume position and start position for GET and PUT requests - * (only works if FTP_AUTOSEEK is enabled) - *

- * @link http://php.net/manual/en/ftp.constants.php - */ -define ('FTP_AUTORESUME', -1); - -/** - *

- * See ftp_set_option for information. - *

- * @link http://php.net/manual/en/ftp.constants.php - */ -define ('FTP_TIMEOUT_SEC', 0); - -/** - *

- * See ftp_set_option for information. - *

- * @link http://php.net/manual/en/ftp.constants.php - */ -define ('FTP_AUTOSEEK', 1); - -/** - *

- * Asynchronous transfer has failed - *

- * @link http://php.net/manual/en/ftp.constants.php - */ -define ('FTP_FAILED', 0); - -/** - *

- * Asynchronous transfer has finished - *

- * @link http://php.net/manual/en/ftp.constants.php - */ -define ('FTP_FINISHED', 1); - -/** - *

- * Asynchronous transfer is still active - *

- * @link http://php.net/manual/en/ftp.constants.php - */ -define ('FTP_MOREDATA', 2); - -// End of ftp v. -?> diff --git a/phpruntime/gd.php b/phpruntime/gd.php deleted file mode 100644 index c130d48..0000000 --- a/phpruntime/gd.php +++ /dev/null @@ -1,2113 +0,0 @@ - - * Retrieve information about the currently installed GD library - * @link http://php.net/manual/en/function.gd-info.php - * @return array an associative array. - *

- *

- * - * Elements of array returned by gd_info - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
AttributeMeaning
GD Versionstring value describing the installed - * libgd version.
FreeType Supportboolean value. TRUE - * if FreeType Support is installed.
FreeType Linkagestring value describing the way in which - * FreeType was linked. Expected values are: 'with freetype', - * 'with TTF library', and 'with unknown library'. This element will - * only be defined if FreeType Support evaluated to - * TRUE.
T1Lib Supportboolean value. TRUE - * if T1Lib support is included.
GIF Read Supportboolean value. TRUE - * if support for reading GIF - * images is included.
GIF Create Supportboolean value. TRUE - * if support for creating GIF - * images is included.
JPEG Supportboolean value. TRUE - * if JPEG support is included.
PNG Supportboolean value. TRUE - * if PNG support is included.
WBMP Supportboolean value. TRUE - * if WBMP support is included.
XBM Supportboolean value. TRUE - * if XBM support is included.
- *

- *

- * Previous to PHP 5.3.0, the JPEG Support attribute was named - * JPG Support. - */ -function gd_info () {} - -/** - * (PHP 4, PHP 5)
- * Draws an arc - * @link http://php.net/manual/en/function.imagearc.php - * @param resource $image - * @param int $cx

- * x-coordinate of the center. - *

- * @param int $cy

- * y-coordinate of the center. - *

- * @param int $width

- * The arc width. - *

- * @param int $height

- * The arc height. - *

- * @param int $start

- * The arc start angle, in degrees. - *

- * @param int $end

- * The arc end angle, in degrees. - * 0° is located at the three-o'clock position, and the arc is drawn - * clockwise. - *

- * @param int $color

- * A color identifier created with - * imagecolorallocate. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagearc ($image, $cx, $cy, $width, $height, $start, $end, $color) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Draw an ellipse - * @link http://php.net/manual/en/function.imageellipse.php - * @param resource $image - * @param int $cx

- * x-coordinate of the center. - *

- * @param int $cy

- * y-coordinate of the center. - *

- * @param int $width

- * The ellipse width. - *

- * @param int $height

- * The ellipse height. - *

- * @param int $color

- * The color of the ellipse. A color identifier created with - * imagecolorallocate. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imageellipse ($image, $cx, $cy, $width, $height, $color) {} - -/** - * (PHP 4, PHP 5)
- * Draw a character horizontally - * @link http://php.net/manual/en/function.imagechar.php - * @param resource $image - * @param int $font - * @param int $x

- * x-coordinate of the start. - *

- * @param int $y

- * y-coordinate of the start. - *

- * @param string $c

- * The character to draw. - *

- * @param int $color

- * A color identifier created with - * imagecolorallocate. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagechar ($image, $font, $x, $y, $c, $color) {} - -/** - * (PHP 4, PHP 5)
- * Draw a character vertically - * @link http://php.net/manual/en/function.imagecharup.php - * @param resource $image - * @param int $font - * @param int $x

- * x-coordinate of the start. - *

- * @param int $y

- * y-coordinate of the start. - *

- * @param string $c

- * The character to draw. - *

- * @param int $color

- * A color identifier created with - * imagecolorallocate. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagecharup ($image, $font, $x, $y, $c, $color) {} - -/** - * (PHP 4, PHP 5)
- * Get the index of the color of a pixel - * @link http://php.net/manual/en/function.imagecolorat.php - * @param resource $image - * @param int $x

- * x-coordinate of the point. - *

- * @param int $y

- * y-coordinate of the point. - *

- * @return int the index of the color. - */ -function imagecolorat ($image, $x, $y) {} - -/** - * (PHP 4, PHP 5)
- * Allocate a color for an image - * @link http://php.net/manual/en/function.imagecolorallocate.php - * @param resource $image - * @param int $red

Value of red component.

- * @param int $green

Value of green component.

- * @param int $blue

Value of blue component.

- * @return int A color identifier or FALSE if the allocation failed. - */ -function imagecolorallocate ($image, $red, $green, $blue) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Copy the palette from one image to another - * @link http://php.net/manual/en/function.imagepalettecopy.php - * @param resource $destination

- * The destination image resource. - *

- * @param resource $source

- * The source image resource. - *

- * @return void No value is returned. - */ -function imagepalettecopy ($destination, $source) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Create a new image from the image stream in the string - * @link http://php.net/manual/en/function.imagecreatefromstring.php - * @param string $image

- * A string containing the image data. - *

- * @return resource An image resource will be returned on success. FALSE is returned if - * the image type is unsupported, the data is not in a recognised format, - * or the image is corrupt and cannot be loaded. - */ -function imagecreatefromstring ($image) {} - -/** - * (PHP 4, PHP 5)
- * Get the index of the closest color to the specified color - * @link http://php.net/manual/en/function.imagecolorclosest.php - * @param resource $image - * @param int $red

Value of red component.

- * @param int $green

Value of green component.

- * @param int $blue

Value of blue component.

- * @return int the index of the closest color, in the palette of the image, to - * the specified one - */ -function imagecolorclosest ($image, $red, $green, $blue) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Get the index of the color which has the hue, white and blackness - * @link http://php.net/manual/en/function.imagecolorclosesthwb.php - * @param resource $image - * @param int $red

Value of red component.

- * @param int $green

Value of green component.

- * @param int $blue

Value of blue component.

- * @return int an integer with the index of the color which has - * the hue, white and blackness nearest the given color. - */ -function imagecolorclosesthwb ($image, $red, $green, $blue) {} - -/** - * (PHP 4, PHP 5)
- * De-allocate a color for an image - * @link http://php.net/manual/en/function.imagecolordeallocate.php - * @param resource $image - * @param int $color

- * The color identifier. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagecolordeallocate ($image, $color) {} - -/** - * (PHP 4, PHP 5)
- * Get the index of the specified color or its closest possible alternative - * @link http://php.net/manual/en/function.imagecolorresolve.php - * @param resource $image - * @param int $red

Value of red component.

- * @param int $green

Value of green component.

- * @param int $blue

Value of blue component.

- * @return int a color index. - */ -function imagecolorresolve ($image, $red, $green, $blue) {} - -/** - * (PHP 4, PHP 5)
- * Get the index of the specified color - * @link http://php.net/manual/en/function.imagecolorexact.php - * @param resource $image - * @param int $red

Value of red component.

- * @param int $green

Value of green component.

- * @param int $blue

Value of blue component.

- * @return int the index of the specified color in the palette, or -1 if the - * color does not exist. - */ -function imagecolorexact ($image, $red, $green, $blue) {} - -/** - * (PHP 4, PHP 5)
- * Set the color for the specified palette index - * @link http://php.net/manual/en/function.imagecolorset.php - * @param resource $image - * @param int $index

- * An index in the palette. - *

- * @param int $red

Value of red component.

- * @param int $green

Value of green component.

- * @param int $blue

Value of blue component.

- * @param int $alpha [optional]

- * Value of alpha component. - *

- * @return void No value is returned. - */ -function imagecolorset ($image, $index, $red, $green, $blue, $alpha = 0) {} - -/** - * (PHP 4, PHP 5)
- * Define a color as transparent - * @link http://php.net/manual/en/function.imagecolortransparent.php - * @param resource $image - * @param int $color [optional]

- * A color identifier created with - * imagecolorallocate. - *

- * @return int The identifier of the new (or current, if none is specified) - * transparent color is returned. If color - * is not specified, and the image has no transparent color, the - * returned identifier will be -1. - */ -function imagecolortransparent ($image, $color = null) {} - -/** - * (PHP 4, PHP 5)
- * Find out the number of colors in an image's palette - * @link http://php.net/manual/en/function.imagecolorstotal.php - * @param resource $image

- * An image resource, returned by one of the image creation functions, such - * as imagecreatefromgif. - *

- * @return int the number of colors in the specified image's palette or 0 for - * truecolor images. - */ -function imagecolorstotal ($image) {} - -/** - * (PHP 4, PHP 5)
- * Get the colors for an index - * @link http://php.net/manual/en/function.imagecolorsforindex.php - * @param resource $image - * @param int $index

- * The color index. - *

- * @return array an associative array with red, green, blue and alpha keys that - * contain the appropriate values for the specified color index. - */ -function imagecolorsforindex ($image, $index) {} - -/** - * (PHP 4, PHP 5)
- * Copy part of an image - * @link http://php.net/manual/en/function.imagecopy.php - * @param resource $dst_im

Destination image link resource.

- * @param resource $src_im

Source image link resource.

- * @param int $dst_x

- * x-coordinate of destination point. - *

- * @param int $dst_y

- * y-coordinate of destination point. - *

- * @param int $src_x

- * x-coordinate of source point. - *

- * @param int $src_y

- * y-coordinate of source point. - *

- * @param int $src_w

Source width.

- * @param int $src_h

Source height.

- * @return bool TRUE on success or FALSE on failure. - */ -function imagecopy ($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Copy and merge part of an image - * @link http://php.net/manual/en/function.imagecopymerge.php - * @param resource $dst_im

Destination image link resource.

- * @param resource $src_im

Source image link resource.

- * @param int $dst_x

- * x-coordinate of destination point. - *

- * @param int $dst_y

- * y-coordinate of destination point. - *

- * @param int $src_x

- * x-coordinate of source point. - *

- * @param int $src_y

- * y-coordinate of source point. - *

- * @param int $src_w

Source width.

- * @param int $src_h

Source height.

- * @param int $pct

- * The two images will be merged according to pct - * which can range from 0 to 100. When pct = 0, - * no action is taken, when 100 this function behaves identically - * to imagecopy for pallete images, except for - * ignoring alpha components, while it implements alpha transparency - * for true colour images. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagecopymerge ($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Copy and merge part of an image with gray scale - * @link http://php.net/manual/en/function.imagecopymergegray.php - * @param resource $dst_im

Destination image link resource.

- * @param resource $src_im

Source image link resource.

- * @param int $dst_x

- * x-coordinate of destination point. - *

- * @param int $dst_y

- * y-coordinate of destination point. - *

- * @param int $src_x

- * x-coordinate of source point. - *

- * @param int $src_y

- * y-coordinate of source point. - *

- * @param int $src_w

Source width.

- * @param int $src_h

Source height.

- * @param int $pct

- * The src_im will be changed to grayscale according - * to pct where 0 is fully grayscale and 100 is - * unchanged. When pct = 100 this function behaves - * identically to imagecopy for pallete images, except for - * ignoring alpha components, while - * it implements alpha transparency for true colour images. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagecopymergegray ($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct) {} - -/** - * (PHP 4, PHP 5)
- * Copy and resize part of an image - * @link http://php.net/manual/en/function.imagecopyresized.php - * @param resource $dst_image

Destination image link resource.

- * @param resource $src_image

Source image link resource.

- * @param int $dst_x

- * x-coordinate of destination point. - *

- * @param int $dst_y

- * y-coordinate of destination point. - *

- * @param int $src_x

- * x-coordinate of source point. - *

- * @param int $src_y

- * y-coordinate of source point. - *

- * @param int $dst_w

- * Destination width. - *

- * @param int $dst_h

- * Destination height. - *

- * @param int $src_w

Source width.

- * @param int $src_h

Source height.

- * @return bool TRUE on success or FALSE on failure. - */ -function imagecopyresized ($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) {} - -/** - * (PHP 4, PHP 5)
- * Create a new palette based image - * @link http://php.net/manual/en/function.imagecreate.php - * @param int $width

- * The image width. - *

- * @param int $height

- * The image height. - *

- * @return resource an image resource identifier on success, FALSE on errors. - */ -function imagecreate ($width, $height) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Create a new true color image - * @link http://php.net/manual/en/function.imagecreatetruecolor.php - * @param int $width

- * Image width. - *

- * @param int $height

- * Image height. - *

- * @return resource an image resource identifier on success, FALSE on errors. - */ -function imagecreatetruecolor ($width, $height) {} - -/** - * (PHP 4 >= 4.3.2, PHP 5)
- * Finds whether an image is a truecolor image - * @link http://php.net/manual/en/function.imageistruecolor.php - * @param resource $image - * @return bool TRUE if the image is truecolor, FALSE - * otherwise. - */ -function imageistruecolor ($image) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Convert a true color image to a palette image - * @link http://php.net/manual/en/function.imagetruecolortopalette.php - * @param resource $image - * @param bool $dither

- * Indicates if the image should be dithered - if it is TRUE then - * dithering will be used which will result in a more speckled image but - * with better color approximation. - *

- * @param int $ncolors

- * Sets the maximum number of colors that should be retained in the palette. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagetruecolortopalette ($image, $dither, $ncolors) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Set the thickness for line drawing - * @link http://php.net/manual/en/function.imagesetthickness.php - * @param resource $image - * @param int $thickness

- * Thickness, in pixels. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagesetthickness ($image, $thickness) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Draw a partial arc and fill it - * @link http://php.net/manual/en/function.imagefilledarc.php - * @param resource $image - * @param int $cx

- * x-coordinate of the center. - *

- * @param int $cy

- * y-coordinate of the center. - *

- * @param int $width

- * The arc width. - *

- * @param int $height

- * The arc height. - *

- * @param int $start

- * The arc start angle, in degrees. - *

- * @param int $end

- * The arc end angle, in degrees. - * 0° is located at the three-o'clock position, and the arc is drawn - * clockwise. - *

- * @param int $color

- * A color identifier created with - * imagecolorallocate. - *

- * @param int $style

- * A bitwise OR of the following possibilities: - * IMG_ARC_PIE - * @return bool TRUE on success or FALSE on failure. - */ -function imagefilledarc ($image, $cx, $cy, $width, $height, $start, $end, $color, $style) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Draw a filled ellipse - * @link http://php.net/manual/en/function.imagefilledellipse.php - * @param resource $image - * @param int $cx

- * x-coordinate of the center. - *

- * @param int $cy

- * y-coordinate of the center. - *

- * @param int $width

- * The ellipse width. - *

- * @param int $height

- * The ellipse height. - *

- * @param int $color

- * The fill color. A color identifier created with - * imagecolorallocate. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagefilledellipse ($image, $cx, $cy, $width, $height, $color) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Set the blending mode for an image - * @link http://php.net/manual/en/function.imagealphablending.php - * @param resource $image - * @param bool $blendmode

- * Whether to enable the blending mode or not. On true color images - * the default value is TRUE otherwise the default value is FALSE - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagealphablending ($image, $blendmode) {} - -/** - * (PHP 4 >= 4.3.2, PHP 5)
- * Set the flag to save full alpha channel information (as opposed to single-color transparency) when saving PNG images - * @link http://php.net/manual/en/function.imagesavealpha.php - * @param resource $image - * @param bool $saveflag

- * Whether to save the alpha channel or not. Default to FALSE. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagesavealpha ($image, $saveflag) {} - -/** - * (PHP 4 >= 4.3.2, PHP 5)
- * Allocate a color for an image - * @link http://php.net/manual/en/function.imagecolorallocatealpha.php - * @param resource $image - * @param int $red

Value of red component.

- * @param int $green

Value of green component.

- * @param int $blue

Value of blue component.

- * @param int $alpha

- * A value between 0 and 127. - * 0 indicates completely opaque while - * 127 indicates completely transparent. - *

- * @return int A color identifier or FALSE if the allocation failed. - */ -function imagecolorallocatealpha ($image, $red, $green, $blue, $alpha) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Get the index of the specified color + alpha or its closest possible alternative - * @link http://php.net/manual/en/function.imagecolorresolvealpha.php - * @param resource $image - * @param int $red

Value of red component.

- * @param int $green

Value of green component.

- * @param int $blue

Value of blue component.

- * @param int $alpha

- * A value between 0 and 127. - * 0 indicates completely opaque while - * 127 indicates completely transparent. - *

- * @return int a color index. - */ -function imagecolorresolvealpha ($image, $red, $green, $blue, $alpha) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Get the index of the closest color to the specified color + alpha - * @link http://php.net/manual/en/function.imagecolorclosestalpha.php - * @param resource $image - * @param int $red

Value of red component.

- * @param int $green

Value of green component.

- * @param int $blue

Value of blue component.

- * @param int $alpha

- * A value between 0 and 127. - * 0 indicates completely opaque while - * 127 indicates completely transparent. - *

- * @return int the index of the closest color in the palette. - */ -function imagecolorclosestalpha ($image, $red, $green, $blue, $alpha) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Get the index of the specified color + alpha - * @link http://php.net/manual/en/function.imagecolorexactalpha.php - * @param resource $image - * @param int $red

Value of red component.

- * @param int $green

Value of green component.

- * @param int $blue

Value of blue component.

- * @param int $alpha

- * A value between 0 and 127. - * 0 indicates completely opaque while - * 127 indicates completely transparent. - *

- * @return int the index of the specified color+alpha in the palette of the - * image, or -1 if the color does not exist in the image's palette. - */ -function imagecolorexactalpha ($image, $red, $green, $blue, $alpha) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Copy and resize part of an image with resampling - * @link http://php.net/manual/en/function.imagecopyresampled.php - * @param resource $dst_image

Destination image link resource.

- * @param resource $src_image

Source image link resource.

- * @param int $dst_x

- * x-coordinate of destination point. - *

- * @param int $dst_y

- * y-coordinate of destination point. - *

- * @param int $src_x

- * x-coordinate of source point. - *

- * @param int $src_y

- * y-coordinate of source point. - *

- * @param int $dst_w

- * Destination width. - *

- * @param int $dst_h

- * Destination height. - *

- * @param int $src_w

Source width.

- * @param int $src_h

Source height.

- * @return bool TRUE on success or FALSE on failure. - */ -function imagecopyresampled ($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Rotate an image with a given angle - * @link http://php.net/manual/en/function.imagerotate.php - * @param resource $image - * @param float $angle

- * Rotation angle, in degrees. The rotation angle is interpreted as the - * number of degrees to rotate the image anticlockwise. - *

- * @param int $bgd_color

- * Specifies the color of the uncovered zone after the rotation - *

- * @param int $ignore_transparent [optional]

- * If set and non-zero, transparent colors are ignored (otherwise kept). - *

- * @return resource an image resource for the rotated image, or FALSE on failure. - */ -function imagerotate ($image, $angle, $bgd_color, $ignore_transparent = 0) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Set the tile image for filling - * @link http://php.net/manual/en/function.imagesettile.php - * @param resource $image - * @param resource $tile

- * The image resource to be used as a tile. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagesettile ($image, $tile) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Set the brush image for line drawing - * @link http://php.net/manual/en/function.imagesetbrush.php - * @param resource $image - * @param resource $brush

- * An image resource. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagesetbrush ($image, $brush) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Set the style for line drawing - * @link http://php.net/manual/en/function.imagesetstyle.php - * @param resource $image - * @param array $style

- * An array of pixel colors. You can use the - * IMG_COLOR_TRANSPARENT constant to add a - * transparent pixel. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagesetstyle ($image, array $style) {} - -/** - * (PHP 4, PHP 5)
- * Create a new image from file or URL - * @link http://php.net/manual/en/function.imagecreatefrompng.php - * @param string $filename

- * Path to the PNG image. - *

- * @return resource an image resource identifier on success, FALSE on errors. - */ -function imagecreatefrompng ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Create a new image from file or URL - * @link http://php.net/manual/en/function.imagecreatefromgif.php - * @param string $filename

- * Path to the GIF image. - *

- * @return resource an image resource identifier on success, FALSE on errors. - */ -function imagecreatefromgif ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Create a new image from file or URL - * @link http://php.net/manual/en/function.imagecreatefromjpeg.php - * @param string $filename

- * Path to the JPEG image. - *

- * @return resource an image resource identifier on success, FALSE on errors. - */ -function imagecreatefromjpeg ($filename) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Create a new image from file or URL - * @link http://php.net/manual/en/function.imagecreatefromwbmp.php - * @param string $filename

- * Path to the WBMP image. - *

- * @return resource an image resource identifier on success, FALSE on errors. - */ -function imagecreatefromwbmp ($filename) {} - -/** - * (PHP 4 >= 4.0.7, PHP 5)
- * Create a new image from GD file or URL - * @link http://php.net/manual/en/function.imagecreatefromgd.php - * @param string $filename

- * Path to the GD file. - *

- * @return resource an image resource identifier on success, FALSE on errors. - */ -function imagecreatefromgd ($filename) {} - -/** - * (PHP 4 >= 4.0.7, PHP 5)
- * Create a new image from GD2 file or URL - * @link http://php.net/manual/en/function.imagecreatefromgd2.php - * @param string $filename

- * Path to the GD2 image. - *

- * @return resource an image resource identifier on success, FALSE on errors. - */ -function imagecreatefromgd2 ($filename) {} - -/** - * (PHP 4 >= 4.0.7, PHP 5)
- * Create a new image from a given part of GD2 file or URL - * @link http://php.net/manual/en/function.imagecreatefromgd2part.php - * @param string $filename

- * Path to the GD2 image. - *

- * @param int $srcX

- * x-coordinate of source point. - *

- * @param int $srcY

- * y-coordinate of source point. - *

- * @param int $width

Source width.

- * @param int $height

Source height.

- * @return resource an image resource identifier on success, FALSE on errors. - */ -function imagecreatefromgd2part ($filename, $srcX, $srcY, $width, $height) {} - -/** - * (PHP 4, PHP 5)
- * Output a PNG image to either the browser or a file - * @link http://php.net/manual/en/function.imagepng.php - * @param resource $image - * @param string $filename [optional]

The path to save the file to. If not set or NULL, the raw image stream will be outputted directly.

- *

- * NULL is invalid if the quality and - * filters arguments are not used. - *

- * @param int $quality [optional]

- * Compression level: from 0 (no compression) to 9. - *

- * @param int $filters [optional]

- * Allows reducing the PNG file size. It is a bitmask field which may be - * set to any combination of the PNG_FILTER_XXX - * constants. PNG_NO_FILTER or - * PNG_ALL_FILTERS may also be used to respectively - * disable or activate all filters. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagepng ($image, $filename = null, $quality = null, $filters = null) {} - -/** - * (PHP 4, PHP 5)
- * Output image to browser or file - * @link http://php.net/manual/en/function.imagegif.php - * @param resource $image - * @param string $filename [optional]

The path to save the file to. If not set or NULL, the raw image stream will be outputted directly.

- * @return bool TRUE on success or FALSE on failure. - */ -function imagegif ($image, $filename = null) {} - -/** - * (PHP 4, PHP 5)
- * Output image to browser or file - * @link http://php.net/manual/en/function.imagejpeg.php - * @param resource $image - * @param string $filename [optional]

The path to save the file to. If not set or NULL, the raw image stream will be outputted directly.

- *

- * To skip this argument in order to provide the - * quality parameter, use NULL. - *

- * @param int $quality [optional]

- * quality is optional, and ranges from 0 (worst - * quality, smaller file) to 100 (best quality, biggest file). The - * default is the default IJG quality value (about 75). - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagejpeg ($image, $filename = null, $quality = null) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Output image to browser or file - * @link http://php.net/manual/en/function.imagewbmp.php - * @param resource $image - * @param string $filename [optional]

The path to save the file to. If not set or NULL, the raw image stream will be outputted directly.

- * @param int $foreground [optional]

- * You can set the foreground color with this parameter by setting an - * identifier obtained from imagecolorallocate. - * The default foreground color is black. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagewbmp ($image, $filename = null, $foreground = null) {} - -/** - * (PHP 4 >= 4.0.7, PHP 5)
- * Output GD image to browser or file - * @link http://php.net/manual/en/function.imagegd.php - * @param resource $image - * @param string $filename [optional]

The path to save the file to. If not set or NULL, the raw image stream will be outputted directly.

- * @return bool TRUE on success or FALSE on failure. - */ -function imagegd ($image, $filename = null) {} - -/** - * (PHP 4 >= 4.0.7, PHP 5)
- * Output GD2 image to browser or file - * @link http://php.net/manual/en/function.imagegd2.php - * @param resource $image - * @param string $filename [optional]

The path to save the file to. If not set or NULL, the raw image stream will be outputted directly.

- * @param int $chunk_size [optional]

- * Chunk size. - *

- * @param int $type [optional]

- * Either IMG_GD2_RAW or - * IMG_GD2_COMPRESSED. Default is - * IMG_GD2_RAW. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagegd2 ($image, $filename = null, $chunk_size = null, $type = 'IMG_GD2_RAW') {} - -/** - * (PHP 4, PHP 5)
- * Destroy an image - * @link http://php.net/manual/en/function.imagedestroy.php - * @param resource $image - * @return bool TRUE on success or FALSE on failure. - */ -function imagedestroy ($image) {} - -/** - * (PHP 4, PHP 5)
- * Apply a gamma correction to a GD image - * @link http://php.net/manual/en/function.imagegammacorrect.php - * @param resource $image - * @param float $inputgamma

- * The input gamma. - *

- * @param float $outputgamma

- * The output gamma. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagegammacorrect ($image, $inputgamma, $outputgamma) {} - -/** - * (PHP 4, PHP 5)
- * Flood fill - * @link http://php.net/manual/en/function.imagefill.php - * @param resource $image - * @param int $x

- * x-coordinate of start point. - *

- * @param int $y

- * y-coordinate of start point. - *

- * @param int $color

- * The fill color. A color identifier created with - * imagecolorallocate. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagefill ($image, $x, $y, $color) {} - -/** - * (PHP 4, PHP 5)
- * Draw a filled polygon - * @link http://php.net/manual/en/function.imagefilledpolygon.php - * @param resource $image - * @param array $points

- * An array containing the x and y - * coordinates of the polygons vertices consecutively. - *

- * @param int $num_points

- * Total number of vertices, which must be at least 3. - *

- * @param int $color

- * A color identifier created with - * imagecolorallocate. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagefilledpolygon ($image, array $points, $num_points, $color) {} - -/** - * (PHP 4, PHP 5)
- * Draw a filled rectangle - * @link http://php.net/manual/en/function.imagefilledrectangle.php - * @param resource $image - * @param int $x1

- * x-coordinate for point 1. - *

- * @param int $y1

- * y-coordinate for point 1. - *

- * @param int $x2

- * x-coordinate for point 2. - *

- * @param int $y2

- * y-coordinate for point 2. - *

- * @param int $color

- * The fill color. A color identifier created with - * imagecolorallocate. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagefilledrectangle ($image, $x1, $y1, $x2, $y2, $color) {} - -/** - * (PHP 4, PHP 5)
- * Flood fill to specific color - * @link http://php.net/manual/en/function.imagefilltoborder.php - * @param resource $image - * @param int $x

- * x-coordinate of start. - *

- * @param int $y

- * y-coordinate of start. - *

- * @param int $border

- * The border color. A color identifier created with - * imagecolorallocate. - *

- * @param int $color

- * The fill color. A color identifier created with - * imagecolorallocate. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagefilltoborder ($image, $x, $y, $border, $color) {} - -/** - * (PHP 4, PHP 5)
- * Get font width - * @link http://php.net/manual/en/function.imagefontwidth.php - * @param int $font - * @return int the pixel width of the font. - */ -function imagefontwidth ($font) {} - -/** - * (PHP 4, PHP 5)
- * Get font height - * @link http://php.net/manual/en/function.imagefontheight.php - * @param int $font - * @return int the pixel height of the font. - */ -function imagefontheight ($font) {} - -/** - * (PHP 4, PHP 5)
- * Enable or disable interlace - * @link http://php.net/manual/en/function.imageinterlace.php - * @param resource $image - * @param int $interlace [optional]

- * If non-zero, the image will be interlaced, else the interlace bit is - * turned off. - *

- * @return int 1 if the interlace bit is set for the image, 0 otherwise. - */ -function imageinterlace ($image, $interlace = 0) {} - -/** - * (PHP 4, PHP 5)
- * Draw a line - * @link http://php.net/manual/en/function.imageline.php - * @param resource $image - * @param int $x1

- * x-coordinate for first point. - *

- * @param int $y1

- * y-coordinate for first point. - *

- * @param int $x2

- * x-coordinate for second point. - *

- * @param int $y2

- * y-coordinate for second point. - *

- * @param int $color

- * The line color. A color identifier created with - * imagecolorallocate. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imageline ($image, $x1, $y1, $x2, $y2, $color) {} - -/** - * (PHP 4, PHP 5)
- * Load a new font - * @link http://php.net/manual/en/function.imageloadfont.php - * @param string $file

- * The font file format is currently binary and architecture - * dependent. This means you should generate the font files on the - * same type of CPU as the machine you are running PHP on. - *

- *

- * - * Font file format - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
byte positionC data typedescription
byte 0-3intnumber of characters in the font
byte 4-7int - * value of first character in the font (often 32 for space) - *
byte 8-11intpixel width of each character
byte 12-15intpixel height of each character
byte 16-char - * array with character data, one byte per pixel in each - * character, for a total of (nchars*width*height) bytes. - *
- *

- * @return int The font identifier which is always bigger than 5 to avoid conflicts with - * built-in fonts or FALSE on errors. - */ -function imageloadfont ($file) {} - -/** - * (PHP 4, PHP 5)
- * Draws a polygon - * @link http://php.net/manual/en/function.imagepolygon.php - * @param resource $image - * @param array $points

- * An array containing the polygon's vertices, e.g.: - * - * points[0] - * = x0 - * - * - * points[1] - * = y0 - * - * - * points[2] - * = x1 - * - * - * points[3] - * = y1 - * - *

- * @param int $num_points

- * Total number of points (vertices). - *

- * @param int $color

- * A color identifier created with - * imagecolorallocate. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagepolygon ($image, array $points, $num_points, $color) {} - -/** - * (PHP 4, PHP 5)
- * Draw a rectangle - * @link http://php.net/manual/en/function.imagerectangle.php - * @param resource $image - * @param int $x1

- * Upper left x coordinate. - *

- * @param int $y1

- * Upper left y coordinate - * 0, 0 is the top left corner of the image. - *

- * @param int $x2

- * Bottom right x coordinate. - *

- * @param int $y2

- * Bottom right y coordinate. - *

- * @param int $color

- * A color identifier created with - * imagecolorallocate. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagerectangle ($image, $x1, $y1, $x2, $y2, $color) {} - -/** - * (PHP 4, PHP 5)
- * Set a single pixel - * @link http://php.net/manual/en/function.imagesetpixel.php - * @param resource $image - * @param int $x

- * x-coordinate. - *

- * @param int $y

- * y-coordinate. - *

- * @param int $color

- * A color identifier created with - * imagecolorallocate. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagesetpixel ($image, $x, $y, $color) {} - -/** - * (PHP 4, PHP 5)
- * Draw a string horizontally - * @link http://php.net/manual/en/function.imagestring.php - * @param resource $image - * @param int $font - * @param int $x

- * x-coordinate of the upper left corner. - *

- * @param int $y

- * y-coordinate of the upper left corner. - *

- * @param string $string

- * The string to be written. - *

- * @param int $color

- * A color identifier created with - * imagecolorallocate. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagestring ($image, $font, $x, $y, $string, $color) {} - -/** - * (PHP 4, PHP 5)
- * Draw a string vertically - * @link http://php.net/manual/en/function.imagestringup.php - * @param resource $image - * @param int $font - * @param int $x

- * x-coordinate of the bottom left corner. - *

- * @param int $y

- * y-coordinate of the bottom left corner. - *

- * @param string $string

- * The string to be written. - *

- * @param int $color

- * A color identifier created with - * imagecolorallocate. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagestringup ($image, $font, $x, $y, $string, $color) {} - -/** - * (PHP 4, PHP 5)
- * Get image width - * @link http://php.net/manual/en/function.imagesx.php - * @param resource $image - * @return int Return the width of the image or FALSE on - * errors. - */ -function imagesx ($image) {} - -/** - * (PHP 4, PHP 5)
- * Get image height - * @link http://php.net/manual/en/function.imagesy.php - * @param resource $image - * @return int Return the height of the image or FALSE on - * errors. - */ -function imagesy ($image) {} - -/** - * (PHP 4, PHP 5)
- * Draw a dashed line - * @link http://php.net/manual/en/function.imagedashedline.php - * @param resource $image - * @param int $x1

- * Upper left x coordinate. - *

- * @param int $y1

- * Upper left y coordinate 0, 0 is the top left corner of the image. - *

- * @param int $x2

- * Bottom right x coordinate. - *

- * @param int $y2

- * Bottom right y coordinate. - *

- * @param int $color

- * The fill color. A color identifier created with - * imagecolorallocate. - *

- * @return bool Always returns true - */ -function imagedashedline ($image, $x1, $y1, $x2, $y2, $color) {} - -/** - * (PHP 4, PHP 5)
- * Give the bounding box of a text using TrueType fonts - * @link http://php.net/manual/en/function.imagettfbbox.php - * @param float $size

- * The font size. - * In GD 1, this is measured in pixels. In GD 2, this is measured in - * points. - *

- * @param float $angle

- * Angle in degrees in which text will be measured. - *

- * @param string $fontfile

- * The name of the TrueType font file (can be a URL). Depending on - * which version of the GD library that PHP is using, it may attempt to - * search for files that do not begin with a leading '/' by appending - * '.ttf' to the filename and searching along a library-defined font path. - *

- * @param string $text

- * The string to be measured. - *

- * @return array imagettfbbox returns an array with 8 - * elements representing four points making the bounding box of the - * text on success and FALSE on error. - * - * key - * contents - * - * - * 0 - * lower left corner, X position - * - * - * 1 - * lower left corner, Y position - * - * - * 2 - * lower right corner, X position - * - * - * 3 - * lower right corner, Y position - * - * - * 4 - * upper right corner, X position - * - * - * 5 - * upper right corner, Y position - * - * - * 6 - * upper left corner, X position - * - * - * 7 - * upper left corner, Y position - * - *

- *

- * The points are relative to the text regardless of the - * angle, so "upper left" means in the top left-hand - * corner seeing the text horizontally. - */ -function imagettfbbox ($size, $angle, $fontfile, $text) {} - -/** - * (PHP 4, PHP 5)
- * Write text to the image using TrueType fonts - * @link http://php.net/manual/en/function.imagettftext.php - * @param resource $image - * @param float $size

The font size. Depending on your version of GD, this should be specified as the pixel size (GD1) or point size (GD2).

- * @param float $angle

- * The angle in degrees, with 0 degrees being left-to-right reading text. - * Higher values represent a counter-clockwise rotation. For example, a - * value of 90 would result in bottom-to-top reading text. - *

- * @param int $x

- * The coordinates given by x and - * y will define the basepoint of the first - * character (roughly the lower-left corner of the character). This - * is different from the imagestring, where - * x and y define the - * upper-left corner of the first character. For example, "top left" - * is 0, 0. - *

- * @param int $y

- * The y-ordinate. This sets the position of the fonts baseline, not the - * very bottom of the character. - *

- * @param int $color

- * The color index. Using the negative of a color index has the effect of - * turning off antialiasing. See imagecolorallocate. - *

- * @param string $fontfile

- * The path to the TrueType font you wish to use. - *

- *

- * Depending on which version of the GD library PHP is using, when - * fontfile does not begin with a leading - * / then .ttf will be appended - * to the filename and the library will attempt to search for that - * filename along a library-defined font path. - *

- *

- * When using versions of the GD library lower than 2.0.18, a space character, - * rather than a semicolon, was used as the 'path separator' for different font files. - * Unintentional use of this feature will result in the warning message: - * Warning: Could not find/open font. For these affected versions, the - * only solution is moving the font to a path which does not contain spaces. - *

- *

- * In many cases where a font resides in the same directory as the script using it - * the following trick will alleviate any include problems. - * - * // Set the enviroment variable for GD - * putenv('GDFONTPATH=' . realpath('.')); - * // Name the font to be used (note the lack of the .ttf extension) - * $font = 'SomeFont'; - * - *

- * @param string $text

- * The text string in UTF-8 encoding. - *

- *

- * May include decimal numeric character references (of the form: - * &#38;#8364;) to access characters in a font beyond position 127. - * The hexadecimal format (like &#38;#xA9;) is supported. - * Strings in UTF-8 encoding can be passed directly. - *

- *

- * Named entities, such as &#38;copy;, are not supported. Consider using - * html_entity_decode - * to decode these named entities into UTF-8 strings (html_entity_decode() - * supports this as of PHP 5.0.0). - *

- *

- * If a character is used in the string which is not supported by the - * font, a hollow rectangle will replace the character. - *

- * @return array an array with 8 elements representing four points making the - * bounding box of the text. The order of the points is lower left, lower - * right, upper right, upper left. The points are relative to the text - * regardless of the angle, so "upper left" means in the top left-hand - * corner when you see the text horizontally. - * Returns FALSE on error. - */ -function imagettftext ($image, $size, $angle, $x, $y, $color, $fontfile, $text) {} - -/** - * (PHP 4 >= 4.0.7, PHP 5)
- * Give the bounding box of a text using fonts via freetype2 - * @link http://php.net/manual/en/function.imageftbbox.php - * @param float $size

The font size. Depending on your version of GD, this should be specified as the pixel size (GD1) or point size (GD2).

- * @param float $angle

- * Angle in degrees in which text will be - * measured. - *

- * @param string $fontfile

- * The name of the TrueType font file (can be a URL). Depending on - * which version of the GD library that PHP is using, it may attempt to - * search for files that do not begin with a leading '/' by appending - * '.ttf' to the filename and searching along a library-defined font path. - *

- * @param string $text

- * The string to be measured. - *

- * @param array $extrainfo [optional]

- * - * Possible array indexes for extrainfo - * - * - * - * - * - * - * - * - * - * - *
KeyTypeMeaning
linespacingfloatDefines drawing linespacing
- *

- * @return array imageftbbox returns an array with 8 - * elements representing four points making the bounding box of the - * text: - * - * 0 - * lower left corner, X position - * - * - * 1 - * lower left corner, Y position - * - * - * 2 - * lower right corner, X position - * - * - * 3 - * lower right corner, Y position - * - * - * 4 - * upper right corner, X position - * - * - * 5 - * upper right corner, Y position - * - * - * 6 - * upper left corner, X position - * - * - * 7 - * upper left corner, Y position - * - *

- *

- * The points are relative to the text regardless of the - * angle, so "upper left" means in the top left-hand - * corner seeing the text horizontally. - */ -function imageftbbox ($size, $angle, $fontfile, $text, array $extrainfo = null) {} - -/** - * (PHP 4 >= 4.0.7, PHP 5)
- * Write text to the image using fonts using FreeType 2 - * @link http://php.net/manual/en/function.imagefttext.php - * @param resource $image - * @param float $size

- * The font size to use in points. - *

- * @param float $angle

- * The angle in degrees, with 0 degrees being left-to-right reading text. - * Higher values represent a counter-clockwise rotation. For example, a - * value of 90 would result in bottom-to-top reading text. - *

- * @param int $x

- * The coordinates given by x and - * y will define the basepoint of the first - * character (roughly the lower-left corner of the character). This - * is different from the imagestring, where - * x and y define the - * upper-left corner of the first character. For example, "top left" - * is 0, 0. - *

- * @param int $y

- * The y-ordinate. This sets the position of the fonts baseline, not the - * very bottom of the character. - *

- * @param int $color

- * The index of the desired color for the text, see - * imagecolorexact. - *

- * @param string $fontfile

- * The path to the TrueType font you wish to use. - *

- *

- * Depending on which version of the GD library PHP is using, when - * fontfile does not begin with a leading - * / then .ttf will be appended - * to the filename and the library will attempt to search for that - * filename along a library-defined font path. - *

- *

- * When using versions of the GD library lower than 2.0.18, a space character, - * rather than a semicolon, was used as the 'path separator' for different font files. - * Unintentional use of this feature will result in the warning message: - * Warning: Could not find/open font. For these affected versions, the - * only solution is moving the font to a path which does not contain spaces. - *

- *

- * In many cases where a font resides in the same directory as the script using it - * the following trick will alleviate any include problems. - * - * // Set the enviroment variable for GD - * putenv('GDFONTPATH=' . realpath('.')); - * // Name the font to be used (note the lack of the .ttf extension) - * $font = 'SomeFont'; - * - *

- * @param string $text

- * Text to be inserted into image. - *

- * @param array $extrainfo [optional]

- * - * Possible array indexes for extrainfo - * - * - * - * - * - * - * - * - * - * - *
KeyTypeMeaning
linespacingfloatDefines drawing linespacing
- *

- * @return array This function returns an array defining the four points of the box, starting in the lower left and moving counter-clockwise: - * - * 0 - * lower left x-coordinate - * - * - * 1 - * lower left y-coordinate - * - * - * 2 - * lower right x-coordinate - * - * - * 3 - * lower right y-coordinate - * - * - * 4 - * upper right x-coordinate - * - * - * 5 - * upper right y-coordinate - * - * - * 6 - * upper left x-coordinate - * - * - * 7 - * upper left y-coordinate - * - */ -function imagefttext ($image, $size, $angle, $x, $y, $color, $fontfile, $text, array $extrainfo = null) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Return the image types supported by this PHP build - * @link http://php.net/manual/en/function.imagetypes.php - * @return int a bit-field corresponding to the image formats supported by the - * version of GD linked into PHP. The following bits are returned, - * IMG_GIF | IMG_JPG | - * IMG_PNG | IMG_WBMP | - * IMG_XPM. - */ -function imagetypes () {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Convert JPEG image file to WBMP image file - * @link http://php.net/manual/en/function.jpeg2wbmp.php - * @param string $jpegname

- * Path to JPEG file. - *

- * @param string $wbmpname

- * Path to destination WBMP file. - *

- * @param int $dest_height

- * Destination image height. - *

- * @param int $dest_width

- * Destination image width. - *

- * @param int $threshold

- * Threshold value, between 0 and 8 (inclusive). - *

- * @return bool TRUE on success or FALSE on failure. - */ -function jpeg2wbmp ($jpegname, $wbmpname, $dest_height, $dest_width, $threshold) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Convert PNG image file to WBMP image file - * @link http://php.net/manual/en/function.png2wbmp.php - * @param string $pngname

- * Path to PNG file. - *

- * @param string $wbmpname

- * Path to destination WBMP file. - *

- * @param int $dest_height

- * Destination image height. - *

- * @param int $dest_width

- * Destination image width. - *

- * @param int $threshold

- * Threshold value, between 0 and 8 (inclusive). - *

- * @return bool TRUE on success or FALSE on failure. - */ -function png2wbmp ($pngname, $wbmpname, $dest_height, $dest_width, $threshold) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Output image to browser or file - * @link http://php.net/manual/en/function.image2wbmp.php - * @param resource $image - * @param string $filename [optional]

- * Path to the saved file. If not given, the raw image stream will be - * outputted directly. - *

- * @param int $threshold [optional]

- * Threshold value, between 0 and 255 (inclusive). - *

- * @return bool TRUE on success or FALSE on failure. - */ -function image2wbmp ($image, $filename = null, $threshold = null) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Makes the colors of the palette version of an image more closely match the true color version - * @link http://php.net/manual/en/function.imagecolormatch.php - * @param resource $image1

- * A truecolor image link resource. - *

- * @param resource $image2

- * A palette image link resource pointing to an image that has the same - * size as image1. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imagecolormatch ($image1, $image2) {} - -/** - * (PHP 5)
- * Applies a filter to an image - * @link http://php.net/manual/en/function.imagefilter.php - * @param resource $image - * @param int $filtertype

- * filtertype can be one of the following: - * IMG_FILTER_NEGATE: Reverses all colors of - * the image. - * @param int $arg1 [optional]

- * IMG_FILTER_BRIGHTNESS: Brightness level. - * @param int $arg2 [optional]

- * IMG_FILTER_COLORIZE: Value of green component. - * @param int $arg3 [optional]

- * IMG_FILTER_COLORIZE: Value of blue component. - * @param int $arg4 [optional]

- * IMG_FILTER_COLORIZE: Alpha channel, A value - * between 0 and 127. 0 indicates completely opaque while 127 indicates - * completely transparent. - * @return bool TRUE on success or FALSE on failure. - */ -function imagefilter ($image, $filtertype, $arg1 = null, $arg2 = null, $arg3 = null, $arg4 = null) {} - -/** - * (PHP 5 >= 5.1.0)
- * Apply a 3x3 convolution matrix, using coefficient and offset - * @link http://php.net/manual/en/function.imageconvolution.php - * @param resource $image - * @param array $matrix

- * A 3x3 matrix: an array of three arrays of three floats. - *

- * @param float $div

- * The divisor of the result of the convolution, used for normalization. - *

- * @param float $offset

- * Color offset. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imageconvolution ($image, array $matrix, $div, $offset) {} - - -/** - * Used as a return value by imagetypes - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_GIF', 1); - -/** - * Used as a return value by imagetypes - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_JPG', 2); - -/** - * Used as a return value by imagetypes - *

- * This constant has the same value as IMG_JPG - *

- * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_JPEG', 2); - -/** - * Used as a return value by imagetypes - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_PNG', 4); - -/** - * Used as a return value by imagetypes - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_WBMP', 8); - -/** - * Used as a return value by imagetypes - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_XPM', 16); - -/** - * Special color option which can be used in stead of color allocated with - * imagecolorallocate or - * imagecolorallocatealpha - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_COLOR_TILED', -5); - -/** - * Special color option which can be used in stead of color allocated with - * imagecolorallocate or - * imagecolorallocatealpha - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_COLOR_STYLED', -2); - -/** - * Special color option which can be used in stead of color allocated with - * imagecolorallocate or - * imagecolorallocatealpha - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_COLOR_BRUSHED', -3); - -/** - * Special color option which can be used in stead of color allocated with - * imagecolorallocate or - * imagecolorallocatealpha - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_COLOR_STYLEDBRUSHED', -4); - -/** - * Special color option which can be used in stead of color allocated with - * imagecolorallocate or - * imagecolorallocatealpha - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_COLOR_TRANSPARENT', -6); - -/** - * A style constant used by the imagefilledarc function. - *

- * This constant has the same value as IMG_ARC_PIE - *

- * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_ARC_ROUNDED', 0); - -/** - * A style constant used by the imagefilledarc function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_ARC_PIE', 0); - -/** - * A style constant used by the imagefilledarc function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_ARC_CHORD', 1); - -/** - * A style constant used by the imagefilledarc function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_ARC_NOFILL', 2); - -/** - * A style constant used by the imagefilledarc function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_ARC_EDGED', 4); - -/** - * A type constant used by the imagegd2 function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_GD2_RAW', 1); - -/** - * A type constant used by the imagegd2 function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_GD2_COMPRESSED', 2); - -/** - * When the bundled version of GD is used this is 1 otherwise - * its set to 0. - * @link http://php.net/manual/en/image.constants.php - */ -define ('GD_BUNDLED', 0); - -/** - * Special GD filter used by the imagefilter function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_FILTER_NEGATE', 0); - -/** - * Special GD filter used by the imagefilter function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_FILTER_GRAYSCALE', 1); - -/** - * Special GD filter used by the imagefilter function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_FILTER_BRIGHTNESS', 2); - -/** - * Special GD filter used by the imagefilter function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_FILTER_CONTRAST', 3); - -/** - * Special GD filter used by the imagefilter function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_FILTER_COLORIZE', 4); - -/** - * Special GD filter used by the imagefilter function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_FILTER_EDGEDETECT', 5); - -/** - * Special GD filter used by the imagefilter function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_FILTER_GAUSSIAN_BLUR', 7); - -/** - * Special GD filter used by the imagefilter function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_FILTER_SELECTIVE_BLUR', 8); - -/** - * Special GD filter used by the imagefilter function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_FILTER_EMBOSS', 6); - -/** - * Special GD filter used by the imagefilter function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_FILTER_MEAN_REMOVAL', 9); - -/** - * Special GD filter used by the imagefilter function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_FILTER_SMOOTH', 10); - -/** - * Special GD filter used by the imagefilter function. - * (Available as of PHP 5.3.0) - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMG_FILTER_PIXELATE', 11); - -/** - * The GD version PHP was compiled against. - * (Available as of PHP 5.2.4) - * @link http://php.net/manual/en/image.constants.php - */ -define ('GD_VERSION', "2.0.36"); - -/** - * The GD major version PHP was compiled against. - * (Available as of PHP 5.2.4) - * @link http://php.net/manual/en/image.constants.php - */ -define ('GD_MAJOR_VERSION', 2); - -/** - * The GD minor version PHP was compiled against. - * (Available as of PHP 5.2.4) - * @link http://php.net/manual/en/image.constants.php - */ -define ('GD_MINOR_VERSION', 0); - -/** - * The GD release version PHP was compiled against. - * (Available as of PHP 5.2.4) - * @link http://php.net/manual/en/image.constants.php - */ -define ('GD_RELEASE_VERSION', 36); - -/** - * The GD "extra" version (beta/rc..) PHP was compiled against. - * (Available as of PHP 5.2.4) - * @link http://php.net/manual/en/image.constants.php - */ -define ('GD_EXTRA_VERSION', ""); - -/** - * A special PNG filter, used by the imagepng function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('PNG_NO_FILTER', 0); - -/** - * A special PNG filter, used by the imagepng function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('PNG_FILTER_NONE', 8); - -/** - * A special PNG filter, used by the imagepng function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('PNG_FILTER_SUB', 16); - -/** - * A special PNG filter, used by the imagepng function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('PNG_FILTER_UP', 32); - -/** - * A special PNG filter, used by the imagepng function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('PNG_FILTER_AVG', 64); - -/** - * A special PNG filter, used by the imagepng function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('PNG_FILTER_PAETH', 128); - -/** - * A special PNG filter, used by the imagepng function. - * @link http://php.net/manual/en/image.constants.php - */ -define ('PNG_ALL_FILTERS', 248); - -// End of gd v. -?> diff --git a/phpruntime/geoip.php b/phpruntime/geoip.php deleted file mode 100644 index 7d45ae1..0000000 --- a/phpruntime/geoip.php +++ /dev/null @@ -1,210 +0,0 @@ - - * Get GeoIP Database information - * @link http://php.net/manual/en/function.geoip-database-info.php - * @param int $database [optional]

- * The database type as an integer. You can use the - * various constants defined with - * this extension (ie: GEOIP_*_EDITION). - *

- * @return string the corresponding database version, or NULL on error. - */ -function geoip_database_info ($database = 'GEOIP_COUNTRY_EDITION') {} - -/** - * (PECL geoip >= 0.2.0)
- * Get the two letter country code - * @link http://php.net/manual/en/function.geoip-country-code-by-name.php - * @param string $hostname

- * The hostname or IP address whose location is to be looked-up. - *

- * @return string the two letter ISO country code on success, or FALSE - * if the address cannot be found in the database. - */ -function geoip_country_code_by_name ($hostname) {} - -/** - * (PECL geoip >= 0.2.0)
- * Get the three letter country code - * @link http://php.net/manual/en/function.geoip-country-code3-by-name.php - * @param string $hostname

- * The hostname or IP address whose location is to be looked-up. - *

- * @return string the three letter country code on success, or FALSE - * if the address cannot be found in the database. - */ -function geoip_country_code3_by_name ($hostname) {} - -/** - * (PECL geoip >= 0.2.0)
- * Get the full country name - * @link http://php.net/manual/en/function.geoip-country-name-by-name.php - * @param string $hostname

- * The hostname or IP address whose location is to be looked-up. - *

- * @return string the country name on success, or FALSE if the address cannot - * be found in the database. - */ -function geoip_country_name_by_name ($hostname) {} - -/** - * (PECL geoip >= 1.0.3)
- * Get the two letter continent code - * @link http://php.net/manual/en/function.geoip-continent-code-by-name.php - * @param string $hostname

- * The hostname or IP address whose location is to be looked-up. - *

- * @return string the two letter continent code on success, or FALSE if the - * address cannot be found in the database. - */ -function geoip_continent_code_by_name ($hostname) {} - -/** - * (PECL geoip >= 0.2.0)
- * Get the organization name - * @link http://php.net/manual/en/function.geoip-org-by-name.php - * @param string $hostname

- * The hostname or IP address. - *

- * @return string the organization name on success, or FALSE if the address - * cannot be found in the database. - */ -function geoip_org_by_name ($hostname) {} - -/** - * (PECL geoip >= 0.2.0)
- * Returns the detailed City information found in the GeoIP Database - * @link http://php.net/manual/en/function.geoip-record-by-name.php - * @param string $hostname

- * The hostname or IP address whose record is to be looked-up. - *

- * @return array the associative array on success, or FALSE if the address - * cannot be found in the database. - */ -function geoip_record_by_name ($hostname) {} - -/** - * (PECL geoip >= 0.2.0)
- * Get the Internet connection type - * @link http://php.net/manual/en/function.geoip-id-by-name.php - * @param string $hostname

- * The hostname or IP address whose connection type is to be looked-up. - *

- * @return int the connection type. - */ -function geoip_id_by_name ($hostname) {} - -/** - * (PECL geoip >= 0.2.0)
- * Get the country code and region - * @link http://php.net/manual/en/function.geoip-region-by-name.php - * @param string $hostname

- * The hostname or IP address whose region is to be looked-up. - *

- * @return array the associative array on success, or FALSE if the address - * cannot be found in the database. - */ -function geoip_region_by_name ($hostname) {} - -/** - * (PECL geoip >= 1.0.2)
- * Get the Internet Service Provider (ISP) name - * @link http://php.net/manual/en/function.geoip-isp-by-name.php - * @param string $hostname

- * The hostname or IP address. - *

- * @return string the ISP name on success, or FALSE if the address - * cannot be found in the database. - */ -function geoip_isp_by_name ($hostname) {} - -/** - * (PECL geoip >= 1.0.1)
- * Determine if GeoIP Database is available - * @link http://php.net/manual/en/function.geoip-db-avail.php - * @param int $database

- * The database type as an integer. You can use the - * various constants defined with - * this extension (ie: GEOIP_*_EDITION). - *

- * @return bool TRUE is database exists, FALSE if not found, or NULL on error. - */ -function geoip_db_avail ($database) {} - -/** - * (PECL geoip >= 1.0.1)
- * Returns detailed information about all GeoIP database types - * @link http://php.net/manual/en/function.geoip-db-get-all-info.php - * @return array the associative array. - */ -function geoip_db_get_all_info () {} - -/** - * (PECL geoip >= 1.0.1)
- * Returns the filename of the corresponding GeoIP Database - * @link http://php.net/manual/en/function.geoip-db-filename.php - * @param int $database

- * The database type as an integer. You can use the - * various constants defined with - * this extension (ie: GEOIP_*_EDITION). - *

- * @return string the filename of the corresponding database, or NULL on error. - */ -function geoip_db_filename ($database) {} - -/** - * (PECL geoip >= 1.0.4)
- * Returns the region name for some country and region code combo - * @link http://php.net/manual/en/function.geoip-region-name-by-code.php - * @param string $country_code

- * The two-letter country code (see - * geoip_country_code_by_name) - *

- * @param string $region_code

- * The two-letter (or digit) region code (see - * geoip_region_by_name) - *

- * @return string the region name on success, or FALSE if the country and region code - * combo cannot be found. - */ -function geoip_region_name_by_code ($country_code, $region_code) {} - -/** - * (PECL geoip >= 1.0.4)
- * Returns the time zone for some country and region code combo - * @link http://php.net/manual/en/function.geoip-time-zone-by-country-and-region.php - * @param string $country_code

- * The two-letter country code (see - * geoip_country_code_by_name) - *

- * @param string $region_code [optional]

- * The two-letter (or digit) region code (see - * geoip_region_by_name) - *

- * @return string the time zone on success, or FALSE if the country and region code - * combo cannot be found. - */ -function geoip_time_zone_by_country_and_region ($country_code, $region_code = null) {} - -define ('GEOIP_COUNTRY_EDITION', 1); -define ('GEOIP_REGION_EDITION_REV0', 7); -define ('GEOIP_CITY_EDITION_REV0', 6); -define ('GEOIP_ORG_EDITION', 5); -define ('GEOIP_ISP_EDITION', 4); -define ('GEOIP_CITY_EDITION_REV1', 2); -define ('GEOIP_REGION_EDITION_REV1', 3); -define ('GEOIP_PROXY_EDITION', 8); -define ('GEOIP_ASNUM_EDITION', 9); -define ('GEOIP_NETSPEED_EDITION', 10); -define ('GEOIP_DOMAIN_EDITION', 11); -define ('GEOIP_UNKNOWN_SPEED', 0); -define ('GEOIP_DIALUP_SPEED', 1); -define ('GEOIP_CABLEDSL_SPEED', 2); -define ('GEOIP_CORPORATE_SPEED', 3); - -// End of geoip v.1.0.7 -?> diff --git a/phpruntime/gettext.php b/phpruntime/gettext.php deleted file mode 100644 index 1d42773..0000000 --- a/phpruntime/gettext.php +++ /dev/null @@ -1,137 +0,0 @@ - - * Sets the default domain - * @link http://php.net/manual/en/function.textdomain.php - * @param string $text_domain

- * The new message domain, or NULL to get the current setting without - * changing it - *

- * @return string If successful, this function returns the current message - * domain, after possibly changing it. - */ -function textdomain ($text_domain) {} - -/** - * (PHP 4, PHP 5)
- * Lookup a message in the current domain - * @link http://php.net/manual/en/function.gettext.php - * @param string $message

- * The message being translated. - *

- * @return string a translated string if one is found in the - * translation table, or the submitted message if not found. - */ -function gettext ($message) {} - -/** - * @param $msgid - */ -function _ ($msgid) {} - -/** - * (PHP 4, PHP 5)
- * Override the current domain - * @link http://php.net/manual/en/function.dgettext.php - * @param string $domain

- * The domain - *

- * @param string $message

- * The message - *

- * @return string A string on success. - */ -function dgettext ($domain, $message) {} - -/** - * (PHP 4, PHP 5)
- * Overrides the domain for a single lookup - * @link http://php.net/manual/en/function.dcgettext.php - * @param string $domain

- * The domain - *

- * @param string $message

- * The message - *

- * @param int $category

- * The category - *

- * @return string A string on success. - */ -function dcgettext ($domain, $message, $category) {} - -/** - * (PHP 4, PHP 5)
- * Sets the path for a domain - * @link http://php.net/manual/en/function.bindtextdomain.php - * @param string $domain

- * The domain - *

- * @param string $directory

- * The directory path - *

- * @return string The full pathname for the domain currently being set. - */ -function bindtextdomain ($domain, $directory) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Plural version of gettext - * @link http://php.net/manual/en/function.ngettext.php - * @param string $msgid1 - * @param string $msgid2 - * @param int $n - * @return string correct plural form of message identified by - * msgid1 and msgid2 - * for count n. - */ -function ngettext ($msgid1, $msgid2, $n) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Plural version of dgettext - * @link http://php.net/manual/en/function.dngettext.php - * @param string $domain

- * The domain - *

- * @param string $msgid1 - * @param string $msgid2 - * @param int $n - * @return string A string on success. - */ -function dngettext ($domain, $msgid1, $msgid2, $n) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Plural version of dcgettext - * @link http://php.net/manual/en/function.dcngettext.php - * @param string $domain

- * The domain - *

- * @param string $msgid1 - * @param string $msgid2 - * @param int $n - * @param int $category - * @return string A string on success. - */ -function dcngettext ($domain, $msgid1, $msgid2, $n, $category) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Specify the character encoding in which the messages from the DOMAIN message catalog will be returned - * @link http://php.net/manual/en/function.bind-textdomain-codeset.php - * @param string $domain

- * The domain - *

- * @param string $codeset

- * The code set - *

- * @return string A string on success. - */ -function bind_textdomain_codeset ($domain, $codeset) {} - -// End of gettext v. -?> diff --git a/phpruntime/gmp.php b/phpruntime/gmp.php deleted file mode 100644 index ee1b65f..0000000 --- a/phpruntime/gmp.php +++ /dev/null @@ -1,641 +0,0 @@ - - * Create GMP number - * @link http://php.net/manual/en/function.gmp-init.php - * @param mixed $number

- * An integer or a string. The string representation can be decimal, - * hexadecimal or octal. - *

- * @param int $base [optional]

- * The base. - *

- *

- * The base may vary from 2 to 36. If base is 0 (default value), the - * actual base is determined from the leading characters: if the first - * two characters are 0x or 0X, - * hexadecimal is assumed, otherwise if the first character is "0", - * octal is assumed, otherwise decimal is assumed. - *

- * @return resource A GMP number resource. - */ -function gmp_init ($number, $base = 0) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Convert GMP number to integer - * @link http://php.net/manual/en/function.gmp-intval.php - * @param resource $gmpnumber

- * A GMP number. - *

- * @return int An integer value of gmpnumber. - */ -function gmp_intval ($gmpnumber) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Convert GMP number to string - * @link http://php.net/manual/en/function.gmp-strval.php - * @param resource $gmpnumber

- * The GMP number that will be converted to a string. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param int $base [optional]

- * The base of the returned number. The default base is 10. - * Allowed values for the base are from 2 to 62 and -2 to -36. - *

- * @return string The number, as a string. - */ -function gmp_strval ($gmpnumber, $base = 10) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Add numbers - * @link http://php.net/manual/en/function.gmp-add.php - * @param resource $a

- * A number that will be added. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param resource $b

- * A number that will be added. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return resource A GMP number representing the sum of the arguments. - */ -function gmp_add ($a, $b) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Subtract numbers - * @link http://php.net/manual/en/function.gmp-sub.php - * @param resource $a

- * The number being subtracted from. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param resource $b

- * The number subtracted from a. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return resource A GMP number resource. - */ -function gmp_sub ($a, $b) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Multiply numbers - * @link http://php.net/manual/en/function.gmp-mul.php - * @param resource $a

- * A number that will be multiplied by b. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param resource $b

- * A number that will be multiplied by a. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return resource A GMP number resource. - */ -function gmp_mul ($a, $b) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Divide numbers and get quotient and remainder - * @link http://php.net/manual/en/function.gmp-div-qr.php - * @param resource $n

- * The number being divided. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param resource $d

- * The number that n is being divided by. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param int $round [optional]

- * See the gmp_div_q function for description - * of the round argument. - *

- * @return array an array, with the first - * element being [n/d] (the integer result of the - * division) and the second being (n - [n/d] * d) - * (the remainder of the division). - */ -function gmp_div_qr ($n, $d, $round = 'GMP_ROUND_ZERO') {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Divide numbers - * @link http://php.net/manual/en/function.gmp-div-q.php - * @param resource $a

- * The number being divided. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param resource $b

- * The number that a is being divided by. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param int $round [optional]

- * The result rounding is defined by the - * round, which can have the following - * values: - * GMP_ROUND_ZERO: The result is truncated - * towards 0. - * @return resource A GMP number resource. - */ -function gmp_div_q ($a, $b, $round = 'GMP_ROUND_ZERO') {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Remainder of the division of numbers - * @link http://php.net/manual/en/function.gmp-div-r.php - * @param resource $n

- * The number being divided. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param resource $d

- * The number that n is being divided by. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param int $round [optional]

- * See the gmp_div_q function for description - * of the round argument. - *

- * @return resource The remainder, as a GMP number. - */ -function gmp_div_r ($n, $d, $round = 'GMP_ROUND_ZERO') {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Alias of gmp_div_q - * @link http://php.net/manual/en/function.gmp-div.php - * @param $a - * @param $b - * @param $round [optional] - */ -function gmp_div ($a, $b, $round) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Modulo operation - * @link http://php.net/manual/en/function.gmp-mod.php - * @param resource $n It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param resource $d

- * The modulo that is being evaluated. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return resource A GMP number resource. - */ -function gmp_mod ($n, $d) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Exact division of numbers - * @link http://php.net/manual/en/function.gmp-divexact.php - * @param resource $n

- * The number being divided. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param resource $d

- * The number that a is being divided by. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return resource A GMP number resource. - */ -function gmp_divexact ($n, $d) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Negate number - * @link http://php.net/manual/en/function.gmp-neg.php - * @param resource $a It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return resource -a, as a GMP number. - */ -function gmp_neg ($a) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Absolute value - * @link http://php.net/manual/en/function.gmp-abs.php - * @param resource $a It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return resource the absolute value of a, as a GMP number. - */ -function gmp_abs ($a) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Factorial - * @link http://php.net/manual/en/function.gmp-fact.php - * @param mixed $a

- * The factorial number. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return resource A GMP number resource. - */ -function gmp_fact ($a) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Calculate square root - * @link http://php.net/manual/en/function.gmp-sqrt.php - * @param resource $a It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return resource The integer portion of the square root, as a GMP number. - */ -function gmp_sqrt ($a) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Square root with remainder - * @link http://php.net/manual/en/function.gmp-sqrtrem.php - * @param resource $a

- * The number being square rooted. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return array array where first element is the integer square root of - * a and the second is the remainder - * (i.e., the difference between a and the - * first element squared). - */ -function gmp_sqrtrem ($a) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Raise number into power - * @link http://php.net/manual/en/function.gmp-pow.php - * @param resource $base

- * The base number. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param int $exp

- * The positive power to raise the base. - *

- * @return resource The new (raised) number, as a GMP number. The case of - * 0^0 yields 1. - */ -function gmp_pow ($base, $exp) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Raise number into power with modulo - * @link http://php.net/manual/en/function.gmp-powm.php - * @param resource $base

- * The base number. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param resource $exp

- * The positive power to raise the base. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param resource $mod

- * The modulo. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return resource The new (raised) number, as a GMP number. - */ -function gmp_powm ($base, $exp, $mod) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Perfect square check - * @link http://php.net/manual/en/function.gmp-perfect-square.php - * @param resource $a

- * The number being checked as a perfect square. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return bool TRUE if a is a perfect square, - * FALSE otherwise. - */ -function gmp_perfect_square ($a) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Check if number is "probably prime" - * @link http://php.net/manual/en/function.gmp-prob-prime.php - * @param resource $a

- * The number being checked as a prime. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param int $reps [optional]

- * Reasonable values - * of reps vary from 5 to 10 (default being - * 10); a higher value lowers the probability for a non-prime to - * pass as a "probable" prime. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return int If this function returns 0, a is - * definitely not prime. If it returns 1, then - * a is "probably" prime. If it returns 2, - * then a is surely prime. - */ -function gmp_prob_prime ($a, $reps = 10) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Calculate GCD - * @link http://php.net/manual/en/function.gmp-gcd.php - * @param resource $a It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param resource $b It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return resource A positive GMP number that divides into both - * a and b. - */ -function gmp_gcd ($a, $b) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Calculate GCD and multipliers - * @link http://php.net/manual/en/function.gmp-gcdext.php - * @param resource $a It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param resource $b It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return array An array of GMP numbers. - */ -function gmp_gcdext ($a, $b) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Inverse by modulo - * @link http://php.net/manual/en/function.gmp-invert.php - * @param resource $a It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param resource $b It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return resource A GMP number on success or FALSE if an inverse does not exist. - */ -function gmp_invert ($a, $b) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Jacobi symbol - * @link http://php.net/manual/en/function.gmp-jacobi.php - * @param resource $a It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param resource $p It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- *

- * Should be odd and must be positive. - *

- * @return int A GMP number resource. - */ -function gmp_jacobi ($a, $p) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Legendre symbol - * @link http://php.net/manual/en/function.gmp-legendre.php - * @param resource $a It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param resource $p It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- *

- * Should be odd and must be positive. - *

- * @return int A GMP number resource. - */ -function gmp_legendre ($a, $p) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Compare numbers - * @link http://php.net/manual/en/function.gmp-cmp.php - * @param resource $a It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param resource $b It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return int a positive value if a > b, zero if - * a = b and a negative value if a < - * b. - */ -function gmp_cmp ($a, $b) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Sign of number - * @link http://php.net/manual/en/function.gmp-sign.php - * @param resource $a It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return int 1 if a is positive, - * -1 if a is negative, - * and 0 if a is zero. - */ -function gmp_sign ($a) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Random number - * @link http://php.net/manual/en/function.gmp-random.php - * @param int $limiter [optional]

- * The limiter. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return resource A random GMP number. - */ -function gmp_random ($limiter = 20) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Bitwise AND - * @link http://php.net/manual/en/function.gmp-and.php - * @param resource $a It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param resource $b It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return resource A GMP number representing the bitwise AND comparison. - */ -function gmp_and ($a, $b) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Bitwise OR - * @link http://php.net/manual/en/function.gmp-or.php - * @param resource $a It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param resource $b It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return resource A GMP number resource. - */ -function gmp_or ($a, $b) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Calculates one's complement - * @link http://php.net/manual/en/function.gmp-com.php - * @param resource $a It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return resource the one's complement of a, as a GMP number. - */ -function gmp_com ($a) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Bitwise XOR - * @link http://php.net/manual/en/function.gmp-xor.php - * @param resource $a It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param resource $b It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return resource A GMP number resource. - */ -function gmp_xor ($a, $b) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Set bit - * @link http://php.net/manual/en/function.gmp-setbit.php - * @param resource $a

- * The number being set to. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param int $index

- * The set bit. - *

- * @param bool $set_clear [optional]

- * Defines if the bit is set to 0 or 1. By default the bit is set to - * 1. Index starts at 0. - *

- * @return void A GMP number resource. - */ -function gmp_setbit ($a, $index, $set_clear = true) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Clear bit - * @link http://php.net/manual/en/function.gmp-clrbit.php - * @param resource $a It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param int $index It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return void A GMP number resource. - */ -function gmp_clrbit ($a, $index) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Scan for 0 - * @link http://php.net/manual/en/function.gmp-scan0.php - * @param resource $a

- * The number to scan. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param int $start

- * The starting bit. - *

- * @return int the index of the found bit, as an integer. The - * index starts from 0. - */ -function gmp_scan0 ($a, $start) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Scan for 1 - * @link http://php.net/manual/en/function.gmp-scan1.php - * @param resource $a

- * The number to scan. - *

- * It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param int $start

- * The starting bit. - *

- * @return int the index of the found bit, as an integer. - * If no set bit is found, -1 is returned. - */ -function gmp_scan1 ($a, $start) {} - -/** - * (PHP 5 >= 5.3.0)
- * Tests if a bit is set - * @link http://php.net/manual/en/function.gmp-testbit.php - * @param resource $a It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @param int $index

- * The bit to test - *

- * @return bool TRUE on success or FALSE on failure. - */ -function gmp_testbit ($a, $index) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Population count - * @link http://php.net/manual/en/function.gmp-popcount.php - * @param resource $a It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return int The population count of a, as an integer. - */ -function gmp_popcount ($a) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Hamming distance - * @link http://php.net/manual/en/function.gmp-hamdist.php - * @param resource $a It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- *

- * It should be positive. - *

- * @param resource $b It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- *

- * It should be positive. - *

- * @return int A GMP number resource. - */ -function gmp_hamdist ($a, $b) {} - -/** - * (PHP 5 >= 5.2.0)
- * Find next prime number - * @link http://php.net/manual/en/function.gmp-nextprime.php - * @param int $a It can be either a GMP number resource, or a - * numeric string given that it is possible to convert the latter to a number.

- * @return resource Return the next prime number greater than a, - * as a GMP number. - */ -function gmp_nextprime ($a) {} - -define ('GMP_ROUND_ZERO', 0); -define ('GMP_ROUND_PLUSINF', 1); -define ('GMP_ROUND_MINUSINF', 2); - -/** - * The GMP library version - * @link http://php.net/manual/en/gmp.constants.php - */ -define ('GMP_VERSION', "5.0.2"); - -// End of gmp v. -?> diff --git a/phpruntime/hash.php b/phpruntime/hash.php deleted file mode 100644 index 9466507..0000000 --- a/phpruntime/hash.php +++ /dev/null @@ -1,317 +0,0 @@ - - * Generate a hash value (message digest) - * @link http://php.net/manual/en/function.hash.php - * @param string $algo

- * Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..) - *

- * @param string $data

- * Message to be hashed. - *

- * @param bool $raw_output [optional]

- * When set to TRUE, outputs raw binary data. - * FALSE outputs lowercase hexits. - *

- * @return string a string containing the calculated message digest as lowercase hexits - * unless raw_output is set to true in which case the raw - * binary representation of the message digest is returned. - */ -function hash ($algo, $data, $raw_output = false) {} - -/** - * (PHP 5 >= 5.1.2, PECL hash >= 1.1)
- * Generate a hash value using the contents of a given file - * @link http://php.net/manual/en/function.hash-file.php - * @param string $algo

- * Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..) - *

- * @param string $filename

- * URL describing location of file to be hashed; Supports fopen wrappers. - *

- * @param bool $raw_output [optional]

- * When set to TRUE, outputs raw binary data. - * FALSE outputs lowercase hexits. - *

- * @return string a string containing the calculated message digest as lowercase hexits - * unless raw_output is set to true in which case the raw - * binary representation of the message digest is returned. - */ -function hash_file ($algo, $filename, $raw_output = false) {} - -/** - * (PHP 5 >= 5.1.2, PECL hash >= 1.1)
- * Generate a keyed hash value using the HMAC method - * @link http://php.net/manual/en/function.hash-hmac.php - * @param string $algo

- * Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..) See hash_algos for a list of supported algorithms. - *

- * @param string $data

- * Message to be hashed. - *

- * @param string $key

- * Shared secret key used for generating the HMAC variant of the message digest. - *

- * @param bool $raw_output [optional]

- * When set to TRUE, outputs raw binary data. - * FALSE outputs lowercase hexits. - *

- * @return string a string containing the calculated message digest as lowercase hexits - * unless raw_output is set to true in which case the raw - * binary representation of the message digest is returned. - */ -function hash_hmac ($algo, $data, $key, $raw_output = false) {} - -/** - * (PHP 5 >= 5.1.2, PECL hash >= 1.1)
- * Generate a keyed hash value using the HMAC method and the contents of a given file - * @link http://php.net/manual/en/function.hash-hmac-file.php - * @param string $algo

- * Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..) See hash_algos for a list of supported algorithms. - *

- * @param string $filename

- * URL describing location of file to be hashed; Supports fopen wrappers. - *

- * @param string $key

- * Shared secret key used for generating the HMAC variant of the message digest. - *

- * @param bool $raw_output [optional]

- * When set to TRUE, outputs raw binary data. - * FALSE outputs lowercase hexits. - *

- * @return string a string containing the calculated message digest as lowercase hexits - * unless raw_output is set to true in which case the raw - * binary representation of the message digest is returned. - */ -function hash_hmac_file ($algo, $filename, $key, $raw_output = false) {} - -/** - * (PHP 5 >= 5.1.2, PECL hash >= 1.1)
- * Initialize an incremental hashing context - * @link http://php.net/manual/en/function.hash-init.php - * @param string $algo

- * Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..) - *

- * @param int $options [optional]

- * Optional settings for hash generation, currently supports only one option: - * HASH_HMAC. When specified, the key - * must be specified. - *

- * @param string $key [optional]

- * When HASH_HMAC is specified for options, - * a shared secret key to be used with the HMAC hashing method must be supplied in this - * parameter. - *

- * @return resource a Hashing Context resource for use with hash_update, - * hash_update_stream, hash_update_file, - * and hash_final. - */ -function hash_init ($algo, $options = 0, $key = null) {} - -/** - * (PHP 5 >= 5.1.2, PECL hash >= 1.1)
- * Pump data into an active hashing context - * @link http://php.net/manual/en/function.hash-update.php - * @param resource $context

- * Hashing context returned by hash_init. - *

- * @param string $data

- * Message to be included in the hash digest. - *

- * @return bool TRUE. - */ -function hash_update ($context, $data) {} - -/** - * (PHP 5 >= 5.1.2, PECL hash >= 1.1)
- * Pump data into an active hashing context from an open stream - * @link http://php.net/manual/en/function.hash-update-stream.php - * @param resource $context

- * Hashing context returned by hash_init. - *

- * @param resource $handle

- * Open file handle as returned by any stream creation function. - *

- * @param int $length [optional]

- * Maximum number of characters to copy from handle - * into the hashing context. - *

- * @return int Actual number of bytes added to the hashing context from handle. - */ -function hash_update_stream ($context, $handle, $length = -1) {} - -/** - * (PHP 5 >= 5.1.2, PECL hash >= 1.1)
- * Pump data into an active hashing context from a file - * @link http://php.net/manual/en/function.hash-update-file.php - * @param resource $context

- * Stream context as returned by stream_context_create. - *

- * @param string $filename

- * URL describing location of file to be hashed; Supports fopen wrappers. - *

- * @param resource $context [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function hash_update_file ($context, $filename, $context = null) {} - -/** - * (PHP 5 >= 5.1.2, PECL hash >= 1.1)
- * Finalize an incremental hash and return resulting digest - * @link http://php.net/manual/en/function.hash-final.php - * @param resource $context

- * Hashing context returned by hash_init. - *

- * @param bool $raw_output [optional]

- * When set to TRUE, outputs raw binary data. - * FALSE outputs lowercase hexits. - *

- * @return string a string containing the calculated message digest as lowercase hexits - * unless raw_output is set to true in which case the raw - * binary representation of the message digest is returned. - */ -function hash_final ($context, $raw_output = false) {} - -/** - * (PHP 5 >= 5.3.0)
- * Copy hashing context - * @link http://php.net/manual/en/function.hash-copy.php - * @param resource $context

- * Hashing context returned by hash_init. - *

- * @return resource a copy of Hashing Context resource. - */ -function hash_copy ($context) {} - -/** - * (PHP 5 >= 5.1.2, PECL hash >= 1.1)
- * Return a list of registered hashing algorithms - * @link http://php.net/manual/en/function.hash-algos.php - * @return array a numerically indexed array containing the list of supported - * hashing algorithms. - */ -function hash_algos () {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Generates a key - * @link http://php.net/manual/en/function.mhash-keygen-s2k.php - * @param int $hash

- * The hash ID used to create the key. - * One of the MHASH_hashname constants. - *

- * @param string $password

- * An user supplied password. - *

- * @param string $salt

- * Must be different and random enough for every key you generate in - * order to create different keys. Because salt - * must be known when you check the keys, it is a good idea to append - * the key to it. Salt has a fixed length of 8 bytes and will be padded - * with zeros if you supply less bytes. - *

- * @param int $bytes

- * The key length, in bytes. - *

- * @return string the generated key as a string, or FALSE on error. - */ -function mhash_keygen_s2k ($hash, $password, $salt, $bytes) {} - -/** - * (PHP 4, PHP 5)
- * Gets the block size of the specified hash - * @link http://php.net/manual/en/function.mhash-get-block-size.php - * @param int $hash

- * The hash ID. One of the MHASH_hashname constants. - *

- * @return int the size in bytes or FALSE, if the hash - * does not exist. - */ -function mhash_get_block_size ($hash) {} - -/** - * (PHP 4, PHP 5)
- * Gets the name of the specified hash - * @link http://php.net/manual/en/function.mhash-get-hash-name.php - * @param int $hash

- * The hash ID. One of the MHASH_hashname constants. - *

- * @return string the name of the hash or FALSE, if the hash does not exist. - */ -function mhash_get_hash_name ($hash) {} - -/** - * (PHP 4, PHP 5)
- * Gets the highest available hash ID - * @link http://php.net/manual/en/function.mhash-count.php - * @return int the highest available hash ID. Hashes are numbered from 0 to this - * hash ID. - */ -function mhash_count () {} - -/** - * (PHP 4, PHP 5)
- * Computes hash - * @link http://php.net/manual/en/function.mhash.php - * @param int $hash

- * The hash ID. One of the MHASH_hashname constants. - *

- * @param string $data

- * The user input, as a string. - *

- * @param string $key [optional]

- * If specified, the function will return the resulting HMAC instead. - * HMAC is keyed hashing for message authentication, or simply a message - * digest that depends on the specified key. Not all algorithms - * supported in mhash can be used in HMAC mode. - *

- * @return string the resulting hash (also called digest) or HMAC as a string, or - * FALSE on error. - */ -function mhash ($hash, $data, $key = null) {} - - -/** - * Optional flag for hash_init. - * Indicates that the HMAC digest-keying algorithm should be - * applied to the current hashing context. - * @link http://php.net/manual/en/hash.constants.php - */ -define ('HASH_HMAC', 1); -define ('MHASH_CRC32', 0); -define ('MHASH_MD5', 1); -define ('MHASH_SHA1', 2); -define ('MHASH_HAVAL256', 3); -define ('MHASH_RIPEMD160', 5); -define ('MHASH_TIGER', 7); -define ('MHASH_GOST', 8); -define ('MHASH_CRC32B', 9); -define ('MHASH_HAVAL224', 10); -define ('MHASH_HAVAL192', 11); -define ('MHASH_HAVAL160', 12); -define ('MHASH_HAVAL128', 13); -define ('MHASH_TIGER128', 14); -define ('MHASH_TIGER160', 15); -define ('MHASH_MD4', 16); -define ('MHASH_SHA256', 17); -define ('MHASH_ADLER32', 18); -define ('MHASH_SHA224', 19); -define ('MHASH_SHA512', 20); -define ('MHASH_SHA384', 21); -define ('MHASH_WHIRLPOOL', 22); -define ('MHASH_RIPEMD128', 23); -define ('MHASH_RIPEMD256', 24); -define ('MHASH_RIPEMD320', 25); -define ('MHASH_SNEFRU256', 27); -define ('MHASH_MD2', 28); -define ('MHASH_FNV132', 29); -define ('MHASH_FNV1A32', 30); -define ('MHASH_FNV164', 31); -define ('MHASH_FNV1A64', 32); -define ('MHASH_JOAAT', 33); - -// End of hash v.1.0 -?> diff --git a/phpruntime/iconv.php b/phpruntime/iconv.php deleted file mode 100644 index fef2aa5..0000000 --- a/phpruntime/iconv.php +++ /dev/null @@ -1,433 +0,0 @@ - - * Convert string to requested character encoding - * @link http://php.net/manual/en/function.iconv.php - * @param string $in_charset

- * The input charset. - *

- * @param string $out_charset

- * The output charset. - *

- *

- * If you append the string //TRANSLIT to - * out_charset transliteration is activated. This - * means that when a character can't be represented in the target charset, - * it can be approximated through one or several similarly looking - * characters. If you append the string //IGNORE, - * characters that cannot be represented in the target charset are silently - * discarded. Otherwise, str is cut from the first - * illegal character and an E_NOTICE is generated. - *

- * @param string $str

- * The string to be converted. - *

- * @return string the converted string or FALSE on failure. - */ -function iconv ($in_charset, $out_charset, $str) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Retrieve internal configuration variables of iconv extension - * @link http://php.net/manual/en/function.iconv-get-encoding.php - * @param string $type [optional]

- * The value of the optional type can be: - * all - * input_encoding - * output_encoding - * internal_encoding - *

- * @return mixed the current value of the internal configuration variable if - * successful or FALSE on failure. - *

- *

- * If type is omitted or set to "all", - * iconv_get_encoding returns an array that - * stores all these variables. - */ -function iconv_get_encoding ($type = "all") {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Set current setting for character encoding conversion - * @link http://php.net/manual/en/function.iconv-set-encoding.php - * @param string $type

- * The value of type can be any one of these: - * input_encoding - * output_encoding - * internal_encoding - *

- * @param string $charset

- * The character set. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function iconv_set_encoding ($type, $charset) {} - -/** - * (PHP 5)
- * Returns the character count of string - * @link http://php.net/manual/en/function.iconv-strlen.php - * @param string $str

- * The string. - *

- * @param string $charset [optional]

- * If charset parameter is omitted, - * str is assumed to be encoded in - * iconv.internal_encoding. - *

- * @return int the character count of str, as an integer. - */ -function iconv_strlen ($str, $charset = 'ini_get("iconv.internal_encoding")') {} - -/** - * (PHP 5)
- * Cut out part of a string - * @link http://php.net/manual/en/function.iconv-substr.php - * @param string $str

- * The original string. - *

- * @param int $offset

- * If offset is non-negative, - * iconv_substr cuts the portion out of - * str beginning at offset'th - * character, counting from zero. - *

- *

- * If offset is negative, - * iconv_substr cuts out the portion beginning - * at the position, offset characters - * away from the end of str. - *

- * @param int $length [optional]

- * If length is given and is positive, the return - * value will contain at most length characters - * of the portion that begins at offset - * (depending on the length of string). - *

- *

- * If negative length is passed, - * iconv_substr cuts the portion out of - * str from the offset'th - * character up to the character that is - * length characters away from the end of the string. - * In case offset is also negative, the start position - * is calculated beforehand according to the rule explained above. - *

- * @param string $charset [optional]

- * If charset parameter is omitted, - * string are assumed to be encoded in - * iconv.internal_encoding. - *

- *

- * Note that offset and length - * parameters are always deemed to represent offsets that are - * calculated on the basis of the character set determined by - * charset, whilst the counterpart - * substr always takes these for byte offsets. - *

- * @return string the portion of str specified by the - * offset and length parameters. - *

- *

- * If str is shorter than offset - * characters long, FALSE will be returned. - */ -function iconv_substr ($str, $offset, $length = 'iconv_strlen($str, $charset)', $charset = 'ini_get("iconv.internal_encoding")') {} - -/** - * (PHP 5)
- * Finds position of first occurrence of a needle within a haystack - * @link http://php.net/manual/en/function.iconv-strpos.php - * @param string $haystack

- * The entire string. - *

- * @param string $needle

- * The searched substring. - *

- * @param int $offset [optional]

- * The optional offset parameter specifies - * the position from which the search should be performed. - *

- * @param string $charset [optional]

- * If charset parameter is omitted, - * string are assumed to be encoded in - * iconv.internal_encoding. - *

- * @return int the numeric position of the first occurrence of - * needle in haystack. - *

- *

- * If needle is not found, - * iconv_strpos will return FALSE. - */ -function iconv_strpos ($haystack, $needle, $offset = 0, $charset = 'ini_get("iconv.internal_encoding")') {} - -/** - * (PHP 5)
- * Finds the last occurrence of a needle within a haystack - * @link http://php.net/manual/en/function.iconv-strrpos.php - * @param string $haystack

- * The entire string. - *

- * @param string $needle

- * The searched substring. - *

- * @param string $charset [optional]

- * If charset parameter is omitted, - * string are assumed to be encoded in - * iconv.internal_encoding. - *

- * @return int the numeric position of the last occurrence of - * needle in haystack. - *

- *

- * If needle is not found, - * iconv_strrpos will return FALSE. - */ -function iconv_strrpos ($haystack, $needle, $charset = 'ini_get("iconv.internal_encoding")') {} - -/** - * (PHP 5)
- * Composes a MIME header field - * @link http://php.net/manual/en/function.iconv-mime-encode.php - * @param string $field_name

- * The field name. - *

- * @param string $field_value

- * The field value. - *

- * @param array $preferences [optional]

- * You can control the behaviour of iconv_mime_encode - * by specifying an associative array that contains configuration items - * to the optional third parameter preferences. - * The items supported by iconv_mime_encode are - * listed below. Note that item names are treated case-sensitive. - * - * Configuration items supported by iconv_mime_encode - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
ItemTypeDescriptionDefault valueExample
schemestring - * Specifies the method to encode a field value by. The value of - * this item may be either "B" or "Q", where "B" stands for - * base64 encoding scheme and "Q" stands for - * quoted-printable encoding scheme. - * BB
input-charsetstring - * Specifies the character set in which the first parameter - * field_name and the second parameter - * field_value are presented. If not given, - * iconv_mime_encode assumes those parameters - * are presented to it in the - * iconv.internal_encoding - * ini setting. - * - * iconv.internal_encoding - * ISO-8859-1
output-charsetstring - * Specifies the character set to use to compose the - * MIME header. - * - * iconv.internal_encoding - * UTF-8
line-lengthinteger - * Specifies the maximum length of the header lines. The resulting - * header is "folded" to a set of multiple lines in case - * the resulting header field would be longer than the value of this - * parameter, according to - * RFC2822 - Internet Message Format. - * If not given, the length will be limited to 76 characters. - * 76996
line-break-charsstring - * Specifies the sequence of characters to append to each line - * as an end-of-line sign when "folding" is performed on a long header - * field. If not given, this defaults to "\r\n" - * (CR LF). Note that - * this parameter is always treated as an ASCII string regardless - * of the value of input-charset. - * \r\n\n
- *

- * @return string an encoded MIME field on success, - * or FALSE if an error occurs during the encoding. - */ -function iconv_mime_encode ($field_name, $field_value, array $preferences = null) {} - -/** - * (PHP 5)
- * Decodes a MIME header field - * @link http://php.net/manual/en/function.iconv-mime-decode.php - * @param string $encoded_header

- * The encoded header, as a string. - *

- * @param int $mode [optional]

- * mode determines the behaviour in the event - * iconv_mime_decode encounters a malformed - * MIME header field. You can specify any combination - * of the following bitmasks. - * - * Bitmasks acceptable to iconv_mime_decode - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
ValueConstantDescription
1ICONV_MIME_DECODE_STRICT - * If set, the given header is decoded in full conformance with the - * standards defined in RFC2047. - * This option is disabled by default because there are a lot of - * broken mail user agents that don't follow the specification and don't - * produce correct MIME headers. - *
2ICONV_MIME_DECODE_CONTINUE_ON_ERROR - * If set, iconv_mime_decode_headers - * attempts to ignore any grammatical errors and continue to process - * a given header. - *
- *

- * @param string $charset [optional]

- * The optional charset parameter specifies the - * character set to represent the result by. If omitted, - * iconv.internal_encoding - * will be used. - *

- * @return string a decoded MIME field on success, - * or FALSE if an error occurs during the decoding. - */ -function iconv_mime_decode ($encoded_header, $mode = 0, $charset = 'ini_get("iconv.internal_encoding")') {} - -/** - * (PHP 5)
- * Decodes multiple MIME header fields at once - * @link http://php.net/manual/en/function.iconv-mime-decode-headers.php - * @param string $encoded_headers

- * The encoded headers, as a string. - *

- * @param int $mode [optional]

- * mode determines the behaviour in the event - * iconv_mime_decode_headers encounters a malformed - * MIME header field. You can specify any combination - * of the following bitmasks. - * - * Bitmasks acceptable to iconv_mime_decode_headers - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
ValueConstantDescription
1ICONV_MIME_DECODE_STRICT - * If set, the given header is decoded in full conformance with the - * standards defined in RFC2047. - * This option is disabled by default because there are a lot of - * broken mail user agents that don't follow the specification and don't - * produce correct MIME headers. - *
2ICONV_MIME_DECODE_CONTINUE_ON_ERROR - * If set, iconv_mime_decode_headers - * attempts to ignore any grammatical errors and continue to process - * a given header. - *
- *

- * @param string $charset [optional]

- * The optional charset parameter specifies the - * character set to represent the result by. If omitted, - * iconv.internal_encoding - * will be used. - *

- * @return array an associative array that holds a whole set of - * MIME header fields specified by - * encoded_headers on success, or FALSE - * if an error occurs during the decoding. - *

- *

- * Each key of the return value represents an individual - * field name and the corresponding element represents a field value. - * If more than one field of the same name are present, - * iconv_mime_decode_headers automatically incorporates - * them into a numerically indexed array in the order of occurrence. - */ -function iconv_mime_decode_headers ($encoded_headers, $mode = 0, $charset = 'ini_get("iconv.internal_encoding")') {} - - -/** - * string - * @link http://php.net/manual/en/iconv.constants.php - */ -define ('ICONV_IMPL', "glibc"); - -/** - * string - * @link http://php.net/manual/en/iconv.constants.php - */ -define ('ICONV_VERSION', 2.15); - -/** - * integer - * @link http://php.net/manual/en/iconv.constants.php - */ -define ('ICONV_MIME_DECODE_STRICT', 1); - -/** - * integer - * @link http://php.net/manual/en/iconv.constants.php - */ -define ('ICONV_MIME_DECODE_CONTINUE_ON_ERROR', 2); - -// End of iconv v. -?> diff --git a/phpruntime/imagick.php b/phpruntime/imagick.php deleted file mode 100644 index f85fe87..0000000 --- a/phpruntime/imagick.php +++ /dev/null @@ -1,6324 +0,0 @@ - - * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -class ImagickDrawException extends Exception { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -class ImagickPixelIteratorException extends Exception { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -class ImagickPixelException extends Exception { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * @link http://php.net/manual/en/class.imagick.php - */ -class Imagick implements Iterator, Traversable { - const COLOR_BLACK = 11; - const COLOR_BLUE = 12; - const COLOR_CYAN = 13; - const COLOR_GREEN = 14; - const COLOR_RED = 15; - const COLOR_YELLOW = 16; - const COLOR_MAGENTA = 17; - const COLOR_OPACITY = 18; - const COLOR_ALPHA = 19; - const COLOR_FUZZ = 20; - const IMAGICK_EXTNUM = 30001; - const IMAGICK_EXTVER = "3.1.0RC1"; - const COMPOSITE_DEFAULT = 40; - const COMPOSITE_UNDEFINED = 0; - const COMPOSITE_NO = 1; - const COMPOSITE_ADD = 2; - const COMPOSITE_ATOP = 3; - const COMPOSITE_BLEND = 4; - const COMPOSITE_BUMPMAP = 5; - const COMPOSITE_CLEAR = 7; - const COMPOSITE_COLORBURN = 8; - const COMPOSITE_COLORDODGE = 9; - const COMPOSITE_COLORIZE = 10; - const COMPOSITE_COPYBLACK = 11; - const COMPOSITE_COPYBLUE = 12; - const COMPOSITE_COPY = 13; - const COMPOSITE_COPYCYAN = 14; - const COMPOSITE_COPYGREEN = 15; - const COMPOSITE_COPYMAGENTA = 16; - const COMPOSITE_COPYOPACITY = 17; - const COMPOSITE_COPYRED = 18; - const COMPOSITE_COPYYELLOW = 19; - const COMPOSITE_DARKEN = 20; - const COMPOSITE_DSTATOP = 21; - const COMPOSITE_DST = 22; - const COMPOSITE_DSTIN = 23; - const COMPOSITE_DSTOUT = 24; - const COMPOSITE_DSTOVER = 25; - const COMPOSITE_DIFFERENCE = 26; - const COMPOSITE_DISPLACE = 27; - const COMPOSITE_DISSOLVE = 28; - const COMPOSITE_EXCLUSION = 29; - const COMPOSITE_HARDLIGHT = 30; - const COMPOSITE_HUE = 31; - const COMPOSITE_IN = 32; - const COMPOSITE_LIGHTEN = 33; - const COMPOSITE_LUMINIZE = 35; - const COMPOSITE_MINUS = 36; - const COMPOSITE_MODULATE = 37; - const COMPOSITE_MULTIPLY = 38; - const COMPOSITE_OUT = 39; - const COMPOSITE_OVER = 40; - const COMPOSITE_OVERLAY = 41; - const COMPOSITE_PLUS = 42; - const COMPOSITE_REPLACE = 43; - const COMPOSITE_SATURATE = 44; - const COMPOSITE_SCREEN = 45; - const COMPOSITE_SOFTLIGHT = 46; - const COMPOSITE_SRCATOP = 47; - const COMPOSITE_SRC = 48; - const COMPOSITE_SRCIN = 49; - const COMPOSITE_SRCOUT = 50; - const COMPOSITE_SRCOVER = 51; - const COMPOSITE_SUBTRACT = 52; - const COMPOSITE_THRESHOLD = 53; - const COMPOSITE_XOR = 54; - const MONTAGEMODE_FRAME = 1; - const MONTAGEMODE_UNFRAME = 2; - const MONTAGEMODE_CONCATENATE = 3; - const STYLE_NORMAL = 1; - const STYLE_ITALIC = 2; - const STYLE_OBLIQUE = 3; - const STYLE_ANY = 4; - const FILTER_UNDEFINED = 0; - const FILTER_POINT = 1; - const FILTER_BOX = 2; - const FILTER_TRIANGLE = 3; - const FILTER_HERMITE = 4; - const FILTER_HANNING = 5; - const FILTER_HAMMING = 6; - const FILTER_BLACKMAN = 7; - const FILTER_GAUSSIAN = 8; - const FILTER_QUADRATIC = 9; - const FILTER_CUBIC = 10; - const FILTER_CATROM = 11; - const FILTER_MITCHELL = 12; - const FILTER_LANCZOS = 22; - const FILTER_BESSEL = 13; - const FILTER_SINC = 14; - const IMGTYPE_UNDEFINED = 0; - const IMGTYPE_BILEVEL = 1; - const IMGTYPE_GRAYSCALE = 2; - const IMGTYPE_GRAYSCALEMATTE = 3; - const IMGTYPE_PALETTE = 4; - const IMGTYPE_PALETTEMATTE = 5; - const IMGTYPE_TRUECOLOR = 6; - const IMGTYPE_TRUECOLORMATTE = 7; - const IMGTYPE_COLORSEPARATION = 8; - const IMGTYPE_COLORSEPARATIONMATTE = 9; - const IMGTYPE_OPTIMIZE = 10; - const RESOLUTION_UNDEFINED = 0; - const RESOLUTION_PIXELSPERINCH = 1; - const RESOLUTION_PIXELSPERCENTIMETER = 2; - const COMPRESSION_UNDEFINED = 0; - const COMPRESSION_NO = 1; - const COMPRESSION_BZIP = 2; - const COMPRESSION_FAX = 6; - const COMPRESSION_GROUP4 = 7; - const COMPRESSION_JPEG = 8; - const COMPRESSION_JPEG2000 = 9; - const COMPRESSION_LOSSLESSJPEG = 10; - const COMPRESSION_LZW = 11; - const COMPRESSION_RLE = 12; - const COMPRESSION_ZIP = 13; - const COMPRESSION_DXT1 = 3; - const COMPRESSION_DXT3 = 4; - const COMPRESSION_DXT5 = 5; - const PAINT_POINT = 1; - const PAINT_REPLACE = 2; - const PAINT_FLOODFILL = 3; - const PAINT_FILLTOBORDER = 4; - const PAINT_RESET = 5; - const GRAVITY_NORTHWEST = 1; - const GRAVITY_NORTH = 2; - const GRAVITY_NORTHEAST = 3; - const GRAVITY_WEST = 4; - const GRAVITY_CENTER = 5; - const GRAVITY_EAST = 6; - const GRAVITY_SOUTHWEST = 7; - const GRAVITY_SOUTH = 8; - const GRAVITY_SOUTHEAST = 9; - const STRETCH_NORMAL = 1; - const STRETCH_ULTRACONDENSED = 2; - const STRETCH_CONDENSED = 4; - const STRETCH_SEMICONDENSED = 5; - const STRETCH_SEMIEXPANDED = 6; - const STRETCH_EXPANDED = 7; - const STRETCH_EXTRAEXPANDED = 8; - const STRETCH_ULTRAEXPANDED = 9; - const STRETCH_ANY = 10; - const ALIGN_UNDEFINED = 0; - const ALIGN_LEFT = 1; - const ALIGN_CENTER = 2; - const ALIGN_RIGHT = 3; - const DECORATION_NO = 1; - const DECORATION_UNDERLINE = 2; - const DECORATION_OVERLINE = 3; - const DECORATION_LINETROUGH = 4; - const NOISE_UNIFORM = 1; - const NOISE_GAUSSIAN = 2; - const NOISE_MULTIPLICATIVEGAUSSIAN = 3; - const NOISE_IMPULSE = 4; - const NOISE_LAPLACIAN = 5; - const NOISE_POISSON = 6; - const NOISE_RANDOM = 7; - const CHANNEL_UNDEFINED = 0; - const CHANNEL_RED = 1; - const CHANNEL_GRAY = 1; - const CHANNEL_CYAN = 1; - const CHANNEL_GREEN = 2; - const CHANNEL_MAGENTA = 2; - const CHANNEL_BLUE = 4; - const CHANNEL_YELLOW = 4; - const CHANNEL_ALPHA = 8; - const CHANNEL_OPACITY = 8; - const CHANNEL_MATTE = 8; - const CHANNEL_BLACK = 32; - const CHANNEL_INDEX = 32; - const CHANNEL_ALL = 134217727; - const CHANNEL_DEFAULT = 134217719; - const METRIC_UNDEFINED = 0; - const METRIC_MEANABSOLUTEERROR = 2; - const METRIC_MEANSQUAREERROR = 4; - const METRIC_PEAKABSOLUTEERROR = 5; - const METRIC_PEAKSIGNALTONOISERATIO = 6; - const METRIC_ROOTMEANSQUAREDERROR = 7; - const PIXEL_CHAR = 1; - const PIXEL_DOUBLE = 2; - const PIXEL_FLOAT = 3; - const PIXEL_INTEGER = 4; - const PIXEL_LONG = 5; - const PIXEL_QUANTUM = 6; - const PIXEL_SHORT = 7; - const EVALUATE_UNDEFINED = 0; - const EVALUATE_ADD = 1; - const EVALUATE_AND = 2; - const EVALUATE_DIVIDE = 3; - const EVALUATE_LEFTSHIFT = 4; - const EVALUATE_MAX = 5; - const EVALUATE_MIN = 6; - const EVALUATE_MULTIPLY = 7; - const EVALUATE_OR = 8; - const EVALUATE_RIGHTSHIFT = 9; - const EVALUATE_SET = 10; - const EVALUATE_SUBTRACT = 11; - const EVALUATE_XOR = 12; - const EVALUATE_POW = 13; - const EVALUATE_LOG = 14; - const EVALUATE_THRESHOLD = 15; - const EVALUATE_THRESHOLDBLACK = 16; - const EVALUATE_THRESHOLDWHITE = 17; - const EVALUATE_GAUSSIANNOISE = 18; - const EVALUATE_IMPULSENOISE = 19; - const EVALUATE_LAPLACIANNOISE = 20; - const EVALUATE_MULTIPLICATIVENOISE = 21; - const EVALUATE_POISSONNOISE = 22; - const EVALUATE_UNIFORMNOISE = 23; - const EVALUATE_COSINE = 24; - const EVALUATE_SINE = 25; - const EVALUATE_ADDMODULUS = 26; - const COLORSPACE_UNDEFINED = 0; - const COLORSPACE_RGB = 1; - const COLORSPACE_GRAY = 2; - const COLORSPACE_TRANSPARENT = 3; - const COLORSPACE_OHTA = 4; - const COLORSPACE_LAB = 5; - const COLORSPACE_XYZ = 6; - const COLORSPACE_YCBCR = 7; - const COLORSPACE_YCC = 8; - const COLORSPACE_YIQ = 9; - const COLORSPACE_YPBPR = 10; - const COLORSPACE_YUV = 11; - const COLORSPACE_CMYK = 12; - const COLORSPACE_SRGB = 13; - const COLORSPACE_HSB = 14; - const COLORSPACE_HSL = 15; - const COLORSPACE_HWB = 16; - const COLORSPACE_REC601LUMA = 17; - const COLORSPACE_REC709LUMA = 19; - const COLORSPACE_LOG = 21; - const COLORSPACE_CMY = 22; - const VIRTUALPIXELMETHOD_UNDEFINED = 0; - const VIRTUALPIXELMETHOD_BACKGROUND = 1; - const VIRTUALPIXELMETHOD_CONSTANT = 2; - const VIRTUALPIXELMETHOD_EDGE = 4; - const VIRTUALPIXELMETHOD_MIRROR = 5; - const VIRTUALPIXELMETHOD_TILE = 7; - const VIRTUALPIXELMETHOD_TRANSPARENT = 8; - const VIRTUALPIXELMETHOD_MASK = 9; - const VIRTUALPIXELMETHOD_BLACK = 10; - const VIRTUALPIXELMETHOD_GRAY = 11; - const VIRTUALPIXELMETHOD_WHITE = 12; - const VIRTUALPIXELMETHOD_HORIZONTALTILE = 13; - const VIRTUALPIXELMETHOD_VERTICALTILE = 14; - const PREVIEW_UNDEFINED = 0; - const PREVIEW_ROTATE = 1; - const PREVIEW_SHEAR = 2; - const PREVIEW_ROLL = 3; - const PREVIEW_HUE = 4; - const PREVIEW_SATURATION = 5; - const PREVIEW_BRIGHTNESS = 6; - const PREVIEW_GAMMA = 7; - const PREVIEW_SPIFF = 8; - const PREVIEW_DULL = 9; - const PREVIEW_GRAYSCALE = 10; - const PREVIEW_QUANTIZE = 11; - const PREVIEW_DESPECKLE = 12; - const PREVIEW_REDUCENOISE = 13; - const PREVIEW_ADDNOISE = 14; - const PREVIEW_SHARPEN = 15; - const PREVIEW_BLUR = 16; - const PREVIEW_THRESHOLD = 17; - const PREVIEW_EDGEDETECT = 18; - const PREVIEW_SPREAD = 19; - const PREVIEW_SOLARIZE = 20; - const PREVIEW_SHADE = 21; - const PREVIEW_RAISE = 22; - const PREVIEW_SEGMENT = 23; - const PREVIEW_SWIRL = 24; - const PREVIEW_IMPLODE = 25; - const PREVIEW_WAVE = 26; - const PREVIEW_OILPAINT = 27; - const PREVIEW_CHARCOALDRAWING = 28; - const PREVIEW_JPEG = 29; - const RENDERINGINTENT_UNDEFINED = 0; - const RENDERINGINTENT_SATURATION = 1; - const RENDERINGINTENT_PERCEPTUAL = 2; - const RENDERINGINTENT_ABSOLUTE = 3; - const RENDERINGINTENT_RELATIVE = 4; - const INTERLACE_UNDEFINED = 0; - const INTERLACE_NO = 1; - const INTERLACE_LINE = 2; - const INTERLACE_PLANE = 3; - const INTERLACE_PARTITION = 4; - const INTERLACE_GIF = 5; - const INTERLACE_JPEG = 6; - const INTERLACE_PNG = 7; - const FILLRULE_UNDEFINED = 0; - const FILLRULE_EVENODD = 1; - const FILLRULE_NONZERO = 2; - const PATHUNITS_UNDEFINED = 0; - const PATHUNITS_USERSPACE = 1; - const PATHUNITS_USERSPACEONUSE = 2; - const PATHUNITS_OBJECTBOUNDINGBOX = 3; - const LINECAP_UNDEFINED = 0; - const LINECAP_BUTT = 1; - const LINECAP_ROUND = 2; - const LINECAP_SQUARE = 3; - const LINEJOIN_UNDEFINED = 0; - const LINEJOIN_MITER = 1; - const LINEJOIN_ROUND = 2; - const LINEJOIN_BEVEL = 3; - const RESOURCETYPE_UNDEFINED = 0; - const RESOURCETYPE_AREA = 1; - const RESOURCETYPE_DISK = 2; - const RESOURCETYPE_FILE = 3; - const RESOURCETYPE_MAP = 4; - const RESOURCETYPE_MEMORY = 5; - const DISPOSE_UNRECOGNIZED = 0; - const DISPOSE_UNDEFINED = 0; - const DISPOSE_NONE = 1; - const DISPOSE_BACKGROUND = 2; - const DISPOSE_PREVIOUS = 3; - const INTERPOLATE_UNDEFINED = 0; - const INTERPOLATE_AVERAGE = 1; - const INTERPOLATE_BICUBIC = 2; - const INTERPOLATE_BILINEAR = 3; - const INTERPOLATE_FILTER = 4; - const INTERPOLATE_INTEGER = 5; - const INTERPOLATE_MESH = 6; - const INTERPOLATE_NEARESTNEIGHBOR = 7; - const INTERPOLATE_SPLINE = 8; - const LAYERMETHOD_UNDEFINED = 0; - const LAYERMETHOD_COALESCE = 1; - const LAYERMETHOD_COMPAREANY = 2; - const LAYERMETHOD_COMPARECLEAR = 3; - const LAYERMETHOD_COMPAREOVERLAY = 4; - const LAYERMETHOD_DISPOSE = 5; - const LAYERMETHOD_OPTIMIZE = 6; - const LAYERMETHOD_OPTIMIZEPLUS = 8; - const LAYERMETHOD_OPTIMIZETRANS = 9; - const LAYERMETHOD_COMPOSITE = 12; - const LAYERMETHOD_OPTIMIZEIMAGE = 7; - const LAYERMETHOD_REMOVEDUPS = 10; - const LAYERMETHOD_REMOVEZERO = 11; - const ORIENTATION_UNDEFINED = 0; - const ORIENTATION_TOPLEFT = 1; - const ORIENTATION_TOPRIGHT = 2; - const ORIENTATION_BOTTOMRIGHT = 3; - const ORIENTATION_BOTTOMLEFT = 4; - const ORIENTATION_LEFTTOP = 5; - const ORIENTATION_RIGHTTOP = 6; - const ORIENTATION_RIGHTBOTTOM = 7; - const ORIENTATION_LEFTBOTTOM = 8; - const DISTORTION_UNDEFINED = 0; - const DISTORTION_AFFINE = 1; - const DISTORTION_AFFINEPROJECTION = 2; - const DISTORTION_ARC = 9; - const DISTORTION_BILINEAR = 6; - const DISTORTION_PERSPECTIVE = 4; - const DISTORTION_PERSPECTIVEPROJECTION = 5; - const DISTORTION_SCALEROTATETRANSLATE = 3; - const DISTORTION_POLYNOMIAL = 8; - const DISTORTION_POLAR = 10; - const DISTORTION_DEPOLAR = 11; - const DISTORTION_BARREL = 14; - const DISTORTION_BARRELINVERSE = 15; - const DISTORTION_SHEPARDS = 16; - const DISTORTION_SENTINEL = 18; - const LAYERMETHOD_MERGE = 13; - const LAYERMETHOD_FLATTEN = 14; - const LAYERMETHOD_MOSAIC = 15; - const ALPHACHANNEL_ACTIVATE = 1; - const ALPHACHANNEL_DEACTIVATE = 4; - const ALPHACHANNEL_RESET = 7; - const ALPHACHANNEL_SET = 8; - const ALPHACHANNEL_UNDEFINED = 0; - const ALPHACHANNEL_COPY = 3; - const ALPHACHANNEL_EXTRACT = 5; - const ALPHACHANNEL_OPAQUE = 6; - const ALPHACHANNEL_SHAPE = 9; - const ALPHACHANNEL_TRANSPARENT = 10; - const SPARSECOLORMETHOD_UNDEFINED = 0; - const SPARSECOLORMETHOD_BARYCENTRIC = 1; - const SPARSECOLORMETHOD_BILINEAR = 7; - const SPARSECOLORMETHOD_POLYNOMIAL = 8; - const SPARSECOLORMETHOD_SPEPARDS = 16; - const SPARSECOLORMETHOD_VORONOI = 18; - const DITHERMETHOD_UNDEFINED = 0; - const DITHERMETHOD_NO = 1; - const DITHERMETHOD_RIEMERSMA = 2; - const DITHERMETHOD_FLOYDSTEINBERG = 3; - const FUNCTION_UNDEFINED = 0; - const FUNCTION_POLYNOMIAL = 1; - const FUNCTION_SINUSOID = 2; - - - /** - * (PECL imagick 2.0.0)
- * Removes repeated portions of images to optimize - * @link http://php.net/manual/en/imagick.optimizeimagelayers.php - * @return bool TRUE on success. - */ - public function optimizeimagelayers () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the maximum bounding region between images - * @link http://php.net/manual/en/imagick.compareimagelayers.php - * @param int $method

- * One of the layer method constants. - *

- * @return Imagick TRUE on success. - */ - public function compareimagelayers ($method) {} - - /** - * (PECL imagick 2.0.0)
- * Quickly fetch attributes - * @link http://php.net/manual/en/imagick.pingimageblob.php - * @param string $image

- * A string containing the image. - *

- * @return bool TRUE on success. - */ - public function pingimageblob ($image) {} - - /** - * (PECL imagick 2.0.0)
- * Get basic image attributes in a lightweight manner - * @link http://php.net/manual/en/imagick.pingimagefile.php - * @param resource $filehandle

- * An open filehandle to the image. - *

- * @param string $fileName [optional]

- * Optional filename for this image. - *

- * @return bool TRUE on success. - */ - public function pingimagefile ($filehandle, $fileName = null) {} - - /** - * (PECL imagick 2.0.0)
- * Creates a vertical mirror image - * @link http://php.net/manual/en/imagick.transposeimage.php - * @return bool TRUE on success. - */ - public function transposeimage () {} - - /** - * (PECL imagick 2.0.0)
- * Creates a horizontal mirror image - * @link http://php.net/manual/en/imagick.transverseimage.php - * @return bool TRUE on success. - */ - public function transverseimage () {} - - /** - * (PECL imagick 2.0.0)
- * Remove edges from the image - * @link http://php.net/manual/en/imagick.trimimage.php - * @param float $fuzz

- * By default target must match a particular pixel color exactly. - * However, in many cases two colors may differ by a small amount. - * The fuzz member of image defines how much tolerance is acceptable - * to consider two colors as the same. This parameter represents the variation - * on the quantum range. - *

- * @return bool TRUE on success. - */ - public function trimimage ($fuzz) {} - - /** - * (PECL imagick 2.0.0)
- * Applies wave filter to the image - * @link http://php.net/manual/en/imagick.waveimage.php - * @param float $amplitude

- * The amplitude of the wave. - *

- * @param float $length

- * The length of the wave. - *

- * @return bool TRUE on success. - */ - public function waveimage ($amplitude, $length) {} - - /** - * (PECL imagick 2.0.0)
- * Adds vignette filter to the image - * @link http://php.net/manual/en/imagick.vignetteimage.php - * @param float $blackPoint

- * The black point. - *

- * @param float $whitePoint

- * The white point - *

- * @param int $x

- * X offset of the ellipse - *

- * @param int $y

- * Y offset of the ellipse - *

- * @return bool TRUE on success. - */ - public function vignetteimage ($blackPoint, $whitePoint, $x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Discards all but one of any pixel color - * @link http://php.net/manual/en/imagick.uniqueimagecolors.php - * @return bool TRUE on success. - */ - public function uniqueimagecolors () {} - - /** - * (PECL imagick 2.0.0)
- * Return if the image has a matte channel - * @link http://php.net/manual/en/imagick.getimagematte.php - * @return bool TRUE on success or FALSE on failure. - */ - public function getimagematte () {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image matte channel - * @link http://php.net/manual/en/imagick.setimagematte.php - * @param bool $matte

- * True activates the matte channel and false disables it. - *

- * @return bool TRUE on success. - */ - public function setimagematte ($matte) {} - - /** - * (PECL imagick 2.0.0)
- * Adaptively resize image with data dependent triangulation - * @link http://php.net/manual/en/imagick.adaptiveresizeimage.php - * @param int $columns

- * The number of columns in the scaled image. - *

- * @param int $rows

- * The number of rows in the scaled image. - *

- * @param bool $bestfit [optional]

- * Whether to fit the image inside a bounding box. - *

- * @return bool TRUE on success. - */ - public function adaptiveresizeimage ($columns, $rows, $bestfit = false) {} - - /** - * (PECL imagick 2.0.0)
- * Simulates a pencil sketch - * @link http://php.net/manual/en/imagick.sketchimage.php - * @param float $radius

- * The radius of the Gaussian, in pixels, not counting the center pixel - *

- * @param float $sigma

- * The standard deviation of the Gaussian, in pixels. - *

- * @param float $angle

- * Apply the effect along this angle. - *

- * @return bool TRUE on success. - */ - public function sketchimage ($radius, $sigma, $angle) {} - - /** - * (PECL imagick 2.0.0)
- * Creates a 3D effect - * @link http://php.net/manual/en/imagick.shadeimage.php - * @param bool $gray

- * A value other than zero shades the intensity of each pixel. - *

- * @param float $azimuth

- * Defines the light source direction. - *

- * @param float $elevation

- * Defines the light source direction. - *

- * @return bool TRUE on success. - */ - public function shadeimage ($gray, $azimuth, $elevation) {} - - /** - * (PECL imagick 2.0.0)
- * Returns the size offset - * @link http://php.net/manual/en/imagick.getsizeoffset.php - * @return int the size offset associated with the Imagick object. - */ - public function getsizeoffset () {} - - /** - * (PECL imagick 2.0.0)
- * Sets the size and offset of the Imagick object - * @link http://php.net/manual/en/imagick.setsizeoffset.php - * @param int $columns

- * The width in pixels. - *

- * @param int $rows

- * The height in pixels. - *

- * @param int $offset

- * The image offset. - *

- * @return bool TRUE on success. - */ - public function setsizeoffset ($columns, $rows, $offset) {} - - /** - * (PECL imagick 2.0.0)
- * Adds adaptive blur filter to image - * @link http://php.net/manual/en/imagick.adaptiveblurimage.php - * @param float $radius

- * The radius of the Gaussian, in pixels, not counting the center pixel. - * Provide a value of 0 and the radius will be chosen automagically. - *

- * @param float $sigma

- * The standard deviation of the Gaussian, in pixels. - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channel constants using bitwise operators. Defaults to Imagick::CHANNEL_DEFAULT. Refer to this list of channel constants - *

- * @return bool TRUE on success. - */ - public function adaptiveblurimage ($radius, $sigma, $channel = 'Imagick::CHANNEL_DEFAULT') {} - - /** - * (PECL imagick 2.0.0)
- * Enhances the contrast of a color image - * @link http://php.net/manual/en/imagick.contraststretchimage.php - * @param float $black_point

- * The black point. - *

- * @param float $white_point

- * The white point. - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To - * apply to more than one channel, combine channeltype constants using - * bitwise operators. Imagick::CHANNEL_ALL. Refer to this - * list of channel constants. - *

- * @return bool TRUE on success. - */ - public function contraststretchimage ($black_point, $white_point, $channel = 'Imagick::CHANNEL_ALL') {} - - /** - * (PECL imagick 2.0.0)
- * Adaptively sharpen the image - * @link http://php.net/manual/en/imagick.adaptivesharpenimage.php - * @param float $radius

- * The radius of the Gaussian, in pixels, not counting the center pixel. Use 0 for auto-select. - *

- * @param float $sigma

- * The standard deviation of the Gaussian, in pixels. - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channel constants using bitwise operators. Defaults to Imagick::CHANNEL_DEFAULT. Refer to this list of channel constants - *

- * @return bool TRUE on success. - */ - public function adaptivesharpenimage ($radius, $sigma, $channel = 'Imagick::CHANNEL_DEFAULT') {} - - /** - * (PECL imagick 2.0.0)
- * Creates a high-contrast, two-color image - * @link http://php.net/manual/en/imagick.randomthresholdimage.php - * @param float $low

- * The low point - *

- * @param float $high

- * The high point - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To - * apply to more than one channel, combine channeltype constants using - * bitwise operators. Refer to this - * list of channel constants. - *

- * @return bool TRUE on success. - */ - public function randomthresholdimage ($low, $high, $channel = 'Imagick::CHANNEL_ALL') {} - - /** - * @param $xRounding - * @param $yRounding - * @param $strokeWidth [optional] - * @param $displace [optional] - * @param $sizeCorrection [optional] - */ - public function roundcornersimage ($xRounding, $yRounding, $strokeWidth, $displace, $sizeCorrection) {} - - /** - * (PECL imagick 2.0.0)
- * Rounds image corners - * @link http://php.net/manual/en/imagick.roundcorners.php - * @param float $x_rounding

- * x rounding - *

- * @param float $y_rounding

- * y rounding - *

- * @param float $stroke_width [optional]

- * stroke width - *

- * @param float $displace [optional]

- * image displace - *

- * @param float $size_correction [optional]

- * size correction - *

- * @return bool TRUE on success. - */ - public function roundcorners ($x_rounding, $y_rounding, $stroke_width = 10, $displace = 5, $size_correction = -6) {} - - /** - * (PECL imagick 2.0.0)
- * Set the iterator position - * @link http://php.net/manual/en/imagick.setiteratorindex.php - * @param int $index

- * The position to set the iterator to - *

- * @return bool TRUE on success. - */ - public function setiteratorindex ($index) {} - - /** - * (PECL imagick 2.0.0)
- * Gets the index of the current active image - * @link http://php.net/manual/en/imagick.getiteratorindex.php - * @return int an integer containing the index of the image in the stack. - */ - public function getiteratorindex () {} - - /** - * (PECL imagick 2.0.0)
- * Convenience method for setting crop size and the image geometry - * @link http://php.net/manual/en/imagick.transformimage.php - * @param string $crop

- * A crop geometry string. This geometry defines a subregion of the image to crop. - *

- * @param string $geometry

- * An image geometry string. This geometry defines the final size of the image. - *

- * @return Imagick TRUE on success. - */ - public function transformimage ($crop, $geometry) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image opacity level - * @link http://php.net/manual/en/imagick.setimageopacity.php - * @param float $opacity

- * The level of transparency: 1.0 is fully opaque and 0.0 is fully - * transparent. - *

- * @return bool TRUE on success. - */ - public function setimageopacity ($opacity) {} - - /** - * (PECL imagick 2.2.2)
- * Performs an ordered dither - * @link http://php.net/manual/en/imagick.orderedposterizeimage.php - * @param string $threshold_map

- * A string containing the name of the threshold dither map to use - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To - * apply to more than one channel, combine channeltype constants using - * bitwise operators. Refer to this - * list of channel constants. - *

- * @return bool TRUE on success. - */ - public function orderedposterizeimage ($threshold_map, $channel = 'Imagick::CHANNEL_ALL') {} - - /** - * (PECL imagick 2.0.0)
- * Simulates a Polaroid picture - * @link http://php.net/manual/en/imagick.polaroidimage.php - * @param ImagickDraw $properties

- * The polaroid properties - *

- * @param float $angle

- * The polaroid angle - *

- * @return bool TRUE on success. - */ - public function polaroidimage (ImagickDraw $properties, $angle) {} - - /** - * (PECL imagick 2.0.0)
- * Returns the named image property - * @link http://php.net/manual/en/imagick.getimageproperty.php - * @param string $name

- * name of the property (for example Exif:DateTime) - *

- * @return string a string containing the image property, false if a - * property with the given name does not exist. - */ - public function getimageproperty ($name) {} - - /** - * (PECL imagick 2.0.0)
- * Sets an image property - * @link http://php.net/manual/en/imagick.setimageproperty.php - * @param string $name - * @param string $value - * @return bool TRUE on success. - */ - public function setimageproperty ($name, $value) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image interpolate pixel method - * @link http://php.net/manual/en/imagick.setimageinterpolatemethod.php - * @param int $method

- * The method is one of the Imagick::INTERPOLATE_* constants - *

- * @return bool TRUE on success. - */ - public function setimageinterpolatemethod ($method) {} - - /** - * (PECL imagick 2.0.0)
- * Returns the interpolation method - * @link http://php.net/manual/en/imagick.getimageinterpolatemethod.php - * @return int the interpolate method on success. - */ - public function getimageinterpolatemethod () {} - - /** - * (PECL imagick 2.0.0)
- * Stretches with saturation the image intensity - * @link http://php.net/manual/en/imagick.linearstretchimage.php - * @param float $blackPoint

- * The image black point - *

- * @param float $whitePoint

- * The image white point - *

- * @return bool TRUE on success. - */ - public function linearstretchimage ($blackPoint, $whitePoint) {} - - /** - * (PECL imagick 2.0.0)
- * Returns the image length in bytes - * @link http://php.net/manual/en/imagick.getimagelength.php - * @return int an int containing the current image size. - */ - public function getimagelength () {} - - /** - * (No version information available, might only be in SVN)
- * Set image size - * @link http://php.net/manual/en/imagick.extentimage.php - * @param int $width

- * The new width - *

- * @param int $height

- * The new height - *

- * @param int $x

- * X position for the new size - *

- * @param int $y

- * Y position for the new size - *

- * @return bool TRUE on success. - */ - public function extentimage ($width, $height, $x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Gets the image orientation - * @link http://php.net/manual/en/imagick.getimageorientation.php - * @return int an int on success. - */ - public function getimageorientation () {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image orientation - * @link http://php.net/manual/en/imagick.setimageorientation.php - * @param int $orientation

- * One of the orientation constants - *

- * @return bool TRUE on success. - */ - public function setimageorientation ($orientation) {} - - /** - * (PECL imagick 2.1.0)
- * Changes the color value of any pixel that matches target - * @link http://php.net/manual/en/imagick.paintfloodfillimage.php - * @param mixed $fill

- * ImagickPixel object or a string containing the fill color - *

- * @param float $fuzz

- * The amount of fuzz. For example, set fuzz to 10 and the color red at - * intensities of 100 and 102 respectively are now interpreted as the - * same color for the purposes of the floodfill. - *

- * @param mixed $bordercolor

- * ImagickPixel object or a string containing the border color - *

- * @param int $x

- * X start position of the floodfill - *

- * @param int $y

- * Y start position of the floodfill - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channel constants using bitwise operators. Defaults to Imagick::CHANNEL_DEFAULT. Refer to this list of channel constants - *

- * @return bool TRUE on success. - */ - public function paintfloodfillimage ($fill, $fuzz, $bordercolor, $x, $y, $channel = 'Imagick::CHANNEL_ALL') {} - - /** - * (PECL imagick 2.0.0)
- * Replaces colors in the image - * @link http://php.net/manual/en/imagick.clutimage.php - * @param Imagick $lookup_table

- * Imagick object containing the color lookup table - *

- * @param float $channel [optional]

- * The Channeltype - * constant. When not supplied, default channels are replaced. - *

- * @return bool TRUE on success. - */ - public function clutimage (Imagick $lookup_table, $channel = 'Imagick::CHANNEL_DEFAULT') {} - - /** - * (PECL imagick 2.0.0)
- * Returns the image properties - * @link http://php.net/manual/en/imagick.getimageproperties.php - * @param string $pattern [optional]

- * The pattern for property names. - *

- * @param bool $only_names [optional]

- * Whether to return only property names. If FALSE then also the values are returned - *

- * @return array an array containing the image properties or property names. - */ - public function getimageproperties ($pattern = "*", $only_names = true) {} - - /** - * (PECL imagick 2.0.0)
- * Returns the image profiles - * @link http://php.net/manual/en/imagick.getimageprofiles.php - * @param string $pattern [optional]

- * The pattern for profile names. - *

- * @param bool $only_names [optional]

- * Whether to return only profile names. If FALSE then values are returned as well - *

- * @return array an array containing the image profiles or profile names. - */ - public function getimageprofiles ($pattern = "*", $only_names = true) {} - - /** - * (PECL imagick 2.0.1)
- * Distorts an image using various distortion methods - * @link http://php.net/manual/en/imagick.distortimage.php - * @param int $method

- * The method of image distortion. See distortion constants - *

- * @param array $arguments

- * The arguments for this distortion method - *

- * @param bool $bestfit

- * Attempt to resize destination to fit distorted source - *

- * @return bool TRUE on success. - */ - public function distortimage ($method, array $arguments, $bestfit) {} - - /** - * (No version information available, might only be in SVN)
- * Writes an image to a filehandle - * @link http://php.net/manual/en/imagick.writeimagefile.php - * @param resource $filehandle

- * Filehandle where to write the image - *

- * @return bool TRUE on success. - */ - public function writeimagefile ($filehandle) {} - - /** - * (No version information available, might only be in SVN)
- * Writes frames to a filehandle - * @link http://php.net/manual/en/imagick.writeimagesfile.php - * @param resource $filehandle

- * Filehandle where to write the images - *

- * @return bool TRUE on success. - */ - public function writeimagesfile ($filehandle) {} - - /** - * (No version information available, might only be in SVN)
- * Reset image page - * @link http://php.net/manual/en/imagick.resetimagepage.php - * @param string $page

- * The page definition. For example 7168x5147+0+0 - *

- * @return bool TRUE on success. - */ - public function resetimagepage ($page) {} - - /** - * (No version information available, might only be in SVN)
- * Sets image clip mask - * @link http://php.net/manual/en/imagick.setimageclipmask.php - * @param Imagick $clip_mask

- * The Imagick object containing the clip mask - *

- * @return bool TRUE on success. - */ - public function setimageclipmask (Imagick $clip_mask) {} - - /** - * (No version information available, might only be in SVN)
- * Gets image clip mask - * @link http://php.net/manual/en/imagick.getimageclipmask.php - * @return Imagick an Imagick object containing the clip mask. - */ - public function getimageclipmask () {} - - /** - * (No version information available, might only be in SVN)
- * Animates an image or images - * @link http://php.net/manual/en/imagick.animateimages.php - * @param string $x_server

- * X server address - *

- * @return bool TRUE on success. - */ - public function animateimages ($x_server) {} - - /** - * (No version information available, might only be in SVN)
- * Recolors image - * @link http://php.net/manual/en/imagick.recolorimage.php - * @param array $matrix

- * The matrix containing the color values - *

- * @return bool TRUE on success. - */ - public function recolorimage (array $matrix) {} - - /** - * (PECL imagick 2.1.0)
- * Sets font - * @link http://php.net/manual/en/imagick.setfont.php - * @param string $font

- * Font name or a filename - *

- * @return bool TRUE on success. - */ - public function setfont ($font) {} - - /** - * (PECL imagick 2.1.0)
- * Gets font - * @link http://php.net/manual/en/imagick.getfont.php - * @return string the string containing the font name or FALSE if not font is set. - */ - public function getfont () {} - - /** - * (PECL imagick 2.1.0)
- * Sets point size - * @link http://php.net/manual/en/imagick.setpointsize.php - * @param float $point_size

- * Point size - *

- * @return bool TRUE on success. - */ - public function setpointsize ($point_size) {} - - /** - * (No version information available, might only be in SVN)
- * Gets point size - * @link http://php.net/manual/en/imagick.getpointsize.php - * @return float a float containing the point size. - */ - public function getpointsize () {} - - /** - * (PECL imagick 2.1.0)
- * Merges image layers - * @link http://php.net/manual/en/imagick.mergeimagelayers.php - * @param int $layer_method

- * One of the Imagick::LAYERMETHOD_* constants - *

- * @return bool TRUE on success. - */ - public function mergeimagelayers ($layer_method) {} - - /** - * (No version information available, might only be in SVN)
- * Sets image alpha channel - * @link http://php.net/manual/en/imagick.setimagealphachannel.php - * @param int $mode

- * One of the Imagick::ALPHACHANNEL_* constants - *

- * @return bool TRUE on success. - */ - public function setimagealphachannel ($mode) {} - - /** - * (No version information available, might only be in SVN)
- * Changes the color value of any pixel that matches target - * @link http://php.net/manual/en/imagick.floodfillpaintimage.php - * @param mixed $fill

- * ImagickPixel object or a string containing the fill color - *

- * @param float $fuzz

- * The amount of fuzz. For example, set fuzz to 10 and the color red at intensities of 100 and 102 respectively are now interpreted as the same color. - *

- * @param mixed $target

- * ImagickPixel object or a string containing the target color to paint - *

- * @param int $x

- * X start position of the floodfill - *

- * @param int $y

- * Y start position of the floodfill - *

- * @param bool $invert

- * If TRUE paints any pixel that does not match the target color. - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channel constants using bitwise operators. Defaults to Imagick::CHANNEL_DEFAULT. Refer to this list of channel constants - *

- * @return bool TRUE on success. - */ - public function floodfillpaintimage ($fill, $fuzz, $target, $x, $y, $invert, $channel = 'Imagick::CHANNEL_DEFAULT') {} - - /** - * (No version information available, might only be in SVN)
- * Changes the color value of any pixel that matches target - * @link http://php.net/manual/en/imagick.opaquepaintimage.php - * @param mixed $target

- * ImagickPixel object or a string containing the color to change - *

- * @param mixed $fill

- * The replacement color - *

- * @param float $fuzz

- * The amount of fuzz. For example, set fuzz to 10 and the color red at intensities of 100 and 102 respectively are now interpreted as the same color. - *

- * @param bool $invert

- * If TRUE paints any pixel that does not match the target color. - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channel constants using bitwise operators. Defaults to Imagick::CHANNEL_DEFAULT. Refer to this list of channel constants - *

- * @return bool TRUE on success. - */ - public function opaquepaintimage ($target, $fill, $fuzz, $invert, $channel = 'Imagick::CHANNEL_DEFAULT') {} - - /** - * (No version information available, might only be in SVN)
- * Paints pixels transparent - * @link http://php.net/manual/en/imagick.transparentpaintimage.php - * @param mixed $target

- * The target color to paint - *

- * @param float $alpha

- * The level of transparency: 1.0 is fully opaque and 0.0 is fully transparent. - *

- * @param float $fuzz

- * The amount of fuzz. For example, set fuzz to 10 and the color red at intensities of 100 and 102 respectively are now interpreted as the same color. - *

- * @param bool $invert

- * If TRUE paints any pixel that does not match the target color. - *

- * @return bool TRUE on success. - */ - public function transparentpaintimage ($target, $alpha, $fuzz, $invert) {} - - /** - * (No version information available, might only be in SVN)
- * Animates an image or images - * @link http://php.net/manual/en/imagick.liquidrescaleimage.php - * @param int $width

- * The width of the target size - *

- * @param int $height

- * The height of the target size - *

- * @param float $delta_x

- * How much the seam can traverse on x-axis. - * Passing 0 causes the seams to be straight. - *

- * @param float $rigidity

- * Introduces a bias for non-straight seams. This parameter is - * typically 0. - *

- * @return bool TRUE on success. - */ - public function liquidrescaleimage ($width, $height, $delta_x, $rigidity) {} - - /** - * (No version information available, might only be in SVN)
- * Enciphers an image - * @link http://php.net/manual/en/imagick.encipherimage.php - * @param string $passphrase

- * The passphrase - *

- * @return bool TRUE on success. - */ - public function encipherimage ($passphrase) {} - - /** - * (No version information available, might only be in SVN)
- * Deciphers an image - * @link http://php.net/manual/en/imagick.decipherimage.php - * @param string $passphrase

- * The passphrase - *

- * @return bool TRUE on success. - */ - public function decipherimage ($passphrase) {} - - /** - * (No version information available, might only be in SVN)
- * Sets the gravity - * @link http://php.net/manual/en/imagick.setgravity.php - * @param int $gravity

- * The gravity property. Refer to the list of - * gravity constants. - *

- * @return bool No value is returned. - */ - public function setgravity ($gravity) {} - - /** - * (No version information available, might only be in SVN)
- * Gets the gravity - * @link http://php.net/manual/en/imagick.getgravity.php - * @return int the gravity property. Refer to the list of - * gravity constants. - */ - public function getgravity () {} - - /** - * (PECL imagick 2.2.1)
- * Gets channel range - * @link http://php.net/manual/en/imagick.getimagechannelrange.php - * @param int $channel

- * Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channel constants using bitwise operators. Defaults to Imagick::CHANNEL_DEFAULT. Refer to this list of channel constants - *

- * @return array an array containing minima and maxima values of the channel(s). - */ - public function getimagechannelrange ($channel) {} - - /** - * (No version information available, might only be in SVN)
- * Gets the image alpha channel - * @link http://php.net/manual/en/imagick.getimagealphachannel.php - * @return int a constant defining the current alpha channel value. Refer to this - * list of alpha channel constants. - */ - public function getimagealphachannel () {} - - /** - * (No version information available, might only be in SVN)
- * Gets channel distortions - * @link http://php.net/manual/en/imagick.getimagechanneldistortions.php - * @param Imagick $reference

- * Imagick object containing the reference image - *

- * @param int $metric

- * Refer to this list of metric type constants. - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channel constants using bitwise operators. Defaults to Imagick::CHANNEL_DEFAULT. Refer to this list of channel constants - *

- * @return float a double describing the channel distortion. - */ - public function getimagechanneldistortions (Imagick $reference, $metric, $channel = 'Imagick::CHANNEL_DEFAULT') {} - - /** - * (No version information available, might only be in SVN)
- * Sets the image gravity - * @link http://php.net/manual/en/imagick.setimagegravity.php - * @param int $gravity

- * The gravity property. Refer to the list of - * gravity constants. - *

- * @return bool No value is returned. - */ - public function setimagegravity ($gravity) {} - - /** - * (No version information available, might only be in SVN)
- * Gets the image gravity - * @link http://php.net/manual/en/imagick.getimagegravity.php - * @return int the images gravity property. Refer to the list of - * gravity constants. - */ - public function getimagegravity () {} - - /** - * (No version information available, might only be in SVN)
- * Imports image pixels - * @link http://php.net/manual/en/imagick.importimagepixels.php - * @param int $x

- * The image x position - *

- * @param int $y

- * The image y position - *

- * @param int $width

- * The image width - *

- * @param int $height

- * The image height - *

- * @param string $map

- * Map of pixel ordering as a string. This can be for example RGB. - * The value can be any combination or order of R = red, G = green, B = blue, A = alpha (0 is transparent), - * O = opacity (0 is opaque), C = cyan, Y = yellow, M = magenta, K = black, I = intensity (for grayscale), P = pad. - *

- * @param int $storage

- * The pixel storage method. - * Refer to this list of pixel constants. - *

- * @param array $pixels

- * The array of pixels - *

- * @return bool TRUE on success. - */ - public function importimagepixels ($x, $y, $width, $height, $map, $storage, array $pixels) {} - - /** - * (No version information available, might only be in SVN)
- * Removes skew from the image - * @link http://php.net/manual/en/imagick.deskewimage.php - * @param float $threshold

- * Deskew threshold - *

- * @return bool - */ - public function deskewimage ($threshold) {} - - /** - * (No version information available, might only be in SVN)
- * Segments an image - * @link http://php.net/manual/en/imagick.segmentimage.php - * @param int $COLORSPACE

- * One of the COLORSPACE constants. - *

- * @param float $cluster_threshold

- * A percentage describing minimum number of pixels - * contained in hexedra before it is considered valid. - *

- * @param float $smooth_threshold

- * Eliminates noise from the histogram. - *

- * @param bool $verbose [optional]

- * Whether to output detailed information about recognised classes. - *

- * @return bool - */ - public function segmentimage ($COLORSPACE, $cluster_threshold, $smooth_threshold, $verbose = false) {} - - /** - * (No version information available, might only be in SVN)
- * Interpolates colors - * @link http://php.net/manual/en/imagick.sparsecolorimage.php - * @param int $SPARSE_METHOD

- * Refer to this list of sparse method constants - *

- * @param array $arguments

- * An array containing the coordinates. - * The array is in format array(1,1, 2,45) - *

- * @param int $channel [optional] - * @return bool TRUE on success. - */ - public function sparsecolorimage ($SPARSE_METHOD, array $arguments, $channel = 'Imagick::CHANNEL_DEFAULT') {} - - /** - * (No version information available, might only be in SVN)
- * Remaps image colors - * @link http://php.net/manual/en/imagick.remapimage.php - * @param Imagick $replacement

- * An Imagick object containing the replacement colors - *

- * @param int $DITHER

- * Refer to this list of dither method constants - *

- * @return bool TRUE on success. - */ - public function remapimage (Imagick $replacement, $DITHER) {} - - /** - * (No version information available, might only be in SVN)
- * Exports raw image pixels - * @link http://php.net/manual/en/imagick.exportimagepixels.php - * @param int $x

- * X-coordinate of the exported area - *

- * @param int $y

- * Y-coordinate of the exported area - *

- * @param int $width

- * Width of the exported aread - *

- * @param int $height

- * Height of the exported area - *

- * @param string $map

- * Ordering of the exported pixels. For example "RGB". - * Valid characters for the map are R, G, B, A, O, C, Y, M, K, I and P. - *

- * @param int $STORAGE

- * Refer to this list of pixel type constants - *

- * @return array an array containing the pixels values. - */ - public function exportimagepixels ($x, $y, $width, $height, $map, $STORAGE) {} - - /** - * (No version information available, might only be in SVN)
- * The getImageChannelKurtosis purpose - * @link http://php.net/manual/en/imagick.getimagechannelkurtosis.php - * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channel constants using bitwise operators. Defaults to Imagick::CHANNEL_DEFAULT. Refer to this list of channel constants - *

- * @return array an array with kurtosis and skewness - * members. - */ - public function getimagechannelkurtosis ($channel = 'Imagick::CHANNEL_DEFAULT') {} - - /** - * (No version information available, might only be in SVN)
- * Applies a function on the image - * @link http://php.net/manual/en/imagick.functionimage.php - * @param int $function

- * Refer to this list of function constants - *

- * @param array $arguments

- * Array of arguments to pass to this function. - *

- * @param int $channel [optional] - * @return bool TRUE on success. - */ - public function functionimage ($function, array $arguments, $channel = 'Imagick::CHANNEL_DEFAULT') {} - - /** - * @param $COLORSPACE - */ - public function transformimagecolorspace ($COLORSPACE) {} - - /** - * (No version information available, might only be in SVN)
- * Replaces colors in the image - * @link http://php.net/manual/en/imagick.haldclutimage.php - * @param Imagick $clut

- * Imagick object containing the Hald lookup image. - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channel constants using bitwise operators. Defaults to Imagick::CHANNEL_DEFAULT. Refer to this list of channel constants - *

- * @return bool TRUE on success. - */ - public function haldclutimage (Imagick $clut, $channel = 'Imagick::CHANNEL_DEFAULT') {} - - /** - * (No version information available, might only be in SVN)
- * Get image artifact - * @link http://php.net/manual/en/imagick.getimageartifact.php - * @param string $artifact

- * The name of the artifact - *

- * @return string the artifact value on success. - */ - public function getimageartifact ($artifact) {} - - /** - * (No version information available, might only be in SVN)
- * Set image artifact - * @link http://php.net/manual/en/imagick.setimageartifact.php - * @param string $artifact

- * The name of the artifact - *

- * @param string $value

- * The value of the artifact - *

- * @return bool TRUE on success. - */ - public function setimageartifact ($artifact, $value) {} - - /** - * (No version information available, might only be in SVN)
- * Delete image artifact - * @link http://php.net/manual/en/imagick.deleteimageartifact.php - * @param string $artifact

- * The name of the artifact - *

- * @return bool TRUE on success. - */ - public function deleteimageartifact ($artifact) {} - - /** - * (PECL imagick 0.9.10-0.9.9)
- * Gets the colorspace - * @link http://php.net/manual/en/imagick.getcolorspace.php - * @return int an integer which can be compared against COLORSPACE constants. - */ - public function getcolorspace () {} - - /** - * (No version information available, might only be in SVN)
- * Set colorspace - * @link http://php.net/manual/en/imagick.setcolorspace.php - * @param int $COLORSPACE

- * One of the COLORSPACE constants - *

- * @return bool TRUE on success. - */ - public function setcolorspace ($COLORSPACE) {} - - /** - * (PECL imagick 2.0.0)
- * The Imagick constructor - * @link http://php.net/manual/en/imagick.construct.php - * @param mixed $files

- * The path to an image to load or an array of paths. Paths can include - * wildcards for file names, or can be URLs. - *

- */ - public function __construct ($files) {} - - public function __tostring () {} - - /** - * (PECL imagick 2.0.0)
- * Returns a MagickPixelIterator - * @link http://php.net/manual/en/imagick.getpixeliterator.php - * @return ImagickPixelIterator an ImagickPixelIterator on success. - */ - public function getpixeliterator () {} - - /** - * (PECL imagick 2.0.0)
- * Get an ImagickPixelIterator for an image section - * @link http://php.net/manual/en/imagick.getpixelregioniterator.php - * @param int $x

- * The x-coordinate of the region. - *

- * @param int $y

- * The y-coordinate of the region. - *

- * @param int $columns

- * The width of the region. - *

- * @param int $rows

- * The height of the region. - *

- * @return ImagickPixelIterator an ImagickPixelIterator for an image section. - */ - public function getpixelregioniterator ($x, $y, $columns, $rows) {} - - /** - * (PECL imagick 0.9.0-0.9.9)
- * Reads image from filename - * @link http://php.net/manual/en/imagick.readimage.php - * @param string $filename - * @return bool TRUE on success. - */ - public function readimage ($filename) {} - - /** - * @param $filenames - */ - public function readimages ($filenames) {} - - /** - * (PECL imagick 2.0.0)
- * Reads image from a binary string - * @link http://php.net/manual/en/imagick.readimageblob.php - * @param string $image - * @param string $filename [optional] - * @return bool TRUE on success. - */ - public function readimageblob ($image, $filename = null) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the format of a particular image - * @link http://php.net/manual/en/imagick.setimageformat.php - * @param string $format

- * String presentation of the image format. Format support - * depends on the ImageMagick installation. - *

- * @return bool TRUE on success. - */ - public function setimageformat ($format) {} - - /** - * (PECL imagick 2.0.0)
- * Scales the size of an image - * @link http://php.net/manual/en/imagick.scaleimage.php - * @param int $cols - * @param int $rows - * @param bool $bestfit [optional] - * @return bool TRUE on success. - */ - public function scaleimage ($cols, $rows, $bestfit = false) {} - - /** - * (PECL imagick 0.9.0-0.9.9)
- * Writes an image to the specified filename - * @link http://php.net/manual/en/imagick.writeimage.php - * @param string $filename [optional] - * @return bool TRUE on success. - */ - public function writeimage ($filename = null) {} - - /** - * (PECL imagick 0.9.0-0.9.9)
- * Writes an image or image sequence - * @link http://php.net/manual/en/imagick.writeimages.php - * @param string $filename - * @param bool $adjoin - * @return bool TRUE on success. - */ - public function writeimages ($filename, $adjoin) {} - - /** - * (PECL imagick 2.0.0)
- * Adds blur filter to image - * @link http://php.net/manual/en/imagick.blurimage.php - * @param float $radius

- * Blur radius - *

- * @param float $sigma

- * Standard deviation - *

- * @param int $channel [optional]

- * The Channeltype - * constant. When not supplied, all channels are blurred. - *

- * @return bool TRUE on success. - */ - public function blurimage ($radius, $sigma, $channel = null) {} - - /** - * (PECL imagick 2.0.0)
- * Changes the size of an image - * @link http://php.net/manual/en/imagick.thumbnailimage.php - * @param int $columns

- * Image width - *

- * @param int $rows

- * Image height - *

- * @param bool $bestfit [optional]

- * Whether to force maximum values - *

- * @param bool $fill [optional] - * @return bool TRUE on success. - */ - public function thumbnailimage ($columns, $rows, $bestfit = false, $fill = false) {} - - /** - * (PECL imagick 2.0.0)
- * Creates a crop thumbnail - * @link http://php.net/manual/en/imagick.cropthumbnailimage.php - * @param int $width

- * The width of the thumbnail - *

- * @param int $height

- * The Height of the thumbnail - *

- * @return bool TRUE on success. - */ - public function cropthumbnailimage ($width, $height) {} - - /** - * (PECL imagick 2.0.0)
- * Returns the filename of a particular image in a sequence - * @link http://php.net/manual/en/imagick.getimagefilename.php - * @return string a string with the filename of the image. - */ - public function getimagefilename () {} - - /** - * (PECL imagick 2.0.0)
- * Sets the filename of a particular image - * @link http://php.net/manual/en/imagick.setimagefilename.php - * @param string $filename - * @return bool TRUE on success. - */ - public function setimagefilename ($filename) {} - - /** - * (PECL imagick 2.0.0)
- * Returns the format of a particular image in a sequence - * @link http://php.net/manual/en/imagick.getimageformat.php - * @return string a string containing the image format on success. - */ - public function getimageformat () {} - - public function getimagemimetype () {} - - /** - * (PECL imagick 2.0.0)
- * Removes an image from the image list - * @link http://php.net/manual/en/imagick.removeimage.php - * @return bool TRUE on success. - */ - public function removeimage () {} - - /** - * (PECL imagick 2.0.0)
- * Destroys the Imagick object - * @link http://php.net/manual/en/imagick.destroy.php - * @return bool TRUE on success. - */ - public function destroy () {} - - /** - * (PECL imagick 2.0.0)
- * Clears all resources associated to Imagick object - * @link http://php.net/manual/en/imagick.clear.php - * @return bool TRUE on success. - */ - public function clear () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the image length in bytes - * @link http://php.net/manual/en/imagick.getimagesize.php - * @return int an int containing the current image size. - */ - public function getimagesize () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the image sequence as a blob - * @link http://php.net/manual/en/imagick.getimageblob.php - * @return string a string containing the image. - */ - public function getimageblob () {} - - /** - * (PECL imagick 2.0.0)
- * Returns all image sequences as a blob - * @link http://php.net/manual/en/imagick.getimagesblob.php - * @return string a string containing the images. On failure, throws - * ImagickException. - */ - public function getimagesblob () {} - - /** - * (PECL imagick 2.0.0)
- * Sets the Imagick iterator to the first image - * @link http://php.net/manual/en/imagick.setfirstiterator.php - * @return bool TRUE on success. - */ - public function setfirstiterator () {} - - /** - * (PECL imagick 2.0.1)
- * Sets the Imagick iterator to the last image - * @link http://php.net/manual/en/imagick.setlastiterator.php - * @return bool TRUE on success. - */ - public function setlastiterator () {} - - public function resetiterator () {} - - /** - * (PECL imagick 2.0.0)
- * Move to the previous image in the object - * @link http://php.net/manual/en/imagick.previousimage.php - * @return bool TRUE on success. - */ - public function previousimage () {} - - /** - * (PECL imagick 2.0.0)
- * Moves to the next image - * @link http://php.net/manual/en/imagick.nextimage.php - * @return bool TRUE on success. - */ - public function nextimage () {} - - /** - * (PECL imagick 2.0.0)
- * Checks if the object has a previous image - * @link http://php.net/manual/en/imagick.haspreviousimage.php - * @return bool TRUE if the object has more images when traversing the list in the - * reverse direction, returns FALSE if there are none. - */ - public function haspreviousimage () {} - - /** - * (PECL imagick 2.0.0)
- * Checks if the object has more images - * @link http://php.net/manual/en/imagick.hasnextimage.php - * @return bool TRUE if the object has more images when traversing the list in the - * forward direction, returns FALSE if there are none. - */ - public function hasnextimage () {} - - /** - * (PECL imagick 2.0.0)
- * Set the iterator position - * @link http://php.net/manual/en/imagick.setimageindex.php - * @param int $index

- * The position to set the iterator to - *

- * @return bool TRUE on success. - */ - public function setimageindex ($index) {} - - /** - * (PECL imagick 2.0.0)
- * Gets the index of the current active image - * @link http://php.net/manual/en/imagick.getimageindex.php - * @return int an integer containing the index of the image in the stack. - */ - public function getimageindex () {} - - /** - * (PECL imagick 2.0.0)
- * Adds a comment to your image - * @link http://php.net/manual/en/imagick.commentimage.php - * @param string $comment

- * The comment to add - *

- * @return bool TRUE on success. - */ - public function commentimage ($comment) {} - - /** - * (PECL imagick 2.0.0)
- * Extracts a region of the image - * @link http://php.net/manual/en/imagick.cropimage.php - * @param int $width

- * The width of the crop - *

- * @param int $height

- * The height of the crop - *

- * @param int $x

- * The X coordinate of the cropped region's top left corner - *

- * @param int $y

- * The Y coordinate of the cropped region's top left corner - *

- * @return bool TRUE on success. - */ - public function cropimage ($width, $height, $x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Adds a label to an image - * @link http://php.net/manual/en/imagick.labelimage.php - * @param string $label

- * The label to add - *

- * @return bool TRUE on success. - */ - public function labelimage ($label) {} - - /** - * (PECL imagick 2.0.0)
- * Gets the width and height as an associative array - * @link http://php.net/manual/en/imagick.getimagegeometry.php - * @return array an array with the width/height of the image. - */ - public function getimagegeometry () {} - - /** - * (PECL imagick 2.0.0)
- * Renders the ImagickDraw object on the current image - * @link http://php.net/manual/en/imagick.drawimage.php - * @param ImagickDraw $draw

- * The drawing operations to render on the image. - *

- * @return bool TRUE on success. - */ - public function drawimage (ImagickDraw $draw) {} - - /** - * (No version information available, might only be in SVN)
- * Sets the image compression quality - * @link http://php.net/manual/en/imagick.setimagecompressionquality.php - * @param int $quality

- * The image compression quality as an integer - *

- * @return bool TRUE on success. - */ - public function setimagecompressionquality ($quality) {} - - /** - * (PECL imagick 2.2.2)
- * Gets the current image's compression quality - * @link http://php.net/manual/en/imagick.getimagecompressionquality.php - * @return int integer describing the images compression quality - */ - public function getimagecompressionquality () {} - - /** - * (PECL imagick 2.0.0)
- * Annotates an image with text - * @link http://php.net/manual/en/imagick.annotateimage.php - * @param ImagickDraw $draw_settings

- * The ImagickDraw object that contains settings for drawing the text - *

- * @param float $x

- * Horizontal offset in pixels to the left of text - *

- * @param float $y

- * Vertical offset in pixels to the baseline of text - *

- * @param float $angle

- * The angle at which to write the text - *

- * @param string $text

- * The string to draw - *

- * @return bool TRUE on success. - */ - public function annotateimage (ImagickDraw $draw_settings, $x, $y, $angle, $text) {} - - /** - * (PECL imagick 2.0.0)
- * Composite one image onto another - * @link http://php.net/manual/en/imagick.compositeimage.php - * @param Imagick $composite_object

- * Imagick object which holds the composite image - *

- * @param int $composite - * @param int $x

- * The column offset of the composited image - *

- * @param int $y

- * The row offset of the composited image - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To - * apply to more than one channel, combine channeltype constants using - * bitwise operators. Refer to this list of channel constants. - *

- * @return bool TRUE on success. - */ - public function compositeimage (Imagick $composite_object, $composite, $x, $y, $channel = 'Imagick::CHANNEL_ALL') {} - - /** - * (PECL imagick 2.0.0)
- * Control the brightness, saturation, and hue - * @link http://php.net/manual/en/imagick.modulateimage.php - * @param float $brightness - * @param float $saturation - * @param float $hue - * @return bool TRUE on success. - */ - public function modulateimage ($brightness, $saturation, $hue) {} - - /** - * (PECL imagick 2.0.0)
- * Gets the number of unique colors in the image - * @link http://php.net/manual/en/imagick.getimagecolors.php - * @return int TRUE on success. - */ - public function getimagecolors () {} - - /** - * (PECL imagick 2.0.0)
- * Creates a composite image - * @link http://php.net/manual/en/imagick.montageimage.php - * @param ImagickDraw $draw

- * The font name, size, and color are obtained from this object. - *

- * @param string $tile_geometry

- * The number of tiles per row and page (e.g. 6x4+0+0). - *

- * @param string $thumbnail_geometry

- * Preferred image size and border size of each thumbnail - * (e.g. 120x120+4+3>). - *

- * @param int $mode

- * Thumbnail framing mode, see Montage Mode constants. - *

- * @param string $frame

- * Surround the image with an ornamental border (e.g. 15x15+3+3). The - * frame color is that of the thumbnail's matte color. - *

- * @return Imagick TRUE on success. - */ - public function montageimage (ImagickDraw $draw, $tile_geometry, $thumbnail_geometry, $mode, $frame) {} - - /** - * (PECL imagick 2.0.0)
- * Identifies an image and fetches attributes - * @link http://php.net/manual/en/imagick.identifyimage.php - * @param bool $appendRawOutput [optional] - * @return array Identifies an image and returns the attributes. Attributes include - * the image width, height, size, and others. - */ - public function identifyimage ($appendRawOutput = false) {} - - /** - * (PECL imagick 2.0.0)
- * Changes the value of individual pixels based on a threshold - * @link http://php.net/manual/en/imagick.thresholdimage.php - * @param float $threshold - * @param int $channel [optional] - * @return bool TRUE on success. - */ - public function thresholdimage ($threshold, $channel = 'Imagick::CHANNEL_ALL') {} - - /** - * (PECL imagick 2.0.0)
- * Selects a threshold for each pixel based on a range of intensity - * @link http://php.net/manual/en/imagick.adaptivethresholdimage.php - * @param int $width

- * Width of the local neighborhood. - *

- * @param int $height

- * Height of the local neighborhood. - *

- * @param int $offset

- * The mean offset - *

- * @return bool TRUE on success. - */ - public function adaptivethresholdimage ($width, $height, $offset) {} - - /** - * (PECL imagick 2.0.0)
- * Forces all pixels below the threshold into black - * @link http://php.net/manual/en/imagick.blackthresholdimage.php - * @param mixed $threshold

- * The threshold below which everything turns black - *

- * @return bool TRUE on success. - */ - public function blackthresholdimage ($threshold) {} - - /** - * (PECL imagick 2.0.0)
- * Force all pixels above the threshold into white - * @link http://php.net/manual/en/imagick.whitethresholdimage.php - * @param mixed $threshold - * @return bool TRUE on success. - */ - public function whitethresholdimage ($threshold) {} - - /** - * (PECL imagick 2.0.0)
- * Append a set of images - * @link http://php.net/manual/en/imagick.appendimages.php - * @param bool $stack [optional]

- * Whether to stack the images vertically. - * By default (or if FALSE is specified) images are stacked left-to-right. - * If stack is TRUE, images are stacked top-to-bottom. - *

- * @return Imagick Imagick instance on success. - */ - public function appendimages ($stack = false) {} - - /** - * (PECL imagick 2.0.0)
- * Simulates a charcoal drawing - * @link http://php.net/manual/en/imagick.charcoalimage.php - * @param float $radius

- * The radius of the Gaussian, in pixels, not counting the center pixel - *

- * @param float $sigma

- * The standard deviation of the Gaussian, in pixels - *

- * @return bool TRUE on success. - */ - public function charcoalimage ($radius, $sigma) {} - - /** - * (PECL imagick 2.0.0)
- * Enhances the contrast of a color image - * @link http://php.net/manual/en/imagick.normalizeimage.php - * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To - * apply to more than one channel, combine channeltype constants using - * bitwise operators. Refer to this - * list of channel constants. - *

- * @return bool TRUE on success. - */ - public function normalizeimage ($channel = 'Imagick::CHANNEL_ALL') {} - - /** - * (PECL imagick 2.0.0)
- * Simulates an oil painting - * @link http://php.net/manual/en/imagick.oilpaintimage.php - * @param float $radius

- * The radius of the circular neighborhood. - *

- * @return bool TRUE on success. - */ - public function oilpaintimage ($radius) {} - - /** - * (PECL imagick 2.0.0)
- * Reduces the image to a limited number of color level - * @link http://php.net/manual/en/imagick.posterizeimage.php - * @param int $levels - * @param bool $dither - * @return bool TRUE on success. - */ - public function posterizeimage ($levels, $dither) {} - - /** - * (PECL imagick 2.0.0)
- * Radial blurs an image - * @link http://php.net/manual/en/imagick.radialblurimage.php - * @param float $angle - * @param int $channel [optional] - * @return bool TRUE on success. - */ - public function radialblurimage ($angle, $channel = 'Imagick::CHANNEL_ALL') {} - - /** - * (PECL imagick 2.0.0)
- * Creates a simulated 3d button-like effect - * @link http://php.net/manual/en/imagick.raiseimage.php - * @param int $width - * @param int $height - * @param int $x - * @param int $y - * @param bool $raise - * @return bool TRUE on success. - */ - public function raiseimage ($width, $height, $x, $y, $raise) {} - - /** - * (PECL imagick 2.0.0)
- * Resample image to desired resolution - * @link http://php.net/manual/en/imagick.resampleimage.php - * @param float $x_resolution - * @param float $y_resolution - * @param int $filter - * @param float $blur - * @return bool TRUE on success. - */ - public function resampleimage ($x_resolution, $y_resolution, $filter, $blur) {} - - /** - * (PECL imagick 2.0.0)
- * Scales an image - * @link http://php.net/manual/en/imagick.resizeimage.php - * @param int $columns

- * Width of the image - *

- * @param int $rows

- * Height of the image - *

- * @param int $filter

- * Refer to the list of filter constants. - *

- * @param float $blur

- * The blur factor where > 1 is blurry, < 1 is sharp. - *

- * @param bool $bestfit [optional]

- * Optional fit parameter. - *

- * @return bool TRUE on success. - */ - public function resizeimage ($columns, $rows, $filter, $blur, $bestfit = false) {} - - /** - * (PECL imagick 2.0.0)
- * Offsets an image - * @link http://php.net/manual/en/imagick.rollimage.php - * @param int $x

- * The X offset. - *

- * @param int $y

- * The Y offset. - *

- * @return bool TRUE on success. - */ - public function rollimage ($x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Rotates an image - * @link http://php.net/manual/en/imagick.rotateimage.php - * @param mixed $background

- * The background color - *

- * @param float $degrees

- * The number of degrees to rotate the image - *

- * @return bool TRUE on success. - */ - public function rotateimage ($background, $degrees) {} - - /** - * (PECL imagick 2.0.0)
- * Scales an image with pixel sampling - * @link http://php.net/manual/en/imagick.sampleimage.php - * @param int $columns - * @param int $rows - * @return bool TRUE on success. - */ - public function sampleimage ($columns, $rows) {} - - /** - * (PECL imagick 2.0.0)
- * Applies a solarizing effect to the image - * @link http://php.net/manual/en/imagick.solarizeimage.php - * @param int $threshold - * @return bool TRUE on success. - */ - public function solarizeimage ($threshold) {} - - /** - * (PECL imagick 2.0.0)
- * Simulates an image shadow - * @link http://php.net/manual/en/imagick.shadowimage.php - * @param float $opacity - * @param float $sigma - * @param int $x - * @param int $y - * @return bool TRUE on success. - */ - public function shadowimage ($opacity, $sigma, $x, $y) {} - - /** - * @param $key - * @param $value - */ - public function setimageattribute ($key, $value) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image background color - * @link http://php.net/manual/en/imagick.setimagebackgroundcolor.php - * @param mixed $background - * @return bool TRUE on success. - */ - public function setimagebackgroundcolor ($background) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image composite operator - * @link http://php.net/manual/en/imagick.setimagecompose.php - * @param int $compose - * @return bool TRUE on success. - */ - public function setimagecompose ($compose) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image compression - * @link http://php.net/manual/en/imagick.setimagecompression.php - * @param int $compression

- * One of the COMPRESSION constants - *

- * @return bool TRUE on success. - */ - public function setimagecompression ($compression) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image delay - * @link http://php.net/manual/en/imagick.setimagedelay.php - * @param int $delay - * @return bool TRUE on success. - */ - public function setimagedelay ($delay) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image depth - * @link http://php.net/manual/en/imagick.setimagedepth.php - * @param int $depth - * @return bool TRUE on success. - */ - public function setimagedepth ($depth) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image gamma - * @link http://php.net/manual/en/imagick.setimagegamma.php - * @param float $gamma - * @return bool TRUE on success. - */ - public function setimagegamma ($gamma) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image iterations - * @link http://php.net/manual/en/imagick.setimageiterations.php - * @param int $iterations - * @return bool TRUE on success. - */ - public function setimageiterations ($iterations) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image matte color - * @link http://php.net/manual/en/imagick.setimagemattecolor.php - * @param mixed $matte - * @return bool TRUE on success. - */ - public function setimagemattecolor ($matte) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the page geometry of the image - * @link http://php.net/manual/en/imagick.setimagepage.php - * @param int $width - * @param int $height - * @param int $x - * @param int $y - * @return bool TRUE on success. - */ - public function setimagepage ($width, $height, $x, $y) {} - - /** - * @param $filename - */ - public function setimageprogressmonitor ($filename) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image resolution - * @link http://php.net/manual/en/imagick.setimageresolution.php - * @param float $x_resolution - * @param float $y_resolution - * @return bool TRUE on success. - */ - public function setimageresolution ($x_resolution, $y_resolution) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image scene - * @link http://php.net/manual/en/imagick.setimagescene.php - * @param int $scene - * @return bool TRUE on success. - */ - public function setimagescene ($scene) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image ticks-per-second - * @link http://php.net/manual/en/imagick.setimagetickspersecond.php - * @param int $ticks_per_second - * @return bool TRUE on success. - */ - public function setimagetickspersecond ($ticks_per_second) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image type - * @link http://php.net/manual/en/imagick.setimagetype.php - * @param int $image_type - * @return bool TRUE on success. - */ - public function setimagetype ($image_type) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image units of resolution - * @link http://php.net/manual/en/imagick.setimageunits.php - * @param int $units - * @return bool TRUE on success. - */ - public function setimageunits ($units) {} - - /** - * (PECL imagick 2.0.0)
- * Sharpens an image - * @link http://php.net/manual/en/imagick.sharpenimage.php - * @param float $radius - * @param float $sigma - * @param int $channel [optional] - * @return bool TRUE on success. - */ - public function sharpenimage ($radius, $sigma, $channel = 'Imagick::CHANNEL_ALL') {} - - /** - * (PECL imagick 2.0.0)
- * Shaves pixels from the image edges - * @link http://php.net/manual/en/imagick.shaveimage.php - * @param int $columns - * @param int $rows - * @return bool TRUE on success. - */ - public function shaveimage ($columns, $rows) {} - - /** - * (PECL imagick 2.0.0)
- * Creating a parallelogram - * @link http://php.net/manual/en/imagick.shearimage.php - * @param mixed $background

- * The background color - *

- * @param float $x_shear

- * The number of degrees to shear on the x axis - *

- * @param float $y_shear

- * The number of degrees to shear on the y axis - *

- * @return bool TRUE on success. - */ - public function shearimage ($background, $x_shear, $y_shear) {} - - /** - * (PECL imagick 2.0.0)
- * Splices a solid color into the image - * @link http://php.net/manual/en/imagick.spliceimage.php - * @param int $width - * @param int $height - * @param int $x - * @param int $y - * @return bool TRUE on success. - */ - public function spliceimage ($width, $height, $x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Fetch basic attributes about the image - * @link http://php.net/manual/en/imagick.pingimage.php - * @param string $filename

- * The filename to read the information from. - *

- * @return bool TRUE on success. - */ - public function pingimage ($filename) {} - - /** - * (PECL imagick 2.0.0)
- * Reads image from open filehandle - * @link http://php.net/manual/en/imagick.readimagefile.php - * @param resource $filehandle - * @param string $fileName [optional] - * @return bool TRUE on success. - */ - public function readimagefile ($filehandle, $fileName = null) {} - - /** - * (PECL imagick 2.0.0)
- * Displays an image - * @link http://php.net/manual/en/imagick.displayimage.php - * @param string $servername

- * The X server name - *

- * @return bool TRUE on success. - */ - public function displayimage ($servername) {} - - /** - * (PECL imagick 2.0.0)
- * Displays an image or image sequence - * @link http://php.net/manual/en/imagick.displayimages.php - * @param string $servername

- * The X server name - *

- * @return bool TRUE on success. - */ - public function displayimages ($servername) {} - - /** - * (PECL imagick 2.0.0)
- * Randomly displaces each pixel in a block - * @link http://php.net/manual/en/imagick.spreadimage.php - * @param float $radius - * @return bool TRUE on success. - */ - public function spreadimage ($radius) {} - - /** - * (PECL imagick 2.0.0)
- * Swirls the pixels about the center of the image - * @link http://php.net/manual/en/imagick.swirlimage.php - * @param float $degrees - * @return bool TRUE on success. - */ - public function swirlimage ($degrees) {} - - /** - * (PECL imagick 2.0.0)
- * Strips an image of all profiles and comments - * @link http://php.net/manual/en/imagick.stripimage.php - * @return bool TRUE on success. - */ - public function stripimage () {} - - /** - * (PECL imagick 2.0.0)
- * Returns formats supported by Imagick - * @link http://php.net/manual/en/imagick.queryformats.php - * @param string $pattern [optional] - * @return array an array containing the formats supported by Imagick. - */ - public function queryformats ($pattern = "*") {} - - /** - * (PECL imagick 2.0.0)
- * Returns the configured fonts - * @link http://php.net/manual/en/imagick.queryfonts.php - * @param string $pattern [optional]

- * The query pattern - *

- * @return array an array containing the configured fonts. - */ - public function queryfonts ($pattern = "*") {} - - /** - * (PECL imagick 2.0.0)
- * Returns an array representing the font metrics - * @link http://php.net/manual/en/imagick.queryfontmetrics.php - * @param ImagickDraw $properties

- * ImagickDraw object containing font properties - *

- * @param string $text

- * The text - *

- * @param bool $multiline [optional]

- * Multiline parameter. If left empty it is autodetected - *

- * @return array a multi-dimensional array representing the font metrics. - */ - public function queryfontmetrics (ImagickDraw $properties, $text, $multiline = null) {} - - /** - * (PECL imagick 2.0.0)
- * Hides a digital watermark within the image - * @link http://php.net/manual/en/imagick.steganoimage.php - * @param Imagick $watermark_wand - * @param int $offset - * @return Imagick TRUE on success. - */ - public function steganoimage (Imagick $watermark_wand, $offset) {} - - /** - * (PECL imagick 2.0.0)
- * Adds random noise to the image - * @link http://php.net/manual/en/imagick.addnoiseimage.php - * @param int $noise_type

- * The type of the noise. Refer to this list of - * noise constants. - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channel constants using bitwise operators. Defaults to Imagick::CHANNEL_DEFAULT. Refer to this list of channel constants - *

- * @return bool TRUE on success. - */ - public function addnoiseimage ($noise_type, $channel = 'Imagick::CHANNEL_DEFAULT') {} - - /** - * (PECL imagick 2.0.0)
- * Simulates motion blur - * @link http://php.net/manual/en/imagick.motionblurimage.php - * @param float $radius

- * The radius of the Gaussian, in pixels, not counting the center pixel. - *

- * @param float $sigma

- * The standard deviation of the Gaussian, in pixels. - *

- * @param float $angle

- * Apply the effect along this angle. - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To - * apply to more than one channel, combine channeltype constants using - * bitwise operators. Refer to this - * list of channel constants. - * The channel argument affects only if Imagick is compiled against ImageMagick version - * 6.4.4 or greater. - *

- * @return bool TRUE on success. - */ - public function motionblurimage ($radius, $sigma, $angle, $channel = 'Imagick::CHANNEL_DEFAULT') {} - - /** - * (PECL imagick 2.0.0)
- * Forms a mosaic from images - * @link http://php.net/manual/en/imagick.mosaicimages.php - * @return Imagick TRUE on success. - */ - public function mosaicimages () {} - - /** - * (PECL imagick 2.0.0)
- * Method morphs a set of images - * @link http://php.net/manual/en/imagick.morphimages.php - * @param int $number_frames

- * The number of in-between images to generate. - *

- * @return Imagick This method returns a new Imagick object on success. - * Throw an - * ImagickException on error. - */ - public function morphimages ($number_frames) {} - - /** - * (PECL imagick 2.0.0)
- * Scales an image proportionally to half its size - * @link http://php.net/manual/en/imagick.minifyimage.php - * @return bool TRUE on success. - */ - public function minifyimage () {} - - /** - * (PECL imagick 2.0.0)
- * Transforms an image - * @link http://php.net/manual/en/imagick.affinetransformimage.php - * @param ImagickDraw $matrix

- * The affine matrix - *

- * @return bool TRUE on success. - */ - public function affinetransformimage (ImagickDraw $matrix) {} - - /** - * (PECL imagick 2.0.0)
- * Average a set of images - * @link http://php.net/manual/en/imagick.averageimages.php - * @return Imagick a new Imagick object on success. - */ - public function averageimages () {} - - /** - * (PECL imagick 2.0.0)
- * Surrounds the image with a border - * @link http://php.net/manual/en/imagick.borderimage.php - * @param mixed $bordercolor

- * ImagickPixel object or a string containing the border color - *

- * @param int $width

- * Border width - *

- * @param int $height

- * Border height - *

- * @return bool TRUE on success. - */ - public function borderimage ($bordercolor, $width, $height) {} - - /** - * (PECL imagick 2.0.0)
- * Removes a region of an image and trims - * @link http://php.net/manual/en/imagick.chopimage.php - * @param int $width

- * Width of the chopped area - *

- * @param int $height

- * Height of the chopped area - *

- * @param int $x

- * X origo of the chopped area - *

- * @param int $y

- * Y origo of the chopped area - *

- * @return bool TRUE on success. - */ - public function chopimage ($width, $height, $x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Clips along the first path from the 8BIM profile - * @link http://php.net/manual/en/imagick.clipimage.php - * @return bool TRUE on success. - */ - public function clipimage () {} - - /** - * (PECL imagick 2.0.0)
- * Clips along the named paths from the 8BIM profile - * @link http://php.net/manual/en/imagick.clippathimage.php - * @param string $pathname

- * The name of the path - *

- * @param bool $inside

- * If TRUE later operations take effect inside clipping path. - * Otherwise later operations take effect outside clipping path. - *

- * @return bool TRUE on success. - */ - public function clippathimage ($pathname, $inside) {} - - /** - * @param $pathname - * @param $inside - */ - public function clipimagepath ($pathname, $inside) {} - - /** - * (PECL imagick 2.0.0)
- * Composites a set of images - * @link http://php.net/manual/en/imagick.coalesceimages.php - * @return Imagick a new Imagick object on success. - */ - public function coalesceimages () {} - - /** - * (PECL imagick 2.0.0)
- * Changes the color value of any pixel that matches target - * @link http://php.net/manual/en/imagick.colorfloodfillimage.php - * @param mixed $fill

- * ImagickPixel object containing the fill color - *

- * @param float $fuzz

- * The amount of fuzz. For example, set fuzz to 10 and the color red at - * intensities of 100 and 102 respectively are now interpreted as the - * same color for the purposes of the floodfill. - *

- * @param mixed $bordercolor

- * ImagickPixel object containing the border color - *

- * @param int $x

- * X start position of the floodfill - *

- * @param int $y

- * Y start position of the floodfill - *

- * @return bool TRUE on success. - */ - public function colorfloodfillimage ($fill, $fuzz, $bordercolor, $x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Blends the fill color with the image - * @link http://php.net/manual/en/imagick.colorizeimage.php - * @param mixed $colorize

- * ImagickPixel object or a string containing the colorize color - *

- * @param mixed $opacity

- * ImagickPixel object or an float containing the opacity value. - * 1.0 is fully opaque and 0.0 is fully transparent. - *

- * @return bool TRUE on success. - */ - public function colorizeimage ($colorize, $opacity) {} - - /** - * (PECL imagick 2.0.0)
- * Returns the difference in one or more images - * @link http://php.net/manual/en/imagick.compareimagechannels.php - * @param Imagick $image

- * Imagick object containing the image to compare. - *

- * @param int $channelType

- * Provide any channel constant that is valid for your channel mode. To - * apply to more than one channel, combine channeltype constants using - * bitwise operators. Refer to this - * list of channel constants. - *

- * @param int $metricType

- * One of the metric type constants. - *

- * @return array Array consisting of new_wand and - * distortion. - */ - public function compareimagechannels (Imagick $image, $channelType, $metricType) {} - - /** - * (PECL imagick 2.0.0)
- * Compares an image to a reconstructed image - * @link http://php.net/manual/en/imagick.compareimages.php - * @param Imagick $compare

- * An image to compare to. - *

- * @param int $metric

- * Provide a valid metric type constant. Refer to this - * list of metric constants. - *

- * @return array TRUE on success. - */ - public function compareimages (Imagick $compare, $metric) {} - - /** - * (PECL imagick 2.0.0)
- * Change the contrast of the image - * @link http://php.net/manual/en/imagick.contrastimage.php - * @param bool $sharpen

- * The sharpen value - *

- * @return bool TRUE on success. - */ - public function contrastimage ($sharpen) {} - - /** - * (PECL imagick 2.0.0)
- * Combines one or more images into a single image - * @link http://php.net/manual/en/imagick.combineimages.php - * @param int $channelType

- * Provide any channel constant that is valid for your channel mode. To - * apply to more than one channel, combine channeltype constants using - * bitwise operators. Refer to this - * list of channel constants. - *

- * @return Imagick TRUE on success. - */ - public function combineimages ($channelType) {} - - /** - * (PECL imagick 2.0.0)
- * Applies a custom convolution kernel to the image - * @link http://php.net/manual/en/imagick.convolveimage.php - * @param array $kernel

- * The convolution kernel - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To - * apply to more than one channel, combine channeltype constants using - * bitwise operators. Refer to this - * list of channel constants. - *

- * @return bool TRUE on success. - */ - public function convolveimage (array $kernel, $channel = 'Imagick::CHANNEL_ALL') {} - - /** - * (PECL imagick 2.0.0)
- * Displaces an image's colormap - * @link http://php.net/manual/en/imagick.cyclecolormapimage.php - * @param int $displace

- * The amount to displace the colormap. - *

- * @return bool TRUE on success. - */ - public function cyclecolormapimage ($displace) {} - - /** - * (PECL imagick 2.0.0)
- * Returns certain pixel differences between images - * @link http://php.net/manual/en/imagick.deconstructimages.php - * @return Imagick a new Imagick object on success. - */ - public function deconstructimages () {} - - /** - * (PECL imagick 2.0.0)
- * Reduces the speckle noise in an image - * @link http://php.net/manual/en/imagick.despeckleimage.php - * @return bool TRUE on success. - */ - public function despeckleimage () {} - - /** - * (PECL imagick 2.0.0)
- * Enhance edges within the image - * @link http://php.net/manual/en/imagick.edgeimage.php - * @param float $radius

- * The radius of the operation. - *

- * @return bool TRUE on success. - */ - public function edgeimage ($radius) {} - - /** - * (PECL imagick 2.0.0)
- * Returns a grayscale image with a three-dimensional effect - * @link http://php.net/manual/en/imagick.embossimage.php - * @param float $radius

- * The radius of the effect - *

- * @param float $sigma

- * The sigma of the effect - *

- * @return bool TRUE on success. - */ - public function embossimage ($radius, $sigma) {} - - /** - * (PECL imagick 2.0.0)
- * Improves the quality of a noisy image - * @link http://php.net/manual/en/imagick.enhanceimage.php - * @return bool TRUE on success. - */ - public function enhanceimage () {} - - /** - * (PECL imagick 2.0.0)
- * Equalizes the image histogram - * @link http://php.net/manual/en/imagick.equalizeimage.php - * @return bool TRUE on success. - */ - public function equalizeimage () {} - - /** - * (PECL imagick 2.0.0)
- * Applies an expression to an image - * @link http://php.net/manual/en/imagick.evaluateimage.php - * @param int $op

- * The evaluation operator - *

- * @param float $constant

- * The value of the operator - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To - * apply to more than one channel, combine channeltype constants using - * bitwise operators. Refer to this - * list of channel constants. - *

- * @return bool TRUE on success. - */ - public function evaluateimage ($op, $constant, $channel = 'Imagick::CHANNEL_ALL') {} - - /** - * (PECL imagick 2.0.0)
- * Merges a sequence of images - * @link http://php.net/manual/en/imagick.flattenimages.php - * @return Imagick TRUE on success. - */ - public function flattenimages () {} - - /** - * (PECL imagick 2.0.0)
- * Creates a vertical mirror image - * @link http://php.net/manual/en/imagick.flipimage.php - * @return bool TRUE on success. - */ - public function flipimage () {} - - /** - * (PECL imagick 2.0.0)
- * Creates a horizontal mirror image - * @link http://php.net/manual/en/imagick.flopimage.php - * @return bool TRUE on success. - */ - public function flopimage () {} - - /** - * (PECL imagick 2.0.0)
- * Adds a simulated three-dimensional border - * @link http://php.net/manual/en/imagick.frameimage.php - * @param mixed $matte_color

- * ImagickPixel object or a string representing the matte color - *

- * @param int $width

- * The width of the border - *

- * @param int $height

- * The height of the border - *

- * @param int $inner_bevel

- * The inner bevel width - *

- * @param int $outer_bevel

- * The outer bevel width - *

- * @return bool TRUE on success. - */ - public function frameimage ($matte_color, $width, $height, $inner_bevel, $outer_bevel) {} - - /** - * (PECL imagick 2.0.0)
- * Evaluate expression for each pixel in the image - * @link http://php.net/manual/en/imagick.fximage.php - * @param string $expression

- * The expression. - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To - * apply to more than one channel, combine channeltype constants using - * bitwise operators. Refer to this - * list of channel constants. - *

- * @return Imagick TRUE on success. - */ - public function fximage ($expression, $channel = 'Imagick::CHANNEL_ALL') {} - - /** - * (PECL imagick 2.0.0)
- * Gamma-corrects an image - * @link http://php.net/manual/en/imagick.gammaimage.php - * @param float $gamma

- * The amount of gamma-correction. - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To - * apply to more than one channel, combine channeltype constants using - * bitwise operators. Refer to this - * list of channel constants. - *

- * @return bool TRUE on success. - */ - public function gammaimage ($gamma, $channel = 'Imagick::CHANNEL_ALL') {} - - /** - * (PECL imagick 2.0.0)
- * Blurs an image - * @link http://php.net/manual/en/imagick.gaussianblurimage.php - * @param float $radius

- * The radius of the Gaussian, in pixels, not counting the center pixel. - *

- * @param float $sigma

- * The standard deviation of the Gaussian, in pixels. - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To - * apply to more than one channel, combine channeltype constants using - * bitwise operators. Refer to this - * list of channel constants. - *

- * @return bool TRUE on success. - */ - public function gaussianblurimage ($radius, $sigma, $channel = 'Imagick::CHANNEL_ALL') {} - - /** - * @param $key - */ - public function getimageattribute ($key) {} - - /** - * (PECL imagick 2.0.0)
- * Returns the image background color - * @link http://php.net/manual/en/imagick.getimagebackgroundcolor.php - * @return ImagickPixel an ImagickPixel set to the background color of the image. - */ - public function getimagebackgroundcolor () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the chromaticy blue primary point - * @link http://php.net/manual/en/imagick.getimageblueprimary.php - * @return array Array consisting of "x" and "y" coordinates of point. - */ - public function getimageblueprimary () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the image border color - * @link http://php.net/manual/en/imagick.getimagebordercolor.php - * @return ImagickPixel TRUE on success. - */ - public function getimagebordercolor () {} - - /** - * (PECL imagick 2.0.0)
- * Gets the depth for a particular image channel - * @link http://php.net/manual/en/imagick.getimagechanneldepth.php - * @param int $channel

- * Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channel constants using bitwise operators. Defaults to Imagick::CHANNEL_DEFAULT. Refer to this list of channel constants - *

- * @return int TRUE on success. - */ - public function getimagechanneldepth ($channel) {} - - /** - * (PECL imagick 2.0.0)
- * Compares image channels of an image to a reconstructed image - * @link http://php.net/manual/en/imagick.getimagechanneldistortion.php - * @param Imagick $reference

- * Imagick object to compare to. - *

- * @param int $channel

- * Provide any channel constant that is valid for your channel mode. To - * apply to more than one channel, combine channeltype constants using - * bitwise operators. Refer to this - * list of channel constants. - *

- * @param int $metric

- * One of the metric type constants. - *

- * @return float TRUE on success. - */ - public function getimagechanneldistortion (Imagick $reference, $channel, $metric) {} - - /** - * (PECL imagick 2.0.0)
- * Gets the extrema for one or more image channels - * @link http://php.net/manual/en/imagick.getimagechannelextrema.php - * @param int $channel

- * Provide any channel constant that is valid for your channel mode. To - * apply to more than one channel, combine channeltype constants using - * bitwise operators. Refer to this - * list of channel constants. - *

- * @return array TRUE on success. - */ - public function getimagechannelextrema ($channel) {} - - /** - * (PECL imagick 2.0.0)
- * Gets the mean and standard deviation - * @link http://php.net/manual/en/imagick.getimagechannelmean.php - * @param int $channel

- * Provide any channel constant that is valid for your channel mode. To - * apply to more than one channel, combine channeltype constants using - * bitwise operators. Refer to this - * list of channel constants. - *

- * @return array TRUE on success. - */ - public function getimagechannelmean ($channel) {} - - /** - * (PECL imagick 2.0.0)
- * Returns statistics for each channel in the image - * @link http://php.net/manual/en/imagick.getimagechannelstatistics.php - * @return array TRUE on success. - */ - public function getimagechannelstatistics () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the color of the specified colormap index - * @link http://php.net/manual/en/imagick.getimagecolormapcolor.php - * @param int $index

- * The offset into the image colormap. - *

- * @return ImagickPixel TRUE on success. - */ - public function getimagecolormapcolor ($index) {} - - /** - * (PECL imagick 2.0.0)
- * Gets the image colorspace - * @link http://php.net/manual/en/imagick.getimagecolorspace.php - * @return int TRUE on success. - */ - public function getimagecolorspace () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the composite operator associated with the image - * @link http://php.net/manual/en/imagick.getimagecompose.php - * @return int TRUE on success. - */ - public function getimagecompose () {} - - /** - * (PECL imagick 2.0.0)
- * Gets the image delay - * @link http://php.net/manual/en/imagick.getimagedelay.php - * @return int the image delay. - */ - public function getimagedelay () {} - - /** - * (PECL imagick 0.9.1-0.9.9)
- * Gets the image depth - * @link http://php.net/manual/en/imagick.getimagedepth.php - * @return int The image depth. - */ - public function getimagedepth () {} - - /** - * (PECL imagick 2.0.0)
- * Compares an image to a reconstructed image - * @link http://php.net/manual/en/imagick.getimagedistortion.php - * @param MagickWand $reference

- * Imagick object to compare to. - *

- * @param int $metric

- * One of the metric type constants. - *

- * @return float the distortion metric used on the image (or the best guess - * thereof). - */ - public function getimagedistortion (MagickWand $reference, $metric) {} - - /** - * (PECL imagick 2.0.0)
- * Gets the extrema for the image - * @link http://php.net/manual/en/imagick.getimageextrema.php - * @return array an associative array with the keys "min" and "max". - */ - public function getimageextrema () {} - - /** - * (PECL imagick 2.0.0)
- * Gets the image disposal method - * @link http://php.net/manual/en/imagick.getimagedispose.php - * @return int the dispose method on success. - */ - public function getimagedispose () {} - - /** - * (PECL imagick 2.0.0)
- * Gets the image gamma - * @link http://php.net/manual/en/imagick.getimagegamma.php - * @return float the image gamma on success. - */ - public function getimagegamma () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the chromaticy green primary point - * @link http://php.net/manual/en/imagick.getimagegreenprimary.php - * @return array an array with the keys "x" and "y" on success, throws an - * ImagickException on failure. - */ - public function getimagegreenprimary () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the image height - * @link http://php.net/manual/en/imagick.getimageheight.php - * @return int the image height in pixels. - */ - public function getimageheight () {} - - /** - * (PECL imagick 2.0.0)
- * Gets the image histogram - * @link http://php.net/manual/en/imagick.getimagehistogram.php - * @return array the image histogram as an array of ImagickPixel objects. - */ - public function getimagehistogram () {} - - /** - * (PECL imagick 2.0.0)
- * Gets the image interlace scheme - * @link http://php.net/manual/en/imagick.getimageinterlacescheme.php - * @return int the interlace scheme as an integer on success. - * Throw an - * ImagickException on error. - */ - public function getimageinterlacescheme () {} - - /** - * (PECL imagick 2.0.0)
- * Gets the image iterations - * @link http://php.net/manual/en/imagick.getimageiterations.php - * @return int the image iterations as an integer. - */ - public function getimageiterations () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the image matte color - * @link http://php.net/manual/en/imagick.getimagemattecolor.php - * @return ImagickPixel ImagickPixel object on success. - */ - public function getimagemattecolor () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the page geometry - * @link http://php.net/manual/en/imagick.getimagepage.php - * @return array the page geometry associated with the image in an array with the - * keys "width", "height", "x", and "y". - */ - public function getimagepage () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the color of the specified pixel - * @link http://php.net/manual/en/imagick.getimagepixelcolor.php - * @param int $x

- * The x-coordinate of the pixel - *

- * @param int $y

- * The y-coordinate of the pixel - *

- * @return ImagickPixel an ImagickPixel instance for the color at the coordinates given. - */ - public function getimagepixelcolor ($x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Returns the named image profile - * @link http://php.net/manual/en/imagick.getimageprofile.php - * @param string $name

- * The name of the profile to return. - *

- * @return string a string containing the image profile. - */ - public function getimageprofile ($name) {} - - /** - * (PECL imagick 2.0.0)
- * Returns the chromaticity red primary point - * @link http://php.net/manual/en/imagick.getimageredprimary.php - * @return array the chromaticity red primary point as an array with the keys "x" - * and "y". - * Throw an - * ImagickException on error. - */ - public function getimageredprimary () {} - - /** - * (PECL imagick 2.0.0)
- * Gets the image rendering intent - * @link http://php.net/manual/en/imagick.getimagerenderingintent.php - * @return int the image rendering intent. - */ - public function getimagerenderingintent () {} - - /** - * (PECL imagick 2.0.0)
- * Gets the image X and Y resolution - * @link http://php.net/manual/en/imagick.getimageresolution.php - * @return array the resolution as an array. - */ - public function getimageresolution () {} - - /** - * (PECL imagick 2.0.0)
- * Gets the image scene - * @link http://php.net/manual/en/imagick.getimagescene.php - * @return int the image scene. - */ - public function getimagescene () {} - - /** - * (PECL imagick 2.0.0)
- * Generates an SHA-256 message digest - * @link http://php.net/manual/en/imagick.getimagesignature.php - * @return string a string containing the SHA-256 hash of the file. - */ - public function getimagesignature () {} - - /** - * (PECL imagick 2.0.0)
- * Gets the image ticks-per-second - * @link http://php.net/manual/en/imagick.getimagetickspersecond.php - * @return int the image ticks-per-second. - */ - public function getimagetickspersecond () {} - - /** - * (PECL imagick 0.9.10-0.9.9)
- * Gets the potential image type - * @link http://php.net/manual/en/imagick.getimagetype.php - * @return int the potential image type. - * imagick::IMGTYPE_UNDEFINED - * imagick::IMGTYPE_BILEVEL - * imagick::IMGTYPE_GRAYSCALE - * imagick::IMGTYPE_GRAYSCALEMATTE - * imagick::IMGTYPE_PALETTE - * imagick::IMGTYPE_PALETTEMATTE - * imagick::IMGTYPE_TRUECOLOR - * imagick::IMGTYPE_TRUECOLORMATTE - * imagick::IMGTYPE_COLORSEPARATION - * imagick::IMGTYPE_COLORSEPARATIONMATTE - * imagick::IMGTYPE_OPTIMIZE - */ - public function getimagetype () {} - - /** - * (PECL imagick 2.0.0)
- * Gets the image units of resolution - * @link http://php.net/manual/en/imagick.getimageunits.php - * @return int the image units of resolution. - */ - public function getimageunits () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the virtual pixel method - * @link http://php.net/manual/en/imagick.getimagevirtualpixelmethod.php - * @return int the virtual pixel method on success. - */ - public function getimagevirtualpixelmethod () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the chromaticity white point - * @link http://php.net/manual/en/imagick.getimagewhitepoint.php - * @return array the chromaticity white point as an associative array with the keys - * "x" and "y". - */ - public function getimagewhitepoint () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the image width - * @link http://php.net/manual/en/imagick.getimagewidth.php - * @return int the image width. - */ - public function getimagewidth () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the number of images in the object - * @link http://php.net/manual/en/imagick.getnumberimages.php - * @return int the number of images associated with Imagick object. - */ - public function getnumberimages () {} - - /** - * (PECL imagick 2.0.0)
- * Gets the image total ink density - * @link http://php.net/manual/en/imagick.getimagetotalinkdensity.php - * @return float the image total ink density of the image. - * Throw an - * ImagickException on error. - */ - public function getimagetotalinkdensity () {} - - /** - * (PECL imagick 2.0.0)
- * Extracts a region of the image - * @link http://php.net/manual/en/imagick.getimageregion.php - * @param int $width

- * The width of the extracted region. - *

- * @param int $height

- * The height of the extracted region. - *

- * @param int $x

- * X-coordinate of the top-left corner of the extracted region. - *

- * @param int $y

- * Y-coordinate of the top-left corner of the extracted region. - *

- * @return Imagick Extracts a region of the image and returns it as a new wand. - */ - public function getimageregion ($width, $height, $x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Creates a new image as a copy - * @link http://php.net/manual/en/imagick.implodeimage.php - * @param float $radius

- * The radius of the implode - *

- * @return bool TRUE on success. - */ - public function implodeimage ($radius) {} - - /** - * (PECL imagick 2.0.0)
- * Adjusts the levels of an image - * @link http://php.net/manual/en/imagick.levelimage.php - * @param float $blackPoint

- * The image black point - *

- * @param float $gamma

- * The gamma value - *

- * @param float $whitePoint

- * The image white point - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To - * apply to more than one channel, combine channeltype constants using - * bitwise operators. Refer to this - * list of channel constants. - *

- * @return bool TRUE on success. - */ - public function levelimage ($blackPoint, $gamma, $whitePoint, $channel = 'Imagick::CHANNEL_ALL') {} - - /** - * (PECL imagick 2.0.0)
- * Scales an image proportionally 2x - * @link http://php.net/manual/en/imagick.magnifyimage.php - * @return bool TRUE on success. - */ - public function magnifyimage () {} - - /** - * (PECL imagick 2.0.0)
- * Replaces the colors of an image with the closest color from a reference image. - * @link http://php.net/manual/en/imagick.mapimage.php - * @param Imagick $map - * @param bool $dither - * @return bool TRUE on success. - */ - public function mapimage (Imagick $map, $dither) {} - - /** - * (PECL imagick 2.0.0)
- * Changes the transparency value of a color - * @link http://php.net/manual/en/imagick.mattefloodfillimage.php - * @param float $alpha

- * The level of transparency: 1.0 is fully opaque and 0.0 is fully - * transparent. - *

- * @param float $fuzz

- * The fuzz member of image defines how much tolerance is acceptable to - * consider two colors as the same. - *

- * @param mixed $bordercolor

- * An ImagickPixel object or string representing the border color. - *

- * @param int $x

- * The starting x coordinate of the operation. - *

- * @param int $y

- * The starting y coordinate of the operation. - *

- * @return bool TRUE on success. - */ - public function mattefloodfillimage ($alpha, $fuzz, $bordercolor, $x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Applies a digital filter - * @link http://php.net/manual/en/imagick.medianfilterimage.php - * @param float $radius

- * The radius of the pixel neighborhood. - *

- * @return bool TRUE on success. - */ - public function medianfilterimage ($radius) {} - - /** - * (PECL imagick 2.0.0)
- * Negates the colors in the reference image - * @link http://php.net/manual/en/imagick.negateimage.php - * @param bool $gray

- * Whether to only negate grayscale pixels within the image. - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To - * apply to more than one channel, combine channeltype constants using - * bitwise operators. Refer to this - * list of channel constants. - *

- * @return bool TRUE on success. - */ - public function negateimage ($gray, $channel = 'Imagick::CHANNEL_ALL') {} - - /** - * (PECL imagick 2.0.0)
- * Change any pixel that matches color - * @link http://php.net/manual/en/imagick.paintopaqueimage.php - * @param mixed $target

- * Change this target color to the fill color within the image. An - * ImagickPixel object or a string representing the target color. - *

- * @param mixed $fill

- * An ImagickPixel object or a string representing the fill color. - *

- * @param float $fuzz

- * The fuzz member of image defines how much tolerance is acceptable to - * consider two colors as the same. - *

- * @param int $channel [optional]

- * Provide any channel constant that is valid for your channel mode. To - * apply to more than one channel, combine channeltype constants using - * bitwise operators. Refer to this - * list of channel constants. - *

- * @return bool TRUE on success. - */ - public function paintopaqueimage ($target, $fill, $fuzz, $channel = 'Imagick::CHANNEL_ALL') {} - - /** - * (PECL imagick 2.0.0)
- * Changes any pixel that matches color with the color defined by fill - * @link http://php.net/manual/en/imagick.painttransparentimage.php - * @param mixed $target

- * Change this target color to specified opacity value within the image. - *

- * @param float $alpha

- * The level of transparency: 1.0 is fully opaque and 0.0 is fully - * transparent. - *

- * @param float $fuzz

- * The fuzz member of image defines how much tolerance is acceptable to - * consider two colors as the same. - *

- * @return bool TRUE on success. - */ - public function painttransparentimage ($target, $alpha, $fuzz) {} - - /** - * (PECL imagick 2.0.0)
- * Quickly pin-point appropriate parameters for image processing - * @link http://php.net/manual/en/imagick.previewimages.php - * @param int $preview

- * Preview type. See Preview type constants - *

- * @return bool TRUE on success. - */ - public function previewimages ($preview) {} - - /** - * (PECL imagick 2.0.0)
- * Adds or removes a profile from an image - * @link http://php.net/manual/en/imagick.profileimage.php - * @param string $name - * @param string $profile - * @return bool TRUE on success. - */ - public function profileimage ($name, $profile) {} - - /** - * (PECL imagick 2.0.0)
- * Analyzes the colors within a reference image - * @link http://php.net/manual/en/imagick.quantizeimage.php - * @param int $numberColors - * @param int $colorspace - * @param int $treedepth - * @param bool $dither - * @param bool $measureError - * @return bool TRUE on success. - */ - public function quantizeimage ($numberColors, $colorspace, $treedepth, $dither, $measureError) {} - - /** - * (PECL imagick 2.0.0)
- * Analyzes the colors within a sequence of images - * @link http://php.net/manual/en/imagick.quantizeimages.php - * @param int $numberColors - * @param int $colorspace - * @param int $treedepth - * @param bool $dither - * @param bool $measureError - * @return bool TRUE on success. - */ - public function quantizeimages ($numberColors, $colorspace, $treedepth, $dither, $measureError) {} - - /** - * (PECL imagick 2.0.0)
- * Smooths the contours of an image - * @link http://php.net/manual/en/imagick.reducenoiseimage.php - * @param float $radius - * @return bool TRUE on success. - */ - public function reducenoiseimage ($radius) {} - - /** - * (PECL imagick 2.0.0)
- * Removes the named image profile and returns it - * @link http://php.net/manual/en/imagick.removeimageprofile.php - * @param string $name - * @return string a string containing the profile of the image. - */ - public function removeimageprofile ($name) {} - - /** - * (PECL imagick 2.0.0)
- * Separates a channel from the image - * @link http://php.net/manual/en/imagick.separateimagechannel.php - * @param int $channel - * @return bool TRUE on success. - */ - public function separateimagechannel ($channel) {} - - /** - * (PECL imagick 2.0.0)
- * Sepia tones an image - * @link http://php.net/manual/en/imagick.sepiatoneimage.php - * @param float $threshold - * @return bool TRUE on success. - */ - public function sepiatoneimage ($threshold) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image bias for any method that convolves an image - * @link http://php.net/manual/en/imagick.setimagebias.php - * @param float $bias - * @return bool TRUE on success. - */ - public function setimagebias ($bias) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image chromaticity blue primary point - * @link http://php.net/manual/en/imagick.setimageblueprimary.php - * @param float $x - * @param float $y - * @return bool TRUE on success. - */ - public function setimageblueprimary ($x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image border color - * @link http://php.net/manual/en/imagick.setimagebordercolor.php - * @param mixed $border

- * The border color - *

- * @return bool TRUE on success. - */ - public function setimagebordercolor ($border) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the depth of a particular image channel - * @link http://php.net/manual/en/imagick.setimagechanneldepth.php - * @param int $channel - * @param int $depth - * @return bool TRUE on success. - */ - public function setimagechanneldepth ($channel, $depth) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the color of the specified colormap index - * @link http://php.net/manual/en/imagick.setimagecolormapcolor.php - * @param int $index - * @param ImagickPixel $color - * @return bool TRUE on success. - */ - public function setimagecolormapcolor ($index, ImagickPixel $color) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image colorspace - * @link http://php.net/manual/en/imagick.setimagecolorspace.php - * @param int $colorspace

- * One of the COLORSPACE constants - *

- * @return bool TRUE on success. - */ - public function setimagecolorspace ($colorspace) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image disposal method - * @link http://php.net/manual/en/imagick.setimagedispose.php - * @param int $dispose - * @return bool TRUE on success. - */ - public function setimagedispose ($dispose) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image size - * @link http://php.net/manual/en/imagick.setimageextent.php - * @param int $columns - * @param int $rows - * @return bool TRUE on success. - */ - public function setimageextent ($columns, $rows) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image chromaticity green primary point - * @link http://php.net/manual/en/imagick.setimagegreenprimary.php - * @param float $x - * @param float $y - * @return bool TRUE on success. - */ - public function setimagegreenprimary ($x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image compression - * @link http://php.net/manual/en/imagick.setimageinterlacescheme.php - * @param int $interlace_scheme - * @return bool TRUE on success. - */ - public function setimageinterlacescheme ($interlace_scheme) {} - - /** - * (PECL imagick 2.0.0)
- * Adds a named profile to the Imagick object - * @link http://php.net/manual/en/imagick.setimageprofile.php - * @param string $name - * @param string $profile - * @return bool TRUE on success. - */ - public function setimageprofile ($name, $profile) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image chromaticity red primary point - * @link http://php.net/manual/en/imagick.setimageredprimary.php - * @param float $x - * @param float $y - * @return bool TRUE on success. - */ - public function setimageredprimary ($x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image rendering intent - * @link http://php.net/manual/en/imagick.setimagerenderingintent.php - * @param int $rendering_intent - * @return bool TRUE on success. - */ - public function setimagerenderingintent ($rendering_intent) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image virtual pixel method - * @link http://php.net/manual/en/imagick.setimagevirtualpixelmethod.php - * @param int $method - * @return bool TRUE on success. - */ - public function setimagevirtualpixelmethod ($method) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image chromaticity white point - * @link http://php.net/manual/en/imagick.setimagewhitepoint.php - * @param float $x - * @param float $y - * @return bool TRUE on success. - */ - public function setimagewhitepoint ($x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Adjusts the contrast of an image - * @link http://php.net/manual/en/imagick.sigmoidalcontrastimage.php - * @param bool $sharpen - * @param float $alpha - * @param float $beta - * @param int $channel [optional] - * @return bool TRUE on success. - */ - public function sigmoidalcontrastimage ($sharpen, $alpha, $beta, $channel = 'Imagick::CHANNEL_ALL') {} - - /** - * (PECL imagick 2.0.0)
- * Composites two images - * @link http://php.net/manual/en/imagick.stereoimage.php - * @param Imagick $offset_wand - * @return bool TRUE on success. - */ - public function stereoimage (Imagick $offset_wand) {} - - /** - * (PECL imagick 2.0.0)
- * Repeatedly tiles the texture image - * @link http://php.net/manual/en/imagick.textureimage.php - * @param Imagick $texture_wand - * @return bool TRUE on success. - */ - public function textureimage (Imagick $texture_wand) {} - - /** - * (PECL imagick 2.0.0)
- * Applies a color vector to each pixel in the image - * @link http://php.net/manual/en/imagick.tintimage.php - * @param mixed $tint - * @param mixed $opacity - * @return bool TRUE on success. - */ - public function tintimage ($tint, $opacity) {} - - /** - * (PECL imagick 2.0.0)
- * Sharpens an image - * @link http://php.net/manual/en/imagick.unsharpmaskimage.php - * @param float $radius - * @param float $sigma - * @param float $amount - * @param float $threshold - * @param int $channel [optional] - * @return bool TRUE on success. - */ - public function unsharpmaskimage ($radius, $sigma, $amount, $threshold, $channel = 'Imagick::CHANNEL_ALL') {} - - /** - * (PECL imagick 2.0.0)
- * Returns a new Imagick object - * @link http://php.net/manual/en/imagick.getimage.php - * @return Imagick a new Imagick object with the current image sequence. - */ - public function getimage () {} - - /** - * (PECL imagick 2.0.0)
- * Adds new image to Imagick object image list - * @link http://php.net/manual/en/imagick.addimage.php - * @param Imagick $source

- * The source Imagick object - *

- * @return bool TRUE on success. - */ - public function addimage (Imagick $source) {} - - /** - * (PECL imagick 2.0.0)
- * Replaces image in the object - * @link http://php.net/manual/en/imagick.setimage.php - * @param Imagick $replace

- * The replace Imagick object - *

- * @return bool TRUE on success. - */ - public function setimage (Imagick $replace) {} - - /** - * (PECL imagick 2.0.0)
- * Creates a new image - * @link http://php.net/manual/en/imagick.newimage.php - * @param int $cols

- * Columns in the new image - *

- * @param int $rows

- * Rows in the new image - *

- * @param mixed $background

- * The background color used for this image - *

- * @param string $format [optional]

- * Image format. This parameter was added in Imagick version 2.0.1. - *

- * @return bool TRUE on success. - */ - public function newimage ($cols, $rows, $background, $format = null) {} - - /** - * (PECL imagick 2.0.0)
- * Creates a new image - * @link http://php.net/manual/en/imagick.newpseudoimage.php - * @param int $columns

- * columns in the new image - *

- * @param int $rows

- * rows in the new image - *

- * @param string $pseudoString

- * string containing pseudo image definition. - *

- * @return bool TRUE on success. - */ - public function newpseudoimage ($columns, $rows, $pseudoString) {} - - /** - * (PECL imagick 2.0.0)
- * Gets the object compression type - * @link http://php.net/manual/en/imagick.getcompression.php - * @return int the compression constant - */ - public function getcompression () {} - - /** - * (PECL imagick 2.0.0)
- * Gets the object compression quality - * @link http://php.net/manual/en/imagick.getcompressionquality.php - * @return int integer describing the compression quality - */ - public function getcompressionquality () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the ImageMagick API copyright as a string - * @link http://php.net/manual/en/imagick.getcopyright.php - * @return string a string containing the copyright notice of Imagemagick and - * Magickwand C API. - */ - public function getcopyright () {} - - /** - * (PECL imagick 2.0.0)
- * The filename associated with an image sequence - * @link http://php.net/manual/en/imagick.getfilename.php - * @return string a string on success. - */ - public function getfilename () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the format of the Imagick object - * @link http://php.net/manual/en/imagick.getformat.php - * @return string the format of the image. - */ - public function getformat () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the ImageMagick home URL - * @link http://php.net/manual/en/imagick.gethomeurl.php - * @return string a link to the imagemagick homepage. - */ - public function gethomeurl () {} - - /** - * (PECL imagick 2.0.0)
- * Gets the object interlace scheme - * @link http://php.net/manual/en/imagick.getinterlacescheme.php - * @return int Gets the wand interlace - * scheme. - */ - public function getinterlacescheme () {} - - /** - * (PECL imagick 2.0.0)
- * Returns a value associated with the specified key - * @link http://php.net/manual/en/imagick.getoption.php - * @param string $key

- * The name of the option - *

- * @return string a value associated with a wand and the specified key. - */ - public function getoption ($key) {} - - /** - * (PECL imagick 2.0.0)
- * Returns the ImageMagick package name - * @link http://php.net/manual/en/imagick.getpackagename.php - * @return string the ImageMagick package name as a string. - */ - public function getpackagename () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the page geometry - * @link http://php.net/manual/en/imagick.getpage.php - * @return array the page geometry associated with the Imagick object in - * an associative array with the keys "width", "height", "x", and "y", - * throwing ImagickException on error. - */ - public function getpage () {} - - /** - * (PECL imagick 2.0.0)
- * Gets the quantum depth - * @link http://php.net/manual/en/imagick.getquantumdepth.php - * @return array the Imagick quantum depth as a string. - */ - public function getquantumdepth () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the Imagick quantum range - * @link http://php.net/manual/en/imagick.getquantumrange.php - * @return array the Imagick quantum range as a string. - */ - public function getquantumrange () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the ImageMagick release date - * @link http://php.net/manual/en/imagick.getreleasedate.php - * @return string the ImageMagick release date as a string. - */ - public function getreleasedate () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the specified resource's memory usage - * @link http://php.net/manual/en/imagick.getresource.php - * @param int $type

- * Refer to the list of resourcetype constants. - *

- * @return int the specified resource's memory usage in megabytes. - */ - public function getresource ($type) {} - - /** - * (PECL imagick 2.0.0)
- * Returns the specified resource limit - * @link http://php.net/manual/en/imagick.getresourcelimit.php - * @param int $type

- * Refer to the list of resourcetype constants. - *

- * @return int the specified resource limit in megabytes. - */ - public function getresourcelimit ($type) {} - - /** - * (PECL imagick 2.0.0)
- * Gets the horizontal and vertical sampling factor - * @link http://php.net/manual/en/imagick.getsamplingfactors.php - * @return array an associative array with the horizontal and vertical sampling - * factors of the image. - */ - public function getsamplingfactors () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the size associated with the Imagick object - * @link http://php.net/manual/en/imagick.getsize.php - * @return array the size associated with the Imagick object as an array with the - * keys "columns" and "rows". - */ - public function getsize () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the ImageMagick API version - * @link http://php.net/manual/en/imagick.getversion.php - * @return array the ImageMagick API version as a string and as a number. - */ - public function getversion () {} - - /** - * (PECL imagick 2.0.0)
- * Sets the object's default background color - * @link http://php.net/manual/en/imagick.setbackgroundcolor.php - * @param mixed $background - * @return bool TRUE on success. - */ - public function setbackgroundcolor ($background) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the object's default compression type - * @link http://php.net/manual/en/imagick.setcompression.php - * @param int $compression - * @return bool TRUE on success. - */ - public function setcompression ($compression) {} - - /** - * (PECL imagick 0.9.10-0.9.9)
- * Sets the object's default compression quality - * @link http://php.net/manual/en/imagick.setcompressionquality.php - * @param int $quality - * @return bool TRUE on success. - */ - public function setcompressionquality ($quality) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the filename before you read or write the image - * @link http://php.net/manual/en/imagick.setfilename.php - * @param string $filename - * @return bool TRUE on success. - */ - public function setfilename ($filename) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the format of the Imagick object - * @link http://php.net/manual/en/imagick.setformat.php - * @param string $format - * @return bool TRUE on success. - */ - public function setformat ($format) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image compression - * @link http://php.net/manual/en/imagick.setinterlacescheme.php - * @param int $interlace_scheme - * @return bool TRUE on success. - */ - public function setinterlacescheme ($interlace_scheme) {} - - /** - * (PECL imagick 2.0.0)
- * Set an option - * @link http://php.net/manual/en/imagick.setoption.php - * @param string $key - * @param string $value - * @return bool TRUE on success. - */ - public function setoption ($key, $value) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the page geometry of the Imagick object - * @link http://php.net/manual/en/imagick.setpage.php - * @param int $width - * @param int $height - * @param int $x - * @param int $y - * @return bool TRUE on success. - */ - public function setpage ($width, $height, $x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the limit for a particular resource in megabytes - * @link http://php.net/manual/en/imagick.setresourcelimit.php - * @param int $type - * @param int $limit - * @return bool TRUE on success. - */ - public function setresourcelimit ($type, $limit) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image resolution - * @link http://php.net/manual/en/imagick.setresolution.php - * @param float $x_resolution

- * The horizontal resolution. - *

- * @param float $y_resolution

- * The vertical resolution. - *

- * @return bool TRUE on success. - */ - public function setresolution ($x_resolution, $y_resolution) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image sampling factors - * @link http://php.net/manual/en/imagick.setsamplingfactors.php - * @param array $factors - * @return bool TRUE on success. - */ - public function setsamplingfactors (array $factors) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the size of the Imagick object - * @link http://php.net/manual/en/imagick.setsize.php - * @param int $columns - * @param int $rows - * @return bool TRUE on success. - */ - public function setsize ($columns, $rows) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the image type attribute - * @link http://php.net/manual/en/imagick.settype.php - * @param int $image_type - * @return bool TRUE on success. - */ - public function settype ($image_type) {} - - public function key () {} - - public function next () {} - - public function rewind () {} - - /** - * (PECL imagick 2.0.0)
- * Checks if the current item is valid - * @link http://php.net/manual/en/imagick.valid.php - * @return bool TRUE on success. - */ - public function valid () {} - - /** - * (PECL imagick 2.0.0)
- * Returns a reference to the current Imagick object - * @link http://php.net/manual/en/imagick.current.php - * @return Imagick self on success. - */ - public function current () {} - -} - -/** - * @link http://php.net/manual/en/class.imagickdraw.php - */ -class ImagickDraw { - - public function resetvectorgraphics () {} - - public function gettextkerning () {} - - /** - * @param $kerning - */ - public function settextkerning ($kerning) {} - - public function gettextinterwordspacing () {} - - /** - * @param $spacing - */ - public function settextinterwordspacing ($spacing) {} - - /** - * (PECL imagick 2.0.0)
- * The ImagickDraw constructor - * @link http://php.net/manual/en/imagickdraw.construct.php - */ - public function __construct () {} - - /** - * (PECL imagick 2.0.0)
- * Sets the fill color to be used for drawing filled objects - * @link http://php.net/manual/en/imagickdraw.setfillcolor.php - * @param ImagickPixel $fill_pixel

- * ImagickPixel to use to set the color - *

- * @return bool No value is returned. - */ - public function setfillcolor (ImagickPixel $fill_pixel) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the opacity to use when drawing using the fill color or fill texture - * @link http://php.net/manual/en/imagickdraw.setfillalpha.php - * @param float $opacity

- * fill alpha - *

- * @return bool No value is returned. - */ - public function setfillalpha ($opacity) {} - - /** - * @param $x_resolution - * @param $y_resolution - */ - public function setresolution ($x_resolution, $y_resolution) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the color used for stroking object outlines - * @link http://php.net/manual/en/imagickdraw.setstrokecolor.php - * @param ImagickPixel $stroke_pixel

- * the stroke color - *

- * @return bool No value is returned. - */ - public function setstrokecolor (ImagickPixel $stroke_pixel) {} - - /** - * (PECL imagick 2.0.0)
- * Specifies the opacity of stroked object outlines - * @link http://php.net/manual/en/imagickdraw.setstrokealpha.php - * @param float $opacity

- * opacity - *

- * @return bool No value is returned. - */ - public function setstrokealpha ($opacity) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the width of the stroke used to draw object outlines - * @link http://php.net/manual/en/imagickdraw.setstrokewidth.php - * @param float $stroke_width

- * stroke width - *

- * @return bool No value is returned. - */ - public function setstrokewidth ($stroke_width) {} - - /** - * (PECL imagick 2.0.0)
- * Clears the ImagickDraw - * @link http://php.net/manual/en/imagickdraw.clear.php - * @return bool an ImagickDraw object. - */ - public function clear () {} - - /** - * (PECL imagick 2.0.0)
- * Draws a circle - * @link http://php.net/manual/en/imagickdraw.circle.php - * @param float $ox

- * origin x coordinate - *

- * @param float $oy

- * origin y coordinate - *

- * @param float $px

- * perimeter x coordinate - *

- * @param float $py

- * perimeter y coordinate - *

- * @return bool No value is returned. - */ - public function circle ($ox, $oy, $px, $py) {} - - /** - * (PECL imagick 2.0.0)
- * Draws text on the image - * @link http://php.net/manual/en/imagickdraw.annotation.php - * @param float $x

- * The x coordinate where text is drawn - *

- * @param float $y

- * The y coordinate where text is drawn - *

- * @param string $text

- * The text to draw on the image - *

- * @return bool No value is returned. - */ - public function annotation ($x, $y, $text) {} - - /** - * (PECL imagick 2.0.0)
- * Controls whether text is antialiased - * @link http://php.net/manual/en/imagickdraw.settextantialias.php - * @param bool $antiAlias - * @return bool No value is returned. - */ - public function settextantialias ($antiAlias) {} - - /** - * (PECL imagick 2.0.0)
- * Specifies specifies the text code set - * @link http://php.net/manual/en/imagickdraw.settextencoding.php - * @param string $encoding

- * the encoding name - *

- * @return bool No value is returned. - */ - public function settextencoding ($encoding) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the fully-specified font to use when annotating with text - * @link http://php.net/manual/en/imagickdraw.setfont.php - * @param string $font_name - * @return bool TRUE on success. - */ - public function setfont ($font_name) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the font family to use when annotating with text - * @link http://php.net/manual/en/imagickdraw.setfontfamily.php - * @param string $font_family

- * the font family - *

- * @return bool TRUE on success. - */ - public function setfontfamily ($font_family) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the font pointsize to use when annotating with text - * @link http://php.net/manual/en/imagickdraw.setfontsize.php - * @param float $pointsize

- * the point size - *

- * @return bool No value is returned. - */ - public function setfontsize ($pointsize) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the font style to use when annotating with text - * @link http://php.net/manual/en/imagickdraw.setfontstyle.php - * @param int $style

- * STYLETYPE_ constant - *

- * @return bool No value is returned. - */ - public function setfontstyle ($style) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the font weight - * @link http://php.net/manual/en/imagickdraw.setfontweight.php - * @param int $font_weight - * @return bool - */ - public function setfontweight ($font_weight) {} - - /** - * (PECL imagick 2.0.0)
- * Returns the font - * @link http://php.net/manual/en/imagickdraw.getfont.php - * @return string a string on success and false if no font is set. - */ - public function getfont () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the font family - * @link http://php.net/manual/en/imagickdraw.getfontfamily.php - * @return string the font family currently selected or false if font family is not set. - */ - public function getfontfamily () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the font pointsize - * @link http://php.net/manual/en/imagickdraw.getfontsize.php - * @return float the font size associated with the current ImagickDraw object. - */ - public function getfontsize () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the font style - * @link http://php.net/manual/en/imagickdraw.getfontstyle.php - * @return int the font style constant (STYLE_) associated with the ImagickDraw object - * or 0 if no style is set. - */ - public function getfontstyle () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the font weight - * @link http://php.net/manual/en/imagickdraw.getfontweight.php - * @return int an int on success and 0 if no weight is set. - */ - public function getfontweight () {} - - /** - * (PECL imagick 2.0.0)
- * Frees all associated resources - * @link http://php.net/manual/en/imagickdraw.destroy.php - * @return bool No value is returned. - */ - public function destroy () {} - - /** - * (PECL imagick 2.0.0)
- * Draws a rectangle - * @link http://php.net/manual/en/imagickdraw.rectangle.php - * @param float $x1

- * x coordinate of the top left corner - *

- * @param float $y1

- * y coordinate of the top left corner - *

- * @param float $x2

- * x coordinate of the bottom right corner - *

- * @param float $y2

- * y coordinate of the bottom right corner - *

- * @return bool No value is returned. - */ - public function rectangle ($x1, $y1, $x2, $y2) {} - - /** - * (PECL imagick 2.0.0)
- * Draws a rounded rectangle - * @link http://php.net/manual/en/imagickdraw.roundrectangle.php - * @param float $x1

- * x coordinate of the top left corner - *

- * @param float $y1

- * y coordinate of the top left corner - *

- * @param float $x2

- * x coordinate of the bottom right - *

- * @param float $y2

- * y coordinate of the bottom right - *

- * @param float $rx

- * x rounding - *

- * @param float $ry

- * y rounding - *

- * @return bool No value is returned. - */ - public function roundrectangle ($x1, $y1, $x2, $y2, $rx, $ry) {} - - /** - * (PECL imagick 2.0.0)
- * Draws an ellipse on the image - * @link http://php.net/manual/en/imagickdraw.ellipse.php - * @param float $ox - * @param float $oy - * @param float $rx - * @param float $ry - * @param float $start - * @param float $end - * @return bool No value is returned. - */ - public function ellipse ($ox, $oy, $rx, $ry, $start, $end) {} - - /** - * (PECL imagick 2.0.0)
- * Skews the current coordinate system in the horizontal direction - * @link http://php.net/manual/en/imagickdraw.skewx.php - * @param float $degrees

- * degrees to skew - *

- * @return bool No value is returned. - */ - public function skewx ($degrees) {} - - /** - * (PECL imagick 2.0.0)
- * Skews the current coordinate system in the vertical direction - * @link http://php.net/manual/en/imagickdraw.skewy.php - * @param float $degrees

- * degrees to skew - *

- * @return bool No value is returned. - */ - public function skewy ($degrees) {} - - /** - * (PECL imagick 2.0.0)
- * Applies a translation to the current coordinate system - * @link http://php.net/manual/en/imagickdraw.translate.php - * @param float $x

- * horizontal translation - *

- * @param float $y

- * vertical translation - *

- * @return bool No value is returned. - */ - public function translate ($x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Draws a line - * @link http://php.net/manual/en/imagickdraw.line.php - * @param float $sx

- * starting x coordinate - *

- * @param float $sy

- * starting y coordinate - *

- * @param float $ex

- * ending x coordinate - *

- * @param float $ey

- * ending y coordinate - *

- * @return bool No value is returned. - */ - public function line ($sx, $sy, $ex, $ey) {} - - /** - * (PECL imagick 2.0.0)
- * Draws an arc - * @link http://php.net/manual/en/imagickdraw.arc.php - * @param float $sx

- * Starting x ordinate of bounding rectangle - *

- * @param float $sy

- * starting y ordinate of bounding rectangle - *

- * @param float $ex

- * ending x ordinate of bounding rectangle - *

- * @param float $ey

- * ending y ordinate of bounding rectangle - *

- * @param float $sd

- * starting degrees of rotation - *

- * @param float $ed

- * ending degrees of rotation - *

- * @return bool No value is returned. - */ - public function arc ($sx, $sy, $ex, $ey, $sd, $ed) {} - - /** - * (PECL imagick 2.0.0)
- * Paints on the image's opacity channel - * @link http://php.net/manual/en/imagickdraw.matte.php - * @param float $x

- * x coordinate of the matte - *

- * @param float $y

- * y coordinate of the matte - *

- * @param int $paintMethod

- * PAINT_ constant - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function matte ($x, $y, $paintMethod) {} - - /** - * (PECL imagick 2.0.0)
- * Draws a polygon - * @link http://php.net/manual/en/imagickdraw.polygon.php - * @param array $coordinates

- * multidimensional array like array( array( 'x' => 3, 'y' => 4 ), array( 'x' => 2, 'y' => 6 ) ); - *

- * @return bool TRUE on success. - */ - public function polygon (array $coordinates) {} - - /** - * (PECL imagick 2.0.0)
- * Draws a point - * @link http://php.net/manual/en/imagickdraw.point.php - * @param float $x

- * point's x coordinate - *

- * @param float $y

- * point's y coordinate - *

- * @return bool No value is returned. - */ - public function point ($x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Returns the text decoration - * @link http://php.net/manual/en/imagickdraw.gettextdecoration.php - * @return int one of the DECORATION_ constants - * and 0 if no decoration is set. - */ - public function gettextdecoration () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the code set used for text annotations - * @link http://php.net/manual/en/imagickdraw.gettextencoding.php - * @return string a string specifying the code set - * or false if text encoding is not set. - */ - public function gettextencoding () {} - - public function getfontstretch () {} - - /** - * (PECL imagick 2.0.0)
- * Sets the font stretch to use when annotating with text - * @link http://php.net/manual/en/imagickdraw.setfontstretch.php - * @param int $fontStretch

- * STRETCH_ constant - *

- * @return bool No value is returned. - */ - public function setfontstretch ($fontStretch) {} - - /** - * (PECL imagick 2.0.0)
- * Controls whether stroked outlines are antialiased - * @link http://php.net/manual/en/imagickdraw.setstrokeantialias.php - * @param bool $stroke_antialias

- * the antialias setting - *

- * @return bool No value is returned. - */ - public function setstrokeantialias ($stroke_antialias) {} - - /** - * (PECL imagick 2.0.0)
- * Specifies a text alignment - * @link http://php.net/manual/en/imagickdraw.settextalignment.php - * @param int $alignment

- * ALIGN_ constant - *

- * @return bool No value is returned. - */ - public function settextalignment ($alignment) {} - - /** - * (PECL imagick 2.0.0)
- * Specifies a decoration - * @link http://php.net/manual/en/imagickdraw.settextdecoration.php - * @param int $decoration

- * DECORATION_ constant - *

- * @return bool No value is returned. - */ - public function settextdecoration ($decoration) {} - - /** - * (PECL imagick 2.0.0)
- * Specifies the color of a background rectangle - * @link http://php.net/manual/en/imagickdraw.settextundercolor.php - * @param ImagickPixel $under_color

- * the under color - *

- * @return bool No value is returned. - */ - public function settextundercolor (ImagickPixel $under_color) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the overall canvas size - * @link http://php.net/manual/en/imagickdraw.setviewbox.php - * @param int $x1

- * left x coordinate - *

- * @param int $y1

- * left y coordinate - *

- * @param int $x2

- * right x coordinate - *

- * @param int $y2

- * right y coordinate - *

- * @return bool No value is returned. - */ - public function setviewbox ($x1, $y1, $x2, $y2) {} - - /** - * (PECL imagick 2.0.0)
- * Adjusts the current affine transformation matrix - * @link http://php.net/manual/en/imagickdraw.affine.php - * @param array $affine

- * Affine matrix parameters - *

- * @return bool No value is returned. - */ - public function affine (array $affine) {} - - /** - * (PECL imagick 2.0.0)
- * Draws a bezier curve - * @link http://php.net/manual/en/imagickdraw.bezier.php - * @param array $coordinates

- * Multidimensional array like array( array( 'x' => 1, 'y' => 2 ), - * array( 'x' => 3, 'y' => 4 ) ) - *

- * @return bool No value is returned. - */ - public function bezier (array $coordinates) {} - - /** - * (PECL imagick 2.0.0)
- * Composites an image onto the current image - * @link http://php.net/manual/en/imagickdraw.composite.php - * @param int $compose

- * composition operator. One of COMPOSITE_ constants - *

- * @param float $x

- * x coordinate of the top left corner - *

- * @param float $y

- * y coordinate of the top left corner - *

- * @param float $width

- * width of the composition image - *

- * @param float $height

- * height of the composition image - *

- * @param Imagick $compositeWand

- * the Imagick object where composition image is taken from - *

- * @return bool TRUE on success. - */ - public function composite ($compose, $x, $y, $width, $height, Imagick $compositeWand) {} - - /** - * (PECL imagick 2.0.0)
- * Draws color on image - * @link http://php.net/manual/en/imagickdraw.color.php - * @param float $x

- * x coordinate of the paint - *

- * @param float $y

- * y coordinate of the paint - *

- * @param int $paintMethod

- * one of the PAINT_ constants - *

- * @return bool No value is returned. - */ - public function color ($x, $y, $paintMethod) {} - - /** - * (PECL imagick 2.0.0)
- * Adds a comment - * @link http://php.net/manual/en/imagickdraw.comment.php - * @param string $comment

- * The comment string to add to vector output stream - *

- * @return bool No value is returned. - */ - public function comment ($comment) {} - - /** - * (PECL imagick 2.0.0)
- * Obtains the current clipping path ID - * @link http://php.net/manual/en/imagickdraw.getclippath.php - * @return string a string containing the clip path ID or false if no clip path exists. - */ - public function getclippath () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the current polygon fill rule - * @link http://php.net/manual/en/imagickdraw.getcliprule.php - * @return int one of the FILLRULE_ constants. - */ - public function getcliprule () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the interpretation of clip path units - * @link http://php.net/manual/en/imagickdraw.getclipunits.php - * @return int an int on success. - */ - public function getclipunits () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the fill color - * @link http://php.net/manual/en/imagickdraw.getfillcolor.php - * @return ImagickPixel an ImagickPixel object. - */ - public function getfillcolor () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the opacity used when drawing - * @link http://php.net/manual/en/imagickdraw.getfillopacity.php - * @return float The opacity. - */ - public function getfillopacity () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the fill rule - * @link http://php.net/manual/en/imagickdraw.getfillrule.php - * @return int a FILLRULE_ constant - */ - public function getfillrule () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the text placement gravity - * @link http://php.net/manual/en/imagickdraw.getgravity.php - * @return int a GRAVITY_ constant on success and 0 if no gravity is set. - */ - public function getgravity () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the current stroke antialias setting - * @link http://php.net/manual/en/imagickdraw.getstrokeantialias.php - * @return bool TRUE if antialiasing is on and false if it is off. - */ - public function getstrokeantialias () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the color used for stroking object outlines - * @link http://php.net/manual/en/imagickdraw.getstrokecolor.php - * @return ImagickPixel an ImagickPixel object which describes the color. - */ - public function getstrokecolor () {} - - /** - * (PECL imagick 2.0.0)
- * Returns an array representing the pattern of dashes and gaps used to stroke paths - * @link http://php.net/manual/en/imagickdraw.getstrokedasharray.php - * @return array an array on success and empty array if not set. - */ - public function getstrokedasharray () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the offset into the dash pattern to start the dash - * @link http://php.net/manual/en/imagickdraw.getstrokedashoffset.php - * @return float a float representing the offset and 0 if it's not set. - */ - public function getstrokedashoffset () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the shape to be used at the end of open subpaths when they are stroked - * @link http://php.net/manual/en/imagickdraw.getstrokelinecap.php - * @return int one of the LINECAP_ constants or 0 if stroke linecap is not set. - */ - public function getstrokelinecap () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the shape to be used at the corners of paths when they are stroked - * @link http://php.net/manual/en/imagickdraw.getstrokelinejoin.php - * @return int one of the LINEJOIN_ constants or 0 if stroke line join is not set. - */ - public function getstrokelinejoin () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the stroke miter limit - * @link http://php.net/manual/en/imagickdraw.getstrokemiterlimit.php - * @return int an int describing the miter limit - * and 0 if no miter limit is set. - */ - public function getstrokemiterlimit () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the opacity of stroked object outlines - * @link http://php.net/manual/en/imagickdraw.getstrokeopacity.php - * @return float a double describing the opacity. - */ - public function getstrokeopacity () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the width of the stroke used to draw object outlines - * @link http://php.net/manual/en/imagickdraw.getstrokewidth.php - * @return float a double describing the stroke width. - */ - public function getstrokewidth () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the text alignment - * @link http://php.net/manual/en/imagickdraw.gettextalignment.php - * @return int one of the ALIGN_ constants and 0 if no align is set. - */ - public function gettextalignment () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the current text antialias setting - * @link http://php.net/manual/en/imagickdraw.gettextantialias.php - * @return bool TRUE if text is antialiased and false if not. - */ - public function gettextantialias () {} - - /** - * (PECL imagick 2.0.0)
- * Returns a string containing vector graphics - * @link http://php.net/manual/en/imagickdraw.getvectorgraphics.php - * @return string a string containing the vector graphics. - */ - public function getvectorgraphics () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the text under color - * @link http://php.net/manual/en/imagickdraw.gettextundercolor.php - * @return ImagickPixel an ImagickPixel object describing the color. - */ - public function gettextundercolor () {} - - /** - * (PECL imagick 2.0.0)
- * Adds a path element to the current path - * @link http://php.net/manual/en/imagickdraw.pathclose.php - * @return bool No value is returned. - */ - public function pathclose () {} - - /** - * (PECL imagick 2.0.0)
- * Draws a cubic Bezier curve - * @link http://php.net/manual/en/imagickdraw.pathcurvetoabsolute.php - * @param float $x1

- * x coordinate of the first control point - *

- * @param float $y1

- * y coordinate of the first control point - *

- * @param float $x2

- * x coordinate of the second control point - *

- * @param float $y2

- * y coordinate of the first control point - *

- * @param float $x

- * x coordinate of the curve end - *

- * @param float $y

- * y coordinate of the curve end - *

- * @return bool No value is returned. - */ - public function pathcurvetoabsolute ($x1, $y1, $x2, $y2, $x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Draws a cubic Bezier curve - * @link http://php.net/manual/en/imagickdraw.pathcurvetorelative.php - * @param float $x1

- * x coordinate of starting control point - *

- * @param float $y1

- * y coordinate of starting control point - *

- * @param float $x2

- * x coordinate of ending control point - *

- * @param float $y2

- * y coordinate of ending control point - *

- * @param float $x

- * ending x coordinate - *

- * @param float $y

- * ending y coordinate - *

- * @return bool No value is returned. - */ - public function pathcurvetorelative ($x1, $y1, $x2, $y2, $x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Draws a quadratic Bezier curve - * @link http://php.net/manual/en/imagickdraw.pathcurvetoquadraticbezierabsolute.php - * @param float $x1

- * x coordinate of the control point - *

- * @param float $y1

- * y coordinate of the control point - *

- * @param float $x

- * x coordinate of the end point - *

- * @param float $y

- * y coordinate of the end point - *

- * @return bool No value is returned. - */ - public function pathcurvetoquadraticbezierabsolute ($x1, $y1, $x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Draws a quadratic Bezier curve - * @link http://php.net/manual/en/imagickdraw.pathcurvetoquadraticbezierrelative.php - * @param float $x1

- * starting x coordinate - *

- * @param float $y1

- * starting y coordinate - *

- * @param float $x

- * ending x coordinate - *

- * @param float $y

- * ending y coordinate - *

- * @return bool No value is returned. - */ - public function pathcurvetoquadraticbezierrelative ($x1, $y1, $x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Draws a quadratic Bezier curve - * @link http://php.net/manual/en/imagickdraw.pathcurvetoquadraticbeziersmoothabsolute.php - * @param float $x

- * ending x coordinate - *

- * @param float $y

- * ending y coordinate - *

- * @return bool No value is returned. - */ - public function pathcurvetoquadraticbeziersmoothabsolute ($x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Draws a quadratic Bezier curve - * @link http://php.net/manual/en/imagickdraw.pathcurvetoquadraticbeziersmoothrelative.php - * @param float $x

- * ending x coordinate - *

- * @param float $y

- * ending y coordinate - *

- * @return bool No value is returned. - */ - public function pathcurvetoquadraticbeziersmoothrelative ($x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Draws a cubic Bezier curve - * @link http://php.net/manual/en/imagickdraw.pathcurvetosmoothabsolute.php - * @param float $x2

- * x coordinate of the second control point - *

- * @param float $y2

- * y coordinate of the second control point - *

- * @param float $x

- * x coordinate of the ending point - *

- * @param float $y

- * y coordinate of the ending point - *

- * @return bool No value is returned. - */ - public function pathcurvetosmoothabsolute ($x2, $y2, $x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Draws a cubic Bezier curve - * @link http://php.net/manual/en/imagickdraw.pathcurvetosmoothrelative.php - * @param float $x2

- * x coordinate of the second control point - *

- * @param float $y2

- * y coordinate of the second control point - *

- * @param float $x

- * x coordinate of the ending point - *

- * @param float $y

- * y coordinate of the ending point - *

- * @return bool No value is returned. - */ - public function pathcurvetosmoothrelative ($x2, $y2, $x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Draws an elliptical arc - * @link http://php.net/manual/en/imagickdraw.pathellipticarcabsolute.php - * @param float $rx

- * x radius - *

- * @param float $ry

- * y radius - *

- * @param float $x_axis_rotation

- * x axis rotation - *

- * @param bool $large_arc_flag

- * large arc flag - *

- * @param bool $sweep_flag

- * sweep flag - *

- * @param float $x

- * x coordinate - *

- * @param float $y

- * y coordinate - *

- * @return bool No value is returned. - */ - public function pathellipticarcabsolute ($rx, $ry, $x_axis_rotation, $large_arc_flag, $sweep_flag, $x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Draws an elliptical arc - * @link http://php.net/manual/en/imagickdraw.pathellipticarcrelative.php - * @param float $rx

- * x radius - *

- * @param float $ry

- * y radius - *

- * @param float $x_axis_rotation

- * x axis rotation - *

- * @param bool $large_arc_flag

- * large arc flag - *

- * @param bool $sweep_flag

- * sweep flag - *

- * @param float $x

- * x coordinate - *

- * @param float $y

- * y coordinate - *

- * @return bool No value is returned. - */ - public function pathellipticarcrelative ($rx, $ry, $x_axis_rotation, $large_arc_flag, $sweep_flag, $x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Terminates the current path - * @link http://php.net/manual/en/imagickdraw.pathfinish.php - * @return bool No value is returned. - */ - public function pathfinish () {} - - /** - * (PECL imagick 2.0.0)
- * Draws a line path - * @link http://php.net/manual/en/imagickdraw.pathlinetoabsolute.php - * @param float $x

- * starting x coordinate - *

- * @param float $y

- * ending x coordinate - *

- * @return bool No value is returned. - */ - public function pathlinetoabsolute ($x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Draws a line path - * @link http://php.net/manual/en/imagickdraw.pathlinetorelative.php - * @param float $x

- * starting x coordinate - *

- * @param float $y

- * starting y coordinate - *

- * @return bool No value is returned. - */ - public function pathlinetorelative ($x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Draws a horizontal line path - * @link http://php.net/manual/en/imagickdraw.pathlinetohorizontalabsolute.php - * @param float $x

- * x coordinate - *

- * @return bool No value is returned. - */ - public function pathlinetohorizontalabsolute ($x) {} - - /** - * (PECL imagick 2.0.0)
- * Draws a horizontal line - * @link http://php.net/manual/en/imagickdraw.pathlinetohorizontalrelative.php - * @param float $x

- * x coordinate - *

- * @return bool No value is returned. - */ - public function pathlinetohorizontalrelative ($x) {} - - /** - * (PECL imagick 2.0.0)
- * Draws a vertical line - * @link http://php.net/manual/en/imagickdraw.pathlinetoverticalabsolute.php - * @param float $y

- * y coordinate - *

- * @return bool No value is returned. - */ - public function pathlinetoverticalabsolute ($y) {} - - /** - * (PECL imagick 2.0.0)
- * Draws a vertical line path - * @link http://php.net/manual/en/imagickdraw.pathlinetoverticalrelative.php - * @param float $y

- * y coordinate - *

- * @return bool No value is returned. - */ - public function pathlinetoverticalrelative ($y) {} - - /** - * (PECL imagick 2.0.0)
- * Starts a new sub-path - * @link http://php.net/manual/en/imagickdraw.pathmovetoabsolute.php - * @param float $x

- * x coordinate of the starting point - *

- * @param float $y

- * y coordinate of the starting point - *

- * @return bool No value is returned. - */ - public function pathmovetoabsolute ($x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Starts a new sub-path - * @link http://php.net/manual/en/imagickdraw.pathmovetorelative.php - * @param float $x

- * target x coordinate - *

- * @param float $y

- * target y coordinate - *

- * @return bool No value is returned. - */ - public function pathmovetorelative ($x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Declares the start of a path drawing list - * @link http://php.net/manual/en/imagickdraw.pathstart.php - * @return bool No value is returned. - */ - public function pathstart () {} - - /** - * (PECL imagick 2.0.0)
- * Draws a polyline - * @link http://php.net/manual/en/imagickdraw.polyline.php - * @param array $coordinates

- * array of x and y coordinates: array( array( 'x' => 4, 'y' => 6 ), array( 'x' => 8, 'y' => 10 ) ) - *

- * @return bool TRUE on success. - */ - public function polyline (array $coordinates) {} - - /** - * (PECL imagick 2.0.0)
- * Terminates a clip path definition - * @link http://php.net/manual/en/imagickdraw.popclippath.php - * @return bool No value is returned. - */ - public function popclippath () {} - - /** - * (PECL imagick 2.0.0)
- * Terminates a definition list - * @link http://php.net/manual/en/imagickdraw.popdefs.php - * @return bool No value is returned. - */ - public function popdefs () {} - - /** - * (PECL imagick 2.0.0)
- * Terminates a pattern definition - * @link http://php.net/manual/en/imagickdraw.poppattern.php - * @return bool TRUE on success or FALSE on failure. - */ - public function poppattern () {} - - /** - * (PECL imagick 2.0.0)
- * Starts a clip path definition - * @link http://php.net/manual/en/imagickdraw.pushclippath.php - * @param string $clip_mask_id

- * Clip mask Id - *

- * @return bool No value is returned. - */ - public function pushclippath ($clip_mask_id) {} - - /** - * (PECL imagick 2.0.0)
- * Indicates that following commands create named elements for early processing - * @link http://php.net/manual/en/imagickdraw.pushdefs.php - * @return bool No value is returned. - */ - public function pushdefs () {} - - /** - * (PECL imagick 2.0.0)
- * Indicates that subsequent commands up to a ImagickDraw::opPattern() command comprise the definition of a named pattern - * @link http://php.net/manual/en/imagickdraw.pushpattern.php - * @param string $pattern_id

- * the pattern Id - *

- * @param float $x

- * x coordinate of the top-left corner - *

- * @param float $y

- * y coordinate of the top-left corner - *

- * @param float $width

- * width of the pattern - *

- * @param float $height

- * height of the pattern - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function pushpattern ($pattern_id, $x, $y, $width, $height) {} - - /** - * (PECL imagick 2.0.0)
- * Renders all preceding drawing commands onto the image - * @link http://php.net/manual/en/imagickdraw.render.php - * @return bool TRUE on success or FALSE on failure. - */ - public function render () {} - - /** - * (PECL imagick 2.0.0)
- * Applies the specified rotation to the current coordinate space - * @link http://php.net/manual/en/imagickdraw.rotate.php - * @param float $degrees

- * degrees to rotate - *

- * @return bool No value is returned. - */ - public function rotate ($degrees) {} - - /** - * (PECL imagick 2.0.0)
- * Adjusts the scaling factor - * @link http://php.net/manual/en/imagickdraw.scale.php - * @param float $x

- * horizontal factor - *

- * @param float $y

- * vertical factor - *

- * @return bool No value is returned. - */ - public function scale ($x, $y) {} - - /** - * (PECL imagick 2.0.0)
- * Associates a named clipping path with the image - * @link http://php.net/manual/en/imagickdraw.setclippath.php - * @param string $clip_mask

- * the clipping path name - *

- * @return bool No value is returned. - */ - public function setclippath ($clip_mask) {} - - /** - * (PECL imagick 2.0.0)
- * Set the polygon fill rule to be used by the clipping path - * @link http://php.net/manual/en/imagickdraw.setcliprule.php - * @param int $fill_rule

- * FILLRULE_ constant - *

- * @return bool No value is returned. - */ - public function setcliprule ($fill_rule) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the interpretation of clip path units - * @link http://php.net/manual/en/imagickdraw.setclipunits.php - * @param int $clip_units

- * the number of clip units - *

- * @return bool No value is returned. - */ - public function setclipunits ($clip_units) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the opacity to use when drawing using the fill color or fill texture - * @link http://php.net/manual/en/imagickdraw.setfillopacity.php - * @param float $fillOpacity

- * the fill opacity - *

- * @return bool No value is returned. - */ - public function setfillopacity ($fillOpacity) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the URL to use as a fill pattern for filling objects - * @link http://php.net/manual/en/imagickdraw.setfillpatternurl.php - * @param string $fill_url

- * URL to use to obtain fill pattern. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setfillpatternurl ($fill_url) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the fill rule to use while drawing polygons - * @link http://php.net/manual/en/imagickdraw.setfillrule.php - * @param int $fill_rule

- * FILLRULE_ constant - *

- * @return bool No value is returned. - */ - public function setfillrule ($fill_rule) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the text placement gravity - * @link http://php.net/manual/en/imagickdraw.setgravity.php - * @param int $gravity

- * GRAVITY_ constant - *

- * @return bool No value is returned. - */ - public function setgravity ($gravity) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the pattern used for stroking object outlines - * @link http://php.net/manual/en/imagickdraw.setstrokepatternurl.php - * @param string $stroke_url

- * stroke URL - *

- * @return bool imagick.imagickdraw.return.success; - */ - public function setstrokepatternurl ($stroke_url) {} - - /** - * (PECL imagick 2.0.0)
- * Specifies the offset into the dash pattern to start the dash - * @link http://php.net/manual/en/imagickdraw.setstrokedashoffset.php - * @param float $dash_offset

- * dash offset - *

- * @return bool No value is returned. - */ - public function setstrokedashoffset ($dash_offset) {} - - /** - * (PECL imagick 2.0.0)
- * Specifies the shape to be used at the end of open subpaths when they are stroked - * @link http://php.net/manual/en/imagickdraw.setstrokelinecap.php - * @param int $linecap

- * LINECAP_ constant - *

- * @return bool No value is returned. - */ - public function setstrokelinecap ($linecap) {} - - /** - * (PECL imagick 2.0.0)
- * Specifies the shape to be used at the corners of paths when they are stroked - * @link http://php.net/manual/en/imagickdraw.setstrokelinejoin.php - * @param int $linejoin

- * LINEJOIN_ constant - *

- * @return bool No value is returned. - */ - public function setstrokelinejoin ($linejoin) {} - - /** - * (PECL imagick 2.0.0)
- * Specifies the miter limit - * @link http://php.net/manual/en/imagickdraw.setstrokemiterlimit.php - * @param int $miterlimit

- * the miter limit - *

- * @return bool No value is returned. - */ - public function setstrokemiterlimit ($miterlimit) {} - - /** - * (PECL imagick 2.0.0)
- * Specifies the opacity of stroked object outlines - * @link http://php.net/manual/en/imagickdraw.setstrokeopacity.php - * @param float $stroke_opacity

- * stroke opacity. 1.0 is fully opaque - *

- * @return bool No value is returned. - */ - public function setstrokeopacity ($stroke_opacity) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the vector graphics - * @link http://php.net/manual/en/imagickdraw.setvectorgraphics.php - * @param string $xml

- * xml containing the vector graphics - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setvectorgraphics ($xml) {} - - /** - * (PECL imagick 2.0.0)
- * Destroys the current ImagickDraw in the stack, and returns to the previously pushed ImagickDraw - * @link http://php.net/manual/en/imagickdraw.pop.php - * @return bool TRUE on success and false on failure. - */ - public function pop () {} - - /** - * (PECL imagick 2.0.0)
- * Clones the current ImagickDraw and pushes it to the stack - * @link http://php.net/manual/en/imagickdraw.push.php - * @return bool TRUE on success or FALSE on failure. - */ - public function push () {} - - /** - * (PECL imagick 2.0.0)
- * Specifies the pattern of dashes and gaps used to stroke paths - * @link http://php.net/manual/en/imagickdraw.setstrokedasharray.php - * @param array $dashArray

- * array of floats - *

- * @return bool TRUE on success. - */ - public function setstrokedasharray (array $dashArray) {} - -} - -/** - * @link http://php.net/manual/en/class.imagickpixeliterator.php - */ -class ImagickPixelIterator implements Iterator, Traversable { - - /** - * (PECL imagick 2.0.0)
- * The ImagickPixelIterator constructor - * @link http://php.net/manual/en/imagickpixeliterator.construct.php - * @param Imagick $wand - */ - public function __construct (Imagick $wand) {} - - /** - * (PECL imagick 2.0.0)
- * Returns a new pixel iterator - * @link http://php.net/manual/en/imagickpixeliterator.newpixeliterator.php - * @param Imagick $wand - * @return bool TRUE on success. Throwing ImagickPixelIteratorException. - */ - public function newpixeliterator (Imagick $wand) {} - - /** - * (PECL imagick 2.0.0)
- * Returns a new pixel iterator - * @link http://php.net/manual/en/imagickpixeliterator.newpixelregioniterator.php - * @param Imagick $wand - * @param int $x - * @param int $y - * @param int $columns - * @param int $rows - * @return bool a new ImagickPixelIterator on success; on failure, throws - * ImagickPixelIteratorException. - */ - public function newpixelregioniterator (Imagick $wand, $x, $y, $columns, $rows) {} - - /** - * (PECL imagick 2.0.0)
- * Returns the current pixel iterator row - * @link http://php.net/manual/en/imagickpixeliterator.getiteratorrow.php - * @return int the integer offset of the row, throwing - * ImagickPixelIteratorException on error. - */ - public function getiteratorrow () {} - - /** - * (PECL imagick 2.0.0)
- * Set the pixel iterator row - * @link http://php.net/manual/en/imagickpixeliterator.setiteratorrow.php - * @param int $row - * @return bool TRUE on success. - */ - public function setiteratorrow ($row) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the pixel iterator to the first pixel row - * @link http://php.net/manual/en/imagickpixeliterator.setiteratorfirstrow.php - * @return bool TRUE on success. - */ - public function setiteratorfirstrow () {} - - /** - * (PECL imagick 2.0.0)
- * Sets the pixel iterator to the last pixel row - * @link http://php.net/manual/en/imagickpixeliterator.setiteratorlastrow.php - * @return bool TRUE on success. - */ - public function setiteratorlastrow () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the previous row - * @link http://php.net/manual/en/imagickpixeliterator.getpreviousiteratorrow.php - * @return array the previous row as an array of ImagickPixelWand objects from the - * ImagickPixelIterator, throwing ImagickPixelIteratorException on error. - */ - public function getpreviousiteratorrow () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the current row of ImagickPixel objects - * @link http://php.net/manual/en/imagickpixeliterator.getcurrentiteratorrow.php - * @return array a row as an array of ImagickPixel objects that can themselves be iterated. - */ - public function getcurrentiteratorrow () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the next row of the pixel iterator - * @link http://php.net/manual/en/imagickpixeliterator.getnextiteratorrow.php - * @return array the next row as an array of ImagickPixel objects, throwing - * ImagickPixelIteratorException on error. - */ - public function getnextiteratorrow () {} - - /** - * (PECL imagick 2.0.0)
- * Resets the pixel iterator - * @link http://php.net/manual/en/imagickpixeliterator.resetiterator.php - * @return bool TRUE on success. - */ - public function resetiterator () {} - - /** - * (PECL imagick 2.0.0)
- * Syncs the pixel iterator - * @link http://php.net/manual/en/imagickpixeliterator.synciterator.php - * @return bool TRUE on success. - */ - public function synciterator () {} - - /** - * (PECL imagick 2.0.0)
- * Deallocates resources associated with a PixelIterator - * @link http://php.net/manual/en/imagickpixeliterator.destroy.php - * @return bool TRUE on success. - */ - public function destroy () {} - - /** - * (PECL imagick 2.0.0)
- * Clear resources associated with a PixelIterator - * @link http://php.net/manual/en/imagickpixeliterator.clear.php - * @return bool TRUE on success. - */ - public function clear () {} - - public function key () {} - - public function next () {} - - public function rewind () {} - - public function current () {} - - public function valid () {} - -} - -/** - * @link http://php.net/manual/en/class.imagickpixel.php - */ -class ImagickPixel { - - /** - * (PECL imagick 2.0.0)
- * Returns the normalized HSL color of the ImagickPixel object - * @link http://php.net/manual/en/imagickpixel.gethsl.php - * @return array the HSL value in an array with the keys "hue", - * "saturation", and "luminosity". Throws ImagickPixelException on failure. - */ - public function gethsl () {} - - /** - * (PECL imagick 2.0.0)
- * Sets the normalized HSL color - * @link http://php.net/manual/en/imagickpixel.sethsl.php - * @param float $hue

- * The normalized value for hue, described as a fractional arc - * (between 0 and 1) of the hue circle, where the zero value is - * red. - *

- * @param float $saturation

- * The normalized value for saturation, with 1 as full saturation. - *

- * @param float $luminosity

- * The normalized value for luminosity, on a scale from black at - * 0 to white at 1, with the full HS value at 0.5 luminosity. - *

- * @return bool TRUE on success. - */ - public function sethsl ($hue, $saturation, $luminosity) {} - - public function getcolorvaluequantum () {} - - /** - * @param $color_value - */ - public function setcolorvaluequantum ($color_value) {} - - public function getindex () {} - - /** - * @param $index - */ - public function setindex ($index) {} - - /** - * (PECL imagick 2.0.0)
- * The ImagickPixel constructor - * @link http://php.net/manual/en/imagickpixel.construct.php - * @param string $color [optional]

- * The optional color string to use as the initial value of this object. - *

- */ - public function __construct ($color = null) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the color - * @link http://php.net/manual/en/imagickpixel.setcolor.php - * @param string $color

- * The color definition to use in order to initialise the - * ImagickPixel object. - *

- * @return bool TRUE if the specified color was set, FALSE otherwise. - */ - public function setcolor ($color) {} - - /** - * (PECL imagick 2.0.0)
- * Sets the normalized value of one of the channels - * @link http://php.net/manual/en/imagickpixel.setcolorvalue.php - * @param int $color

- * One of the Imagick channel color constants. - *

- * @param float $value

- * The value to set this channel to, ranging from 0 to 1. - *

- * @return bool TRUE on success. - */ - public function setcolorvalue ($color, $value) {} - - /** - * (PECL imagick 2.0.0)
- * Gets the normalized value of the provided color channel - * @link http://php.net/manual/en/imagickpixel.getcolorvalue.php - * @param int $color

- * The channel to check, specified as one of the Imagick channel constants. - *

- * @return float The value of the channel, as a normalized floating-point number, throwing - * ImagickPixelException on error. - */ - public function getcolorvalue ($color) {} - - /** - * (PECL imagick 2.0.0)
- * Clears resources associated with this object - * @link http://php.net/manual/en/imagickpixel.clear.php - * @return bool TRUE on success. - */ - public function clear () {} - - /** - * (PECL imagick 2.0.0)
- * Deallocates resources associated with this object - * @link http://php.net/manual/en/imagickpixel.destroy.php - * @return bool TRUE on success. - */ - public function destroy () {} - - /** - * (PECL imagick 2.0.0)
- * Check the distance between this color and another - * @link http://php.net/manual/en/imagickpixel.issimilar.php - * @param ImagickPixel $color

- * The ImagickPixel object to compare this object against. - *

- * @param float $fuzz

- * The maximum distance within which to consider these colors as similar. - * The theoretical maximum for this value is the square root of three - * (1.732). - *

- * @return bool TRUE on success. - */ - public function issimilar (ImagickPixel $color, $fuzz) {} - - /** - * (PECL imagick 2.0.0)
- * Returns the color - * @link http://php.net/manual/en/imagickpixel.getcolor.php - * @param bool $normalized [optional]

- * Normalize the color values - *

- * @return array An array of channel values, each normalized if TRUE is given as param. Throws - * ImagickPixelException on error. - */ - public function getcolor ($normalized = false) {} - - /** - * (PECL imagick 2.1.0)
- * Returns the color as a string - * @link http://php.net/manual/en/imagickpixel.getcolorasstring.php - * @return string the color of the ImagickPixel object as a string. - */ - public function getcolorasstring () {} - - /** - * (PECL imagick 2.0.0)
- * Returns the color count associated with this color - * @link http://php.net/manual/en/imagickpixel.getcolorcount.php - * @return int the color count as an integer on success, throws - * ImagickPixelException on failure. - */ - public function getcolorcount () {} - - /** - * @param $colorCount - */ - public function setcolorcount ($colorCount) {} - -} -// End of imagick v.3.1.0RC1 -?> diff --git a/phpruntime/imap.php b/phpruntime/imap.php deleted file mode 100644 index b8656fd..0000000 --- a/phpruntime/imap.php +++ /dev/null @@ -1,1726 +0,0 @@ - - * Open an IMAP stream to a mailbox - * @link http://php.net/manual/en/function.imap-open.php - * @param string $mailbox

- * A mailbox name consists of a server and a mailbox path on this server. - * The special name INBOX stands for the current users - * personal mailbox. Mailbox names that contain international characters - * besides those in the printable ASCII space have to be encoded width - * imap_utf7_encode. - *

- *

- * The server part, which is enclosed in '{' and '}', consists of the servers - * name or ip address, an optional port (prefixed by ':'), and an optional - * protocol specification (prefixed by '/'). - *

- *

- * The server part is mandatory in all mailbox - * parameters. - *

- *

- * All names which start with { are remote names, and are - * in the form "{" remote_system_name [":" port] [flags] "}" - * [mailbox_name] where: - * remote_system_name - Internet domain name or - * bracketed IP address of server. - * @param string $username

- * The user name - *

- * @param string $password

- * The password associated with the username - *

- * @param int $options [optional]

- * The options are a bit mask with one or more of - * the following: - * OP_READONLY - Open mailbox read-only - * @param int $n_retries [optional]

- * Number of maximum connect attempts - *

- * @param array $params [optional]

- * Connection parameters, the following (string) keys maybe used - * to set one or more connection parameters: - * DISABLE_AUTHENTICATOR - Disable authentication properties - * @return resource an IMAP stream on success or FALSE on error. - */ -function imap_open ($mailbox, $username, $password, $options = 'NIL', $n_retries = 0, array $params = null) {} - -/** - * (PHP 4, PHP 5)
- * Reopen IMAP stream to new mailbox - * @link http://php.net/manual/en/function.imap-reopen.php - * @param resource $imap_stream - * @param string $mailbox

- * The mailbox name, see imap_open for more - * information - *

- * @param int $options [optional]

- * The options are a bit mask with one or more of - * the following: - * OP_READONLY - Open mailbox read-only - * @param int $n_retries [optional]

- * Number of maximum connect attempts - *

- * @return bool TRUE if the stream is reopened, FALSE otherwise. - */ -function imap_reopen ($imap_stream, $mailbox, $options = 0, $n_retries = 0) {} - -/** - * (PHP 4, PHP 5)
- * Close an IMAP stream - * @link http://php.net/manual/en/function.imap-close.php - * @param resource $imap_stream - * @param int $flag [optional]

- * If set to CL_EXPUNGE, the function will silently - * expunge the mailbox before closing, removing all messages marked for - * deletion. You can achieve the same thing by using - * imap_expunge - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imap_close ($imap_stream, $flag = 0) {} - -/** - * (PHP 4, PHP 5)
- * Gets the number of messages in the current mailbox - * @link http://php.net/manual/en/function.imap-num-msg.php - * @param resource $imap_stream - * @return int Return the number of messages in the current mailbox, as an integer. - */ -function imap_num_msg ($imap_stream) {} - -/** - * (PHP 4, PHP 5)
- * Gets the number of recent messages in current mailbox - * @link http://php.net/manual/en/function.imap-num-recent.php - * @param resource $imap_stream - * @return int the number of recent messages in the current mailbox, as an - * integer. - */ -function imap_num_recent ($imap_stream) {} - -/** - * (PHP 4, PHP 5)
- * Returns headers for all messages in a mailbox - * @link http://php.net/manual/en/function.imap-headers.php - * @param resource $imap_stream - * @return array an array of string formatted with header info. One - * element per mail message. - */ -function imap_headers ($imap_stream) {} - -/** - * (PHP 4, PHP 5)
- * Read the header of the message - * @link http://php.net/manual/en/function.imap-headerinfo.php - * @param resource $imap_stream - * @param int $msg_number

- * The message number - *

- * @param int $fromlength [optional]

- * Number of characters for the fetchfrom property. - * Must be greater than or equal to zero. - *

- * @param int $subjectlength [optional]

- * Number of characters for the fetchsubject property - * Must be greater than or equal to zero. - *

- * @param string $defaulthost [optional] - * @return object the information in an object with following properties: - * toaddress - full to: line, up to 1024 characters - * to - an array of objects from the To: line, with the following - * properties: personal, adl, - * mailbox, and host - * fromaddress - full from: line, up to 1024 characters - * from - an array of objects from the From: line, with the following - * properties: personal, adl, - * mailbox, and host - * ccaddress - full cc: line, up to 1024 characters - * cc - an array of objects from the Cc: line, with the following - * properties: personal, adl, - * mailbox, and host - * bccaddress - full bcc: line, up to 1024 characters - * bcc - an array of objects from the Bcc: line, with the following - * properties: personal, adl, - * mailbox, and host - * reply_toaddress - full Reply-To: line, up to 1024 characters - * reply_to - an array of objects from the Reply-To: line, with the following - * properties: personal, adl, - * mailbox, and host - * senderaddress - full sender: line, up to 1024 characters - * sender - an array of objects from the Sender: line, with the following - * properties: personal, adl, - * mailbox, and host - * return_pathaddress - full Return-Path: line, up to 1024 characters - * return_path - an array of objects from the Return-Path: line, with the - * following properties: personal, - * adl, mailbox, and - * host - * remail - - * date - The message date as found in its headers - * Date - Same as date - * subject - The message subject - * Subject - Same a subject - * in_reply_to - - * message_id - - * newsgroups - - * followup_to - - * references - - * Recent - R if recent and seen, N - * if recent and not seen, ' ' if not recent. - * Unseen - U if not seen AND not recent, ' ' if seen - * OR not seen and recent - * Flagged - F if flagged, ' ' if not flagged - * Answered - A if answered, ' ' if unanswered - * Deleted - D if deleted, ' ' if not deleted - * Draft - X if draft, ' ' if not draft - * Msgno - The message number - * MailDate - - * Size - The message size - * udate - mail message date in Unix time - * fetchfrom - from line formatted to fit fromlength - * characters - * fetchsubject - subject line formatted to fit - * subjectlength characters - */ -function imap_headerinfo ($imap_stream, $msg_number, $fromlength = 0, $subjectlength = 0, $defaulthost = null) {} - -/** - * (PHP 4, PHP 5)
- * Parse mail headers from a string - * @link http://php.net/manual/en/function.imap-rfc822-parse-headers.php - * @param string $headers

- * The parsed headers data - *

- * @param string $defaulthost [optional]

- * The default host name - *

- * @return object an object similar to the one returned by - * imap_header, except for the flags and other - * properties that come from the IMAP server. - */ -function imap_rfc822_parse_headers ($headers, $defaulthost = "UNKNOWN") {} - -/** - * (PHP 4, PHP 5)
- * Returns a properly formatted email address given the mailbox, host, and personal info - * @link http://php.net/manual/en/function.imap-rfc822-write-address.php - * @param string $mailbox

- * The mailbox name, see imap_open for more - * information - *

- * @param string $host

- * The email host part - *

- * @param string $personal

- * The name of the account owner - *

- * @return string a string properly formatted email address as defined in RFC2822. - */ -function imap_rfc822_write_address ($mailbox, $host, $personal) {} - -/** - * (PHP 4, PHP 5)
- * Parses an address string - * @link http://php.net/manual/en/function.imap-rfc822-parse-adrlist.php - * @param string $address

- * A string containing addresses - *

- * @param string $default_host

- * The default host name - *

- * @return array an array of objects. The objects properties are: - *

- *

- * mailbox - the mailbox name (username) - * host - the host name - * personal - the personal name - * adl - at domain source route - */ -function imap_rfc822_parse_adrlist ($address, $default_host) {} - -/** - * (PHP 4, PHP 5)
- * Read the message body - * @link http://php.net/manual/en/function.imap-body.php - * @param resource $imap_stream - * @param int $msg_number

- * The message number - *

- * @param int $options [optional]

- * The optional options are a bit mask - * with one or more of the following: - * FT_UID - The msg_number is a UID - * @return string the body of the specified message, as a string. - */ -function imap_body ($imap_stream, $msg_number, $options = 0) {} - -/** - * (PHP 4, PHP 5)
- * Read the structure of a specified body section of a specific message - * @link http://php.net/manual/en/function.imap-bodystruct.php - * @param resource $imap_stream - * @param int $msg_number

- * The message number - *

- * @param string $section

- * The body section to read - *

- * @return object the information in an object, for a detailed description - * of the object structure and properties see - * imap_fetchstructure. - */ -function imap_bodystruct ($imap_stream, $msg_number, $section) {} - -/** - * (PHP 4, PHP 5)
- * Fetch a particular section of the body of the message - * @link http://php.net/manual/en/function.imap-fetchbody.php - * @param resource $imap_stream - * @param int $msg_number

- * The message number - *

- * @param string $section

- * The part number. It is a string of integers delimited by period which - * index into a body part list as per the IMAP4 specification - *

- * @param int $options [optional]

- * A bitmask with one or more of the following: - * FT_UID - The msg_number is a UID - * @return string a particular section of the body of the specified messages as a - * text string. - */ -function imap_fetchbody ($imap_stream, $msg_number, $section, $options = 0) {} - -/** - * (PHP 5 >= 5.3.6)
- * Fetch MIME headers for a particular section of the message - * @link http://php.net/manual/en/function.imap-fetchmime.php - * @param resource $imap_stream - * @param int $msg_number

- * The message number - *

- * @param string $section

- * The part number. It is a string of integers delimited by period which - * index into a body part list as per the IMAP4 specification - *

- * @param int $options [optional]

- * A bitmask with one or more of the following: - * FT_UID - The msg_number is a UID - * @return string the MIME headers of a particular section of the body of the specified messages as a - * text string. - */ -function imap_fetchmime ($imap_stream, $msg_number, $section, $options = 0) {} - -/** - * (PHP 5 >= 5.1.3)
- * Save a specific body section to a file - * @link http://php.net/manual/en/function.imap-savebody.php - * @param resource $imap_stream - * @param mixed $file

- * The path to the saved file as a string, or a valid file descriptor - * returned by fopen. - *

- * @param int $msg_number

- * The message number - *

- * @param string $part_number [optional]

- * The part number. It is a string of integers delimited by period which - * index into a body part list as per the IMAP4 specification - *

- * @param int $options [optional]

- * A bitmask with one or more of the following: - * FT_UID - The msg_number is a UID - * @return bool TRUE on success or FALSE on failure. - */ -function imap_savebody ($imap_stream, $file, $msg_number, $part_number = "", $options = 0) {} - -/** - * (PHP 4, PHP 5)
- * Returns header for a message - * @link http://php.net/manual/en/function.imap-fetchheader.php - * @param resource $imap_stream - * @param int $msg_number

- * The message number - *

- * @param int $options [optional]

- * The possible options are: - * FT_UID - The msgno - * argument is a UID - * @return string the header of the specified message as a text string. - */ -function imap_fetchheader ($imap_stream, $msg_number, $options = 0) {} - -/** - * (PHP 4, PHP 5)
- * Read the structure of a particular message - * @link http://php.net/manual/en/function.imap-fetchstructure.php - * @param resource $imap_stream - * @param int $msg_number

- * The message number - *

- * @param int $options [optional]

- * This optional parameter only has a single option, - * FT_UID, which tells the function to treat the - * msg_number argument as a - * UID. - *

- * @return object an object includes the envelope, internal date, size, flags and - * body structure along with a similar object for each mime attachment. The - * structure of the returned objects is as follows: - *

- *

- * - * Returned Objects for imap_fetchstructure - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
typePrimary body type
encodingBody transfer encoding
ifsubtypeTRUE if there is a subtype string
subtypeMIME subtype
ifdescriptionTRUE if there is a description string
descriptionContent description string
ifidTRUE if there is an identification string
idIdentification string
linesNumber of lines
bytesNumber of bytes
ifdispositionTRUE if there is a disposition string
dispositionDisposition string
ifdparametersTRUE if the dparameters array exists
dparametersAn array of objects where each object has an - * "attribute" and a "value" - * property corresponding to the parameters on the - * Content-disposition MIME - * header.
ifparametersTRUE if the parameters array exists
parametersAn array of objects where each object has an - * "attribute" and a "value" - * property.
partsAn array of objects identical in structure to the top-level - * object, each of which corresponds to a MIME body - * part.
- *

- *

- * - * Primary body type (may vary with used library) - * - * - * - * - * - * - * - * - *
0text
1multipart
2message
3application
4audio
5image
6video
7other
- *

- *

- * - * Transfer encodings (may vary with used library) - * - * - * - * - * - * - *
07BIT
18BIT
2BINARY
3BASE64
4QUOTED-PRINTABLE
5OTHER
- */ -function imap_fetchstructure ($imap_stream, $msg_number, $options = 0) {} - -/** - * (PHP 5 >= 5.3.0)
- * Clears IMAP cache - * @link http://php.net/manual/en/function.imap-gc.php - * @param resource $imap_stream - * @param int $caches

- * Specifies the cache to purge. It may one or a combination - * of the following constants: - * IMAP_GC_ELT (message cache elements), - * IMAP_GC_ENV (enveloppe and bodies), - * IMAP_GC_TEXTS (texts). - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imap_gc ($imap_stream, $caches) {} - -/** - * (PHP 4, PHP 5)
- * Delete all messages marked for deletion - * @link http://php.net/manual/en/function.imap-expunge.php - * @param resource $imap_stream - * @return bool TRUE. - */ -function imap_expunge ($imap_stream) {} - -/** - * (PHP 4, PHP 5)
- * Mark a message for deletion from current mailbox - * @link http://php.net/manual/en/function.imap-delete.php - * @param resource $imap_stream - * @param int $msg_number

- * The message number - *

- * @param int $options [optional]

- * You can set the FT_UID which tells the function - * to treat the msg_number argument as an - * UID. - *

- * @return bool TRUE. - */ -function imap_delete ($imap_stream, $msg_number, $options = 0) {} - -/** - * (PHP 4, PHP 5)
- * Unmark the message which is marked deleted - * @link http://php.net/manual/en/function.imap-undelete.php - * @param resource $imap_stream - * @param int $msg_number

- * The message number - *

- * @param int $flags [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function imap_undelete ($imap_stream, $msg_number, $flags = 0) {} - -/** - * (PHP 4, PHP 5)
- * Check current mailbox - * @link http://php.net/manual/en/function.imap-check.php - * @param resource $imap_stream - * @return object the information in an object with following properties: - * Date - current system time formatted according to RFC2822 - * Driver - protocol used to access this mailbox: - * POP3, IMAP, NNTP - * Mailbox - the mailbox name - * Nmsgs - number of messages in the mailbox - * Recent - number of recent messages in the mailbox - *

- *

- * Returns FALSE on failure. - */ -function imap_check ($imap_stream) {} - -/** - * (PHP 4, PHP 5)
- * Returns the list of mailboxes that matches the given text - * @link http://php.net/manual/en/function.imap-listscan.php - * @param resource $imap_stream - * @param string $ref

- * ref should normally be just the server - * specification as described in imap_open - *

- * @param string $pattern Specifies where in the mailbox hierarchy - * to start searching.

There are two special characters you can - * pass as part of the pattern: - * '*' and '%'. - * '*' means to return all mailboxes. If you pass - * pattern as '*', you will - * get a list of the entire mailbox hierarchy. - * '%' - * means to return the current level only. - * '%' as the pattern - * parameter will return only the top level - * mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox in the ~/mail directory, but none in subfolders of that directory.

- * @param string $content

- * The searched string - *

- * @return array an array containing the names of the mailboxes that have - * content in the text of the mailbox. - */ -function imap_listscan ($imap_stream, $ref, $pattern, $content) {} - -/** - * (PHP 4, PHP 5)
- * Copy specified messages to a mailbox - * @link http://php.net/manual/en/function.imap-mail-copy.php - * @param resource $imap_stream - * @param string $msglist

- * msglist is a range not just message - * numbers (as described in RFC2060). - *

- * @param string $mailbox

- * The mailbox name, see imap_open for more - * information - *

- * @param int $options [optional]

- * options is a bitmask of one or more of - * CP_UID - the sequence numbers contain UIDS - * @return bool TRUE on success or FALSE on failure. - */ -function imap_mail_copy ($imap_stream, $msglist, $mailbox, $options = 0) {} - -/** - * (PHP 4, PHP 5)
- * Move specified messages to a mailbox - * @link http://php.net/manual/en/function.imap-mail-move.php - * @param resource $imap_stream - * @param string $msglist

- * msglist is a range not just message numbers - * (as described in RFC2060). - *

- * @param string $mailbox

- * The mailbox name, see imap_open for more - * information - *

- * @param int $options [optional]

- * options is a bitmask and may contain the single option: - * CP_UID - the sequence numbers contain UIDS - * @return bool TRUE on success or FALSE on failure. - */ -function imap_mail_move ($imap_stream, $msglist, $mailbox, $options = 0) {} - -/** - * (PHP 4, PHP 5)
- * Create a MIME message based on given envelope and body sections - * @link http://php.net/manual/en/function.imap-mail-compose.php - * @param array $envelope

- * An associative array of headers fields. Valid keys are: "remail", - * "return_path", "date", "from", "reply_to", "in_reply_to", "subject", - * "to", "cc", "bcc", "message_id" and "custom_headers" (which contains - * associative array of other headers). - *

- * @param array $body

- * An indexed array of bodies - *

- *

- * A body is an associative array which can consist of the following keys: - * "type", "encoding", "charset", "type.parameters", "subtype", "id", - * "description", "disposition.type", "disposition", "contents.data", - * "lines", "bytes" and "md5". - *

- * @return string the MIME message. - */ -function imap_mail_compose (array $envelope, array $body) {} - -/** - * (PHP 4, PHP 5)
- * Create a new mailbox - * @link http://php.net/manual/en/function.imap-createmailbox.php - * @param resource $imap_stream - * @param string $mailbox

- * The mailbox name, see imap_open for more - * information. Names containing international characters should be - * encoded by imap_utf7_encode - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imap_createmailbox ($imap_stream, $mailbox) {} - -/** - * (PHP 4, PHP 5)
- * Rename an old mailbox to new mailbox - * @link http://php.net/manual/en/function.imap-renamemailbox.php - * @param resource $imap_stream - * @param string $old_mbox

- * The old mailbox name, see imap_open for more - * information - *

- * @param string $new_mbox

- * The new mailbox name, see imap_open for more - * information - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imap_renamemailbox ($imap_stream, $old_mbox, $new_mbox) {} - -/** - * (PHP 4, PHP 5)
- * Delete a mailbox - * @link http://php.net/manual/en/function.imap-deletemailbox.php - * @param resource $imap_stream - * @param string $mailbox

- * The mailbox name, see imap_open for more - * information - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imap_deletemailbox ($imap_stream, $mailbox) {} - -/** - * (PHP 4, PHP 5)
- * Subscribe to a mailbox - * @link http://php.net/manual/en/function.imap-subscribe.php - * @param resource $imap_stream - * @param string $mailbox

- * The mailbox name, see imap_open for more - * information - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imap_subscribe ($imap_stream, $mailbox) {} - -/** - * (PHP 4, PHP 5)
- * Unsubscribe from a mailbox - * @link http://php.net/manual/en/function.imap-unsubscribe.php - * @param resource $imap_stream - * @param string $mailbox

- * The mailbox name, see imap_open for more - * information - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imap_unsubscribe ($imap_stream, $mailbox) {} - -/** - * (PHP 4, PHP 5)
- * Append a string message to a specified mailbox - * @link http://php.net/manual/en/function.imap-append.php - * @param resource $imap_stream - * @param string $mailbox

- * The mailbox name, see imap_open for more - * information - *

- * @param string $message

- * The message to be append, as a string - *

- *

- * When talking to the Cyrus IMAP server, you must use "\r\n" as - * your end-of-line terminator instead of "\n" or the operation will - * fail - *

- * @param string $options [optional]

- * If provided, the options will also be written - * to the mailbox - *

- * @param string $internal_date [optional]

- * If this parameter is set, it will set the INTERNALDATE on the appended message. The parameter should be a date string that conforms to the rfc2060 specifications for a date_time value. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imap_append ($imap_stream, $mailbox, $message, $options = null, $internal_date = null) {} - -/** - * (PHP 4, PHP 5)
- * Check if the IMAP stream is still active - * @link http://php.net/manual/en/function.imap-ping.php - * @param resource $imap_stream - * @return bool TRUE if the stream is still alive, FALSE otherwise. - */ -function imap_ping ($imap_stream) {} - -/** - * (PHP 4, PHP 5)
- * Decode BASE64 encoded text - * @link http://php.net/manual/en/function.imap-base64.php - * @param string $text

- * The encoded text - *

- * @return string the decoded message as a string. - */ -function imap_base64 ($text) {} - -/** - * (PHP 4, PHP 5)
- * Convert a quoted-printable string to an 8 bit string - * @link http://php.net/manual/en/function.imap-qprint.php - * @param string $string

- * A quoted-printable string - *

- * @return string an 8 bits string. - */ -function imap_qprint ($string) {} - -/** - * (PHP 4, PHP 5)
- * Convert an 8bit string to a quoted-printable string - * @link http://php.net/manual/en/function.imap-8bit.php - * @param string $string

- * The 8bit string to convert - *

- * @return string a quoted-printable string. - */ -function imap_8bit ($string) {} - -/** - * (PHP 4, PHP 5)
- * Convert an 8bit string to a base64 string - * @link http://php.net/manual/en/function.imap-binary.php - * @param string $string

- * The 8bit string - *

- * @return string a base64 encoded string. - */ -function imap_binary ($string) {} - -/** - * (PHP 4, PHP 5)
- * Converts MIME-encoded text to UTF-8 - * @link http://php.net/manual/en/function.imap-utf8.php - * @param string $mime_encoded_text

- * A MIME encoded string. MIME encoding method and the UTF-8 - * specification are described in RFC2047 and RFC2044 respectively. - *

- * @return string an UTF-8 encoded string. - */ -function imap_utf8 ($mime_encoded_text) {} - -/** - * (PHP 4, PHP 5)
- * Returns status information on a mailbox - * @link http://php.net/manual/en/function.imap-status.php - * @param resource $imap_stream - * @param string $mailbox

- * The mailbox name, see imap_open for more - * information - *

- * @param int $options

- * Valid flags are: - * SA_MESSAGES - set $status->messages to the - * number of messages in the mailbox - * @return object This function returns an object containing status information. - * The object has the following properties: messages, - * recent, unseen, - * uidnext, and uidvalidity. - *

- *

- * flags is also set, which contains a bitmask which can - * be checked against any of the above constants. - */ -function imap_status ($imap_stream, $mailbox, $options) {} - -/** - * (PHP 4, PHP 5)
- * Get information about the current mailbox - * @link http://php.net/manual/en/function.imap-mailboxmsginfo.php - * @param resource $imap_stream - * @return object the information in an object with following properties: - * - * Mailbox properties - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Datedate of last change (current datetime)
Driverdriver
Mailboxname of the mailbox
Nmsgsnumber of messages
Recentnumber of recent messages
Unreadnumber of unread messages
Deletednumber of deleted messages
Sizemailbox size
- *

- *

- * Returns FALSE on failure. - */ -function imap_mailboxmsginfo ($imap_stream) {} - -/** - * (PHP 4, PHP 5)
- * Sets flags on messages - * @link http://php.net/manual/en/function.imap-setflag-full.php - * @param resource $imap_stream - * @param string $sequence

- * A sequence of message numbers. You can enumerate desired messages - * with the X,Y syntax, or retrieve all messages - * within an interval with the X:Y syntax - *

- * @param string $flag

- * The flags which you can set are \Seen, - * \Answered, \Flagged, - * \Deleted, and \Draft as - * defined by RFC2060. - *

- * @param int $options [optional]

- * A bit mask that may contain the single option: - * ST_UID - The sequence argument contains UIDs - * instead of sequence numbers - * @return bool TRUE on success or FALSE on failure. - */ -function imap_setflag_full ($imap_stream, $sequence, $flag, $options = 'NIL') {} - -/** - * (PHP 4, PHP 5)
- * Clears flags on messages - * @link http://php.net/manual/en/function.imap-clearflag-full.php - * @param resource $imap_stream - * @param string $sequence

- * A sequence of message numbers. You can enumerate desired messages - * with the X,Y syntax, or retrieve all messages - * within an interval with the X:Y syntax - *

- * @param string $flag

- * The flags which you can unset are "\\Seen", "\\Answered", "\\Flagged", - * "\\Deleted", and "\\Draft" (as defined by RFC2060) - *

- * @param int $options [optional]

- * options are a bit mask and may contain - * the single option: - * ST_UID - The sequence argument contains UIDs - * instead of sequence numbers - * @return bool TRUE on success or FALSE on failure. - */ -function imap_clearflag_full ($imap_stream, $sequence, $flag, $options = 0) {} - -/** - * (PHP 4, PHP 5)
- * Gets and sort messages - * @link http://php.net/manual/en/function.imap-sort.php - * @param resource $imap_stream - * @param int $criteria

- * Criteria can be one (and only one) of the following: - * SORTDATE - message Date - * @param int $reverse

- * Set this to 1 for reverse sorting - *

- * @param int $options [optional]

- * The options are a bitmask of one or more of the - * following: - * SE_UID - Return UIDs instead of sequence numbers - * @param string $search_criteria [optional] - * @param string $charset [optional] - * @return array an array of message numbers sorted by the given - * parameters. - */ -function imap_sort ($imap_stream, $criteria, $reverse, $options = 0, $search_criteria = null, $charset = 'NIL') {} - -/** - * (PHP 4, PHP 5)
- * This function returns the UID for the given message sequence number - * @link http://php.net/manual/en/function.imap-uid.php - * @param resource $imap_stream - * @param int $msg_number

- * The message number. - *

- * @return int The UID of the given message. - */ -function imap_uid ($imap_stream, $msg_number) {} - -/** - * (PHP 4, PHP 5)
- * Gets the message sequence number for the given UID - * @link http://php.net/manual/en/function.imap-msgno.php - * @param resource $imap_stream - * @param int $uid

- * The message UID - *

- * @return int the message sequence number for the given - * uid. - */ -function imap_msgno ($imap_stream, $uid) {} - -/** - * (PHP 4, PHP 5)
- * Read the list of mailboxes - * @link http://php.net/manual/en/function.imap-list.php - * @param resource $imap_stream - * @param string $ref

- * ref should normally be just the server - * specification as described in imap_open. - *

- * @param string $pattern Specifies where in the mailbox hierarchy - * to start searching.

There are two special characters you can - * pass as part of the pattern: - * '*' and '%'. - * '*' means to return all mailboxes. If you pass - * pattern as '*', you will - * get a list of the entire mailbox hierarchy. - * '%' - * means to return the current level only. - * '%' as the pattern - * parameter will return only the top level - * mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox in the ~/mail directory, but none in subfolders of that directory.

- * @return array an array containing the names of the mailboxes. - */ -function imap_list ($imap_stream, $ref, $pattern) {} - -/** - * (PHP 4, PHP 5)
- * List all the subscribed mailboxes - * @link http://php.net/manual/en/function.imap-lsub.php - * @param resource $imap_stream - * @param string $ref

- * ref should normally be just the server - * specification as described in imap_open - *

- * @param string $pattern Specifies where in the mailbox hierarchy - * to start searching.

There are two special characters you can - * pass as part of the pattern: - * '*' and '%'. - * '*' means to return all mailboxes. If you pass - * pattern as '*', you will - * get a list of the entire mailbox hierarchy. - * '%' - * means to return the current level only. - * '%' as the pattern - * parameter will return only the top level - * mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox in the ~/mail directory, but none in subfolders of that directory.

- * @return array an array of all the subscribed mailboxes. - */ -function imap_lsub ($imap_stream, $ref, $pattern) {} - -/** - * (PHP 4, PHP 5)
- * Read an overview of the information in the headers of the given message - * @link http://php.net/manual/en/function.imap-fetch-overview.php - * @param resource $imap_stream - * @param string $sequence

- * A message sequence description. You can enumerate desired messages - * with the X,Y syntax, or retrieve all messages - * within an interval with the X:Y syntax - *

- * @param int $options [optional]

- * sequence will contain a sequence of message - * indices or UIDs, if this parameter is set to - * FT_UID. - *

- * @return array an array of objects describing one message header each. - * The object will only define a property if it exists. The possible - * properties are: - * subject - the messages subject - * from - who sent it - * to - recipient - * date - when was it sent - * message_id - Message-ID - * references - is a reference to this message id - * in_reply_to - is a reply to this message id - * size - size in bytes - * uid - UID the message has in the mailbox - * msgno - message sequence number in the mailbox - * recent - this message is flagged as recent - * flagged - this message is flagged - * answered - this message is flagged as answered - * deleted - this message is flagged for deletion - * seen - this message is flagged as already read - * draft - this message is flagged as being a draft - */ -function imap_fetch_overview ($imap_stream, $sequence, $options = 0) {} - -/** - * (PHP 4, PHP 5)
- * Returns all IMAP alert messages that have occurred - * @link http://php.net/manual/en/function.imap-alerts.php - * @return array an array of all of the IMAP alert messages generated or FALSE if - * no alert messages are available. - */ -function imap_alerts () {} - -/** - * (PHP 4, PHP 5)
- * Returns all of the IMAP errors that have occured - * @link http://php.net/manual/en/function.imap-errors.php - * @return array This function returns an array of all of the IMAP error messages - * generated since the last imap_errors call, - * or the beginning of the page. Returns FALSE if no error messages are - * available. - */ -function imap_errors () {} - -/** - * (PHP 4, PHP 5)
- * Gets the last IMAP error that occurred during this page request - * @link http://php.net/manual/en/function.imap-last-error.php - * @return string the full text of the last IMAP error message that occurred on the - * current page. Returns FALSE if no error messages are available. - */ -function imap_last_error () {} - -/** - * (PHP 4, PHP 5)
- * This function returns an array of messages matching the given search criteria - * @link http://php.net/manual/en/function.imap-search.php - * @param resource $imap_stream - * @param string $criteria

- * A string, delimited by spaces, in which the following keywords are - * allowed. Any multi-word arguments (e.g. - * FROM "joey smith") must be quoted. Results will match - * all criteria entries. - * ALL - return all messages matching the rest of the criteria - * @param int $options [optional]

- * Valid values for options are - * SE_UID, which causes the returned array to - * contain UIDs instead of messages sequence numbers. - *

- * @param string $charset [optional] - * @return array an array of message numbers or UIDs. - *

- *

- * Return FALSE if it does not understand the search - * criteria or no messages have been found. - */ -function imap_search ($imap_stream, $criteria, $options = 'SE_FREE', $charset = 'NIL') {} - -/** - * (PHP 4, PHP 5)
- * Decodes a modified UTF-7 encoded string - * @link http://php.net/manual/en/function.imap-utf7-decode.php - * @param string $text

- * A modified UTF-7 encoding string, as defined in RFC 2060, section 5.1.3 (original UTF-7 - * was defined in RFC1642). - *

- * @return string a string that is encoded in ISO-8859-1 and consists of the same - * sequence of characters in text, or FALSE - * if text contains invalid modified UTF-7 sequence - * or text contains a character that is not part of - * ISO-8859-1 character set. - */ -function imap_utf7_decode ($text) {} - -/** - * (PHP 4, PHP 5)
- * Converts ISO-8859-1 string to modified UTF-7 text - * @link http://php.net/manual/en/function.imap-utf7-encode.php - * @param string $data

- * An ISO-8859-1 string. - *

- * @return string data encoded with the modified UTF-7 - * encoding as defined in RFC 2060, - * section 5.1.3 (original UTF-7 was defined in RFC1642). - */ -function imap_utf7_encode ($data) {} - -/** - * (PHP 4, PHP 5)
- * Decode MIME header elements - * @link http://php.net/manual/en/function.imap-mime-header-decode.php - * @param string $text

- * The MIME text - *

- * @return array The decoded elements are returned in an array of objects, where each - * object has two properties, charset and - * text. - *

- *

- * If the element hasn't been encoded, and in other words is in - * plain US-ASCII, the charset property of that element is - * set to default. - */ -function imap_mime_header_decode ($text) {} - -/** - * (PHP 4 >= 4.0.7, PHP 5)
- * Returns a tree of threaded message - * @link http://php.net/manual/en/function.imap-thread.php - * @param resource $imap_stream - * @param int $options [optional] - * @return array imap_thread returns an associative array containing - * a tree of messages threaded by REFERENCES, or FALSE - * on error. - *

- *

- * Every message in the current mailbox will be represented by three entries - * in the resulting array: - *

- * $thread["XX.num"] - current message number - *

- *

- * $thread["XX.next"] - *

- *

- * $thread["XX.branch"] - *

- */ -function imap_thread ($imap_stream, $options = 'SE_FREE') {} - -/** - * (PHP 4 >= 4.3.3, PHP 5)
- * Set or fetch imap timeout - * @link http://php.net/manual/en/function.imap-timeout.php - * @param int $timeout_type

- * One of the following: - * IMAP_OPENTIMEOUT, - * IMAP_READTIMEOUT, - * IMAP_WRITETIMEOUT, or - * IMAP_CLOSETIMEOUT. - *

- * @param int $timeout [optional]

- * The timeout, in seconds. - *

- * @return mixed If the timeout parameter is set, this function - * returns TRUE on success and FALSE on failure. - *

- *

- * If timeout is not provided or evaluates to -1, - * the current timeout value of timeout_type is - * returned as an integer. - */ -function imap_timeout ($timeout_type, $timeout = -1) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Retrieve the quota level settings, and usage statics per mailbox - * @link http://php.net/manual/en/function.imap-get-quota.php - * @param resource $imap_stream - * @param string $quota_root

- * quota_root should normally be in the form of - * user.name where name is the mailbox you wish to - * retrieve information about. - *

- * @return array an array with integer values limit and usage for the given - * mailbox. The value of limit represents the total amount of space - * allowed for this mailbox. The usage value represents the mailboxes - * current level of capacity. Will return FALSE in the case of failure. - *

- *

- * As of PHP 4.3, the function more properly reflects the - * functionality as dictated by the RFC2087. - * The array return value has changed to support an unlimited number of returned - * resources (i.e. messages, or sub-folders) with each named resource receiving - * an individual array key. Each key value then contains an another array with - * the usage and limit values within it. - *

- *

- * For backwards compatibility reasons, the original access methods are - * still available for use, although it is suggested to update. - */ -function imap_get_quota ($imap_stream, $quota_root) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Retrieve the quota settings per user - * @link http://php.net/manual/en/function.imap-get-quotaroot.php - * @param resource $imap_stream - * @param string $quota_root

- * quota_root should normally be in the form of - * which mailbox (i.e. INBOX). - *

- * @return array an array of integer values pertaining to the specified user - * mailbox. All values contain a key based upon the resource name, and a - * corresponding array with the usage and limit values within. - *

- *

- * This function will return FALSE in the case of call failure, and an - * array of information about the connection upon an un-parsable response - * from the server. - */ -function imap_get_quotaroot ($imap_stream, $quota_root) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Sets a quota for a given mailbox - * @link http://php.net/manual/en/function.imap-set-quota.php - * @param resource $imap_stream - * @param string $quota_root

- * The mailbox to have a quota set. This should follow the IMAP standard - * format for a mailbox: user.name. - *

- * @param int $quota_limit

- * The maximum size (in KB) for the quota_root - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imap_set_quota ($imap_stream, $quota_root, $quota_limit) {} - -/** - * (PHP 4 >= 4.0.7, PHP 5)
- * Sets the ACL for a giving mailbox - * @link http://php.net/manual/en/function.imap-setacl.php - * @param resource $imap_stream - * @param string $mailbox

- * The mailbox name, see imap_open for more - * information - *

- * @param string $id

- * The user to give the rights to. - *

- * @param string $rights

- * The rights to give to the user. Passing an empty string will delete - * acl. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imap_setacl ($imap_stream, $mailbox, $id, $rights) {} - -/** - * (PHP 5)
- * Gets the ACL for a given mailbox - * @link http://php.net/manual/en/function.imap-getacl.php - * @param resource $imap_stream - * @param string $mailbox

- * The mailbox name, see imap_open for more - * information - *

- * @return array an associative array of "folder" => "acl" pairs. - */ -function imap_getacl ($imap_stream, $mailbox) {} - -/** - * (PHP 4, PHP 5)
- * Send an email message - * @link http://php.net/manual/en/function.imap-mail.php - * @param string $to

- * The receiver - *

- * @param string $subject

- * The mail subject - *

- * @param string $message

- * The mail body - *

- * @param string $additional_headers [optional]

- * As string with additional headers to be set on the mail - *

- * @param string $cc [optional] - * @param string $bcc [optional]

- * The receivers specified in bcc will get the - * mail, but are excluded from the headers. - *

- * @param string $rpath [optional]

- * Use this parameter to specify return path upon mail delivery failure. - * This is useful when using PHP as a mail client for multiple users. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function imap_mail ($to, $subject, $message, $additional_headers = null, $cc = null, $bcc = null, $rpath = null) {} - -/** - * (PHP 4, PHP 5)
- * Alias of imap_headerinfo - * @link http://php.net/manual/en/function.imap-header.php - * @param $stream_id - * @param $msg_no - * @param $from_length [optional] - * @param $subject_length [optional] - * @param $default_host [optional] - */ -function imap_header ($stream_id, $msg_no, $from_length, $subject_length, $default_host) {} - -/** - * (PHP 4, PHP 5)
- * Alias of imap_list - * @link http://php.net/manual/en/function.imap-listmailbox.php - * @param $stream_id - * @param $ref - * @param $pattern - */ -function imap_listmailbox ($stream_id, $ref, $pattern) {} - -/** - * (PHP 4, PHP 5)
- * Read the list of mailboxes, returning detailed information on each one - * @link http://php.net/manual/en/function.imap-getmailboxes.php - * @param resource $imap_stream - * @param string $ref

- * ref should normally be just the server - * specification as described in imap_open - *

- * @param string $pattern Specifies where in the mailbox hierarchy - * to start searching.

There are two special characters you can - * pass as part of the pattern: - * '*' and '%'. - * '*' means to return all mailboxes. If you pass - * pattern as '*', you will - * get a list of the entire mailbox hierarchy. - * '%' - * means to return the current level only. - * '%' as the pattern - * parameter will return only the top level - * mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox in the ~/mail directory, but none in subfolders of that directory.

- * @return array an array of objects containing mailbox information. Each - * object has the attributes name, specifying - * the full name of the mailbox; delimiter, - * which is the hierarchy delimiter for the part of the hierarchy - * this mailbox is in; and - * attributes. Attributes - * is a bitmask that can be tested against: - *

- * LATT_NOINFERIORS - This mailbox contains, and may not contain any - * "children" (there are no mailboxes below this one). Calling - * imap_createmailbox will not work on this mailbox. - *

- *

- * LATT_NOSELECT - This is only a container, - * not a mailbox - you cannot open it. - *

- *

- * LATT_MARKED - This mailbox is marked. This means that it may - * contain new messages since the last time it was checked. Not provided by all IMAP - * servers. - *

- *

- * LATT_UNMARKED - This mailbox is not marked, does not contain new - * messages. If either MARKED or UNMARKED is - * provided, you can assume the IMAP server supports this feature for this mailbox. - *

- */ -function imap_getmailboxes ($imap_stream, $ref, $pattern) {} - -/** - * (PHP 4, PHP 5)
- * Alias of imap_listscan - * @link http://php.net/manual/en/function.imap-scanmailbox.php - * @param $stream_id - * @param $ref - * @param $pattern - * @param $content - */ -function imap_scanmailbox ($stream_id, $ref, $pattern, $content) {} - -/** - * (PHP 4, PHP 5)
- * Alias of imap_lsub - * @link http://php.net/manual/en/function.imap-listsubscribed.php - * @param $stream_id - * @param $ref - * @param $pattern - */ -function imap_listsubscribed ($stream_id, $ref, $pattern) {} - -/** - * (PHP 4, PHP 5)
- * List all the subscribed mailboxes - * @link http://php.net/manual/en/function.imap-getsubscribed.php - * @param resource $imap_stream - * @param string $ref

- * ref should normally be just the server - * specification as described in imap_open - *

- * @param string $pattern Specifies where in the mailbox hierarchy - * to start searching.

There are two special characters you can - * pass as part of the pattern: - * '*' and '%'. - * '*' means to return all mailboxes. If you pass - * pattern as '*', you will - * get a list of the entire mailbox hierarchy. - * '%' - * means to return the current level only. - * '%' as the pattern - * parameter will return only the top level - * mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox in the ~/mail directory, but none in subfolders of that directory.

- * @return array an array of objects containing mailbox information. Each - * object has the attributes name, specifying - * the full name of the mailbox; delimiter, - * which is the hierarchy delimiter for the part of the hierarchy - * this mailbox is in; and - * attributes. Attributes - * is a bitmask that can be tested against: - * LATT_NOINFERIORS - This mailbox has no - * "children" (there are no mailboxes below this one). - * LATT_NOSELECT - This is only a container, - * not a mailbox - you cannot open it. - * LATT_MARKED - This mailbox is marked. - * Only used by UW-IMAPD. - * LATT_UNMARKED - This mailbox is not marked. - * Only used by UW-IMAPD. - */ -function imap_getsubscribed ($imap_stream, $ref, $pattern) {} - -/** - * (PHP 4, PHP 5)
- * Alias of imap_body - * @link http://php.net/manual/en/function.imap-fetchtext.php - * @param $stream_id - * @param $msg_no - * @param $options [optional] - */ -function imap_fetchtext ($stream_id, $msg_no, $options) {} - -/** - * (PHP 4, PHP 5)
- * Alias of imap_listscan - * @link http://php.net/manual/en/function.imap-scan.php - * @param $stream_id - * @param $ref - * @param $pattern - * @param $content - */ -function imap_scan ($stream_id, $ref, $pattern, $content) {} - -/** - * (PHP 4, PHP 5)
- * Alias of imap_createmailbox - * @link http://php.net/manual/en/function.imap-create.php - * @param $stream_id - * @param $mailbox - */ -function imap_create ($stream_id, $mailbox) {} - -/** - * (PHP 4, PHP 5)
- * Alias of imap_renamemailbox - * @link http://php.net/manual/en/function.imap-rename.php - * @param $stream_id - * @param $old_name - * @param $new_name - */ -function imap_rename ($stream_id, $old_name, $new_name) {} - -define ('NIL', 0); -define ('IMAP_OPENTIMEOUT', 1); -define ('IMAP_READTIMEOUT', 2); -define ('IMAP_WRITETIMEOUT', 3); -define ('IMAP_CLOSETIMEOUT', 4); -define ('OP_DEBUG', 1); - -/** - * Open mailbox read-only - * @link http://php.net/manual/en/imap.constants.php - */ -define ('OP_READONLY', 2); - -/** - * Don't use or update a .newsrc for news - * (NNTP only) - * @link http://php.net/manual/en/imap.constants.php - */ -define ('OP_ANONYMOUS', 4); -define ('OP_SHORTCACHE', 8); -define ('OP_SILENT', 16); -define ('OP_PROTOTYPE', 32); - -/** - * For IMAP and NNTP - * names, open a connection but don't open a mailbox. - * @link http://php.net/manual/en/imap.constants.php - */ -define ('OP_HALFOPEN', 64); -define ('OP_EXPUNGE', 128); -define ('OP_SECURE', 256); - -/** - * silently expunge the mailbox before closing when - * calling imap_close - * @link http://php.net/manual/en/imap.constants.php - */ -define ('CL_EXPUNGE', 32768); - -/** - * The parameter is a UID - * @link http://php.net/manual/en/imap.constants.php - */ -define ('FT_UID', 1); - -/** - * Do not set the \Seen flag if not already set - * @link http://php.net/manual/en/imap.constants.php - */ -define ('FT_PEEK', 2); -define ('FT_NOT', 4); - -/** - * The return string is in internal format, will not canonicalize to CRLF. - * @link http://php.net/manual/en/imap.constants.php - */ -define ('FT_INTERNAL', 8); -define ('FT_PREFETCHTEXT', 32); - -/** - * The sequence argument contains UIDs instead of sequence numbers - * @link http://php.net/manual/en/imap.constants.php - */ -define ('ST_UID', 1); -define ('ST_SILENT', 2); -define ('ST_SET', 4); - -/** - * the sequence numbers contain UIDS - * @link http://php.net/manual/en/imap.constants.php - */ -define ('CP_UID', 1); - -/** - * Delete the messages from the current mailbox after copying - * with imap_mail_copy - * @link http://php.net/manual/en/imap.constants.php - */ -define ('CP_MOVE', 2); - -/** - * Return UIDs instead of sequence numbers - * @link http://php.net/manual/en/imap.constants.php - */ -define ('SE_UID', 1); -define ('SE_FREE', 2); - -/** - * Don't prefetch searched messages - * @link http://php.net/manual/en/imap.constants.php - */ -define ('SE_NOPREFETCH', 4); -define ('SO_FREE', 8); -define ('SO_NOSERVER', 16); -define ('SA_MESSAGES', 1); -define ('SA_RECENT', 2); -define ('SA_UNSEEN', 4); -define ('SA_UIDNEXT', 8); -define ('SA_UIDVALIDITY', 16); -define ('SA_ALL', 31); - -/** - * This mailbox has no "children" (there are no - * mailboxes below this one). - * @link http://php.net/manual/en/imap.constants.php - */ -define ('LATT_NOINFERIORS', 1); - -/** - * This is only a container, not a mailbox - you - * cannot open it. - * @link http://php.net/manual/en/imap.constants.php - */ -define ('LATT_NOSELECT', 2); - -/** - * This mailbox is marked. Only used by UW-IMAPD. - * @link http://php.net/manual/en/imap.constants.php - */ -define ('LATT_MARKED', 4); - -/** - * This mailbox is not marked. Only used by - * UW-IMAPD. - * @link http://php.net/manual/en/imap.constants.php - */ -define ('LATT_UNMARKED', 8); -define ('LATT_REFERRAL', 16); -define ('LATT_HASCHILDREN', 32); -define ('LATT_HASNOCHILDREN', 64); - -/** - * Sort criteria for imap_sort: - * message Date - * @link http://php.net/manual/en/imap.constants.php - */ -define ('SORTDATE', 0); - -/** - * Sort criteria for imap_sort: - * arrival date - * @link http://php.net/manual/en/imap.constants.php - */ -define ('SORTARRIVAL', 1); - -/** - * Sort criteria for imap_sort: - * mailbox in first From address - * @link http://php.net/manual/en/imap.constants.php - */ -define ('SORTFROM', 2); - -/** - * Sort criteria for imap_sort: - * message subject - * @link http://php.net/manual/en/imap.constants.php - */ -define ('SORTSUBJECT', 3); - -/** - * Sort criteria for imap_sort: - * mailbox in first To address - * @link http://php.net/manual/en/imap.constants.php - */ -define ('SORTTO', 4); - -/** - * Sort criteria for imap_sort: - * mailbox in first cc address - * @link http://php.net/manual/en/imap.constants.php - */ -define ('SORTCC', 5); - -/** - * Sort criteria for imap_sort: - * size of message in octets - * @link http://php.net/manual/en/imap.constants.php - */ -define ('SORTSIZE', 6); -define ('TYPETEXT', 0); -define ('TYPEMULTIPART', 1); -define ('TYPEMESSAGE', 2); -define ('TYPEAPPLICATION', 3); -define ('TYPEAUDIO', 4); -define ('TYPEIMAGE', 5); -define ('TYPEVIDEO', 6); -define ('TYPEMODEL', 7); -define ('TYPEOTHER', 8); -define ('ENC7BIT', 0); -define ('ENC8BIT', 1); -define ('ENCBINARY', 2); -define ('ENCBASE64', 3); -define ('ENCQUOTEDPRINTABLE', 4); -define ('ENCOTHER', 5); - -/** - * Garbage collector, clear message cache elements. - * @link http://php.net/manual/en/imap.constants.php - */ -define ('IMAP_GC_ELT', 1); - -/** - * Garbage collector, clear envelopes and bodies. - * @link http://php.net/manual/en/imap.constants.php - */ -define ('IMAP_GC_ENV', 2); - -/** - * Garbage collector, clear texts. - * @link http://php.net/manual/en/imap.constants.php - */ -define ('IMAP_GC_TEXTS', 4); - -// End of imap v. -?> diff --git a/phpruntime/interbase.php b/phpruntime/interbase.php deleted file mode 100644 index 395c54b..0000000 --- a/phpruntime/interbase.php +++ /dev/null @@ -1,1146 +0,0 @@ - - * Open a connection to a database - * @link http://php.net/manual/en/function.ibase-connect.php - * @param string $database [optional]

- * The database argument has to be a valid path to - * database file on the server it resides on. If the server is not local, - * it must be prefixed with either 'hostname:' (TCP/IP), '//hostname/' - * (NetBEUI), depending on the connection - * protocol used. - *

- * @param string $username [optional]

- * The user name. Can be set with the - * ibase.default_user php.ini directive. - *

- * @param string $password [optional]

- * The password for username. Can be set with the - * ibase.default_password php.ini directive. - *

- * @param string $charset [optional]

- * charset is the default character set for a - * database. - *

- * @param int $buffers [optional]

- * buffers is the number of database buffers to - * allocate for the server-side cache. If 0 or omitted, server chooses - * its own default. - *

- * @param int $dialect [optional]

- * dialect selects the default SQL dialect for any - * statement executed within a connection, and it defaults to the highest - * one supported by client libraries. - *

- * @param string $role [optional]

- * Functional only with InterBase 5 and up. - *

- * @param int $sync [optional] - * @return resource an Firebird/InterBase link identifier on success, or FALSE on error. - */ -function ibase_connect ($database = null, $username = null, $password = null, $charset = null, $buffers = null, $dialect = null, $role = null, $sync = null) {} - -/** - * (PHP 4, PHP 5)
- * Open a persistent connection to an InterBase database - * @link http://php.net/manual/en/function.ibase-pconnect.php - * @param string $database [optional]

- * The database argument has to be a valid path to - * database file on the server it resides on. If the server is not local, - * it must be prefixed with either 'hostname:' (TCP/IP), '//hostname/' - * (NetBEUI) or 'hostname@' (IPX/SPX), depending on the connection - * protocol used. - *

- * @param string $username [optional]

- * The user name. Can be set with the - * ibase.default_user php.ini directive. - *

- * @param string $password [optional]

- * The password for username. Can be set with the - * ibase.default_password php.ini directive. - *

- * @param string $charset [optional]

- * charset is the default character set for a - * database. - *

- * @param int $buffers [optional]

- * buffers is the number of database buffers to - * allocate for the server-side cache. If 0 or omitted, server chooses - * its own default. - *

- * @param int $dialect [optional]

- * dialect selects the default SQL dialect for any - * statement executed within a connection, and it defaults to the highest - * one supported by client libraries. Functional only with InterBase 6 - * and up. - *

- * @param string $role [optional]

- * Functional only with InterBase 5 and up. - *

- * @param int $sync [optional] - * @return resource an InterBase link identifier on success, or FALSE on error. - */ -function ibase_pconnect ($database = null, $username = null, $password = null, $charset = null, $buffers = null, $dialect = null, $role = null, $sync = null) {} - -/** - * (PHP 4, PHP 5)
- * Close a connection to an InterBase database - * @link http://php.net/manual/en/function.ibase-close.php - * @param resource $connection_id [optional]

- * An InterBase link identifier returned from - * ibase_connect. If omitted, the last opened link - * is assumed. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ibase_close ($connection_id = null) {} - -/** - * (PHP 5)
- * Drops a database - * @link http://php.net/manual/en/function.ibase-drop-db.php - * @param resource $connection [optional]

- * An InterBase link identifier. If omitted, the last opened link is - * assumed. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ibase_drop_db ($connection = null) {} - -/** - * (PHP 4, PHP 5)
- * Execute a query on an InterBase database - * @link http://php.net/manual/en/function.ibase-query.php - * @param resource $link_identifier [optional]

- * An InterBase link identifier. If omitted, the last opened link is - * assumed. - *

- * @param string $query

- * An InterBase query. - *

- * @param int $bind_args [optional] - * @return resource If the query raises an error, returns FALSE. If it is successful and - * there is a (possibly empty) result set (such as with a SELECT query), - * returns a result identifier. If the query was successful and there were - * no results, returns TRUE. - *

- *

- * In PHP 5.0.0 and up, this function will return the number of rows - * affected by the query for INSERT, UPDATE and DELETE statements. In order - * to retain backward compatibility, it will return TRUE for these - * statements if the query succeeded without affecting any rows. - */ -function ibase_query ($link_identifier = null, $query, $bind_args = null) {} - -/** - * (PHP 4, PHP 5)
- * Fetch a row from an InterBase database - * @link http://php.net/manual/en/function.ibase-fetch-row.php - * @param resource $result_identifier

- * An InterBase result identifier. - *

- * @param int $fetch_flag [optional]

- * fetch_flag is a combination of the constants - * IBASE_TEXT and IBASE_UNIXTIME - * ORed together. Passing IBASE_TEXT will cause this - * function to return BLOB contents instead of BLOB ids. Passing - * IBASE_UNIXTIME will cause this function to return - * date/time values as Unix timestamps instead of as formatted strings. - *

- * @return array an array that corresponds to the fetched row, or FALSE if there - * are no more rows. Each result column is stored in an array offset, - * starting at offset 0. - */ -function ibase_fetch_row ($result_identifier, $fetch_flag = 0) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Fetch a result row from a query as an associative array - * @link http://php.net/manual/en/function.ibase-fetch-assoc.php - * @param resource $result

- * The result handle. - *

- * @param int $fetch_flag [optional]

- * fetch_flag is a combination of the constants - * IBASE_TEXT and IBASE_UNIXTIME - * ORed together. Passing IBASE_TEXT will cause this - * function to return BLOB contents instead of BLOB ids. Passing - * IBASE_UNIXTIME will cause this function to return - * date/time values as Unix timestamps instead of as formatted strings. - *

- * @return array an associative array that corresponds to the fetched row. - * Subsequent calls will return the next row in the result set, or FALSE if - * there are no more rows. - */ -function ibase_fetch_assoc ($result, $fetch_flag = 0) {} - -/** - * (PHP 4, PHP 5)
- * Get an object from a InterBase database - * @link http://php.net/manual/en/function.ibase-fetch-object.php - * @param resource $result_id

- * An InterBase result identifier obtained either by - * ibase_query or ibase_execute. - *

- * @param int $fetch_flag [optional]

- * fetch_flag is a combination of the constants - * IBASE_TEXT and IBASE_UNIXTIME - * ORed together. Passing IBASE_TEXT will cause this - * function to return BLOB contents instead of BLOB ids. Passing - * IBASE_UNIXTIME will cause this function to return - * date/time values as Unix timestamps instead of as formatted strings. - *

- * @return object an object with the next row information, or FALSE if there are - * no more rows. - */ -function ibase_fetch_object ($result_id, $fetch_flag = 0) {} - -/** - * (PHP 4, PHP 5)
- * Free a result set - * @link http://php.net/manual/en/function.ibase-free-result.php - * @param resource $result_identifier

- * A result set created by ibase_query or - * ibase_execute. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ibase_free_result ($result_identifier) {} - -/** - * (PHP 5)
- * Assigns a name to a result set - * @link http://php.net/manual/en/function.ibase-name-result.php - * @param resource $result

- * An InterBase result set. - *

- * @param string $name

- * The name to be assigned. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ibase_name_result ($result, $name) {} - -/** - * (PHP 4, PHP 5)
- * Prepare a query for later binding of parameter placeholders and execution - * @link http://php.net/manual/en/function.ibase-prepare.php - * @param string $query

- * An InterBase query. - *

- * @return resource a prepared query handle, or FALSE on error. - */ -function ibase_prepare ($query) {} - -/** - * (PHP 4, PHP 5)
- * Execute a previously prepared query - * @link http://php.net/manual/en/function.ibase-execute.php - * @param resource $query

- * An InterBase query prepared by ibase_prepare. - *

- * @param mixed $bind_arg [optional] - * @param mixed $_ [optional] - * @return resource If the query raises an error, returns FALSE. If it is successful and - * there is a (possibly empty) result set (such as with a SELECT query), - * returns a result identifier. If the query was successful and there were - * no results, returns TRUE. - *

- *

- * In PHP 5.0.0 and up, this function returns the number of rows affected by - * the query (if > 0 and applicable to the statement type). A query that - * succeeded, but did not affect any rows (e.g. an UPDATE of a non-existent - * record) will return TRUE. - */ -function ibase_execute ($query, $bind_arg = null, $_ = null) {} - -/** - * (PHP 4, PHP 5)
- * Free memory allocated by a prepared query - * @link http://php.net/manual/en/function.ibase-free-query.php - * @param resource $query

- * A query prepared with ibase_prepare. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ibase_free_query ($query) {} - -/** - * (PHP 5)
- * Increments the named generator and returns its new value - * @link http://php.net/manual/en/function.ibase-gen-id.php - * @param string $generator - * @param int $increment [optional] - * @param resource $link_identifier [optional] - * @return mixed new generator value as integer, or as string if the value is too big. - */ -function ibase_gen_id ($generator, $increment = 1, $link_identifier = null) {} - -/** - * (PHP 4, PHP 5)
- * Get the number of fields in a result set - * @link http://php.net/manual/en/function.ibase-num-fields.php - * @param resource $result_id

- * An InterBase result identifier. - *

- * @return int the number of fields as an integer. - */ -function ibase_num_fields ($result_id) {} - -/** - * (PHP 5)
- * Return the number of parameters in a prepared query - * @link http://php.net/manual/en/function.ibase-num-params.php - * @param resource $query

- * The prepared query handle. - *

- * @return int the number of parameters as an integer. - */ -function ibase_num_params ($query) {} - -/** - * (PHP 5)
- * Return the number of rows that were affected by the previous query - * @link http://php.net/manual/en/function.ibase-affected-rows.php - * @param resource $link_identifier [optional]

- * A transaction context. If link_identifier is a - * connection resource, its default transaction is used. - *

- * @return int the number of rows as an integer. - */ -function ibase_affected_rows ($link_identifier = null) {} - -/** - * (PHP 4, PHP 5)
- * Get information about a field - * @link http://php.net/manual/en/function.ibase-field-info.php - * @param resource $result

- * An InterBase result identifier. - *

- * @param int $field_number

- * Field offset. - *

- * @return array an array with the following keys: name, - * alias, relation, - * length and type. - */ -function ibase_field_info ($result, $field_number) {} - -/** - * (PHP 5)
- * Return information about a parameter in a prepared query - * @link http://php.net/manual/en/function.ibase-param-info.php - * @param resource $query

- * An InterBase prepared query handle. - *

- * @param int $param_number

- * Parameter offset. - *

- * @return array an array with the following keys: name, - * alias, relation, - * length and type. - */ -function ibase_param_info ($query, $param_number) {} - -/** - * (PHP 4, PHP 5)
- * Begin a transaction - * @link http://php.net/manual/en/function.ibase-trans.php - * @param int $trans_args [optional]

- * trans_args can be a combination of - * IBASE_READ, - * IBASE_WRITE, - * IBASE_COMMITTED, - * IBASE_CONSISTENCY, - * IBASE_CONCURRENCY, - * IBASE_REC_VERSION, - * IBASE_REC_NO_VERSION, - * IBASE_WAIT and - * IBASE_NOWAIT. - *

- * @param resource $link_identifier [optional]

- * An InterBase link identifier. If omitted, the last opened link is - * assumed. - *

- * @return resource a transaction handle, or FALSE on error. - */ -function ibase_trans ($trans_args = null, $link_identifier = null) {} - -/** - * (PHP 4, PHP 5)
- * Commit a transaction - * @link http://php.net/manual/en/function.ibase-commit.php - * @param resource $link_or_trans_identifier [optional]

- * If called without an argument, this function commits the default - * transaction of the default link. If the argument is a connection - * identifier, the default transaction of the corresponding connection - * will be committed. If the argument is a transaction identifier, the - * corresponding transaction will be committed. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ibase_commit ($link_or_trans_identifier = null) {} - -/** - * (PHP 4, PHP 5)
- * Roll back a transaction - * @link http://php.net/manual/en/function.ibase-rollback.php - * @param resource $link_or_trans_identifier [optional]

- * If called without an argument, this function rolls back the default - * transaction of the default link. If the argument is a connection - * identifier, the default transaction of the corresponding connection - * will be rolled back. If the argument is a transaction identifier, the - * corresponding transaction will be rolled back. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ibase_rollback ($link_or_trans_identifier = null) {} - -/** - * (PHP 5)
- * Commit a transaction without closing it - * @link http://php.net/manual/en/function.ibase-commit-ret.php - * @param resource $link_or_trans_identifier [optional]

- * If called without an argument, this function commits the default - * transaction of the default link. If the argument is a connection - * identifier, the default transaction of the corresponding connection - * will be committed. If the argument is a transaction identifier, the - * corresponding transaction will be committed. The transaction context - * will be retained, so statements executed from within this transaction - * will not be invalidated. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ibase_commit_ret ($link_or_trans_identifier = null) {} - -/** - * (PHP 5)
- * Roll back a transaction without closing it - * @link http://php.net/manual/en/function.ibase-rollback-ret.php - * @param resource $link_or_trans_identifier [optional]

- * If called without an argument, this function rolls back the default - * transaction of the default link. If the argument is a connection - * identifier, the default transaction of the corresponding connection - * will be rolled back. If the argument is a transaction identifier, the - * corresponding transaction will be rolled back. The transaction context - * will be retained, so statements executed from within this transaction - * will not be invalidated. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ibase_rollback_ret ($link_or_trans_identifier = null) {} - -/** - * (PHP 4, PHP 5)
- * Return blob length and other useful info - * @link http://php.net/manual/en/function.ibase-blob-info.php - * @param resource $link_identifier

- * An InterBase link identifier. If omitted, the last opened link is - * assumed. - *

- * @param string $blob_id

- * A BLOB id. - *

- * @return array an array containing information about a BLOB. The information returned - * consists of the length of the BLOB, the number of segments it contains, the size - * of the largest segment, and whether it is a stream BLOB or a segmented BLOB. - */ -function ibase_blob_info ($link_identifier, $blob_id) {} - -/** - * (PHP 4, PHP 5)
- * Create a new blob for adding data - * @link http://php.net/manual/en/function.ibase-blob-create.php - * @param resource $link_identifier [optional]

- * An InterBase link identifier. If omitted, the last opened link is - * assumed. - *

- * @return resource a BLOB handle for later use with - * ibase_blob_add or FALSE on failure. - */ -function ibase_blob_create ($link_identifier = null) {} - -/** - * (PHP 4, PHP 5)
- * Add data into a newly created blob - * @link http://php.net/manual/en/function.ibase-blob-add.php - * @param resource $blob_handle

- * A blob handle opened with ibase_blob_create. - *

- * @param string $data

- * The data to be added. - *

- * @return void No value is returned. - */ -function ibase_blob_add ($blob_handle, $data) {} - -/** - * (PHP 4, PHP 5)
- * Cancel creating blob - * @link http://php.net/manual/en/function.ibase-blob-cancel.php - * @param resource $blob_handle

- * A BLOB handle opened with ibase_blob_create. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ibase_blob_cancel ($blob_handle) {} - -/** - * (PHP 4, PHP 5)
- * Close blob - * @link http://php.net/manual/en/function.ibase-blob-close.php - * @param resource $blob_handle

- * A BLOB handle opened with ibase_blob_create or - * ibase_blob_open. - *

- * @return mixed If the BLOB was being read, this function returns TRUE on success, if - * the BLOB was being written to, this function returns a string containing - * the BLOB id that has been assigned to it by the database. On failure, this - * function returns FALSE. - */ -function ibase_blob_close ($blob_handle) {} - -/** - * (PHP 4, PHP 5)
- * Open blob for retrieving data parts - * @link http://php.net/manual/en/function.ibase-blob-open.php - * @param resource $link_identifier

- * An InterBase link identifier. If omitted, the last opened link is - * assumed. - *

- * @param string $blob_id

- * A BLOB id. - *

- * @return resource a BLOB handle for later use with - * ibase_blob_get or FALSE on failure. - */ -function ibase_blob_open ($link_identifier, $blob_id) {} - -/** - * (PHP 4, PHP 5)
- * Get len bytes data from open blob - * @link http://php.net/manual/en/function.ibase-blob-get.php - * @param resource $blob_handle

- * A BLOB handle opened with ibase_blob_open. - *

- * @param int $len

- * Size of returned data. - *

- * @return string at most len bytes from the BLOB, or FALSE - * on failure. - */ -function ibase_blob_get ($blob_handle, $len) {} - -/** - * (PHP 4, PHP 5)
- * Output blob contents to browser - * @link http://php.net/manual/en/function.ibase-blob-echo.php - * @param string $blob_id - * @return bool TRUE on success or FALSE on failure. - */ -function ibase_blob_echo ($blob_id) {} - -/** - * (PHP 4, PHP 5)
- * Create blob, copy file in it, and close it - * @link http://php.net/manual/en/function.ibase-blob-import.php - * @param resource $link_identifier

- * An InterBase link identifier. If omitted, the last opened link is - * assumed. - *

- * @param resource $file_handle

- * The file handle is a handle returned by fopen. - *

- * @return string the BLOB id on success, or FALSE on error. - */ -function ibase_blob_import ($link_identifier, $file_handle) {} - -/** - * (PHP 4, PHP 5)
- * Return error messages - * @link http://php.net/manual/en/function.ibase-errmsg.php - * @return string the error message as a string, or FALSE if no error occurred. - */ -function ibase_errmsg () {} - -/** - * (PHP 5)
- * Return an error code - * @link http://php.net/manual/en/function.ibase-errcode.php - * @return int the error code as an integer, or FALSE if no error occurred. - */ -function ibase_errcode () {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Add a user to a security database - * @link http://php.net/manual/en/function.ibase-add-user.php - * @param resource $service_handle - * @param string $user_name - * @param string $password - * @param string $first_name [optional] - * @param string $middle_name [optional] - * @param string $last_name [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function ibase_add_user ($service_handle, $user_name, $password, $first_name = null, $middle_name = null, $last_name = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Modify a user to a security database - * @link http://php.net/manual/en/function.ibase-modify-user.php - * @param resource $service_handle - * @param string $user_name - * @param string $password - * @param string $first_name [optional] - * @param string $middle_name [optional] - * @param string $last_name [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function ibase_modify_user ($service_handle, $user_name, $password, $first_name = null, $middle_name = null, $last_name = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Delete a user from a security database - * @link http://php.net/manual/en/function.ibase-delete-user.php - * @param resource $service_handle - * @param string $user_name - * @return bool TRUE on success or FALSE on failure. - */ -function ibase_delete_user ($service_handle, $user_name) {} - -/** - * (PHP 5)
- * Connect to the service manager - * @link http://php.net/manual/en/function.ibase-service-attach.php - * @param string $host - * @param string $dba_username - * @param string $dba_password - * @return resource - */ -function ibase_service_attach ($host, $dba_username, $dba_password) {} - -/** - * (PHP 5)
- * Disconnect from the service manager - * @link http://php.net/manual/en/function.ibase-service-detach.php - * @param resource $service_handle - * @return bool TRUE on success or FALSE on failure. - */ -function ibase_service_detach ($service_handle) {} - -/** - * (PHP 5)
- * Initiates a backup task in the service manager and returns immediately - * @link http://php.net/manual/en/function.ibase-backup.php - * @param resource $service_handle - * @param string $source_db - * @param string $dest_file - * @param int $options [optional] - * @param bool $verbose [optional] - * @return mixed - */ -function ibase_backup ($service_handle, $source_db, $dest_file, $options = 0, $verbose = false) {} - -/** - * (PHP 5)
- * Initiates a restore task in the service manager and returns immediately - * @link http://php.net/manual/en/function.ibase-restore.php - * @param resource $service_handle - * @param string $source_file - * @param string $dest_db - * @param int $options [optional] - * @param bool $verbose [optional] - * @return mixed - */ -function ibase_restore ($service_handle, $source_file, $dest_db, $options = 0, $verbose = false) {} - -/** - * (PHP 5)
- * Execute a maintenance command on the database server - * @link http://php.net/manual/en/function.ibase-maintain-db.php - * @param resource $service_handle - * @param string $db - * @param int $action - * @param int $argument [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function ibase_maintain_db ($service_handle, $db, $action, $argument = 0) {} - -/** - * (PHP 5)
- * Request statistics about a database - * @link http://php.net/manual/en/function.ibase-db-info.php - * @param resource $service_handle - * @param string $db - * @param int $action - * @param int $argument [optional] - * @return string - */ -function ibase_db_info ($service_handle, $db, $action, $argument = 0) {} - -/** - * (PHP 5)
- * Request information about a database server - * @link http://php.net/manual/en/function.ibase-server-info.php - * @param resource $service_handle - * @param int $action - * @return string - */ -function ibase_server_info ($service_handle, $action) {} - -/** - * (PHP 5)
- * Wait for an event to be posted by the database - * @link http://php.net/manual/en/function.ibase-wait-event.php - * @param string $event_name1

- * The event name. - *

- * @param string $event_name2 [optional] - * @param string $_ [optional] - * @return string the name of the event that was posted. - */ -function ibase_wait_event ($event_name1, $event_name2 = null, $_ = null) {} - -/** - * (PHP 5)
- * Register a callback function to be called when events are posted - * @link http://php.net/manual/en/function.ibase-set-event-handler.php - * @param callable $event_handler

- * The callback is called with the event name and the link resource as - * arguments whenever one of the specified events is posted by the - * database. - *

- *

- * The callback must return FALSE if the event handler should be - * canceled. Any other return value is ignored. This function accepts up - * to 15 event arguments. - *

- * @param string $event_name1

- * An event name. - *

- * @param string $event_name2 [optional]

- * At most 15 events allowed. - *

- * @param string $_ [optional] - * @return resource The return value is an event resource. This resource can be used to free - * the event handler using ibase_free_event_handler. - */ -function ibase_set_event_handler (callable $event_handler, $event_name1, $event_name2 = null, $_ = null) {} - -/** - * (PHP 5)
- * Cancels a registered event handler - * @link http://php.net/manual/en/function.ibase-free-event-handler.php - * @param resource $event

- * An event resource, created by - * ibase_set_event_handler. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ibase_free_event_handler ($event) {} - -/** - * @param $database - * @param $username [optional] - * @param $password [optional] - * @param $charset [optional] - * @param $buffers [optional] - * @param $dialect [optional] - * @param $role [optional] - */ -function fbird_connect ($database, $username, $password, $charset, $buffers, $dialect, $role) {} - -/** - * @param $database - * @param $username [optional] - * @param $password [optional] - * @param $charset [optional] - * @param $buffers [optional] - * @param $dialect [optional] - * @param $role [optional] - */ -function fbird_pconnect ($database, $username, $password, $charset, $buffers, $dialect, $role) {} - -/** - * @param $link_identifier [optional] - */ -function fbird_close ($link_identifier) {} - -/** - * @param $link_identifier [optional] - */ -function fbird_drop_db ($link_identifier) {} - -/** - * @param $link_identifier [optional] - * @param $link_identifier [optional] - * @param $query [optional] - * @param $bind_arg [optional] - * @param $bind_arg [optional] - */ -function fbird_query ($link_identifier, $link_identifier, $query, $bind_arg, $bind_arg) {} - -/** - * @param $result - * @param $fetch_flags [optional] - */ -function fbird_fetch_row ($result, $fetch_flags) {} - -/** - * @param $result - * @param $fetch_flags [optional] - */ -function fbird_fetch_assoc ($result, $fetch_flags) {} - -/** - * @param $result - * @param $fetch_flags [optional] - */ -function fbird_fetch_object ($result, $fetch_flags) {} - -/** - * @param $result - */ -function fbird_free_result ($result) {} - -/** - * @param $result - * @param $name - */ -function fbird_name_result ($result, $name) {} - -/** - * @param $link_identifier [optional] - * @param $query [optional] - */ -function fbird_prepare ($link_identifier, $query) {} - -/** - * @param $query - * @param $bind_arg [optional] - * @param $bind_arg [optional] - */ -function fbird_execute ($query, $bind_arg, $bind_arg) {} - -/** - * @param $query - */ -function fbird_free_query ($query) {} - -/** - * @param $generator - * @param $increment [optional] - * @param $link_identifier [optional] - */ -function fbird_gen_id ($generator, $increment, $link_identifier) {} - -/** - * @param $query_result - */ -function fbird_num_fields ($query_result) {} - -/** - * @param $query - */ -function fbird_num_params ($query) {} - -/** - * @param $link_identifier [optional] - */ -function fbird_affected_rows ($link_identifier) {} - -/** - * @param $query_result - * @param $field_number - */ -function fbird_field_info ($query_result, $field_number) {} - -/** - * @param $query - * @param $field_number - */ -function fbird_param_info ($query, $field_number) {} - -/** - * @param $trans_args [optional] - * @param $link_identifier [optional] - * @param $trans_args [optional] - * @param $link_identifier [optional] - */ -function fbird_trans ($trans_args, $link_identifier, $trans_args, $link_identifier) {} - -/** - * @param $link_identifier - */ -function fbird_commit ($link_identifier) {} - -/** - * @param $link_identifier - */ -function fbird_rollback ($link_identifier) {} - -/** - * @param $link_identifier - */ -function fbird_commit_ret ($link_identifier) {} - -/** - * @param $link_identifier - */ -function fbird_rollback_ret ($link_identifier) {} - -/** - * @param $link_identifier [optional] - * @param $blob_id [optional] - */ -function fbird_blob_info ($link_identifier, $blob_id) {} - -/** - * @param $link_identifier [optional] - */ -function fbird_blob_create ($link_identifier) {} - -/** - * @param $blob_handle - * @param $data - */ -function fbird_blob_add ($blob_handle, $data) {} - -/** - * @param $blob_handle - */ -function fbird_blob_cancel ($blob_handle) {} - -/** - * @param $blob_handle - */ -function fbird_blob_close ($blob_handle) {} - -/** - * @param $link_identifier [optional] - * @param $blob_id [optional] - */ -function fbird_blob_open ($link_identifier, $blob_id) {} - -/** - * @param $blob_handle - * @param $len - */ -function fbird_blob_get ($blob_handle, $len) {} - -/** - * @param $link_identifier [optional] - * @param $blob_id [optional] - */ -function fbird_blob_echo ($link_identifier, $blob_id) {} - -/** - * @param $link_identifier [optional] - * @param $file [optional] - */ -function fbird_blob_import ($link_identifier, $file) {} - -function fbird_errmsg () {} - -function fbird_errcode () {} - -/** - * @param $service_handle - * @param $user_name - * @param $password - * @param $first_name [optional] - * @param $middle_name [optional] - * @param $last_name [optional] - */ -function fbird_add_user ($service_handle, $user_name, $password, $first_name, $middle_name, $last_name) {} - -/** - * @param $service_handle - * @param $user_name - * @param $password - * @param $first_name [optional] - * @param $middle_name [optional] - * @param $last_name [optional] - */ -function fbird_modify_user ($service_handle, $user_name, $password, $first_name, $middle_name, $last_name) {} - -/** - * @param $service_handle - * @param $user_name - * @param $password - * @param $first_name [optional] - * @param $middle_name [optional] - * @param $last_name [optional] - */ -function fbird_delete_user ($service_handle, $user_name, $password, $first_name, $middle_name, $last_name) {} - -/** - * @param $host - * @param $dba_username - * @param $dba_password - */ -function fbird_service_attach ($host, $dba_username, $dba_password) {} - -/** - * @param $service_handle - */ -function fbird_service_detach ($service_handle) {} - -/** - * @param $service_handle - * @param $source_db - * @param $dest_file - * @param $options [optional] - * @param $verbose [optional] - */ -function fbird_backup ($service_handle, $source_db, $dest_file, $options, $verbose) {} - -/** - * @param $service_handle - * @param $source_file - * @param $dest_db - * @param $options [optional] - * @param $verbose [optional] - */ -function fbird_restore ($service_handle, $source_file, $dest_db, $options, $verbose) {} - -/** - * @param $service_handle - * @param $db - * @param $action - * @param $argument [optional] - */ -function fbird_maintain_db ($service_handle, $db, $action, $argument) {} - -/** - * @param $service_handle - * @param $db - * @param $action - * @param $argument [optional] - */ -function fbird_db_info ($service_handle, $db, $action, $argument) {} - -/** - * @param $service_handle - * @param $action - */ -function fbird_server_info ($service_handle, $action) {} - -/** - * @param $link_identifier - * @param $event [optional] - * @param $event2 [optional] - */ -function fbird_wait_event ($link_identifier, $event, $event2) {} - -/** - * @param $link_identifier - * @param $handler - * @param $event [optional] - * @param $event2 [optional] - */ -function fbird_set_event_handler ($link_identifier, $handler, $event, $event2) {} - -/** - * @param $event - */ -function fbird_free_event_handler ($event) {} - -define ('IBASE_DEFAULT', 0); -define ('IBASE_CREATE', 0); -define ('IBASE_TEXT', 1); -define ('IBASE_FETCH_BLOBS', 1); -define ('IBASE_FETCH_ARRAYS', 2); -define ('IBASE_UNIXTIME', 4); -define ('IBASE_WRITE', 1); -define ('IBASE_READ', 2); -define ('IBASE_COMMITTED', 8); -define ('IBASE_CONSISTENCY', 16); -define ('IBASE_CONCURRENCY', 4); -define ('IBASE_REC_VERSION', 64); -define ('IBASE_REC_NO_VERSION', 32); -define ('IBASE_NOWAIT', 256); -define ('IBASE_WAIT', 128); -define ('IBASE_BKP_IGNORE_CHECKSUMS', 1); -define ('IBASE_BKP_IGNORE_LIMBO', 2); -define ('IBASE_BKP_METADATA_ONLY', 4); -define ('IBASE_BKP_NO_GARBAGE_COLLECT', 8); -define ('IBASE_BKP_OLD_DESCRIPTIONS', 16); -define ('IBASE_BKP_NON_TRANSPORTABLE', 32); - -/** - * Options to ibase_backup - * @link http://php.net/manual/en/ibase.constants.php - */ -define ('IBASE_BKP_CONVERT', 64); -define ('IBASE_RES_DEACTIVATE_IDX', 256); -define ('IBASE_RES_NO_SHADOW', 512); -define ('IBASE_RES_NO_VALIDITY', 1024); -define ('IBASE_RES_ONE_AT_A_TIME', 2048); -define ('IBASE_RES_REPLACE', 4096); -define ('IBASE_RES_CREATE', 8192); - -/** - * Options to ibase_restore - * @link http://php.net/manual/en/ibase.constants.php - */ -define ('IBASE_RES_USE_ALL_SPACE', 16384); -define ('IBASE_PRP_PAGE_BUFFERS', 5); -define ('IBASE_PRP_SWEEP_INTERVAL', 6); -define ('IBASE_PRP_SHUTDOWN_DB', 7); -define ('IBASE_PRP_DENY_NEW_TRANSACTIONS', 10); -define ('IBASE_PRP_DENY_NEW_ATTACHMENTS', 9); -define ('IBASE_PRP_RESERVE_SPACE', 11); -define ('IBASE_PRP_RES_USE_FULL', 35); -define ('IBASE_PRP_RES', 36); -define ('IBASE_PRP_WRITE_MODE', 12); -define ('IBASE_PRP_WM_ASYNC', 37); -define ('IBASE_PRP_WM_SYNC', 38); -define ('IBASE_PRP_ACCESS_MODE', 13); -define ('IBASE_PRP_AM_READONLY', 39); -define ('IBASE_PRP_AM_READWRITE', 40); -define ('IBASE_PRP_SET_SQL_DIALECT', 14); -define ('IBASE_PRP_ACTIVATE', 256); -define ('IBASE_PRP_DB_ONLINE', 512); -define ('IBASE_RPR_CHECK_DB', 16); -define ('IBASE_RPR_IGNORE_CHECKSUM', 32); -define ('IBASE_RPR_KILL_SHADOWS', 64); -define ('IBASE_RPR_MEND_DB', 4); -define ('IBASE_RPR_VALIDATE_DB', 1); -define ('IBASE_RPR_FULL', 128); - -/** - * Options to ibase_maintain_db - * @link http://php.net/manual/en/ibase.constants.php - */ -define ('IBASE_RPR_SWEEP_DB', 2); -define ('IBASE_STS_DATA_PAGES', 1); -define ('IBASE_STS_DB_LOG', 2); -define ('IBASE_STS_HDR_PAGES', 4); -define ('IBASE_STS_IDX_PAGES', 8); - -/** - * Options to ibase_db_info - * @link http://php.net/manual/en/ibase.constants.php - */ -define ('IBASE_STS_SYS_RELATIONS', 16); -define ('IBASE_SVC_SERVER_VERSION', 55); -define ('IBASE_SVC_IMPLEMENTATION', 56); -define ('IBASE_SVC_GET_ENV', 59); -define ('IBASE_SVC_GET_ENV_LOCK', 60); -define ('IBASE_SVC_GET_ENV_MSG', 61); -define ('IBASE_SVC_USER_DBPATH', 58); -define ('IBASE_SVC_SVR_DB_INFO', 50); - -/** - * Options to ibase_server_info - * @link http://php.net/manual/en/ibase.constants.php - */ -define ('IBASE_SVC_GET_USERS', 68); - -// End of interbase v. -?> diff --git a/phpruntime/intl.php b/phpruntime/intl.php deleted file mode 100644 index 2973c43..0000000 --- a/phpruntime/intl.php +++ /dev/null @@ -1,3823 +0,0 @@ - - * Sort strings with different accents from the back of the string. This - * attribute is automatically set to - * On - * for the French locales and a few others. Users normally would not need - * to explicitly set this attribute. There is a string comparison - * performance cost when it is set On, - * but sort key length is unaffected. Possible values are: - * Collator::ON - * Collator::OFFCollator::DEFAULT_VALUE - *

- *

- * FRENCH_COLLATION rules - *

- * F=OFF cote < coté < côte < côté - * F=ON cote < côte < coté < côté - *

- *

- * @link http://php.net/manual/en/intl.collator-constants.php - */ - const FRENCH_COLLATION = 0; - - /** - *

- * The Alternate attribute is used to control the handling of the so called - * variable characters in the UCA: whitespace, punctuation and symbols. If - * Alternate is set to NonIgnorable - * (N), then differences among these characters are of the same importance - * as differences among letters. If Alternate is set to - * Shifted - * (S), then these characters are of only minor importance. The - * Shifted value is often used in combination with - * Strength - * set to Quaternary. In such a case, whitespace, punctuation, and symbols - * are considered when comparing strings, but only if all other aspects of - * the strings (base letters, accents, and case) are identical. If - * Alternate is not set to Shifted, then there is no difference between a - * Strength of 3 and a Strength of 4. For more information and examples, - * see Variable_Weighting in the - * UCA. - * The reason the Alternate values are not simply - * On and Off - * is that additional Alternate values may be added in the future. The UCA - * option Blanked is expressed with Strength set to 3, and Alternate set to - * Shifted. The default for most locales is NonIgnorable. If Shifted is - * selected, it may be slower if there are many strings that are the same - * except for punctuation; sort key length will not be affected unless the - * strength level is also increased. - *

- *

- * Possible values are: - * Collator::NON_IGNORABLECollator::SHIFTED - * Collator::DEFAULT_VALUE - *

- *

- * ALTERNATE_HANDLING rules - *

- * S=3, A=N di Silva < Di Silva < diSilva < U.S.A. < USA - * S=3, A=S di Silva = diSilva < Di Silva < U.S.A. = USA - * S=4, A=S di Silva < diSilva < Di Silva < U.S.A. < USA - *

- *

- * @link http://php.net/manual/en/intl.collator-constants.php - */ - const ALTERNATE_HANDLING = 1; - - /** - *

- * The Case_First attribute is used to control whether uppercase letters - * come before lowercase letters or vice versa, in the absence of other - * differences in the strings. The possible values are - * Uppercase_First - * (U) and Lowercase_First - * (L), plus the standard Default - * and Off. - * There is almost no difference between the Off and Lowercase_First - * options in terms of results, so typically users will not use - * Lowercase_First: only Off or Uppercase_First. (People interested in the - * detailed differences between X and L should consult the Collation - * Customization). Specifying either L or U won't affect string comparison - * performance, but will affect the sort key length. - *

- *

- * Possible values are: - * Collator::OFFCollator::LOWER_FIRST - * Collator::UPPER_FIRST - * Collator:DEFAULT - *

- *

- * CASE_FIRST rules - *

- * C=X or C=L "china" < "China" < "denmark" < "Denmark" - * C=U "China" < "china" < "Denmark" < "denmark" - *

- *

- * @link http://php.net/manual/en/intl.collator-constants.php - */ - const CASE_FIRST = 2; - - /** - *

- * The Case_Level attribute is used when ignoring accents but not case. In - * such a situation, set Strength to be Primary, - * and Case_Level to be On. - * In most locales, this setting is Off by default. There is a small - * string comparison performance and sort key impact if this attribute is - * set to be On. - *

- *

- * Possible values are: - * Collator::OFFCollator::ON - * Collator::DEFAULT_VALUE - *

- *

- * CASE_LEVEL rules - *

- * S=1, E=X role = Role = rôle - * S=1, E=O role = rôle < Role - *

- *

- * @link http://php.net/manual/en/intl.collator-constants.php - */ - const CASE_LEVEL = 3; - - /** - *

- * The Normalization setting determines whether text is thoroughly - * normalized or not in comparison. Even if the setting is off (which is - * the default for many locales), text as represented in common usage will - * compare correctly (for details, see UTN #5). Only if the accent marks - * are in noncanonical order will there be a problem. If the setting is - * On, - * then the best results are guaranteed for all possible text input. - * There is a medium string comparison performance cost if this attribute - * is On, - * depending on the frequency of sequences that require normalization. - * There is no significant effect on sort key length. If the input text is - * known to be in NFD or NFKD normalization forms, there is no need to - * enable this Normalization option. - *

- *

- * Possible values are: - * Collator::OFFCollator::ON - * Collator::DEFAULT_VALUE - *

- * @link http://php.net/manual/en/intl.collator-constants.php - */ - const NORMALIZATION_MODE = 4; - - /** - *

- * The ICU Collation Service supports many levels of comparison (named - * "Levels", but also known as "Strengths"). Having these categories - * enables ICU to sort strings precisely according to local conventions. - * However, by allowing the levels to be selectively employed, searching - * for a string in text can be performed with various matching conditions. - * For more detailed information, see - * collator_set_strength chapter. - *

- *

- * Possible values are: - * Collator::PRIMARY - * Collator::SECONDARY - * Collator::TERTIARYCollator::QUATERNARY - * Collator::IDENTICAL - * Collator::DEFAULT_VALUE - *

- * @link http://php.net/manual/en/intl.collator-constants.php - */ - const STRENGTH = 5; - - /** - *

- * Compatibility with JIS x 4061 requires the introduction of an additional - * level to distinguish Hiragana and Katakana characters. If compatibility - * with that standard is required, then this attribute should be set - * On, - * and the strength set to Quaternary. This will affect sort key length - * and string comparison string comparison performance. - *

- *

- * Possible values are: - * Collator::OFFCollator::ON - * Collator::DEFAULT_VALUE - *

- * @link http://php.net/manual/en/intl.collator-constants.php - */ - const HIRAGANA_QUATERNARY_MODE = 6; - - /** - *

- * When turned on, this attribute generates a collation key for the numeric - * value of substrings of digits. This is a way to get '100' to sort AFTER - * '2'. - *

- *

- * Possible values are: - * Collator::OFFCollator::ON - * Collator::DEFAULT_VALUE - *

- * @link http://php.net/manual/en/intl.collator-constants.php - */ - const NUMERIC_COLLATION = 7; - const SORT_REGULAR = 0; - const SORT_STRING = 1; - const SORT_NUMERIC = 2; - - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Create a collator - * @link http://php.net/manual/en/collator.construct.php - * @param $arg1 - */ - public function __construct ($arg1) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Create a collator - * @link http://php.net/manual/en/collator.create.php - * @param string $locale

- * The locale containing the required collation rules. Special values for - * locales can be passed in - if null is passed for the locale, the - * default locale collation rules will be used. If empty string ("") or - * "root" are passed, UCA rules will be used. - *

- * @return Collator Return new instance of Collator object, or NULL - * on error. - */ - public static function create ($locale) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Compare two Unicode strings - * @link http://php.net/manual/en/collator.compare.php - * @param string $str1

- * The first string to compare. - *

- * @param string $str2

- * The second string to compare. - *

- * @return int Return comparison result:

- *

- *

- * 1 if str1 is greater than - * str2 ; - *

- *

- * 0 if str1 is equal to - * str2; - *

- *

- * -1 if str1 is less than - * str2 . - *

- * On error - * boolean - * FALSE - * is returned. - */ - public function compare ($str1, $str2) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Sort array using specified collator - * @link http://php.net/manual/en/collator.sort.php - * @param array $arr

- * Array of strings to sort. - *

- * @param int $sort_flag [optional]

- * Optional sorting type, one of the following: - *

- *

- *

- * Collator::SORT_REGULAR - * - compare items normally (don't change types) - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function sort (array &$arr, $sort_flag = null) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Sort array using specified collator and sort keys - * @link http://php.net/manual/en/collator.sortwithsortkeys.php - * @param array $arr

Array of strings to sort

- * @return bool TRUE on success or FALSE on failure. - */ - public function sortWithSortKeys (array &$arr) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Sort array maintaining index association - * @link http://php.net/manual/en/collator.asort.php - * @param array $arr

Array of strings to sort.

- * @param int $sort_flag [optional]

- * Optional sorting type, one of the following: - *

- * Collator::SORT_REGULAR - * - compare items normally (don't change types) - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function asort (array &$arr, $sort_flag = null) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get collation attribute value - * @link http://php.net/manual/en/collator.getattribute.php - * @param int $attr

- * Attribute to get value for. - *

- * @return int Attribute value, or boolean FALSE on error. - */ - public function getAttribute ($attr) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Set collation attribute - * @link http://php.net/manual/en/collator.setattribute.php - * @param int $attr

Attribute.

- * @param int $val

- * Attribute value. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setAttribute ($attr, $val) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get current collation strength - * @link http://php.net/manual/en/collator.getstrength.php - * @return int current collation strength, or boolean FALSE on error. - */ - public function getStrength () {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Set collation strength - * @link http://php.net/manual/en/collator.setstrength.php - * @param int $strength

Strength to set.

- *

- * Possible values are: - *

- * Collator::PRIMARY - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setStrength ($strength) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the locale name of the collator - * @link http://php.net/manual/en/collator.getlocale.php - * @param int $type [optional]

- * You can choose between valid and actual locale ( - * Locale::VALID_LOCALE and - * Locale::ACTUAL_LOCALE, - * respectively). The default is the actual locale. - *

- * @return string Real locale name from which the collation data comes. If the collator was - * instantiated from rules or an error occurred, returns - * boolean FALSE. - */ - public function getLocale ($type = null) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get collator's last error code - * @link http://php.net/manual/en/collator.geterrorcode.php - * @return int Error code returned by the last Collator API function call. - */ - public function getErrorCode () {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get text for collator's last error code - * @link http://php.net/manual/en/collator.geterrormessage.php - * @return string Description of an error occurred in the last Collator API function call. - */ - public function getErrorMessage () {} - - /** - * (No version information available, might only be in SVN)
- * Get sorting key for a string - * @link http://php.net/manual/en/collator.getsortkey.php - * @param string $str

- * The string to produce the key from. - *

- * @return string the collation key for the string. Collation keys can be compared directly instead of strings. - */ - public function getSortKey ($str) {} - -} - -class NumberFormatter { - - /** - * Decimal format defined by pattern - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const PATTERN_DECIMAL = 0; - - /** - * Decimal format - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const DECIMAL = 1; - - /** - * Currency format - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const CURRENCY = 2; - - /** - * Percent format - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const PERCENT = 3; - - /** - * Scientific format - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const SCIENTIFIC = 4; - - /** - * Spellout rule-based format - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const SPELLOUT = 5; - - /** - * Ordinal rule-based format - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const ORDINAL = 6; - - /** - * Duration rule-based format - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const DURATION = 7; - - /** - * Rule-based format defined by pattern - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const PATTERN_RULEBASED = 9; - - /** - * Alias for PATTERN_DECIMAL - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const IGNORE = 0; - - /** - * Default format for the locale - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const DEFAULT_STYLE = 1; - - /** - * Rounding mode to round towards positive infinity. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const ROUND_CEILING = 0; - - /** - * Rounding mode to round towards negative infinity. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const ROUND_FLOOR = 1; - - /** - * Rounding mode to round towards zero. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const ROUND_DOWN = 2; - - /** - * Rounding mode to round away from zero. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const ROUND_UP = 3; - - /** - * Rounding mode to round towards the "nearest neighbor" unless both - * neighbors are equidistant, in which case, round towards the even - * neighbor. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const ROUND_HALFEVEN = 4; - - /** - * Rounding mode to round towards "nearest neighbor" unless both neighbors - * are equidistant, in which case round down. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const ROUND_HALFDOWN = 5; - - /** - * Rounding mode to round towards "nearest neighbor" unless both neighbors - * are equidistant, in which case round up. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const ROUND_HALFUP = 6; - - /** - * Pad characters inserted before the prefix. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const PAD_BEFORE_PREFIX = 0; - - /** - * Pad characters inserted after the prefix. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const PAD_AFTER_PREFIX = 1; - - /** - * Pad characters inserted before the suffix. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const PAD_BEFORE_SUFFIX = 2; - - /** - * Pad characters inserted after the suffix. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const PAD_AFTER_SUFFIX = 3; - - /** - * Parse integers only. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const PARSE_INT_ONLY = 0; - - /** - * Use grouping separator. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const GROUPING_USED = 1; - - /** - * Always show decimal point. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const DECIMAL_ALWAYS_SHOWN = 2; - - /** - * Maximum integer digits. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const MAX_INTEGER_DIGITS = 3; - - /** - * Minimum integer digits. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const MIN_INTEGER_DIGITS = 4; - - /** - * Integer digits. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const INTEGER_DIGITS = 5; - - /** - * Maximum fraction digits. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const MAX_FRACTION_DIGITS = 6; - - /** - * Minimum fraction digits. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const MIN_FRACTION_DIGITS = 7; - - /** - * Fraction digits. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const FRACTION_DIGITS = 8; - - /** - * Multiplier. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const MULTIPLIER = 9; - - /** - * Grouping size. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const GROUPING_SIZE = 10; - - /** - * Rounding Mode. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const ROUNDING_MODE = 11; - - /** - * Rounding increment. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const ROUNDING_INCREMENT = 12; - - /** - * The width to which the output of format() is padded. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const FORMAT_WIDTH = 13; - - /** - * The position at which padding will take place. See pad position - * constants for possible argument values. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const PADDING_POSITION = 14; - - /** - * Secondary grouping size. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const SECONDARY_GROUPING_SIZE = 15; - - /** - * Use significant digits. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const SIGNIFICANT_DIGITS_USED = 16; - - /** - * Minimum significant digits. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const MIN_SIGNIFICANT_DIGITS = 17; - - /** - * Maximum significant digits. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const MAX_SIGNIFICANT_DIGITS = 18; - - /** - * Lenient parse mode used by rule-based formats. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const LENIENT_PARSE = 19; - - /** - * Positive prefix. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const POSITIVE_PREFIX = 0; - - /** - * Positive suffix. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const POSITIVE_SUFFIX = 1; - - /** - * Negative prefix. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const NEGATIVE_PREFIX = 2; - - /** - * Negative suffix. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const NEGATIVE_SUFFIX = 3; - - /** - * The character used to pad to the format width. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const PADDING_CHARACTER = 4; - - /** - * The ISO currency code. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const CURRENCY_CODE = 5; - - /** - * The default rule set. This is only available with rule-based - * formatters. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const DEFAULT_RULESET = 6; - - /** - * The public rule sets. This is only available with rule-based - * formatters. This is a read-only attribute. The public rulesets are - * returned as a single string, with each ruleset name delimited by ';' - * (semicolon). - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const PUBLIC_RULESETS = 7; - - /** - * The decimal separator. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const DECIMAL_SEPARATOR_SYMBOL = 0; - - /** - * The grouping separator. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const GROUPING_SEPARATOR_SYMBOL = 1; - - /** - * The pattern separator. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const PATTERN_SEPARATOR_SYMBOL = 2; - - /** - * The percent sign. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const PERCENT_SYMBOL = 3; - - /** - * Zero. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const ZERO_DIGIT_SYMBOL = 4; - - /** - * Character representing a digit in the pattern. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const DIGIT_SYMBOL = 5; - - /** - * The minus sign. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const MINUS_SIGN_SYMBOL = 6; - - /** - * The plus sign. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const PLUS_SIGN_SYMBOL = 7; - - /** - * The currency symbol. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const CURRENCY_SYMBOL = 8; - - /** - * The international currency symbol. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const INTL_CURRENCY_SYMBOL = 9; - - /** - * The monetary separator. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const MONETARY_SEPARATOR_SYMBOL = 10; - - /** - * The exponential symbol. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const EXPONENTIAL_SYMBOL = 11; - - /** - * Per mill symbol. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const PERMILL_SYMBOL = 12; - - /** - * Escape padding character. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const PAD_ESCAPE_SYMBOL = 13; - - /** - * Infinity symbol. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const INFINITY_SYMBOL = 14; - - /** - * Not-a-number symbol. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const NAN_SYMBOL = 15; - - /** - * Significant digit symbol. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const SIGNIFICANT_DIGIT_SYMBOL = 16; - - /** - * The monetary grouping separator. - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const MONETARY_GROUPING_SEPARATOR_SYMBOL = 17; - - /** - * Derive the type from variable type - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const TYPE_DEFAULT = 0; - - /** - * Format/parse as 32-bit integer - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const TYPE_INT32 = 1; - - /** - * Format/parse as 64-bit integer - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const TYPE_INT64 = 2; - - /** - * Format/parse as floating point value - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const TYPE_DOUBLE = 3; - - /** - * Format/parse as currency value - * @link http://php.net/manual/en/intl.numberformatter-constants.php - */ - const TYPE_CURRENCY = 4; - - - /** - * @param $locale - * @param $style - * @param $pattern [optional] - */ - public function __construct ($locale, $style, $pattern) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Create a number formatter - * @link http://php.net/manual/en/numberformatter.create.php - * @param string $locale

- * Locale in which the number would be formatted (locale name, e.g. en_CA). - *

- * @param int $style

- * Style of the formatting, one of the - * format style constants. If - * NumberFormatter::PATTERN_DECIMAL - * or NumberFormatter::PATTERN_RULEBASED - * is passed then the number format is opened using the given pattern, - * which must conform to the syntax described in - * ICU DecimalFormat - * documentation or - * ICU RuleBasedNumberFormat - * documentation, respectively. - *

- * @param string $pattern [optional]

- * Pattern string if the chosen style requires a pattern. - *

- * @return NumberFormatter NumberFormatter object or FALSE on error. - */ - public static function create ($locale, $style, $pattern = null) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Format a number - * @link http://php.net/manual/en/numberformatter.format.php - * @param number $value

- * The value to format. Can be integer or float, - * other values will be converted to a numeric value. - *

- * @param int $type [optional]

- * The - * formatting type to use. - *

- * @return string the string containing formatted value, or FALSE on error. - */ - public function format ($value, $type = null) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Parse a number - * @link http://php.net/manual/en/numberformatter.parse.php - * @param string $value - * @param int $type [optional]

- * The - * formatting type to use. By default, - * NumberFormatter::TYPE_DOUBLE is used. - *

- * @param int $position [optional]

- * Offset in the string at which to begin parsing. On return, this value - * will hold the offset at which parsing ended. - *

- * @return mixed The value of the parsed number or FALSE on error. - */ - public function parse ($value, $type = null, &$position = null) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Format a currency value - * @link http://php.net/manual/en/numberformatter.formatcurrency.php - * @param float $value

- * The numeric currency value. - *

- * @param string $currency

- * The 3-letter ISO 4217 currency code indicating the currency to use. - *

- * @return string String representing the formatted currency value. - */ - public function formatCurrency ($value, $currency) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Parse a currency number - * @link http://php.net/manual/en/numberformatter.parsecurrency.php - * @param string $value - * @param string $currency

- * Parameter to receive the currency name (3-letter ISO 4217 currency - * code). - *

- * @param int $position [optional]

- * Offset in the string at which to begin parsing. On return, this value - * will hold the offset at which parsing ended. - *

- * @return float The parsed numeric value or FALSE on error. - */ - public function parseCurrency ($value, &$currency, &$position = null) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Set an attribute - * @link http://php.net/manual/en/numberformatter.setattribute.php - * @param int $attr

- * Attribute specifier - one of the - * numeric attribute constants. - *

- * @param int $value

- * The attribute value. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setAttribute ($attr, $value) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get an attribute - * @link http://php.net/manual/en/numberformatter.getattribute.php - * @param int $attr

- * Attribute specifier - one of the - * numeric attribute constants. - *

- * @return int Return attribute value on success, or FALSE on error. - */ - public function getAttribute ($attr) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Set a text attribute - * @link http://php.net/manual/en/numberformatter.settextattribute.php - * @param int $attr

- * Attribute specifier - one of the - * text attribute - * constants. - *

- * @param string $value

- * Text for the attribute value. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setTextAttribute ($attr, $value) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get a text attribute - * @link http://php.net/manual/en/numberformatter.gettextattribute.php - * @param int $attr

- * Attribute specifier - one of the - * text attribute constants. - *

- * @return string Return attribute value on success, or FALSE on error. - */ - public function getTextAttribute ($attr) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Set a symbol value - * @link http://php.net/manual/en/numberformatter.setsymbol.php - * @param int $attr

- * Symbol specifier, one of the - * format symbol constants. - *

- * @param string $value

- * Text for the symbol. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setSymbol ($attr, $value) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get a symbol value - * @link http://php.net/manual/en/numberformatter.getsymbol.php - * @param int $attr

- * Symbol specifier, one of the - * format symbol constants. - *

- * @return string The symbol string or FALSE on error. - */ - public function getSymbol ($attr) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Set formatter pattern - * @link http://php.net/manual/en/numberformatter.setpattern.php - * @param string $pattern

- * Pattern in syntax described in - * ICU DecimalFormat - * documentation. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setPattern ($pattern) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get formatter pattern - * @link http://php.net/manual/en/numberformatter.getpattern.php - * @return string Pattern string that is used by the formatter, or FALSE if an error happens. - */ - public function getPattern () {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get formatter locale - * @link http://php.net/manual/en/numberformatter.getlocale.php - * @param int $type [optional]

- * You can choose between valid and actual locale ( - * Locale::VALID_LOCALE, - * Locale::ACTUAL_LOCALE, - * respectively). The default is the actual locale. - *

- * @return string The locale name used to create the formatter. - */ - public function getLocale ($type = null) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get formatter's last error code. - * @link http://php.net/manual/en/numberformatter.geterrorcode.php - * @return int error code from last formatter call. - */ - public function getErrorCode () {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get formatter's last error message. - * @link http://php.net/manual/en/numberformatter.geterrormessage.php - * @return string error message from last formatter call. - */ - public function getErrorMessage () {} - -} - -class Normalizer { - - /** - * No decomposition/composition - * @link http://php.net/manual/en/intl.normalizer-constants.php - */ - const NONE = 1; - - /** - * Normalization Form D (NFD) - Canonical Decomposition - * @link http://php.net/manual/en/intl.normalizer-constants.php - */ - const FORM_D = 2; - const NFD = 2; - - /** - * Normalization Form KD (NFKD) - Compatibility Decomposition - * @link http://php.net/manual/en/intl.normalizer-constants.php - */ - const FORM_KD = 3; - const NFKD = 3; - - /** - * Normalization Form C (NFC) - Canonical Decomposition followed by - * Canonical Composition - * @link http://php.net/manual/en/intl.normalizer-constants.php - */ - const FORM_C = 4; - const NFC = 4; - - /** - * Normalization Form KC (NFKC) - Compatibility Decomposition, followed by - * Canonical Composition - * @link http://php.net/manual/en/intl.normalizer-constants.php - */ - const FORM_KC = 5; - const NFKC = 5; - - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Normalizes the input provided and returns the normalized string - * @link http://php.net/manual/en/normalizer.normalize.php - * @param string $input

The input string to normalize

- * @param string $form [optional]

One of the normalization forms.

- * @return string The normalized string or NULL if an error occurred. - */ - public static function normalize ($input, $form = 'Normalizer::FORM_C') {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Checks if the provided string is already in the specified normalization -form. - * @link http://php.net/manual/en/normalizer.isnormalized.php - * @param string $input

The input string to normalize

- * @param string $form [optional]

- * One of the normalization forms. - *

- * @return bool TRUE if normalized, FALSE otherwise or if there an error - */ - public static function isNormalized ($input, $form = 'Normalizer::FORM_C') {} - -} - -class Locale { - - /** - * This is locale the data actually comes from. - * @link http://php.net/manual/en/intl.locale-constants.php - */ - const ACTUAL_LOCALE = 0; - - /** - * This is the most specific locale supported by ICU. - * @link http://php.net/manual/en/intl.locale-constants.php - */ - const VALID_LOCALE = 1; - - /** - * Used as locale parameter with the methods of the various locale affected classes, - * such as NumberFormatter. This constant would make the methods to use default - * locale. - * @link http://php.net/manual/en/intl.locale-constants.php - */ - const DEFAULT_LOCALE = null; - - /** - * Language subtag - * @link http://php.net/manual/en/intl.locale-constants.php - */ - const LANG_TAG = "language"; - - /** - * Extended language subtag - * @link http://php.net/manual/en/intl.locale-constants.php - */ - const EXTLANG_TAG = "extlang"; - - /** - * Script subtag - * @link http://php.net/manual/en/intl.locale-constants.php - */ - const SCRIPT_TAG = "script"; - - /** - * Region subtag - * @link http://php.net/manual/en/intl.locale-constants.php - */ - const REGION_TAG = "region"; - - /** - * Variant subtag - * @link http://php.net/manual/en/intl.locale-constants.php - */ - const VARIANT_TAG = "variant"; - - /** - * Grandfathered Language subtag - * @link http://php.net/manual/en/intl.locale-constants.php - */ - const GRANDFATHERED_LANG_TAG = "grandfathered"; - - /** - * Private subtag - * @link http://php.net/manual/en/intl.locale-constants.php - */ - const PRIVATE_TAG = "private"; - - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Gets the default locale value from the INTL global 'default_locale' - * @link http://php.net/manual/en/locale.getdefault.php - * @return string The current runtime locale - */ - public static function getDefault () {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * sets the default runtime locale - * @link http://php.net/manual/en/locale.setdefault.php - * @param string $locale

- * Is a BCP 47 compliant language tag containing the - *

- * @return bool TRUE on success or FALSE on failure. - */ - public static function setDefault ($locale) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Gets the primary language for the input locale - * @link http://php.net/manual/en/locale.getprimarylanguage.php - * @param string $locale

- * The locale to extract the primary language code from - *

- * @return string The language code associated with the language or NULL in case of error. - */ - public static function getPrimaryLanguage ($locale) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Gets the script for the input locale - * @link http://php.net/manual/en/locale.getscript.php - * @param string $locale

- * The locale to extract the script code from - *

- * @return string The script subtag for the locale or NULL if not present - */ - public static function getScript ($locale) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Gets the region for the input locale - * @link http://php.net/manual/en/locale.getregion.php - * @param string $locale

- * The locale to extract the region code from - *

- * @return string The region subtag for the locale or NULL if not present - */ - public static function getRegion ($locale) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Gets the keywords for the input locale - * @link http://php.net/manual/en/locale.getkeywords.php - * @param string $locale

- * The locale to extract the keywords from - *

- * @return array Associative array containing the keyword-value pairs for this locale - */ - public static function getKeywords ($locale) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Returns an appropriately localized display name for script of the input locale - * @link http://php.net/manual/en/locale.getdisplayscript.php - * @param string $locale

- * The locale to return a display script for - *

- * @param string $in_locale [optional]

- * Optional format locale to use to display the script name - *

- * @return string Display name of the script for the $locale in the format appropriate for - * $in_locale. - */ - public static function getDisplayScript ($locale, $in_locale = null) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Returns an appropriately localized display name for region of the input locale - * @link http://php.net/manual/en/locale.getdisplayregion.php - * @param string $locale

- * The locale to return a display region for. - *

- * @param string $in_locale [optional]

- * Optional format locale to use to display the region name - *

- * @return string display name of the region for the $locale in the format appropriate for - * $in_locale. - */ - public static function getDisplayRegion ($locale, $in_locale = null) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Returns an appropriately localized display name for the input locale - * @link http://php.net/manual/en/locale.getdisplayname.php - * @param string $locale

- * The locale to return a display name for. - *

- * @param string $in_locale [optional]

optional format locale

- * @return string Display name of the locale in the format appropriate for $in_locale. - */ - public static function getDisplayName ($locale, $in_locale = null) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Returns an appropriately localized display name for language of the inputlocale - * @link http://php.net/manual/en/locale.getdisplaylanguage.php - * @param string $locale

- * The locale to return a display language for - *

- * @param string $in_locale [optional]

- * Optional format locale to use to display the language name - *

- * @return string display name of the language for the $locale in the format appropriate for - * $in_locale. - */ - public static function getDisplayLanguage ($locale, $in_locale = null) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Returns an appropriately localized display name for variants of the input locale - * @link http://php.net/manual/en/locale.getdisplayvariant.php - * @param string $locale

- * The locale to return a display variant for - *

- * @param string $in_locale [optional]

- * Optional format locale to use to display the variant name - *

- * @return string Display name of the variant for the $locale in the format appropriate for - * $in_locale. - */ - public static function getDisplayVariant ($locale, $in_locale = null) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Returns a correctly ordered and delimited locale ID - * @link http://php.net/manual/en/locale.composelocale.php - * @param array $subtags

- * an array containing a list of key-value pairs, where the keys identify - * the particular locale ID subtags, and the values are the associated - * subtag values. - *

- * The 'variant' and 'private' subtags can take maximum 15 values - * whereas 'extlang' can take maximum 3 values.e.g. Variants are allowed - * with the suffix ranging from 0-14. Hence the keys for the input array - * can be variant0, variant1, ...,variant14. In the returned locale id, - * the subtag is ordered by suffix resulting in variant0 followed by - * variant1 followed by variant2 and so on. - *

- *

- * The 'variant', 'private' and 'extlang' multiple values can be specified both - * as array under specific key (e.g. 'variant') and as multiple numbered keys - * (e.g. 'variant0', 'variant1', etc.). - *

- *

- * @return string The corresponding locale identifier. - */ - public static function composeLocale (array $subtags) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Returns a key-value array of locale ID subtag elements. - * @link http://php.net/manual/en/locale.parselocale.php - * @param string $locale

- * The locale to extract the subtag array from. Note: The 'variant' and - * 'private' subtags can take maximum 15 values whereas 'extlang' can take - * maximum 3 values. - *

- * @return array an array containing a list of key-value pairs, where the keys - * identify the particular locale ID subtags, and the values are the - * associated subtag values. The array will be ordered as the locale id - * subtags e.g. in the locale id if variants are '-varX-varY-varZ' then the - * returned array will have variant0=>varX , variant1=>varY , - * variant2=>varZ - */ - public static function parseLocale ($locale) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Gets the variants for the input locale - * @link http://php.net/manual/en/locale.getallvariants.php - * @param string $locale

- * The locale to extract the variants from - *

- * @return array The array containing the list of all variants subtag for the locale - * or NULL if not present - */ - public static function getAllVariants ($locale) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Checks if a language tag filter matches with locale - * @link http://php.net/manual/en/locale.filtermatches.php - * @param string $langtag

- * The language tag to check - *

- * @param string $locale

- * The language range to check against - *

- * @param bool $canonicalize [optional]

- * If true, the arguments will be converted to canonical form before - * matching. - *

- * @return bool TRUE if $locale matches $langtag FALSE otherwise. - */ - public static function filterMatches ($langtag, $locale, $canonicalize = false) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Searches the language tag list for the best match to the language - * @link http://php.net/manual/en/locale.lookup.php - * @param array $langtag

- * An array containing a list of language tags to compare to - * locale. Maximum 100 items allowed. - *

- * @param string $locale

- * The locale to use as the language range when matching. - *

- * @param bool $canonicalize [optional]

- * If true, the arguments will be converted to canonical form before - * matching. - *

- * @param string $default [optional]

- * The locale to use if no match is found. - *

- * @return string The closest matching language tag or default value. - */ - public static function lookup (array $langtag, $locale, $canonicalize = false, $default = null) {} - - /** - * @param $arg1 - */ - public static function canonicalize ($arg1) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Tries to find out best available locale based on HTTP "Accept-Language" header - * @link http://php.net/manual/en/locale.acceptfromhttp.php - * @param string $header

- * The string containing the "Accept-Language" header according to format in RFC 2616. - *

- * @return string The corresponding locale identifier. - */ - public static function acceptFromHttp ($header) {} - -} - -class MessageFormatter { - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Constructs a new Message Formatter - * @link http://php.net/manual/en/messageformatter.create.php - * @param string $locale

- * The locale to use when formatting arguments - *

- * @param string $pattern

- * The pattern string to stick arguments into. - * The pattern uses an 'apostrophe-friendly' syntax; it is run through - * umsg_autoQuoteApostrophe - * before being interpreted. - *

- */ - public function __construct ($locale, $pattern) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Constructs a new Message Formatter - * @link http://php.net/manual/en/messageformatter.create.php - * @param string $locale

- * The locale to use when formatting arguments - *

- * @param string $pattern

- * The pattern string to stick arguments into. - * The pattern uses an 'apostrophe-friendly' syntax; it is run through - * umsg_autoQuoteApostrophe - * before being interpreted. - *

- * @return MessageFormatter The formatter object - */ - public static function create ($locale, $pattern) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Format the message - * @link http://php.net/manual/en/messageformatter.format.php - * @param array $args

- * Arguments to insert into the format string - *

- * @return string The formatted string, or FALSE if an error occurred - */ - public function format (array $args) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Quick format message - * @link http://php.net/manual/en/messageformatter.formatmessage.php - * @param string $locale

- * The locale to use for formatting locale-dependent parts - *

- * @param string $pattern

- * The pattern string to insert things into. - * The pattern uses an 'apostrophe-friendly' syntax; it is run through - * umsg_autoQuoteApostrophe - * before being interpreted. - *

- * @param array $args

- * The array of values to insert into the format string - *

- * @return string The formatted pattern string or FALSE if an error occurred - */ - public static function formatMessage ($locale, $pattern, array $args) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Parse input string according to pattern - * @link http://php.net/manual/en/messageformatter.parse.php - * @param string $value

- * The string to parse - *

- * @return array An array containing the items extracted, or FALSE on error - */ - public function parse ($value) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Quick parse input string - * @link http://php.net/manual/en/messageformatter.parsemessage.php - * @param string $locale

- * The locale to use for parsing locale-dependent parts - *

- * @param string $pattern

- * The pattern with which to parse the value. - *

- * @param string $source

- * The string to parse, conforming to the pattern. - *

- * @return array An array containing items extracted, or FALSE on error - */ - public static function parseMessage ($locale, $pattern, $source) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Set the pattern used by the formatter - * @link http://php.net/manual/en/messageformatter.setpattern.php - * @param string $pattern

- * The pattern string to use in this message formatter. - * The pattern uses an 'apostrophe-friendly' syntax; it is run through - * umsg_autoQuoteApostrophe - * before being interpreted. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setPattern ($pattern) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the pattern used by the formatter - * @link http://php.net/manual/en/messageformatter.getpattern.php - * @return string The pattern string for this message formatter - */ - public function getPattern () {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the locale for which the formatter was created. - * @link http://php.net/manual/en/messageformatter.getlocale.php - * @return string The locale name - */ - public function getLocale () {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the error code from last operation - * @link http://php.net/manual/en/messageformatter.geterrorcode.php - * @return int The error code, one of UErrorCode values. Initial value is U_ZERO_ERROR. - */ - public function getErrorCode () {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the error text from the last operation - * @link http://php.net/manual/en/messageformatter.geterrormessage.php - * @return string Description of the last error. - */ - public function getErrorMessage () {} - -} - -class IntlDateFormatter { - - /** - * Completely specified style (Tuesday, April 12, 1952 AD or 3:30:42pm PST) - * @link http://php.net/manual/en/intl.intldateformatter-constants.php - */ - const FULL = 0; - - /** - * Long style (January 12, 1952 or 3:30:32pm) - * @link http://php.net/manual/en/intl.intldateformatter-constants.php - */ - const LONG = 1; - - /** - * Medium style (Jan 12, 1952) - * @link http://php.net/manual/en/intl.intldateformatter-constants.php - */ - const MEDIUM = 2; - - /** - * Most abbreviated style, only essential data (12/13/52 or 3:30pm) - * @link http://php.net/manual/en/intl.intldateformatter-constants.php - */ - const SHORT = 3; - - /** - * Do not include this element - * @link http://php.net/manual/en/intl.intldateformatter-constants.php - */ - const NONE = -1; - - /** - * Gregorian Calendar - * @link http://php.net/manual/en/intl.intldateformatter-constants.php - */ - const GREGORIAN = 1; - - /** - * Non-Gregorian Calendar - * @link http://php.net/manual/en/intl.intldateformatter-constants.php - */ - const TRADITIONAL = 0; - - - /** - * @param $locale - * @param $datetype - * @param $timetype - * @param $timezone [optional] - * @param $calendar [optional] - * @param $pattern [optional] - */ - public function __construct ($locale, $datetype, $timetype, $timezone, $calendar, $pattern) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Create a date formatter - * @link http://php.net/manual/en/intldateformatter.create.php - * @param string $locale

- * Locale to use when formatting or parsing. - *

- * @param int $datetype

- * Date type to use (none, - * short, medium, - * long, full). - * This is one of the - * IntlDateFormatter constants. - *

- * @param int $timetype

- * Time type to use (none, - * short, medium, - * long, full). - * This is one of the - * IntlDateFormatter constants. - *

- * @param string $timezone [optional]

- * Time zone ID, default is system default. - *

- * @param int $calendar [optional]

- * Calendar to use for formatting or parsing; default is Gregorian. - * This is one of the - * IntlDateFormatter calendar constants. - *

- * @param string $pattern [optional]

- * Optional pattern to use when formatting or parsing. - * Possible patterns are documented at http://userguide.icu-project.org/formatparse/datetime. - *

- * @return IntlDateFormatter - */ - public static function create ($locale, $datetype, $timetype, $timezone = null, $calendar = null, $pattern = null) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the datetype used for the IntlDateFormatter - * @link http://php.net/manual/en/intldateformatter.getdatetype.php - * @return int The current date type value of the formatter. - */ - public function getDateType () {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the timetype used for the IntlDateFormatter - * @link http://php.net/manual/en/intldateformatter.gettimetype.php - * @return int The current date type value of the formatter. - */ - public function getTimeType () {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the calendar used for the IntlDateFormatter - * @link http://php.net/manual/en/intldateformatter.getcalendar.php - * @return int The calendar being used by the formatter. - */ - public function getCalendar () {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * sets the calendar used to the appropriate calendar, which must be - * @link http://php.net/manual/en/intldateformatter.setcalendar.php - * @param int $which

- * The calendar to use. - * Default is IntlDateFormatter::GREGORIAN. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setCalendar ($which) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the timezone-id used for the IntlDateFormatter - * @link http://php.net/manual/en/intldateformatter.gettimezoneid.php - * @return string ID string for the time zone used by this formatter. - */ - public function getTimeZoneId () {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Sets the time zone to use - * @link http://php.net/manual/en/intldateformatter.settimezoneid.php - * @param string $zone

- * The time zone ID string of the time zone to use. - * If NULL or the empty string, the default time zone for the runtime is used. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setTimeZoneId ($zone) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Set the pattern used for the IntlDateFormatter - * @link http://php.net/manual/en/intldateformatter.setpattern.php - * @param string $pattern

- * New pattern string to use. - * Possible patterns are documented at http://userguide.icu-project.org/formatparse/datetime. - *

- * @return bool TRUE on success or FALSE on failure. - * Bad formatstrings are usually the cause of the failure. - */ - public function setPattern ($pattern) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the pattern used for the IntlDateFormatter - * @link http://php.net/manual/en/intldateformatter.getpattern.php - * @return string The pattern string being used to format/parse. - */ - public function getPattern () {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the locale used by formatter - * @link http://php.net/manual/en/intldateformatter.getlocale.php - * @param int $which [optional] - * @return string the locale of this formatter or 'false' if error - */ - public function getLocale ($which = null) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Set the leniency of the parser - * @link http://php.net/manual/en/intldateformatter.setlenient.php - * @param bool $lenient

- * Sets whether the parser is lenient or not, default is TRUE (lenient). - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setLenient ($lenient) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the lenient used for the IntlDateFormatter - * @link http://php.net/manual/en/intldateformatter.islenient.php - * @return bool TRUE if parser is lenient, FALSE if parser is strict. By default the parser is lenient. - */ - public function isLenient () {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Format the date/time value as a string - * @link http://php.net/manual/en/intldateformatter.format.php - * @param mixed $value

- * Value to format. This may be a DateTime object, - * an integer representing a Unix timestamp value (seconds - * since epoch, UTC) or an array in the format output by - * localtime. - *

- * @return string The formatted string or, if an error occurred, FALSE. - */ - public function format ($value) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Parse string to a timestamp value - * @link http://php.net/manual/en/intldateformatter.parse.php - * @param string $value

- * string to convert to a time - *

- * @param int $position [optional]

- * Position at which to start the parsing in $value (zero-based). - * If no error occurs before $value is consumed, $parse_pos will contain -1 - * otherwise it will contain the position at which parsing ended (and the error occurred). - * This variable will contain the end position if the parse fails. - * If $parse_pos > strlen($value), the parse fails immediately. - *

- * @return int timestamp parsed value - */ - public function parse ($value, &$position = null) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Parse string to a field-based time value - * @link http://php.net/manual/en/intldateformatter.localtime.php - * @param string $value

- * string to convert to a time - *

- * @param int $position [optional]

- * Position at which to start the parsing in $value (zero-based). - * If no error occurs before $value is consumed, $parse_pos will contain -1 - * otherwise it will contain the position at which parsing ended . - * If $parse_pos > strlen($value), the parse fails immediately. - *

- * @return array Localtime compatible array of integers : contains 24 hour clock value in tm_hour field - */ - public function localtime ($value, &$position = null) {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the error code from last operation - * @link http://php.net/manual/en/intldateformatter.geterrorcode.php - * @return int The error code, one of UErrorCode values. Initial value is U_ZERO_ERROR. - */ - public function getErrorCode () {} - - /** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the error text from the last operation. - * @link http://php.net/manual/en/intldateformatter.geterrormessage.php - * @return string Description of the last error. - */ - public function getErrorMessage () {} - -} - -class ResourceBundle implements Traversable { - - /** - * @param $locale - * @param $bundlename - * @param $fallback [optional] - */ - public function __construct ($locale, $bundlename, $fallback) {} - - /** - * (PHP >= 5.3.2, PECL intl >= 2.0.0)
- * Create a resource bundle - * @link http://php.net/manual/en/resourcebundle.create.php - * @param string $locale

- * Locale for which the resources should be loaded (locale name, e.g. en_CA). - *

- * @param string $bundlename

- * The directory where the data is stored or the name of the .dat file. - *

- * @param bool $fallback [optional]

- * Whether locale should match exactly or fallback to parent locale is allowed. - *

- * @return ResourceBundle ResourceBundle object or FALSE on error. - */ - public static function create ($locale, $bundlename, $fallback = null) {} - - /** - * (PHP >= 5.3.2, PECL intl >= 2.0.0)
- * Get data from the bundle - * @link http://php.net/manual/en/resourcebundle.get.php - * @param string|int $index

- * Data index, must be string or integer. - *

- * @return mixed the data located at the index or NULL on error. Strings, integers and binary data strings - * are returned as corresponding PHP types, integer array is returned as PHP array. Complex types are - * returned as ResourceBundle object. - */ - public function get ($index) {} - - /** - * (PHP >= 5.3.2, PECL intl >= 2.0.0)
- * Get number of elements in the bundle - * @link http://php.net/manual/en/resourcebundle.count.php - * @return int number of elements in the bundle. - */ - public function count () {} - - /** - * (PHP >= 5.3.2, PECL intl >= 2.0.0)
- * Get supported locales - * @link http://php.net/manual/en/resourcebundle.locales.php - * @param string $bundlename

- * Path of ResourceBundle for which to get available locales, or - * empty string for default locales list. - *

- * @return array the list of locales supported by the bundle. - */ - public static function getLocales ($bundlename) {} - - /** - * (PHP >= 5.3.2, PECL intl >= 2.0.0)
- * Get bundle's last error code. - * @link http://php.net/manual/en/resourcebundle.geterrorcode.php - * @return int error code from last bundle object call. - */ - public function getErrorCode () {} - - /** - * (PHP >= 5.3.2, PECL intl >= 2.0.0)
- * Get bundle's last error message. - * @link http://php.net/manual/en/resourcebundle.geterrormessage.php - * @return string error message from last bundle object's call. - */ - public function getErrorMessage () {} - -} - -class Transliterator { - const FORWARD = 0; - const REVERSE = 1; - - public $id; - - - /** - * (PHP >= 5.4.0, PECL intl >= 2.0.0)
- * Private constructor to deny instantiation - * @link http://php.net/manual/en/transliterator.construct.php - */ - final private function __construct () {} - - /** - * (PHP >= 5.4.0, PECL intl >= 2.0.0)
- * Create a transliterator - * @link http://php.net/manual/en/transliterator.create.php - * @param string $id

- * The id. - *

- * @param int $direction [optional]

- * The direction, defaults to - * >Transliterator::FORWARD. - * May also be set to - * Transliterator::REVERSE. - *

- * @return Transliterator a Transliterator object on success, - * or NULL on failure. - */ - public static function create ($id, $direction = null) {} - - /** - * (PHP >= 5.4.0, PECL intl >= 2.0.0)
- * Create transliterator from rules - * @link http://php.net/manual/en/transliterator.createfromrules.php - * @param string $rules

- * The rules. - *

- * @param string $direction [optional]

- * The direction, defaults to - * >Transliterator::FORWARD. - * May also be set to - * Transliterator::REVERSE. - *

- * @return Transliterator a Transliterator object on success, - * or NULL on failure. - */ - public static function createFromRules ($rules, $direction = null) {} - - /** - * (PHP >= 5.4.0, PECL intl >= 2.0.0)
- * Create an inverse transliterator - * @link http://php.net/manual/en/transliterator.createinverse.php - * @return Transliterator a Transliterator object on success, - * or NULL on failure - */ - public function createInverse () {} - - /** - * (PHP >= 5.4.0, PECL intl >= 2.0.0)
- * Get transliterator IDs - * @link http://php.net/manual/en/transliterator.listids.php - * @return array An array of registered transliterator IDs on success, - * or FALSE on failure. - */ - public static function listIDs () {} - - /** - * (PHP >= 5.4.0, PECL intl >= 2.0.0)
- * Transliterate a string - * @link http://php.net/manual/en/transliterator.transliterate.php - * @param string $subject

- * The string to be transformed. - *

- * @param int $start [optional]

- * The start index (in UTF-16 code units) from which the string will start - * to be transformed, inclusive. Indexing starts at 0. The text before will - * be left as is. - *

- * @param int $end [optional]

- * The end index (in UTF-16 code units) until which the string will be - * transformed, exclusive. Indexing starts at 0. The text after will be - * left as is. - *

- * @return string The transfomed string on success, or FALSE on failure. - */ - public function transliterate ($subject, $start = null, $end = null) {} - - /** - * (PHP >= 5.4.0, PECL intl >= 2.0.0)
- * Get last error code - * @link http://php.net/manual/en/transliterator.geterrorcode.php - * @return int The error code on success, - * or FALSE if none exists, or on failure. - */ - public function getErrorCode () {} - - /** - * (PHP >= 5.4.0, PECL intl >= 2.0.0)
- * Get last error message - * @link http://php.net/manual/en/transliterator.geterrormessage.php - * @return string The error code on success, - * or FALSE if none exists, or on failure. - */ - public function getErrorMessage () {} - -} - -/** - * @link http://php.net/manual/en/class.spoofchecker.php - */ -class Spoofchecker { - const SINGLE_SCRIPT_CONFUSABLE = 1; - const MIXED_SCRIPT_CONFUSABLE = 2; - const WHOLE_SCRIPT_CONFUSABLE = 4; - const ANY_CASE = 8; - const SINGLE_SCRIPT = 16; - const INVISIBLE = 32; - const CHAR_LIMIT = 64; - - - /** - * (PHP >= 5.4.0, PECL intl >= 2.0.0)
- * Constructor - * @link http://php.net/manual/en/spoofchecker.construct.php - */ - public function __construct () {} - - /** - * (PHP >= 5.4.0, PECL intl >= 2.0.0)
- * Checks if a given text contains any suspicious characters - * @link http://php.net/manual/en/spoofchecker.issuspicious.php - * @param string $text

- *

- * @param string $error [optional]

- *

- * @return bool - */ - public function isSuspicious ($text, &$error = null) {} - - /** - * (PHP >= 5.4.0, PECL intl >= 2.0.0)
- * Checks if a given text contains any confusable characters - * @link http://php.net/manual/en/spoofchecker.areconfusable.php - * @param string $s1

- *

- * @param string $s2

- *

- * @param string $error [optional]

- *

- * @return bool - */ - public function areConfusable ($s1, $s2, &$error = null) {} - - /** - * (PHP >= 5.4.0, PECL intl >= 2.0.0)
- * Locales to use when running checks - * @link http://php.net/manual/en/spoofchecker.setallowedlocales.php - * @param string $locale_list

- *

- * @return void - */ - public function setAllowedLocales ($locale_list) {} - - /** - * (PHP >= 5.4.0, PECL intl >= 2.0.0)
- * Set the checks to run - * @link http://php.net/manual/en/spoofchecker.setchecks.php - * @param string $checks

- *

- * @return void - */ - public function setChecks ($checks) {} - -} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Create a collator - * @link http://php.net/manual/en/collator.create.php - * @param string $locale

- * The locale containing the required collation rules. Special values for - * locales can be passed in - if null is passed for the locale, the - * default locale collation rules will be used. If empty string ("") or - * "root" are passed, UCA rules will be used. - *

- * @return Collator Return new instance of Collator object, or NULL - * on error. - */ -function collator_create ($locale) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Compare two Unicode strings - * @link http://php.net/manual/en/collator.compare.php - * @param string $str1

- * The first string to compare. - *

- * @param string $str2

- * The second string to compare. - *

- * @return int Return comparison result:

- *

- *

- * 1 if str1 is greater than - * str2 ; - *

- *

- * 0 if str1 is equal to - * str2; - *

- *

- * -1 if str1 is less than - * str2 . - *

- * On error - * boolean - * FALSE - * is returned. - */ -function collator_compare ($str1, $str2) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get collation attribute value - * @link http://php.net/manual/en/collator.getattribute.php - * @param int $attr

- * Attribute to get value for. - *

- * @return int Attribute value, or boolean FALSE on error. - */ -function collator_get_attribute ($attr) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Set collation attribute - * @link http://php.net/manual/en/collator.setattribute.php - * @param int $attr

Attribute.

- * @param int $val

- * Attribute value. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function collator_set_attribute ($attr, $val) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get current collation strength - * @link http://php.net/manual/en/collator.getstrength.php - * @param Collator $object - * @return int current collation strength, or boolean FALSE on error. - */ -function collator_get_strength (Collator $object) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Set collation strength - * @link http://php.net/manual/en/collator.setstrength.php - * @param int $strength

Strength to set.

- *

- * Possible values are: - *

- * Collator::PRIMARY - *

- * @return bool TRUE on success or FALSE on failure. - */ -function collator_set_strength ($strength) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Sort array using specified collator - * @link http://php.net/manual/en/collator.sort.php - * @param array $arr

- * Array of strings to sort. - *

- * @param int $sort_flag [optional]

- * Optional sorting type, one of the following: - *

- *

- *

- * Collator::SORT_REGULAR - * - compare items normally (don't change types) - *

- * @return bool TRUE on success or FALSE on failure. - */ -function collator_sort (array &$arr, $sort_flag = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Sort array using specified collator and sort keys - * @link http://php.net/manual/en/collator.sortwithsortkeys.php - * @param array $arr

Array of strings to sort

- * @return bool TRUE on success or FALSE on failure. - */ -function collator_sort_with_sort_keys (array &$arr) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Sort array maintaining index association - * @link http://php.net/manual/en/collator.asort.php - * @param array $arr

Array of strings to sort.

- * @param int $sort_flag [optional]

- * Optional sorting type, one of the following: - *

- * Collator::SORT_REGULAR - * - compare items normally (don't change types) - *

- * @return bool TRUE on success or FALSE on failure. - */ -function collator_asort (array &$arr, $sort_flag = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the locale name of the collator - * @link http://php.net/manual/en/collator.getlocale.php - * @param int $type [optional]

- * You can choose between valid and actual locale ( - * Locale::VALID_LOCALE and - * Locale::ACTUAL_LOCALE, - * respectively). The default is the actual locale. - *

- * @return string Real locale name from which the collation data comes. If the collator was - * instantiated from rules or an error occurred, returns - * boolean FALSE. - */ -function collator_get_locale ($type = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get collator's last error code - * @link http://php.net/manual/en/collator.geterrorcode.php - * @param Collator $object - * @return int Error code returned by the last Collator API function call. - */ -function collator_get_error_code (Collator $object) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get text for collator's last error code - * @link http://php.net/manual/en/collator.geterrormessage.php - * @param Collator $object - * @return string Description of an error occurred in the last Collator API function call. - */ -function collator_get_error_message (Collator $object) {} - -/** - * (No version information available, might only be in SVN)
- * Get sorting key for a string - * @link http://php.net/manual/en/collator.getsortkey.php - * @param string $str

- * The string to produce the key from. - *

- * @return string the collation key for the string. Collation keys can be compared directly instead of strings. - */ -function collator_get_sort_key ($str) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Create a number formatter - * @link http://php.net/manual/en/numberformatter.create.php - * @param string $locale

- * Locale in which the number would be formatted (locale name, e.g. en_CA). - *

- * @param int $style

- * Style of the formatting, one of the - * format style constants. If - * NumberFormatter::PATTERN_DECIMAL - * or NumberFormatter::PATTERN_RULEBASED - * is passed then the number format is opened using the given pattern, - * which must conform to the syntax described in - * ICU DecimalFormat - * documentation or - * ICU RuleBasedNumberFormat - * documentation, respectively. - *

- * @param string $pattern [optional]

- * Pattern string if the chosen style requires a pattern. - *

- * @return NumberFormatter NumberFormatter object or FALSE on error. - */ -function numfmt_create ($locale, $style, $pattern = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Format a number - * @link http://php.net/manual/en/numberformatter.format.php - * @param number $value

- * The value to format. Can be integer or float, - * other values will be converted to a numeric value. - *

- * @param int $type [optional]

- * The - * formatting type to use. - *

- * @return string the string containing formatted value, or FALSE on error. - */ -function numfmt_format ($value, $type = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Parse a number - * @link http://php.net/manual/en/numberformatter.parse.php - * @param string $value - * @param int $type [optional]

- * The - * formatting type to use. By default, - * NumberFormatter::TYPE_DOUBLE is used. - *

- * @param int $position [optional]

- * Offset in the string at which to begin parsing. On return, this value - * will hold the offset at which parsing ended. - *

- * @return mixed The value of the parsed number or FALSE on error. - */ -function numfmt_parse ($value, $type = null, &$position = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Format a currency value - * @link http://php.net/manual/en/numberformatter.formatcurrency.php - * @param float $value

- * The numeric currency value. - *

- * @param string $currency

- * The 3-letter ISO 4217 currency code indicating the currency to use. - *

- * @return string String representing the formatted currency value. - */ -function numfmt_format_currency ($value, $currency) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Parse a currency number - * @link http://php.net/manual/en/numberformatter.parsecurrency.php - * @param string $value - * @param string $currency

- * Parameter to receive the currency name (3-letter ISO 4217 currency - * code). - *

- * @param int $position [optional]

- * Offset in the string at which to begin parsing. On return, this value - * will hold the offset at which parsing ended. - *

- * @return float The parsed numeric value or FALSE on error. - */ -function numfmt_parse_currency ($value, &$currency, &$position = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Set an attribute - * @link http://php.net/manual/en/numberformatter.setattribute.php - * @param int $attr

- * Attribute specifier - one of the - * numeric attribute constants. - *

- * @param int $value

- * The attribute value. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function numfmt_set_attribute ($attr, $value) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get an attribute - * @link http://php.net/manual/en/numberformatter.getattribute.php - * @param int $attr

- * Attribute specifier - one of the - * numeric attribute constants. - *

- * @return int Return attribute value on success, or FALSE on error. - */ -function numfmt_get_attribute ($attr) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Set a text attribute - * @link http://php.net/manual/en/numberformatter.settextattribute.php - * @param int $attr

- * Attribute specifier - one of the - * text attribute - * constants. - *

- * @param string $value

- * Text for the attribute value. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function numfmt_set_text_attribute ($attr, $value) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get a text attribute - * @link http://php.net/manual/en/numberformatter.gettextattribute.php - * @param int $attr

- * Attribute specifier - one of the - * text attribute constants. - *

- * @return string Return attribute value on success, or FALSE on error. - */ -function numfmt_get_text_attribute ($attr) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Set a symbol value - * @link http://php.net/manual/en/numberformatter.setsymbol.php - * @param int $attr

- * Symbol specifier, one of the - * format symbol constants. - *

- * @param string $value

- * Text for the symbol. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function numfmt_set_symbol ($attr, $value) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get a symbol value - * @link http://php.net/manual/en/numberformatter.getsymbol.php - * @param int $attr

- * Symbol specifier, one of the - * format symbol constants. - *

- * @return string The symbol string or FALSE on error. - */ -function numfmt_get_symbol ($attr) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Set formatter pattern - * @link http://php.net/manual/en/numberformatter.setpattern.php - * @param string $pattern

- * Pattern in syntax described in - * ICU DecimalFormat - * documentation. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function numfmt_set_pattern ($pattern) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get formatter pattern - * @link http://php.net/manual/en/numberformatter.getpattern.php - * @param $nf - * @return string Pattern string that is used by the formatter, or FALSE if an error happens. - */ -function numfmt_get_pattern ($nf) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get formatter locale - * @link http://php.net/manual/en/numberformatter.getlocale.php - * @param int $type [optional]

- * You can choose between valid and actual locale ( - * Locale::VALID_LOCALE, - * Locale::ACTUAL_LOCALE, - * respectively). The default is the actual locale. - *

- * @return string The locale name used to create the formatter. - */ -function numfmt_get_locale ($type = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get formatter's last error code. - * @link http://php.net/manual/en/numberformatter.geterrorcode.php - * @param $nf - * @return int error code from last formatter call. - */ -function numfmt_get_error_code ($nf) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get formatter's last error message. - * @link http://php.net/manual/en/numberformatter.geterrormessage.php - * @param $nf - * @return string error message from last formatter call. - */ -function numfmt_get_error_message ($nf) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Normalizes the input provided and returns the normalized string - * @link http://php.net/manual/en/normalizer.normalize.php - * @param string $input

The input string to normalize

- * @param string $form [optional]

One of the normalization forms.

- * @return string The normalized string or NULL if an error occurred. - */ -function normalizer_normalize ($input, $form = 'Normalizer::FORM_C') {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Checks if the provided string is already in the specified normalization -form. - * @link http://php.net/manual/en/normalizer.isnormalized.php - * @param string $input

The input string to normalize

- * @param string $form [optional]

- * One of the normalization forms. - *

- * @return bool TRUE if normalized, FALSE otherwise or if there an error - */ -function normalizer_is_normalized ($input, $form = 'Normalizer::FORM_C') {} - -/** - * Get the default Locale - * @link http://php.net/manual/en/function.locale-get-default.php - * @return string a string with the current Locale. - */ -function locale_get_default () {} - -/** - * Set the default Locale - * @link http://php.net/manual/en/function.locale-set-default.php - * @param string $name

- * The new Locale name. A comprehensive list of the supported locales is - * available at . - *

- * @return bool TRUE on success or FALSE on failure. - */ -function locale_set_default ($name) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Gets the primary language for the input locale - * @link http://php.net/manual/en/locale.getprimarylanguage.php - * @param string $locale

- * The locale to extract the primary language code from - *

- * @return string The language code associated with the language or NULL in case of error. - */ -function locale_get_primary_language ($locale) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Gets the script for the input locale - * @link http://php.net/manual/en/locale.getscript.php - * @param string $locale

- * The locale to extract the script code from - *

- * @return string The script subtag for the locale or NULL if not present - */ -function locale_get_script ($locale) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Gets the region for the input locale - * @link http://php.net/manual/en/locale.getregion.php - * @param string $locale

- * The locale to extract the region code from - *

- * @return string The region subtag for the locale or NULL if not present - */ -function locale_get_region ($locale) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Gets the keywords for the input locale - * @link http://php.net/manual/en/locale.getkeywords.php - * @param string $locale

- * The locale to extract the keywords from - *

- * @return array Associative array containing the keyword-value pairs for this locale - */ -function locale_get_keywords ($locale) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Returns an appropriately localized display name for script of the input locale - * @link http://php.net/manual/en/locale.getdisplayscript.php - * @param string $locale

- * The locale to return a display script for - *

- * @param string $in_locale [optional]

- * Optional format locale to use to display the script name - *

- * @return string Display name of the script for the $locale in the format appropriate for - * $in_locale. - */ -function locale_get_display_script ($locale, $in_locale = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Returns an appropriately localized display name for region of the input locale - * @link http://php.net/manual/en/locale.getdisplayregion.php - * @param string $locale

- * The locale to return a display region for. - *

- * @param string $in_locale [optional]

- * Optional format locale to use to display the region name - *

- * @return string display name of the region for the $locale in the format appropriate for - * $in_locale. - */ -function locale_get_display_region ($locale, $in_locale = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Returns an appropriately localized display name for the input locale - * @link http://php.net/manual/en/locale.getdisplayname.php - * @param string $locale

- * The locale to return a display name for. - *

- * @param string $in_locale [optional]

optional format locale

- * @return string Display name of the locale in the format appropriate for $in_locale. - */ -function locale_get_display_name ($locale, $in_locale = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Returns an appropriately localized display name for language of the inputlocale - * @link http://php.net/manual/en/locale.getdisplaylanguage.php - * @param string $locale

- * The locale to return a display language for - *

- * @param string $in_locale [optional]

- * Optional format locale to use to display the language name - *

- * @return string display name of the language for the $locale in the format appropriate for - * $in_locale. - */ -function locale_get_display_language ($locale, $in_locale = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Returns an appropriately localized display name for variants of the input locale - * @link http://php.net/manual/en/locale.getdisplayvariant.php - * @param string $locale

- * The locale to return a display variant for - *

- * @param string $in_locale [optional]

- * Optional format locale to use to display the variant name - *

- * @return string Display name of the variant for the $locale in the format appropriate for - * $in_locale. - */ -function locale_get_display_variant ($locale, $in_locale = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Returns a correctly ordered and delimited locale ID - * @link http://php.net/manual/en/locale.composelocale.php - * @param array $subtags

- * an array containing a list of key-value pairs, where the keys identify - * the particular locale ID subtags, and the values are the associated - * subtag values. - *

- * The 'variant' and 'private' subtags can take maximum 15 values - * whereas 'extlang' can take maximum 3 values.e.g. Variants are allowed - * with the suffix ranging from 0-14. Hence the keys for the input array - * can be variant0, variant1, ...,variant14. In the returned locale id, - * the subtag is ordered by suffix resulting in variant0 followed by - * variant1 followed by variant2 and so on. - *

- *

- * The 'variant', 'private' and 'extlang' multiple values can be specified both - * as array under specific key (e.g. 'variant') and as multiple numbered keys - * (e.g. 'variant0', 'variant1', etc.). - *

- *

- * @return string The corresponding locale identifier. - */ -function locale_compose (array $subtags) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Returns a key-value array of locale ID subtag elements. - * @link http://php.net/manual/en/locale.parselocale.php - * @param string $locale

- * The locale to extract the subtag array from. Note: The 'variant' and - * 'private' subtags can take maximum 15 values whereas 'extlang' can take - * maximum 3 values. - *

- * @return array an array containing a list of key-value pairs, where the keys - * identify the particular locale ID subtags, and the values are the - * associated subtag values. The array will be ordered as the locale id - * subtags e.g. in the locale id if variants are '-varX-varY-varZ' then the - * returned array will have variant0=>varX , variant1=>varY , - * variant2=>varZ - */ -function locale_parse ($locale) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Gets the variants for the input locale - * @link http://php.net/manual/en/locale.getallvariants.php - * @param string $locale

- * The locale to extract the variants from - *

- * @return array The array containing the list of all variants subtag for the locale - * or NULL if not present - */ -function locale_get_all_variants ($locale) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Checks if a language tag filter matches with locale - * @link http://php.net/manual/en/locale.filtermatches.php - * @param string $langtag

- * The language tag to check - *

- * @param string $locale

- * The language range to check against - *

- * @param bool $canonicalize [optional]

- * If true, the arguments will be converted to canonical form before - * matching. - *

- * @return bool TRUE if $locale matches $langtag FALSE otherwise. - */ -function locale_filter_matches ($langtag, $locale, $canonicalize = false) {} - -/** - * @param $arg1 - */ -function locale_canonicalize ($arg1) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Searches the language tag list for the best match to the language - * @link http://php.net/manual/en/locale.lookup.php - * @param array $langtag

- * An array containing a list of language tags to compare to - * locale. Maximum 100 items allowed. - *

- * @param string $locale

- * The locale to use as the language range when matching. - *

- * @param bool $canonicalize [optional]

- * If true, the arguments will be converted to canonical form before - * matching. - *

- * @param string $default [optional]

- * The locale to use if no match is found. - *

- * @return string The closest matching language tag or default value. - */ -function locale_lookup (array $langtag, $locale, $canonicalize = false, $default = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Tries to find out best available locale based on HTTP "Accept-Language" header - * @link http://php.net/manual/en/locale.acceptfromhttp.php - * @param string $header

- * The string containing the "Accept-Language" header according to format in RFC 2616. - *

- * @return string The corresponding locale identifier. - */ -function locale_accept_from_http ($header) {} - -/** - * @param $locale - * @param $pattern - */ -function msgfmt_create ($locale, $pattern) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Format the message - * @link http://php.net/manual/en/messageformatter.format.php - * @param array $args

- * Arguments to insert into the format string - *

- * @return string The formatted string, or FALSE if an error occurred - */ -function msgfmt_format (array $args) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Quick format message - * @link http://php.net/manual/en/messageformatter.formatmessage.php - * @param string $locale

- * The locale to use for formatting locale-dependent parts - *

- * @param string $pattern

- * The pattern string to insert things into. - * The pattern uses an 'apostrophe-friendly' syntax; it is run through - * umsg_autoQuoteApostrophe - * before being interpreted. - *

- * @param array $args

- * The array of values to insert into the format string - *

- * @return string The formatted pattern string or FALSE if an error occurred - */ -function msgfmt_format_message ($locale, $pattern, array $args) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Parse input string according to pattern - * @link http://php.net/manual/en/messageformatter.parse.php - * @param string $value

- * The string to parse - *

- * @return array An array containing the items extracted, or FALSE on error - */ -function msgfmt_parse ($value) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Quick parse input string - * @link http://php.net/manual/en/messageformatter.parsemessage.php - * @param string $locale

- * The locale to use for parsing locale-dependent parts - *

- * @param string $pattern

- * The pattern with which to parse the value. - *

- * @param string $source

- * The string to parse, conforming to the pattern. - *

- * @return array An array containing items extracted, or FALSE on error - */ -function msgfmt_parse_message ($locale, $pattern, $source) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Set the pattern used by the formatter - * @link http://php.net/manual/en/messageformatter.setpattern.php - * @param string $pattern

- * The pattern string to use in this message formatter. - * The pattern uses an 'apostrophe-friendly' syntax; it is run through - * umsg_autoQuoteApostrophe - * before being interpreted. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function msgfmt_set_pattern ($pattern) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the pattern used by the formatter - * @link http://php.net/manual/en/messageformatter.getpattern.php - * @param $mf - * @return string The pattern string for this message formatter - */ -function msgfmt_get_pattern ($mf) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the locale for which the formatter was created. - * @link http://php.net/manual/en/messageformatter.getlocale.php - * @param $mf - * @return string The locale name - */ -function msgfmt_get_locale ($mf) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the error code from last operation - * @link http://php.net/manual/en/messageformatter.geterrorcode.php - * @param $nf - * @return int The error code, one of UErrorCode values. Initial value is U_ZERO_ERROR. - */ -function msgfmt_get_error_code ($nf) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the error text from the last operation - * @link http://php.net/manual/en/messageformatter.geterrormessage.php - * @param $coll - * @return string Description of the last error. - */ -function msgfmt_get_error_message ($coll) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Create a date formatter - * @link http://php.net/manual/en/intldateformatter.create.php - * @param string $locale

- * Locale to use when formatting or parsing. - *

- * @param int $datetype

- * Date type to use (none, - * short, medium, - * long, full). - * This is one of the - * IntlDateFormatter constants. - *

- * @param int $timetype

- * Time type to use (none, - * short, medium, - * long, full). - * This is one of the - * IntlDateFormatter constants. - *

- * @param string $timezone [optional]

- * Time zone ID, default is system default. - *

- * @param int $calendar [optional]

- * Calendar to use for formatting or parsing; default is Gregorian. - * This is one of the - * IntlDateFormatter calendar constants. - *

- * @param string $pattern [optional]

- * Optional pattern to use when formatting or parsing. - * Possible patterns are documented at http://userguide.icu-project.org/formatparse/datetime. - *

- * @return IntlDateFormatter - */ -function datefmt_create ($locale, $datetype, $timetype, $timezone = null, $calendar = null, $pattern = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the datetype used for the IntlDateFormatter - * @link http://php.net/manual/en/intldateformatter.getdatetype.php - * @param $mf - * @return int The current date type value of the formatter. - */ -function datefmt_get_datetype ($mf) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the timetype used for the IntlDateFormatter - * @link http://php.net/manual/en/intldateformatter.gettimetype.php - * @param $mf - * @return int The current date type value of the formatter. - */ -function datefmt_get_timetype ($mf) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the calendar used for the IntlDateFormatter - * @link http://php.net/manual/en/intldateformatter.getcalendar.php - * @param $mf - * @return int The calendar being used by the formatter. - */ -function datefmt_get_calendar ($mf) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * sets the calendar used to the appropriate calendar, which must be - * @link http://php.net/manual/en/intldateformatter.setcalendar.php - * @param int $which

- * The calendar to use. - * Default is IntlDateFormatter::GREGORIAN. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function datefmt_set_calendar ($which) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the locale used by formatter - * @link http://php.net/manual/en/intldateformatter.getlocale.php - * @param int $which [optional] - * @return string the locale of this formatter or 'false' if error - */ -function datefmt_get_locale ($which = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the timezone-id used for the IntlDateFormatter - * @link http://php.net/manual/en/intldateformatter.gettimezoneid.php - * @param $mf - * @return string ID string for the time zone used by this formatter. - */ -function datefmt_get_timezone_id ($mf) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Sets the time zone to use - * @link http://php.net/manual/en/intldateformatter.settimezoneid.php - * @param string $zone

- * The time zone ID string of the time zone to use. - * If NULL or the empty string, the default time zone for the runtime is used. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function datefmt_set_timezone_id ($zone) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the pattern used for the IntlDateFormatter - * @link http://php.net/manual/en/intldateformatter.getpattern.php - * @param $mf - * @return string The pattern string being used to format/parse. - */ -function datefmt_get_pattern ($mf) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Set the pattern used for the IntlDateFormatter - * @link http://php.net/manual/en/intldateformatter.setpattern.php - * @param string $pattern

- * New pattern string to use. - * Possible patterns are documented at http://userguide.icu-project.org/formatparse/datetime. - *

- * @return bool TRUE on success or FALSE on failure. - * Bad formatstrings are usually the cause of the failure. - */ -function datefmt_set_pattern ($pattern) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the lenient used for the IntlDateFormatter - * @link http://php.net/manual/en/intldateformatter.islenient.php - * @param $mf - * @return bool TRUE if parser is lenient, FALSE if parser is strict. By default the parser is lenient. - */ -function datefmt_is_lenient ($mf) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Set the leniency of the parser - * @link http://php.net/manual/en/intldateformatter.setlenient.php - * @param bool $lenient

- * Sets whether the parser is lenient or not, default is TRUE (lenient). - *

- * @return bool TRUE on success or FALSE on failure. - */ -function datefmt_set_lenient ($lenient) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Format the date/time value as a string - * @link http://php.net/manual/en/intldateformatter.format.php - * @param mixed $value

- * Value to format. This may be a DateTime object, - * an integer representing a Unix timestamp value (seconds - * since epoch, UTC) or an array in the format output by - * localtime. - *

- * @return string The formatted string or, if an error occurred, FALSE. - */ -function datefmt_format ($value) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Parse string to a timestamp value - * @link http://php.net/manual/en/intldateformatter.parse.php - * @param string $value

- * string to convert to a time - *

- * @param int $position [optional]

- * Position at which to start the parsing in $value (zero-based). - * If no error occurs before $value is consumed, $parse_pos will contain -1 - * otherwise it will contain the position at which parsing ended (and the error occurred). - * This variable will contain the end position if the parse fails. - * If $parse_pos > strlen($value), the parse fails immediately. - *

- * @return int timestamp parsed value - */ -function datefmt_parse ($value, &$position = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Parse string to a field-based time value - * @link http://php.net/manual/en/intldateformatter.localtime.php - * @param string $value

- * string to convert to a time - *

- * @param int $position [optional]

- * Position at which to start the parsing in $value (zero-based). - * If no error occurs before $value is consumed, $parse_pos will contain -1 - * otherwise it will contain the position at which parsing ended . - * If $parse_pos > strlen($value), the parse fails immediately. - *

- * @return array Localtime compatible array of integers : contains 24 hour clock value in tm_hour field - */ -function datefmt_localtime ($value, &$position = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the error code from last operation - * @link http://php.net/manual/en/intldateformatter.geterrorcode.php - * @param $nf - * @return int The error code, one of UErrorCode values. Initial value is U_ZERO_ERROR. - */ -function datefmt_get_error_code ($nf) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the error text from the last operation. - * @link http://php.net/manual/en/intldateformatter.geterrormessage.php - * @param $coll - * @return string Description of the last error. - */ -function datefmt_get_error_message ($coll) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get string length in grapheme units - * @link http://php.net/manual/en/function.grapheme-strlen.php - * @param string $input

- * The string being measured for length. It must be a valid UTF-8 string. - *

- * @return int The length of the string on success, and 0 if the string is empty. - */ -function grapheme_strlen ($input) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Find position (in grapheme units) of first occurrence of a string - * @link http://php.net/manual/en/function.grapheme-strpos.php - * @param string $haystack

- * The string to look in. Must be valid UTF-8. - *

- * @param string $needle

- * The string to look for. Must be valid UTF-8. - *

- * @param int $offset [optional]

- * The optional $offset parameter allows you to specify where in $haystack to - * start searching as an offset in grapheme units (not bytes or characters). - * The position returned is still relative to the beginning of haystack - * regardless of the value of $offset. - *

- * @return int the position as an integer. If needle is not found, strpos() will return boolean FALSE. - */ -function grapheme_strpos ($haystack, $needle, $offset = 0) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Find position (in grapheme units) of first occurrence of a case-insensitive string - * @link http://php.net/manual/en/function.grapheme-stripos.php - * @param string $haystack

- * The string to look in. Must be valid UTF-8. - *

- * @param string $needle

- * The string to look for. Must be valid UTF-8. - *

- * @param int $offset [optional]

- * The optional $offset parameter allows you to specify where in haystack to - * start searching as an offset in grapheme units (not bytes or characters). - * The position returned is still relative to the beginning of haystack - * regardless of the value of $offset. - *

- * @return int the position as an integer. If needle is not found, grapheme_stripos() will return boolean FALSE. - */ -function grapheme_stripos ($haystack, $needle, $offset = 0) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Find position (in grapheme units) of last occurrence of a string - * @link http://php.net/manual/en/function.grapheme-strrpos.php - * @param string $haystack

- * The string to look in. Must be valid UTF-8. - *

- * @param string $needle

- * The string to look for. Must be valid UTF-8. - *

- * @param int $offset [optional]

- * The optional $offset parameter allows you to specify where in $haystack to - * start searching as an offset in grapheme units (not bytes or characters). - * The position returned is still relative to the beginning of haystack - * regardless of the value of $offset. - *

- * @return int the position as an integer. If needle is not found, grapheme_strrpos() will return boolean FALSE. - */ -function grapheme_strrpos ($haystack, $needle, $offset = 0) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Find position (in grapheme units) of last occurrence of a case-insensitive string - * @link http://php.net/manual/en/function.grapheme-strripos.php - * @param string $haystack

- * The string to look in. Must be valid UTF-8. - *

- * @param string $needle

- * The string to look for. Must be valid UTF-8. - *

- * @param int $offset [optional]

- * The optional $offset parameter allows you to specify where in $haystack to - * start searching as an offset in grapheme units (not bytes or characters). - * The position returned is still relative to the beginning of haystack - * regardless of the value of $offset. - *

- * @return int the position as an integer. If needle is not found, grapheme_strripos() will return boolean FALSE. - */ -function grapheme_strripos ($haystack, $needle, $offset = 0) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Return part of a string - * @link http://php.net/manual/en/function.grapheme-substr.php - * @param string $string

- * The input string. Must be valid UTF-8. - *

- * @param int $start

- * Start position in default grapheme units. - * If $start is non-negative, the returned string will start at the - * $start'th position in $string, counting from zero. If $start is negative, - * the returned string will start at the $start'th grapheme unit from the - * end of string. - *

- * @param int $length [optional]

- * Length in grapheme units. - * If $length is given and is positive, the string returned will contain - * at most $length grapheme units beginning from $start (depending on the - * length of string). If $length is given and is negative, then - * that many grapheme units will be omitted from the end of string (after the - * start position has been calculated when a start is negative). If $start - * denotes a position beyond this truncation, FALSE will be returned. - *

- * @return int the extracted part of $string. - */ -function grapheme_substr ($string, $start, $length = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Returns part of haystack string from the first occurrence of needle to the end of haystack. - * @link http://php.net/manual/en/function.grapheme-strstr.php - * @param string $haystack

- * The input string. Must be valid UTF-8. - *

- * @param string $needle

- * The string to look for. Must be valid UTF-8. - *

- * @param bool $before_needle [optional]

- * If TRUE, grapheme_strstr() returns the part of the - * haystack before the first occurrence of the needle (excluding the needle). - *

- * @return string the portion of string, or FALSE if needle is not found. - */ -function grapheme_strstr ($haystack, $needle, $before_needle = false) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Returns part of haystack string from the first occurrence of case-insensitive needle to the end of haystack. - * @link http://php.net/manual/en/function.grapheme-stristr.php - * @param string $haystack

- * The input string. Must be valid UTF-8. - *

- * @param string $needle

- * The string to look for. Must be valid UTF-8. - *

- * @param bool $before_needle [optional]

- * If TRUE, grapheme_strstr() returns the part of the - * haystack before the first occurrence of the needle (excluding needle). - *

- * @return string the portion of $haystack, or FALSE if $needle is not found. - */ -function grapheme_stristr ($haystack, $needle, $before_needle = false) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Function to extract a sequence of default grapheme clusters from a text buffer, which must be encoded in UTF-8. - * @link http://php.net/manual/en/function.grapheme-extract.php - * @param string $haystack

- * String to search. - *

- * @param int $size

- * Maximum number items - based on the $extract_type - to return. - *

- * @param int $extract_type [optional]

- * Defines the type of units referred to by the $size parameter: - *

- *

- * GRAPHEME_EXTR_COUNT (default) - $size is the number of default - * grapheme clusters to extract. - * GRAPHEME_EXTR_MAXBYTES - $size is the maximum number of bytes - * returned. - * GRAPHEME_EXTR_MAXCHARS - $size is the maximum number of UTF-8 - * characters returned. - *

- * @param int $start [optional]

- * Starting position in $haystack in bytes - if given, it must be zero or a - * positive value that is less than or equal to the length of $haystack in - * bytes. If $start does not point to the first byte of a UTF-8 - * character, the start position is moved to the next character boundary. - *

- * @param int $next [optional]

- * Reference to a value that will be set to the next starting position. - * When the call returns, this may point to the first byte position past the end of the string. - *

- * @return string A string starting at offset $start and ending on a default grapheme cluster - * boundary that conforms to the $size and $extract_type specified. - */ -function grapheme_extract ($haystack, $size, $extract_type = null, $start = 0, &$next = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.2, PECL idn >= 0.1)
- * Convert UTF-8 encoded domain name to ASCII - * @link http://php.net/manual/en/function.idn-to-ascii.php - * @param string $utf8_domain

- * The UTF-8 encoded domain name. - *

- * If e.g. an ISO-8859-1 (aka Western Europe latin1) encoded string is - * passed it will be converted into an ACE encoded "xn--" string. - * It will not be the one you expected though! - *

- *

- * @param int $errorcode [optional]

- * Will be set to the IDNA error code. - *

- * @return string The ACE encoded version of the domain name or FALSE on failure. - */ -function idn_to_ascii ($utf8_domain, &$errorcode = null) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.2, PECL idn >= 0.1)
- * Convert ASCII encoded domain name to UTF-8 - * @link http://php.net/manual/en/function.idn-to-utf8.php - * @param string $ascii_domain

- * The ASCII encoded domain name. Looks like "xn--..." if the it originally contained non-ASCII characters. - *

- * @param int $errorcode [optional]

- * Will be set to the IDNA error code. - *

- * @return string The UTF-8 encoded version of the domain name or FALSE on failure. - * RFC 3490 4.2 states though "ToUnicode never fails. If any step fails, then the original input - * sequence is returned immediately in that step." - */ -function idn_to_utf8 ($ascii_domain, &$errorcode = null) {} - -/** - * (PHP >= 5.3.2, PECL intl >= 2.0.0)
- * Create a resource bundle - * @link http://php.net/manual/en/resourcebundle.create.php - * @param string $locale

- * Locale for which the resources should be loaded (locale name, e.g. en_CA). - *

- * @param string $bundlename

- * The directory where the data is stored or the name of the .dat file. - *

- * @param bool $fallback [optional]

- * Whether locale should match exactly or fallback to parent locale is allowed. - *

- * @return ResourceBundle ResourceBundle object or FALSE on error. - */ -function resourcebundle_create ($locale, $bundlename, $fallback = null) {} - -/** - * (PHP >= 5.3.2, PECL intl >= 2.0.0)
- * Get data from the bundle - * @link http://php.net/manual/en/resourcebundle.get.php - * @param string|int $index

- * Data index, must be string or integer. - *

- * @return mixed the data located at the index or NULL on error. Strings, integers and binary data strings - * are returned as corresponding PHP types, integer array is returned as PHP array. Complex types are - * returned as ResourceBundle object. - */ -function resourcebundle_get ($index) {} - -/** - * (PHP >= 5.3.2, PECL intl >= 2.0.0)
- * Get number of elements in the bundle - * @link http://php.net/manual/en/resourcebundle.count.php - * @param $bundle - * @return int number of elements in the bundle. - */ -function resourcebundle_count ($bundle) {} - -/** - * (PHP >= 5.3.2, PECL intl >= 2.0.0)
- * Get supported locales - * @link http://php.net/manual/en/resourcebundle.locales.php - * @param string $bundlename

- * Path of ResourceBundle for which to get available locales, or - * empty string for default locales list. - *

- * @return array the list of locales supported by the bundle. - */ -function resourcebundle_locales ($bundlename) {} - -/** - * (PHP >= 5.3.2, PECL intl >= 2.0.0)
- * Get bundle's last error code. - * @link http://php.net/manual/en/resourcebundle.geterrorcode.php - * @param $bundle - * @return int error code from last bundle object call. - */ -function resourcebundle_get_error_code ($bundle) {} - -/** - * (PHP >= 5.3.2, PECL intl >= 2.0.0)
- * Get bundle's last error message. - * @link http://php.net/manual/en/resourcebundle.geterrormessage.php - * @param $bundle - * @return string error message from last bundle object's call. - */ -function resourcebundle_get_error_message ($bundle) {} - -/** - * (PHP >= 5.4.0, PECL intl >= 2.0.0)
- * Create a transliterator - * @link http://php.net/manual/en/transliterator.create.php - * @param string $id

- * The id. - *

- * @param int $direction [optional]

- * The direction, defaults to - * >Transliterator::FORWARD. - * May also be set to - * Transliterator::REVERSE. - *

- * @return Transliterator a Transliterator object on success, - * or NULL on failure. - */ -function transliterator_create ($id, $direction = null) {} - -/** - * (PHP >= 5.4.0, PECL intl >= 2.0.0)
- * Create transliterator from rules - * @link http://php.net/manual/en/transliterator.createfromrules.php - * @param string $rules

- * The rules. - *

- * @param string $direction [optional]

- * The direction, defaults to - * >Transliterator::FORWARD. - * May also be set to - * Transliterator::REVERSE. - *

- * @return Transliterator a Transliterator object on success, - * or NULL on failure. - */ -function transliterator_create_from_rules ($rules, $direction = null) {} - -/** - * (PHP >= 5.4.0, PECL intl >= 2.0.0)
- * Get transliterator IDs - * @link http://php.net/manual/en/transliterator.listids.php - * @return array An array of registered transliterator IDs on success, - * or FALSE on failure. - */ -function transliterator_list_ids () {} - -/** - * (PHP >= 5.4.0, PECL intl >= 2.0.0)
- * Create an inverse transliterator - * @link http://php.net/manual/en/transliterator.createinverse.php - * @param Transliterator $orig_trans - * @return Transliterator a Transliterator object on success, - * or NULL on failure - */ -function transliterator_create_inverse (Transliterator $orig_trans) {} - -/** - * (PHP >= 5.4.0, PECL intl >= 2.0.0)
- * Transliterate a string - * @link http://php.net/manual/en/transliterator.transliterate.php - * @param string $subject

- * The string to be transformed. - *

- * @param int $start [optional]

- * The start index (in UTF-16 code units) from which the string will start - * to be transformed, inclusive. Indexing starts at 0. The text before will - * be left as is. - *

- * @param int $end [optional]

- * The end index (in UTF-16 code units) until which the string will be - * transformed, exclusive. Indexing starts at 0. The text after will be - * left as is. - *

- * @return string The transfomed string on success, or FALSE on failure. - */ -function transliterator_transliterate ($subject, $start = null, $end = null) {} - -/** - * (PHP >= 5.4.0, PECL intl >= 2.0.0)
- * Get last error code - * @link http://php.net/manual/en/transliterator.geterrorcode.php - * @param Transliterator $trans - * @return int The error code on success, - * or FALSE if none exists, or on failure. - */ -function transliterator_get_error_code (Transliterator $trans) {} - -/** - * (PHP >= 5.4.0, PECL intl >= 2.0.0)
- * Get last error message - * @link http://php.net/manual/en/transliterator.geterrormessage.php - * @param Transliterator $trans - * @return string The error code on success, - * or FALSE if none exists, or on failure. - */ -function transliterator_get_error_message (Transliterator $trans) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get the last error code - * @link http://php.net/manual/en/function.intl-get-error-code.php - * @return int Error code returned by the last API function call. - */ -function intl_get_error_code () {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get description of the last error - * @link http://php.net/manual/en/function.intl-get-error-message.php - * @return string Description of an error occurred in the last API function call. - */ -function intl_get_error_message () {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Check whether the given error code indicates failure - * @link http://php.net/manual/en/function.intl-is-failure.php - * @param int $error_code

- * is a value that returned by functions: - * intl_get_error_code, - * collator_get_error_code . - *

- * @return bool TRUE if it the code indicates some failure, and FALSE - * in case of success or a warning. - */ -function intl_is_failure ($error_code) {} - -/** - * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
- * Get symbolic name for a given error code - * @link http://php.net/manual/en/function.intl-error-name.php - * @param int $error_code

- * ICU error code. - *

- * @return string The returned string will be the same as the name of the error code - * constant. - */ -function intl_error_name ($error_code) {} - - -/** - * Limit on locale length, set to 80 in PHP code. Locale names longer - * than this limit will not be accepted. - * @link http://php.net/manual/en/intl.constants.php - */ -define ('INTL_MAX_LOCALE_LEN', 80); -define ('INTL_ICU_VERSION', "4.8.1.1"); -define ('INTL_ICU_DATA_VERSION', "4.8.1"); -define ('ULOC_ACTUAL_LOCALE', 0); -define ('ULOC_VALID_LOCALE', 1); -define ('GRAPHEME_EXTR_COUNT', 0); -define ('GRAPHEME_EXTR_MAXBYTES', 1); -define ('GRAPHEME_EXTR_MAXCHARS', 2); -define ('U_USING_FALLBACK_WARNING', -128); -define ('U_ERROR_WARNING_START', -128); -define ('U_USING_DEFAULT_WARNING', -127); -define ('U_SAFECLONE_ALLOCATED_WARNING', -126); -define ('U_STATE_OLD_WARNING', -125); -define ('U_STRING_NOT_TERMINATED_WARNING', -124); -define ('U_SORT_KEY_TOO_SHORT_WARNING', -123); -define ('U_AMBIGUOUS_ALIAS_WARNING', -122); -define ('U_DIFFERENT_UCA_VERSION', -121); -define ('U_ERROR_WARNING_LIMIT', -119); -define ('U_ZERO_ERROR', 0); -define ('U_ILLEGAL_ARGUMENT_ERROR', 1); -define ('U_MISSING_RESOURCE_ERROR', 2); -define ('U_INVALID_FORMAT_ERROR', 3); -define ('U_FILE_ACCESS_ERROR', 4); -define ('U_INTERNAL_PROGRAM_ERROR', 5); -define ('U_MESSAGE_PARSE_ERROR', 6); -define ('U_MEMORY_ALLOCATION_ERROR', 7); -define ('U_INDEX_OUTOFBOUNDS_ERROR', 8); -define ('U_PARSE_ERROR', 9); -define ('U_INVALID_CHAR_FOUND', 10); -define ('U_TRUNCATED_CHAR_FOUND', 11); -define ('U_ILLEGAL_CHAR_FOUND', 12); -define ('U_INVALID_TABLE_FORMAT', 13); -define ('U_INVALID_TABLE_FILE', 14); -define ('U_BUFFER_OVERFLOW_ERROR', 15); -define ('U_UNSUPPORTED_ERROR', 16); -define ('U_RESOURCE_TYPE_MISMATCH', 17); -define ('U_ILLEGAL_ESCAPE_SEQUENCE', 18); -define ('U_UNSUPPORTED_ESCAPE_SEQUENCE', 19); -define ('U_NO_SPACE_AVAILABLE', 20); -define ('U_CE_NOT_FOUND_ERROR', 21); -define ('U_PRIMARY_TOO_LONG_ERROR', 22); -define ('U_STATE_TOO_OLD_ERROR', 23); -define ('U_TOO_MANY_ALIASES_ERROR', 24); -define ('U_ENUM_OUT_OF_SYNC_ERROR', 25); -define ('U_INVARIANT_CONVERSION_ERROR', 26); -define ('U_INVALID_STATE_ERROR', 27); -define ('U_COLLATOR_VERSION_MISMATCH', 28); -define ('U_USELESS_COLLATOR_ERROR', 29); -define ('U_NO_WRITE_PERMISSION', 30); -define ('U_STANDARD_ERROR_LIMIT', 31); -define ('U_BAD_VARIABLE_DEFINITION', 65536); -define ('U_PARSE_ERROR_START', 65536); -define ('U_MALFORMED_RULE', 65537); -define ('U_MALFORMED_SET', 65538); -define ('U_MALFORMED_SYMBOL_REFERENCE', 65539); -define ('U_MALFORMED_UNICODE_ESCAPE', 65540); -define ('U_MALFORMED_VARIABLE_DEFINITION', 65541); -define ('U_MALFORMED_VARIABLE_REFERENCE', 65542); -define ('U_MISMATCHED_SEGMENT_DELIMITERS', 65543); -define ('U_MISPLACED_ANCHOR_START', 65544); -define ('U_MISPLACED_CURSOR_OFFSET', 65545); -define ('U_MISPLACED_QUANTIFIER', 65546); -define ('U_MISSING_OPERATOR', 65547); -define ('U_MISSING_SEGMENT_CLOSE', 65548); -define ('U_MULTIPLE_ANTE_CONTEXTS', 65549); -define ('U_MULTIPLE_CURSORS', 65550); -define ('U_MULTIPLE_POST_CONTEXTS', 65551); -define ('U_TRAILING_BACKSLASH', 65552); -define ('U_UNDEFINED_SEGMENT_REFERENCE', 65553); -define ('U_UNDEFINED_VARIABLE', 65554); -define ('U_UNQUOTED_SPECIAL', 65555); -define ('U_UNTERMINATED_QUOTE', 65556); -define ('U_RULE_MASK_ERROR', 65557); -define ('U_MISPLACED_COMPOUND_FILTER', 65558); -define ('U_MULTIPLE_COMPOUND_FILTERS', 65559); -define ('U_INVALID_RBT_SYNTAX', 65560); -define ('U_INVALID_PROPERTY_PATTERN', 65561); -define ('U_MALFORMED_PRAGMA', 65562); -define ('U_UNCLOSED_SEGMENT', 65563); -define ('U_ILLEGAL_CHAR_IN_SEGMENT', 65564); -define ('U_VARIABLE_RANGE_EXHAUSTED', 65565); -define ('U_VARIABLE_RANGE_OVERLAP', 65566); -define ('U_ILLEGAL_CHARACTER', 65567); -define ('U_INTERNAL_TRANSLITERATOR_ERROR', 65568); -define ('U_INVALID_ID', 65569); -define ('U_INVALID_FUNCTION', 65570); -define ('U_PARSE_ERROR_LIMIT', 65571); -define ('U_UNEXPECTED_TOKEN', 65792); -define ('U_FMT_PARSE_ERROR_START', 65792); -define ('U_MULTIPLE_DECIMAL_SEPARATORS', 65793); -define ('U_MULTIPLE_DECIMAL_SEPERATORS', 65793); -define ('U_MULTIPLE_EXPONENTIAL_SYMBOLS', 65794); -define ('U_MALFORMED_EXPONENTIAL_PATTERN', 65795); -define ('U_MULTIPLE_PERCENT_SYMBOLS', 65796); -define ('U_MULTIPLE_PERMILL_SYMBOLS', 65797); -define ('U_MULTIPLE_PAD_SPECIFIERS', 65798); -define ('U_PATTERN_SYNTAX_ERROR', 65799); -define ('U_ILLEGAL_PAD_POSITION', 65800); -define ('U_UNMATCHED_BRACES', 65801); -define ('U_UNSUPPORTED_PROPERTY', 65802); -define ('U_UNSUPPORTED_ATTRIBUTE', 65803); -define ('U_FMT_PARSE_ERROR_LIMIT', 65810); -define ('U_BRK_INTERNAL_ERROR', 66048); -define ('U_BRK_ERROR_START', 66048); -define ('U_BRK_HEX_DIGITS_EXPECTED', 66049); -define ('U_BRK_SEMICOLON_EXPECTED', 66050); -define ('U_BRK_RULE_SYNTAX', 66051); -define ('U_BRK_UNCLOSED_SET', 66052); -define ('U_BRK_ASSIGN_ERROR', 66053); -define ('U_BRK_VARIABLE_REDFINITION', 66054); -define ('U_BRK_MISMATCHED_PAREN', 66055); -define ('U_BRK_NEW_LINE_IN_QUOTED_STRING', 66056); -define ('U_BRK_UNDEFINED_VARIABLE', 66057); -define ('U_BRK_INIT_ERROR', 66058); -define ('U_BRK_RULE_EMPTY_SET', 66059); -define ('U_BRK_UNRECOGNIZED_OPTION', 66060); -define ('U_BRK_MALFORMED_RULE_TAG', 66061); -define ('U_BRK_ERROR_LIMIT', 66062); -define ('U_REGEX_INTERNAL_ERROR', 66304); -define ('U_REGEX_ERROR_START', 66304); -define ('U_REGEX_RULE_SYNTAX', 66305); -define ('U_REGEX_INVALID_STATE', 66306); -define ('U_REGEX_BAD_ESCAPE_SEQUENCE', 66307); -define ('U_REGEX_PROPERTY_SYNTAX', 66308); -define ('U_REGEX_UNIMPLEMENTED', 66309); -define ('U_REGEX_MISMATCHED_PAREN', 66310); -define ('U_REGEX_NUMBER_TOO_BIG', 66311); -define ('U_REGEX_BAD_INTERVAL', 66312); -define ('U_REGEX_MAX_LT_MIN', 66313); -define ('U_REGEX_INVALID_BACK_REF', 66314); -define ('U_REGEX_INVALID_FLAG', 66315); -define ('U_REGEX_LOOK_BEHIND_LIMIT', 66316); -define ('U_REGEX_SET_CONTAINS_STRING', 66317); -define ('U_REGEX_ERROR_LIMIT', 66324); -define ('U_IDNA_PROHIBITED_ERROR', 66560); -define ('U_IDNA_ERROR_START', 66560); -define ('U_IDNA_UNASSIGNED_ERROR', 66561); -define ('U_IDNA_CHECK_BIDI_ERROR', 66562); -define ('U_IDNA_STD3_ASCII_RULES_ERROR', 66563); -define ('U_IDNA_ACE_PREFIX_ERROR', 66564); -define ('U_IDNA_VERIFICATION_ERROR', 66565); -define ('U_IDNA_LABEL_TOO_LONG_ERROR', 66566); -define ('U_IDNA_ZERO_LENGTH_LABEL_ERROR', 66567); -define ('U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR', 66568); -define ('U_IDNA_ERROR_LIMIT', 66569); -define ('U_STRINGPREP_PROHIBITED_ERROR', 66560); -define ('U_STRINGPREP_UNASSIGNED_ERROR', 66561); -define ('U_STRINGPREP_CHECK_BIDI_ERROR', 66562); -define ('U_ERROR_LIMIT', 66818); - -/** - * Prohibit processing of unassigned codepoints in the input for IDN - * functions and do not check if the input conforms to domain name ASCII rules. - * @link http://php.net/manual/en/intl.constants.php - */ -define ('IDNA_DEFAULT', 0); - -/** - * Allow processing of unassigned codepoints in the input for IDN functions. - * @link http://php.net/manual/en/intl.constants.php - */ -define ('IDNA_ALLOW_UNASSIGNED', 1); - -/** - * Check if the input for IDN functions conforms to domain name ASCII rules. - * @link http://php.net/manual/en/intl.constants.php - */ -define ('IDNA_USE_STD3_RULES', 2); - -/** - * Check whether the input conforms to the BiDi rules. - * Ignored by the IDNA2003 implementation, which always performs this check. - * @link http://php.net/manual/en/intl.constants.php - */ -define ('IDNA_CHECK_BIDI', 4); - -/** - * Check whether the input conforms to the CONTEXTJ rules. - * Ignored by the IDNA2003 implementation, as this check is new in IDNA2008. - * @link http://php.net/manual/en/intl.constants.php - */ -define ('IDNA_CHECK_CONTEXTJ', 8); - -/** - * Option for nontransitional processing in - * idn_to_ascii. Transitional processing is activated - * by default. This option is ignored by the IDNA2003 implementation. - * @link http://php.net/manual/en/intl.constants.php - */ -define ('IDNA_NONTRANSITIONAL_TO_ASCII', 16); - -/** - * Option for nontransitional processing in - * idn_to_utf8. Transitional processing is activated - * by default. This option is ignored by the IDNA2003 implementation. - * @link http://php.net/manual/en/intl.constants.php - */ -define ('IDNA_NONTRANSITIONAL_TO_UNICODE', 32); - -/** - * Use IDNA 2003 algorithm in idn_to_utf8 and - * idn_to_ascii. This is the default. - * @link http://php.net/manual/en/intl.constants.php - */ -define ('INTL_IDNA_VARIANT_2003', 0); - -/** - * Use UTS #46 algorithm in idn_to_utf8 and - * idn_to_ascii. - * @link http://php.net/manual/en/intl.constants.php - */ -define ('INTL_IDNA_VARIANT_UTS46', 1); - -/** - * Errors reported in a bitset returned by the UTS #46 algorithm in - * idn_to_utf8 and - * idn_to_ascii. - * @link http://php.net/manual/en/intl.constants.php - */ -define ('IDNA_ERROR_EMPTY_LABEL', 1); -define ('IDNA_ERROR_LABEL_TOO_LONG', 2); -define ('IDNA_ERROR_DOMAIN_NAME_TOO_LONG', 4); -define ('IDNA_ERROR_LEADING_HYPHEN', 8); -define ('IDNA_ERROR_TRAILING_HYPHEN', 16); -define ('IDNA_ERROR_HYPHEN_3_4', 32); -define ('IDNA_ERROR_LEADING_COMBINING_MARK', 64); -define ('IDNA_ERROR_DISALLOWED', 128); -define ('IDNA_ERROR_PUNYCODE', 256); -define ('IDNA_ERROR_LABEL_HAS_DOT', 512); -define ('IDNA_ERROR_INVALID_ACE_LABEL', 1024); -define ('IDNA_ERROR_BIDI', 2048); -define ('IDNA_ERROR_CONTEXTJ', 4096); - -// End of intl v.1.1.0 -?> diff --git a/phpruntime/json.php b/phpruntime/json.php deleted file mode 100644 index cf47d46..0000000 --- a/phpruntime/json.php +++ /dev/null @@ -1,209 +0,0 @@ -json_encode. - * @link http://php.net/manual/en/class.jsonserializable.php - */ -interface JsonSerializable { - - /** - * (PHP 5 >= 5.4.0)
- * Specify data which should be serialized to JSON - * @link http://php.net/manual/en/jsonserializable.jsonserialize.php - * @return mixed data which can be serialized by json_encode, - * which is a value of any type other than a resource. - */ - abstract public function jsonSerialize (); - -} - -/** - * (PHP 5 >= 5.2.0, PECL json >= 1.2.0)
- * Returns the JSON representation of a value - * @link http://php.net/manual/en/function.json-encode.php - * @param mixed $value

- * The value being encoded. Can be any type except - * a resource. - *

- *

- * This function only works with UTF-8 encoded data. - *

- * @param int $options [optional]

- * Bitmask consisting of JSON_HEX_QUOT, - * JSON_HEX_TAG, - * JSON_HEX_AMP, - * JSON_HEX_APOS, - * JSON_NUMERIC_CHECK, - * JSON_PRETTY_PRINT, - * JSON_UNESCAPED_SLASHES, - * JSON_FORCE_OBJECT, - * JSON_UNESCAPED_UNICODE. The behaviour of these - * constants is described on - * the JSON constants page. - *

- * @return string a JSON encoded string on success or FALSE on failure. - */ -function json_encode ($value, $options = 0) {} - -/** - * (PHP 5 >= 5.2.0, PECL json >= 1.2.0)
- * Decodes a JSON string - * @link http://php.net/manual/en/function.json-decode.php - * @param string $json

- * The json string being decoded. - *

- *

- * This function only works with UTF-8 encoded data. - *

- * @param bool $assoc [optional]

- * When TRUE, returned objects will be converted into - * associative arrays. - *

- * @param int $depth [optional]

- * User specified recursion depth. - *

- * @param int $options [optional]

- * Bitmask of JSON decode options. Currently only - * JSON_BIGINT_AS_STRING - * is supported (default is to cast large integers as floats) - *

- * @return mixed the value encoded in json in appropriate - * PHP type. Values true, false and - * null (case-insensitive) are returned as TRUE, FALSE - * and NULL respectively. NULL is returned if the - * json cannot be decoded or if the encoded - * data is deeper than the recursion limit. - */ -function json_decode ($json, $assoc = false, $depth = 512, $options = 0) {} - -/** - * (PHP 5 >= 5.3.0)
- * Returns the last error occurred - * @link http://php.net/manual/en/function.json-last-error.php - * @return int an integer, the value can be one of the following - * constants: - */ -function json_last_error () {} - - -/** - * All < and > are converted to \u003C and \u003E. - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/json.constants.php - */ -define ('JSON_HEX_TAG', 1); - -/** - * All &#38;s are converted to \u0026. - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/json.constants.php - */ -define ('JSON_HEX_AMP', 2); - -/** - * All ' are converted to \u0027. - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/json.constants.php - */ -define ('JSON_HEX_APOS', 4); - -/** - * All " are converted to \u0022. - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/json.constants.php - */ -define ('JSON_HEX_QUOT', 8); - -/** - * Outputs an object rather than an array when a non-associative array is - * used. Especially useful when the recipient of the output is expecting - * an object and the array is empty. - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/json.constants.php - */ -define ('JSON_FORCE_OBJECT', 16); - -/** - * Encodes numeric strings as numbers. - * Available since PHP 5.3.3. - * @link http://php.net/manual/en/json.constants.php - */ -define ('JSON_NUMERIC_CHECK', 32); - -/** - * Don't escape /. - * Available since PHP 5.4.0. - * @link http://php.net/manual/en/json.constants.php - */ -define ('JSON_UNESCAPED_SLASHES', 64); - -/** - * Use whitespace in returned data to format it. - * Available since PHP 5.4.0. - * @link http://php.net/manual/en/json.constants.php - */ -define ('JSON_PRETTY_PRINT', 128); - -/** - * Encode multibyte Unicode characters literally (default is to escape as \uXXXX). - * Available since PHP 5.4.0. - * @link http://php.net/manual/en/json.constants.php - */ -define ('JSON_UNESCAPED_UNICODE', 256); - -/** - * No error has occurred. - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/json.constants.php - */ -define ('JSON_ERROR_NONE', 0); - -/** - * The maximum stack depth has been exceeded. - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/json.constants.php - */ -define ('JSON_ERROR_DEPTH', 1); - -/** - * Occurs with underflow or with the modes mismatch. - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/json.constants.php - */ -define ('JSON_ERROR_STATE_MISMATCH', 2); - -/** - * Control character error, possibly incorrectly encoded. - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/json.constants.php - */ -define ('JSON_ERROR_CTRL_CHAR', 3); - -/** - * Syntax error. - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/json.constants.php - */ -define ('JSON_ERROR_SYNTAX', 4); - -/** - * Malformed UTF-8 characters, possibly incorrectly encoded. This - * constant is available as of PHP 5.3.3. - * @link http://php.net/manual/en/json.constants.php - */ -define ('JSON_ERROR_UTF8', 5); -define ('JSON_OBJECT_AS_ARRAY', 1); - -/** - * Encodes large integers as their original string value. - * Available since PHP 5.4.0. - * @link http://php.net/manual/en/json.constants.php - */ -define ('JSON_BIGINT_AS_STRING', 2); - -// End of json v.1.2.1 -?> diff --git a/phpruntime/ldap.php b/phpruntime/ldap.php deleted file mode 100644 index d7f8265..0000000 --- a/phpruntime/ldap.php +++ /dev/null @@ -1,1020 +0,0 @@ - - * Connect to an LDAP server - * @link http://php.net/manual/en/function.ldap-connect.php - * @param string $hostname [optional]

- * If you are using OpenLDAP 2.x.x you can specify a URL instead of the - * hostname. To use LDAP with SSL, compile OpenLDAP 2.x.x with SSL - * support, configure PHP with SSL, and set this parameter as - * ldaps://hostname/. - *

- * @param int $port [optional]

- * The port to connect to. Not used when using URLs. - *

- * @return resource a positive LDAP link identifier on success, or FALSE on error. - * When OpenLDAP 2.x.x is used, ldap_connect will always - * return a resource as it does not actually connect but just - * initializes the connecting parameters. The actual connect happens with - * the next calls to ldap_* funcs, usually with - * ldap_bind. - *

- *

- * If no arguments are specified then the link identifier of the already - * opened link will be returned. - */ -function ldap_connect ($hostname = null, $port = 389) {} - -/** - * (PHP 4, PHP 5)
- * Alias of ldap_unbind - * @link http://php.net/manual/en/function.ldap-close.php - * @param $link_identifier - */ -function ldap_close ($link_identifier) {} - -/** - * (PHP 4, PHP 5)
- * Bind to LDAP directory - * @link http://php.net/manual/en/function.ldap-bind.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param string $bind_rdn [optional] - * @param string $bind_password [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function ldap_bind ($link_identifier, $bind_rdn = null, $bind_password = null) {} - -/** - * (PHP 5)
- * Bind to LDAP directory using SASL - * @link http://php.net/manual/en/function.ldap-sasl-bind.php - * @param resource $link - * @param string $binddn [optional] - * @param string $password [optional] - * @param string $sasl_mech [optional] - * @param string $sasl_realm [optional] - * @param string $sasl_authc_id [optional] - * @param string $sasl_authz_id [optional] - * @param string $props [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function ldap_sasl_bind ($link, $binddn = null, $password = null, $sasl_mech = null, $sasl_realm = null, $sasl_authc_id = null, $sasl_authz_id = null, $props = null) {} - -/** - * (PHP 4, PHP 5)
- * Unbind from LDAP directory - * @link http://php.net/manual/en/function.ldap-unbind.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ldap_unbind ($link_identifier) {} - -/** - * (PHP 4, PHP 5)
- * Read an entry - * @link http://php.net/manual/en/function.ldap-read.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param string $base_dn

- * The base DN for the directory. - *

- * @param string $filter

- * An empty filter is not allowed. If you want to retrieve absolutely all - * information for this entry, use a filter of - * objectClass=*. If you know which entry types are - * used on the directory server, you might use an appropriate filter such - * as objectClass=inetOrgPerson. - *

- * @param array $attributes [optional]

- * An array of the required attributes, e.g. array("mail", "sn", "cn"). - * Note that the "dn" is always returned irrespective of which attributes - * types are requested. - *

- *

- * Using this parameter is much more efficient than the default action - * (which is to return all attributes and their associated values). - * The use of this parameter should therefore be considered good - * practice. - *

- * @param int $attrsonly [optional]

- * Should be set to 1 if only attribute types are wanted. If set to 0 - * both attributes types and attribute values are fetched which is the - * default behaviour. - *

- * @param int $sizelimit [optional]

- * Enables you to limit the count of entries fetched. Setting this to 0 - * means no limit. - *

- *

- * This parameter can NOT override server-side preset sizelimit. You can - * set it lower though. - *

- *

- * Some directory server hosts will be configured to return no more than - * a preset number of entries. If this occurs, the server will indicate - * that it has only returned a partial results set. This also occurs if - * you use this parameter to limit the count of fetched entries. - *

- * @param int $timelimit [optional]

- * Sets the number of seconds how long is spend on the search. Setting - * this to 0 means no limit. - *

- *

- * This parameter can NOT override server-side preset timelimit. You can - * set it lower though. - *

- * @param int $deref [optional]

- * Specifies how aliases should be handled during the search. It can be - * one of the following: - * LDAP_DEREF_NEVER - (default) aliases are never - * dereferenced. - * @return resource a search result identifier or FALSE on error. - */ -function ldap_read ($link_identifier, $base_dn, $filter, array $attributes = null, $attrsonly = null, $sizelimit = null, $timelimit = null, $deref = null) {} - -/** - * (PHP 4, PHP 5)
- * Single-level search - * @link http://php.net/manual/en/function.ldap-list.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param string $base_dn

- * The base DN for the directory. - *

- * @param string $filter - * @param array $attributes [optional]

- * An array of the required attributes, e.g. array("mail", "sn", "cn"). - * Note that the "dn" is always returned irrespective of which attributes - * types are requested. - *

- *

- * Using this parameter is much more efficient than the default action - * (which is to return all attributes and their associated values). - * The use of this parameter should therefore be considered good - * practice. - *

- * @param int $attrsonly [optional]

- * Should be set to 1 if only attribute types are wanted. If set to 0 - * both attributes types and attribute values are fetched which is the - * default behaviour. - *

- * @param int $sizelimit [optional]

- * Enables you to limit the count of entries fetched. Setting this to 0 - * means no limit. - *

- *

- * This parameter can NOT override server-side preset sizelimit. You can - * set it lower though. - *

- *

- * Some directory server hosts will be configured to return no more than - * a preset number of entries. If this occurs, the server will indicate - * that it has only returned a partial results set. This also occurs if - * you use this parameter to limit the count of fetched entries. - *

- * @param int $timelimit [optional]

- * Sets the number of seconds how long is spend on the search. Setting - * this to 0 means no limit. - *

- *

- * This parameter can NOT override server-side preset timelimit. You can - * set it lower though. - *

- * @param int $deref [optional]

- * Specifies how aliases should be handled during the search. It can be - * one of the following: - * LDAP_DEREF_NEVER - (default) aliases are never - * dereferenced. - * @return resource a search result identifier or FALSE on error. - */ -function ldap_list ($link_identifier, $base_dn, $filter, array $attributes = null, $attrsonly = null, $sizelimit = null, $timelimit = null, $deref = null) {} - -/** - * (PHP 4, PHP 5)
- * Search LDAP tree - * @link http://php.net/manual/en/function.ldap-search.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param string $base_dn

- * The base DN for the directory. - *

- * @param string $filter

- * The search filter can be simple or advanced, using boolean operators in - * the format described in the LDAP documentation (see the Netscape Directory SDK for full - * information on filters). - *

- * @param array $attributes [optional]

- * An array of the required attributes, e.g. array("mail", "sn", "cn"). - * Note that the "dn" is always returned irrespective of which attributes - * types are requested. - *

- *

- * Using this parameter is much more efficient than the default action - * (which is to return all attributes and their associated values). - * The use of this parameter should therefore be considered good - * practice. - *

- * @param int $attrsonly [optional]

- * Should be set to 1 if only attribute types are wanted. If set to 0 - * both attributes types and attribute values are fetched which is the - * default behaviour. - *

- * @param int $sizelimit [optional]

- * Enables you to limit the count of entries fetched. Setting this to 0 - * means no limit. - *

- *

- * This parameter can NOT override server-side preset sizelimit. You can - * set it lower though. - *

- *

- * Some directory server hosts will be configured to return no more than - * a preset number of entries. If this occurs, the server will indicate - * that it has only returned a partial results set. This also occurs if - * you use this parameter to limit the count of fetched entries. - *

- * @param int $timelimit [optional]

- * Sets the number of seconds how long is spend on the search. Setting - * this to 0 means no limit. - *

- *

- * This parameter can NOT override server-side preset timelimit. You can - * set it lower though. - *

- * @param int $deref [optional]

- * Specifies how aliases should be handled during the search. It can be - * one of the following: - * LDAP_DEREF_NEVER - (default) aliases are never - * dereferenced. - * @return resource a search result identifier or FALSE on error. - */ -function ldap_search ($link_identifier, $base_dn, $filter, array $attributes = null, $attrsonly = null, $sizelimit = null, $timelimit = null, $deref = null) {} - -/** - * (PHP 4, PHP 5)
- * Free result memory - * @link http://php.net/manual/en/function.ldap-free-result.php - * @param resource $result_identifier - * @return bool TRUE on success or FALSE on failure. - */ -function ldap_free_result ($result_identifier) {} - -/** - * (PHP 4, PHP 5)
- * Count the number of entries in a search - * @link http://php.net/manual/en/function.ldap-count-entries.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param resource $result_identifier

- * The internal LDAP result. - *

- * @return int number of entries in the result or FALSE on error. - */ -function ldap_count_entries ($link_identifier, $result_identifier) {} - -/** - * (PHP 4, PHP 5)
- * Return first result id - * @link http://php.net/manual/en/function.ldap-first-entry.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param resource $result_identifier - * @return resource the result entry identifier for the first entry on success and - * FALSE on error. - */ -function ldap_first_entry ($link_identifier, $result_identifier) {} - -/** - * (PHP 4, PHP 5)
- * Get next result entry - * @link http://php.net/manual/en/function.ldap-next-entry.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param resource $result_entry_identifier - * @return resource entry identifier for the next entry in the result whose entries - * are being read starting with ldap_first_entry. If - * there are no more entries in the result then it returns FALSE. - */ -function ldap_next_entry ($link_identifier, $result_entry_identifier) {} - -/** - * (PHP 4, PHP 5)
- * Get all result entries - * @link http://php.net/manual/en/function.ldap-get-entries.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param resource $result_identifier - * @return array a complete result information in a multi-dimensional array on - * success and FALSE on error. - *

- *

- * The structure of the array is as follows. - * The attribute index is converted to lowercase. (Attributes are - * case-insensitive for directory servers, but not when used as - * array indices.) - *

- * return_value["count"] = number of entries in the result
- * return_value[0] : refers to the details of first entry
- * return_value[i]["dn"] = DN of the ith entry in the result
- * return_value[i]["count"] = number of attributes in ith entry
- * return_value[i][j] = NAME of the jth attribute in the ith entry in the result
- * return_value[i]["attribute"]["count"] = number of values for
- * attribute in ith entry
- * return_value[i]["attribute"][j] = jth value of attribute in ith entry
- * 
- */ -function ldap_get_entries ($link_identifier, $result_identifier) {} - -/** - * (PHP 4, PHP 5)
- * Return first attribute - * @link http://php.net/manual/en/function.ldap-first-attribute.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param resource $result_entry_identifier - * @return string the first attribute in the entry on success and FALSE on - * error. - */ -function ldap_first_attribute ($link_identifier, $result_entry_identifier) {} - -/** - * (PHP 4, PHP 5)
- * Get the next attribute in result - * @link http://php.net/manual/en/function.ldap-next-attribute.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param resource $result_entry_identifier - * @return string the next attribute in an entry on success and FALSE on - * error. - */ -function ldap_next_attribute ($link_identifier, $result_entry_identifier) {} - -/** - * (PHP 4, PHP 5)
- * Get attributes from a search result entry - * @link http://php.net/manual/en/function.ldap-get-attributes.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param resource $result_entry_identifier - * @return array a complete entry information in a multi-dimensional array - * on success and FALSE on error. - */ -function ldap_get_attributes ($link_identifier, $result_entry_identifier) {} - -/** - * (PHP 4, PHP 5)
- * Get all values from a result entry - * @link http://php.net/manual/en/function.ldap-get-values.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param resource $result_entry_identifier - * @param string $attribute - * @return array an array of values for the attribute on success and FALSE on - * error. The number of values can be found by indexing "count" in the - * resultant array. Individual values are accessed by integer index in the - * array. The first index is 0. - *

- *

- * LDAP allows more than one entry for an attribute, so it can, for example, - * store a number of email addresses for one person's directory entry all - * labeled with the attribute "mail" - * return_value["count"] = number of values for attribute - * return_value[0] = first value of attribute - * return_value[i] = ith value of attribute - */ -function ldap_get_values ($link_identifier, $result_entry_identifier, $attribute) {} - -/** - * (PHP 4, PHP 5)
- * Get all binary values from a result entry - * @link http://php.net/manual/en/function.ldap-get-values-len.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param resource $result_entry_identifier - * @param string $attribute - * @return array an array of values for the attribute on success and FALSE on - * error. Individual values are accessed by integer index in the array. The - * first index is 0. The number of values can be found by indexing "count" - * in the resultant array. - */ -function ldap_get_values_len ($link_identifier, $result_entry_identifier, $attribute) {} - -/** - * (PHP 4, PHP 5)
- * Get the DN of a result entry - * @link http://php.net/manual/en/function.ldap-get-dn.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param resource $result_entry_identifier - * @return string the DN of the result entry and FALSE on error. - */ -function ldap_get_dn ($link_identifier, $result_entry_identifier) {} - -/** - * (PHP 4, PHP 5)
- * Splits DN into its component parts - * @link http://php.net/manual/en/function.ldap-explode-dn.php - * @param string $dn

- * The distinguished name of an LDAP entity. - *

- * @param int $with_attrib

- * Used to request if the RDNs are returned with only values or their - * attributes as well. To get RDNs with the attributes (i.e. in - * attribute=value format) set with_attrib to 0 - * and to get only values set it to 1. - *

- * @return array an array of all DN components. - * The first element in this array has count key and - * represents the number of returned values, next elements are numerically - * indexed DN components. - */ -function ldap_explode_dn ($dn, $with_attrib) {} - -/** - * (PHP 4, PHP 5)
- * Convert DN to User Friendly Naming format - * @link http://php.net/manual/en/function.ldap-dn2ufn.php - * @param string $dn

- * The distinguished name of an LDAP entity. - *

- * @return string the user friendly name. - */ -function ldap_dn2ufn ($dn) {} - -/** - * (PHP 4, PHP 5)
- * Add entries to LDAP directory - * @link http://php.net/manual/en/function.ldap-add.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param string $dn

- * The distinguished name of an LDAP entity. - *

- * @param array $entry

- * An array that specifies the information about the entry. The values in - * the entries are indexed by individual attributes. - * In case of multiple values for an attribute, they are indexed using - * integers starting with 0. - * - * $entree["attribut1"] = "value"; - * $entree["attribut2"][0] = "value1"; - * $entree["attribut2"][1] = "value2"; - * - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ldap_add ($link_identifier, $dn, array $entry) {} - -/** - * (PHP 4, PHP 5)
- * Delete an entry from a directory - * @link http://php.net/manual/en/function.ldap-delete.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param string $dn

- * The distinguished name of an LDAP entity. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ldap_delete ($link_identifier, $dn) {} - -/** - * (PHP 4, PHP 5)
- * Modify an LDAP entry - * @link http://php.net/manual/en/function.ldap-modify.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param string $dn

- * The distinguished name of an LDAP entity. - *

- * @param array $entry - * @return bool TRUE on success or FALSE on failure. - */ -function ldap_modify ($link_identifier, $dn, array $entry) {} - -/** - * (PHP 4, PHP 5)
- * Add attribute values to current attributes - * @link http://php.net/manual/en/function.ldap-mod-add.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param string $dn

- * The distinguished name of an LDAP entity. - *

- * @param array $entry - * @return bool TRUE on success or FALSE on failure. - */ -function ldap_mod_add ($link_identifier, $dn, array $entry) {} - -/** - * (PHP 4, PHP 5)
- * Replace attribute values with new ones - * @link http://php.net/manual/en/function.ldap-mod-replace.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param string $dn

- * The distinguished name of an LDAP entity. - *

- * @param array $entry - * @return bool TRUE on success or FALSE on failure. - */ -function ldap_mod_replace ($link_identifier, $dn, array $entry) {} - -/** - * (PHP 4, PHP 5)
- * Delete attribute values from current attributes - * @link http://php.net/manual/en/function.ldap-mod-del.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param string $dn

- * The distinguished name of an LDAP entity. - *

- * @param array $entry - * @return bool TRUE on success or FALSE on failure. - */ -function ldap_mod_del ($link_identifier, $dn, array $entry) {} - -/** - * (PHP 4, PHP 5)
- * Return the LDAP error number of the last LDAP command - * @link http://php.net/manual/en/function.ldap-errno.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @return int Return the LDAP error number of the last LDAP command for this - * link. - */ -function ldap_errno ($link_identifier) {} - -/** - * (PHP 4, PHP 5)
- * Convert LDAP error number into string error message - * @link http://php.net/manual/en/function.ldap-err2str.php - * @param int $errno

- * The error number. - *

- * @return string the error message, as a string. - */ -function ldap_err2str ($errno) {} - -/** - * (PHP 4, PHP 5)
- * Return the LDAP error message of the last LDAP command - * @link http://php.net/manual/en/function.ldap-error.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @return string string error message. - */ -function ldap_error ($link_identifier) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Compare value of attribute found in entry specified with DN - * @link http://php.net/manual/en/function.ldap-compare.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param string $dn

- * The distinguished name of an LDAP entity. - *

- * @param string $attribute

- * The attribute name. - *

- * @param string $value

- * The compared value. - *

- * @return mixed TRUE if value matches otherwise returns - * FALSE. Returns -1 on error. - */ -function ldap_compare ($link_identifier, $dn, $attribute, $value) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Sort LDAP result entries - * @link http://php.net/manual/en/function.ldap-sort.php - * @param resource $link

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param resource $result

- * An search result identifier, returned by - * ldap_search. - *

- * @param string $sortfilter

- * The attribute to use as a key in the sort. - *

- * @return bool - */ -function ldap_sort ($link, $result, $sortfilter) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Modify the name of an entry - * @link http://php.net/manual/en/function.ldap-rename.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param string $dn

- * The distinguished name of an LDAP entity. - *

- * @param string $newrdn

- * The new RDN. - *

- * @param string $newparent

- * The new parent/superior entry. - *

- * @param bool $deleteoldrdn

- * If TRUE the old RDN value(s) is removed, else the old RDN value(s) - * is retained as non-distinguished values of the entry. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ldap_rename ($link_identifier, $dn, $newrdn, $newparent, $deleteoldrdn) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Get the current value for given option - * @link http://php.net/manual/en/function.ldap-get-option.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param int $option

- * The parameter option can be one of: - * - * Option - * Type - * - * - * LDAP_OPT_DEREF - * integer - * - * - * LDAP_OPT_SIZELIMIT - * integer - * - * - * LDAP_OPT_TIMELIMIT - * integer - * - * - * LDAP_OPT_NETWORK_TIMEOUT - * integer - * - * - * LDAP_OPT_PROTOCOL_VERSION - * integer - * - * - * LDAP_OPT_ERROR_NUMBER - * integer - * - * - * LDAP_OPT_REFERRALS - * bool - * - * - * LDAP_OPT_RESTART - * bool - * - * - * LDAP_OPT_HOST_NAME - * string - * - * - * LDAP_OPT_ERROR_STRING - * string - * - * - * LDAP_OPT_MATCHED_DN - * string - * - * - * LDAP_OPT_SERVER_CONTROLS - * array - * - * - * LDAP_OPT_CLIENT_CONTROLS - * array - * - *

- * @param mixed $retval

- * This will be set to the option value. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ldap_get_option ($link_identifier, $option, &$retval) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Set the value of the given option - * @link http://php.net/manual/en/function.ldap-set-option.php - * @param resource $link_identifier

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param int $option

- * The parameter option can be one of: - * - * Option - * Type - * Available since - * - * - * LDAP_OPT_DEREF - * integer - * - * - * - * LDAP_OPT_SIZELIMIT - * integer - * - * - * - * LDAP_OPT_TIMELIMIT - * integer - * - * - * - * LDAP_OPT_NETWORK_TIMEOUT - * integer - * PHP 5.3.0 - * - * - * LDAP_OPT_PROTOCOL_VERSION - * integer - * - * - * - * LDAP_OPT_ERROR_NUMBER - * integer - * - * - * - * LDAP_OPT_REFERRALS - * bool - * - * - * - * LDAP_OPT_RESTART - * bool - * - * - * - * LDAP_OPT_HOST_NAME - * string - * - * - * - * LDAP_OPT_ERROR_STRING - * string - * - * - * - * LDAP_OPT_MATCHED_DN - * string - * - * - * - * LDAP_OPT_SERVER_CONTROLS - * array - * - * - * - * LDAP_OPT_CLIENT_CONTROLS - * array - * - * - *

- *

- * LDAP_OPT_SERVER_CONTROLS and - * LDAP_OPT_CLIENT_CONTROLS require a list of - * controls, this means that the value must be an array of controls. A - * control consists of an oid identifying the control, - * an optional value, and an optional flag for - * criticality. In PHP a control is given by an - * array containing an element with the key oid - * and string value, and two optional elements. The optional - * elements are key value with string value - * and key iscritical with boolean value. - * iscritical defaults to FALSE - * if not supplied. See draft-ietf-ldapext-ldap-c-api-xx.txt - * for details. See also the second example below. - *

- * @param mixed $newval

- * The new value for the specified option. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ldap_set_option ($link_identifier, $option, $newval) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Return first reference - * @link http://php.net/manual/en/function.ldap-first-reference.php - * @param resource $link - * @param resource $result - * @return resource - */ -function ldap_first_reference ($link, $result) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Get next reference - * @link http://php.net/manual/en/function.ldap-next-reference.php - * @param resource $link - * @param resource $entry - * @return resource - */ -function ldap_next_reference ($link, $entry) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Extract information from reference entry - * @link http://php.net/manual/en/function.ldap-parse-reference.php - * @param resource $link - * @param resource $entry - * @param array $referrals - * @return bool - */ -function ldap_parse_reference ($link, $entry, array &$referrals) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Extract information from result - * @link http://php.net/manual/en/function.ldap-parse-result.php - * @param resource $link - * @param resource $result - * @param int $errcode - * @param string $matcheddn [optional] - * @param string $errmsg [optional] - * @param array $referrals [optional] - * @return bool - */ -function ldap_parse_result ($link, $result, &$errcode, &$matcheddn = null, &$errmsg = null, array &$referrals = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Start TLS - * @link http://php.net/manual/en/function.ldap-start-tls.php - * @param resource $link - * @return bool - */ -function ldap_start_tls ($link) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Set a callback function to do re-binds on referral chasing - * @link http://php.net/manual/en/function.ldap-set-rebind-proc.php - * @param resource $link - * @param callable $callback - * @return bool - */ -function ldap_set_rebind_proc ($link, callable $callback) {} - -/** - * (PHP 5 >= 5.4.0)
- * Send LDAP pagination control - * @link http://php.net/manual/en/function.ldap-control-paged-result.php - * @param resource $link

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param int $pagesize

- * The number of entries by page. - *

- * @param bool $iscritical [optional]

- * Indicates whether the pagination is critical of not. - * If true and if the server doesn't support pagination, the search - * will return no result. - *

- * @param string $cookie [optional]

- * An opaque structure sent by the server - * (ldap_control_paged_result_response). - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ldap_control_paged_result ($link, $pagesize, $iscritical = null, $cookie = null) {} - -/** - * (PHP 5 >= 5.4.0)
- * Retrieve the LDAP pagination cookie - * @link http://php.net/manual/en/function.ldap-control-paged-result-response.php - * @param resource $link

- * An LDAP link identifier, returned by ldap_connect. - *

- * @param resource $result - * @param string $cookie [optional]

- * An opaque structure sent by the server. - *

- * @param int $estimated [optional]

- * The estimated number of entries to retrieve. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ldap_control_paged_result_response ($link, $result, &$cookie = null, &$estimated = null) {} - -define ('LDAP_DEREF_NEVER', 0); -define ('LDAP_DEREF_SEARCHING', 1); -define ('LDAP_DEREF_FINDING', 2); -define ('LDAP_DEREF_ALWAYS', 3); - -/** - * Specifies alternative rules for following aliases at the server. - * @link http://php.net/manual/en/ldap.constants.php - */ -define ('LDAP_OPT_DEREF', 2); - -/** - *

- * Specifies the maximum number of entries that can be - * returned on a search operation. - *

- * The actual size limit for operations is also bounded - * by the server's configured maximum number of return entries. - * The lesser of these two settings is the actual size limit. - * @link http://php.net/manual/en/ldap.constants.php - */ -define ('LDAP_OPT_SIZELIMIT', 3); - -/** - * Specifies the number of seconds to wait for search results. - * The actual time limit for operations is also bounded - * by the server's configured maximum time. - * The lesser of these two settings is the actual time limit. - * @link http://php.net/manual/en/ldap.constants.php - */ -define ('LDAP_OPT_TIMELIMIT', 4); - -/** - * Option for ldap_set_option to allow setting network timeout. - * (Available as of PHP 5.3.0) - * @link http://php.net/manual/en/ldap.constants.php - */ -define ('LDAP_OPT_NETWORK_TIMEOUT', 20485); - -/** - * Specifies the LDAP protocol to be used (V2 or V3). - * @link http://php.net/manual/en/ldap.constants.php - */ -define ('LDAP_OPT_PROTOCOL_VERSION', 17); -define ('LDAP_OPT_ERROR_NUMBER', 49); - -/** - * Specifies whether to automatically follow referrals returned - * by the LDAP server. - * @link http://php.net/manual/en/ldap.constants.php - */ -define ('LDAP_OPT_REFERRALS', 8); -define ('LDAP_OPT_RESTART', 9); -define ('LDAP_OPT_HOST_NAME', 48); -define ('LDAP_OPT_ERROR_STRING', 50); -define ('LDAP_OPT_MATCHED_DN', 51); - -/** - * Specifies a default list of server controls to be sent with each request. - * @link http://php.net/manual/en/ldap.constants.php - */ -define ('LDAP_OPT_SERVER_CONTROLS', 18); - -/** - * Specifies a default list of client controls to be processed with each request. - * @link http://php.net/manual/en/ldap.constants.php - */ -define ('LDAP_OPT_CLIENT_CONTROLS', 19); - -/** - * Specifies a bitwise level for debug traces. - * @link http://php.net/manual/en/ldap.constants.php - */ -define ('LDAP_OPT_DEBUG_LEVEL', 20481); -define ('LDAP_OPT_X_SASL_MECH', 24832); -define ('LDAP_OPT_X_SASL_REALM', 24833); -define ('LDAP_OPT_X_SASL_AUTHCID', 24834); -define ('LDAP_OPT_X_SASL_AUTHZID', 24835); - -// End of ldap v. -?> diff --git a/phpruntime/libxml.php b/phpruntime/libxml.php deleted file mode 100644 index b06a96f..0000000 --- a/phpruntime/libxml.php +++ /dev/null @@ -1,290 +0,0 @@ - - * the severity of the error (one of the following constants: - * LIBXML_ERR_WARNING, - * LIBXML_ERR_ERROR or - * LIBXML_ERR_FATAL) - *

- * @var int - */ - public $level; - /** - *

- * The error's code. - *

- * @var int - */ - public $code; - /** - *

- * The column where the error occurred. - *

- *

Note: - *

- * This property isn't entirely implemented in libxml and therefore - * 0 is often returned. - *

- * @var int - */ - public $column; - /** - *

- * The error message, if any. - *

- * @var string - */ - public $message; - /** - *

The filename, or empty if the XML was loaded from a string.

- * @var string - */ - public $file; - /** - *

- * The line where the error occurred. - *

- * @var int - */ - public $line; - -} - -/** - * (PHP 5)
- * Set the streams context for the next libxml document load or write - * @link http://php.net/manual/en/function.libxml-set-streams-context.php - * @param resource $streams_context

- * The stream context resource (created with - * stream_context_create) - *

- * @return void No value is returned. - */ -function libxml_set_streams_context ($streams_context) {} - -/** - * (PHP 5 >= 5.1.0)
- * Disable libxml errors and allow user to fetch error information as needed - * @link http://php.net/manual/en/function.libxml-use-internal-errors.php - * @param bool $use_errors [optional]

- * Enable (TRUE) user error handling or disable (FALSE) user error handling. Disabling will also clear any existing libxml errors. - *

- * @return bool This function returns the previous value of - * use_errors. - */ -function libxml_use_internal_errors ($use_errors = false) {} - -/** - * (PHP 5 >= 5.1.0)
- * Retrieve last error from libxml - * @link http://php.net/manual/en/function.libxml-get-last-error.php - * @return LibXMLError a LibXMLError object if there is any error in the - * buffer, FALSE otherwise. - */ -function libxml_get_last_error () {} - -/** - * (PHP 5 >= 5.1.0)
- * Clear libxml error buffer - * @link http://php.net/manual/en/function.libxml-clear-errors.php - * @return void No value is returned. - */ -function libxml_clear_errors () {} - -/** - * (PHP 5 >= 5.1.0)
- * Retrieve array of errors - * @link http://php.net/manual/en/function.libxml-get-errors.php - * @return array an array with LibXMLError objects if there are any - * errors in the buffer, or an empty array otherwise. - */ -function libxml_get_errors () {} - -/** - * (PHP 5 >= 5.2.11)
- * Disable the ability to load external entities - * @link http://php.net/manual/en/function.libxml-disable-entity-loader.php - * @param bool $disable [optional]

- * Disable (TRUE) or enable (FALSE) libxml extensions (such as - * , - * and ) to load external entities. - *

- * @return bool the previous value. - */ -function libxml_disable_entity_loader ($disable = true) {} - -/** - * (PHP 5 >= 5.4.0)
- * Changes the default external entity loader - * @link http://php.net/manual/en/function.libxml-set-external-entity-loader.php - * @param callable $resolver_function

- * A callable that takes three arguments. Two strings, a public id - * and system id, and a context (an array with four keys) as the third argument. - * This callback should return a resource, a string from which a resource can be - * opened, or NULL. - *

- * @return void No value is returned. - */ -function libxml_set_external_entity_loader (callable $resolver_function) {} - - -/** - * libxml version like 20605 or 20617 - * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_VERSION', 20800); - -/** - * libxml version like 2.6.5 or 2.6.17 - * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_DOTTED_VERSION', "2.8.0"); -define ('LIBXML_LOADED_VERSION', 20800); - -/** - * Substitute entities - * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_NOENT', 2); - -/** - * Load the external subset - * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_DTDLOAD', 4); - -/** - * Default DTD attributes - * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_DTDATTR', 8); - -/** - * Validate with the DTD - * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_DTDVALID', 16); - -/** - * Suppress error reports - * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_NOERROR', 32); - -/** - * Suppress warning reports - * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_NOWARNING', 64); - -/** - * Remove blank nodes - * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_NOBLANKS', 256); - -/** - * Implement XInclude substitution - * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_XINCLUDE', 1024); - -/** - * Remove redundant namespaces declarations - * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_NSCLEAN', 8192); - -/** - * Merge CDATA as text nodes - * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_NOCDATA', 16384); - -/** - * Disable network access when loading documents - * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_NONET', 2048); -define ('LIBXML_PEDANTIC', 128); - -/** - * Activate small nodes allocation optimization. This may speed up your - * application without needing to change the code. - *

- * Only available in Libxml >= 2.6.21 - *

- * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_COMPACT', 65536); - -/** - * Drop the XML declaration when saving a document - *

- * Only available in Libxml >= 2.6.21 - *

- * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_NOXMLDECL', 2); - -/** - * Sets XML_PARSE_HUGE flag, which relaxes any hardcoded limit from the parser. This affects - * limits like maximum depth of a document or the entity recursion, as well as limits of the - * size of text nodes. - *

- * Only available in Libxml >= 2.7.0 (as of PHP >= 5.3.2 and PHP >= 5.2.12) - *

- * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_PARSEHUGE', 524288); - -/** - * Expand empty tags (e.g. <br/> to - * <br></br>) - *

- * This option is currently just available in the - * and - * functions. - *

- * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_NOEMPTYTAG', 4); -define ('LIBXML_HTML_NOIMPLIED', 8192); -define ('LIBXML_HTML_NODEFDTD', 4); - -/** - * No errors - * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_ERR_NONE', 0); - -/** - * A simple warning - * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_ERR_WARNING', 1); - -/** - * A recoverable error - * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_ERR_ERROR', 2); - -/** - * A fatal error - * @link http://php.net/manual/en/libxml.constants.php - */ -define ('LIBXML_ERR_FATAL', 3); - -// End of libxml v. -?> diff --git a/phpruntime/mbstring.php b/phpruntime/mbstring.php deleted file mode 100644 index 7fd747b..0000000 --- a/phpruntime/mbstring.php +++ /dev/null @@ -1,1376 +0,0 @@ - - * Perform case folding on a string - * @link http://php.net/manual/en/function.mb-convert-case.php - * @param string $str

- * The string being converted. - *

- * @param int $mode [optional]

- * The mode of the conversion. It can be one of - * MB_CASE_UPPER, - * MB_CASE_LOWER, or - * MB_CASE_TITLE. - *

- * @param string $encoding [optional] The encoding - * parameter is the character encoding. If it is omitted, the internal character - * encoding value will be used.

- * @return string A case folded version of string converted in the - * way specified by mode. - */ -function mb_convert_case ($str, $mode = 'MB_CASE_UPPER', $encoding = 'mb_internal_encoding()') {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Make a string uppercase - * @link http://php.net/manual/en/function.mb-strtoupper.php - * @param string $str

- * The string being uppercased. - *

- * @param string $encoding [optional] The encoding - * parameter is the character encoding. If it is omitted, the internal character - * encoding value will be used.

- * @return string str with all alphabetic characters converted to uppercase. - */ -function mb_strtoupper ($str, $encoding = 'mb_internal_encoding()') {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Make a string lowercase - * @link http://php.net/manual/en/function.mb-strtolower.php - * @param string $str

- * The string being lowercased. - *

- * @param string $encoding [optional] The encoding - * parameter is the character encoding. If it is omitted, the internal character - * encoding value will be used.

- * @return string str with all alphabetic characters converted to lowercase. - */ -function mb_strtolower ($str, $encoding = 'mb_internal_encoding()') {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Set/Get current language - * @link http://php.net/manual/en/function.mb-language.php - * @param string $language [optional]

- * Used for encoding - * e-mail messages. Valid languages are "Japanese", - * "ja","English","en" and "uni" - * (UTF-8). mb_send_mail uses this setting to - * encode e-mail. - *

- *

- * Language and its setting is ISO-2022-JP/Base64 for - * Japanese, UTF-8/Base64 for uni, ISO-8859-1/quoted printable for - * English. - *

- * @return mixed If language is set and - * language is valid, it returns - * TRUE. Otherwise, it returns FALSE. - * When language is omitted, it returns the language - * name as a string. If no language is set previously, it then returns - * FALSE. - */ -function mb_language ($language = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Set/Get internal character encoding - * @link http://php.net/manual/en/function.mb-internal-encoding.php - * @param string $encoding [optional]

- * encoding is the character encoding name - * used for the HTTP input character encoding conversion, HTTP output - * character encoding conversion, and the default character encoding - * for string functions defined by the mbstring module. - *

- * @return mixed If encoding is set, then - * Returns TRUE on success or FALSE on failure. - * If encoding is omitted, then - * the current character encoding name is returned. - */ -function mb_internal_encoding ($encoding = 'mb_internal_encoding()') {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Detect HTTP input character encoding - * @link http://php.net/manual/en/function.mb-http-input.php - * @param string $type [optional]

- * Input string specifies the input type. - * "G" for GET, "P" for POST, "C" for COOKIE, "S" for string, "L" for list, and - * "I" for the whole list (will return array). - * If type is omitted, it returns the last input type processed. - *

- * @return mixed The character encoding name, as per the type. - * If mb_http_input does not process specified - * HTTP input, it returns FALSE. - */ -function mb_http_input ($type = "") {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Set/Get HTTP output character encoding - * @link http://php.net/manual/en/function.mb-http-output.php - * @param string $encoding [optional]

- * If encoding is set, - * mb_http_output sets the HTTP output character - * encoding to encoding. - *

- *

- * If encoding is omitted, - * mb_http_output returns the current HTTP output - * character encoding. - *

- * @return mixed If encoding is omitted, - * mb_http_output returns the current HTTP output - * character encoding. Otherwise, - * Returns TRUE on success or FALSE on failure. - */ -function mb_http_output ($encoding = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Set/Get character encoding detection order - * @link http://php.net/manual/en/function.mb-detect-order.php - * @param mixed $encoding_list [optional]

- * encoding_list is an array or - * comma separated list of character encoding. See supported encodings. - *

- *

- * If encoding_list is omitted, it returns - * the current character encoding detection order as array. - *

- *

- * This setting affects mb_detect_encoding and - * mb_send_mail. - *

- *

- * mbstring currently implements the following - * encoding detection filters. If there is an invalid byte sequence - * for the following encodings, encoding detection will fail. - *

- * UTF-8, UTF-7, - * ASCII, - * EUC-JP,SJIS, - * eucJP-win, SJIS-win, - * JIS, ISO-2022-JP - *

- * For ISO-8859-*, mbstring - * always detects as ISO-8859-*. - *

- *

- * For UTF-16, UTF-32, - * UCS2 and UCS4, encoding - * detection will fail always. - *

- *

- * Useless detect order example - *

- * ; Always detect as ISO-8859-1
- * detect_order = ISO-8859-1, UTF-8
- * ; Always detect as UTF-8, since ASCII/UTF-7 values are
- * ; valid for UTF-8
- * detect_order = UTF-8, ASCII, UTF-7
- * 
- *

- * @return mixed TRUE on success or FALSE on failure. - */ -function mb_detect_order ($encoding_list = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Set/Get substitution character - * @link http://php.net/manual/en/function.mb-substitute-character.php - * @param mixed $substrchar [optional]

- * Specify the Unicode value as an integer, - * or as one of the following strings: - * "none" : no output - * @return mixed If substchar is set, it returns TRUE for success, - * otherwise returns FALSE. - * If substchar is not set, it returns the Unicode value, - * or "none" or "long". - */ -function mb_substitute_character ($substrchar = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Parse GET/POST/COOKIE data and set global variable - * @link http://php.net/manual/en/function.mb-parse-str.php - * @param string $encoded_string

- * The URL encoded data. - *

- * @param array $result [optional]

- * An array containing decoded and character encoded converted values. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mb_parse_str ($encoded_string, array &$result = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Callback function converts character encoding in output buffer - * @link http://php.net/manual/en/function.mb-output-handler.php - * @param string $contents

- * The contents of the output buffer. - *

- * @param int $status

- * The status of the output buffer. - *

- * @return string The converted string. - */ -function mb_output_handler ($contents, $status) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Get MIME charset string - * @link http://php.net/manual/en/function.mb-preferred-mime-name.php - * @param string $encoding

- * The encoding being checked. - *

- * @return string The MIME charset string for character encoding - * encoding. - */ -function mb_preferred_mime_name ($encoding) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Get string length - * @link http://php.net/manual/en/function.mb-strlen.php - * @param string $str

- * The string being checked for length. - *

- * @param string $encoding [optional] The encoding - * parameter is the character encoding. If it is omitted, the internal character - * encoding value will be used.

- * @return int the number of characters in - * string str having character encoding - * encoding. A multi-byte character is - * counted as 1. - */ -function mb_strlen ($str, $encoding = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Find position of first occurrence of string in a string - * @link http://php.net/manual/en/function.mb-strpos.php - * @param string $haystack

- * The string being checked. - *

- * @param string $needle

- * The string to find in haystack. In contrast - * with strpos, numeric values are not applied - * as the ordinal value of a character. - *

- * @param int $offset [optional]

- * The search offset. If it is not specified, 0 is used. - *

- * @param string $encoding [optional] The encoding - * parameter is the character encoding. If it is omitted, the internal character - * encoding value will be used.

- * @return int the numeric position of - * the first occurrence of needle in the - * haystack string. If - * needle is not found, it returns FALSE. - */ -function mb_strpos ($haystack, $needle, $offset = 0, $encoding = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Find position of last occurrence of a string in a string - * @link http://php.net/manual/en/function.mb-strrpos.php - * @param string $haystack

- * The string being checked, for the last occurrence - * of needle - *

- * @param string $needle

- * The string to find in haystack. - *

- * @param int $offset [optional] May be specified to begin searching an arbitrary number of characters into - * the string. Negative values will stop searching at an arbitrary point - * prior to the end of the string. - * @param string $encoding [optional] The encoding - * parameter is the character encoding. If it is omitted, the internal character - * encoding value will be used.

- * @return int the numeric position of - * the last occurrence of needle in the - * haystack string. If - * needle is not found, it returns FALSE. - */ -function mb_strrpos ($haystack, $needle, $offset = 0, $encoding = null) {} - -/** - * (PHP 5 >= 5.2.0)
- * Finds position of first occurrence of a string within another, case insensitive - * @link http://php.net/manual/en/function.mb-stripos.php - * @param string $haystack

- * The string from which to get the position of the first occurrence - * of needle - *

- * @param string $needle

- * The string to find in haystack - *

- * @param int $offset [optional]

- * The position in haystack - * to start searching - *

- * @param string $encoding [optional]

- * Character encoding name to use. - * If it is omitted, internal character encoding is used. - *

- * @return int Return the numeric position of the first occurrence of - * needle in the haystack - * string, or FALSE if needle is not found. - */ -function mb_stripos ($haystack, $needle, $offset = null, $encoding = null) {} - -/** - * (PHP 5 >= 5.2.0)
- * Finds position of last occurrence of a string within another, case insensitive - * @link http://php.net/manual/en/function.mb-strripos.php - * @param string $haystack

- * The string from which to get the position of the last occurrence - * of needle - *

- * @param string $needle

- * The string to find in haystack - *

- * @param int $offset [optional]

- * The position in haystack - * to start searching - *

- * @param string $encoding [optional]

- * Character encoding name to use. - * If it is omitted, internal character encoding is used. - *

- * @return int Return the numeric position of - * the last occurrence of needle in the - * haystack string, or FALSE - * if needle is not found. - */ -function mb_strripos ($haystack, $needle, $offset = 0, $encoding = null) {} - -/** - * (PHP 5 >= 5.2.0)
- * Finds first occurrence of a string within another - * @link http://php.net/manual/en/function.mb-strstr.php - * @param string $haystack

- * The string from which to get the first occurrence - * of needle - *

- * @param string $needle

- * The string to find in haystack - *

- * @param bool $before_needle [optional]

- * Determines which portion of haystack - * this function returns. - * If set to TRUE, it returns all of haystack - * from the beginning to the first occurrence of needle (excluding needle). - * If set to FALSE, it returns all of haystack - * from the first occurrence of needle to the end (including needle). - *

- * @param string $encoding [optional]

- * Character encoding name to use. - * If it is omitted, internal character encoding is used. - *

- * @return string the portion of haystack, - * or FALSE if needle is not found. - */ -function mb_strstr ($haystack, $needle, $before_needle = false, $encoding = null) {} - -/** - * (PHP 5 >= 5.2.0)
- * Finds the last occurrence of a character in a string within another - * @link http://php.net/manual/en/function.mb-strrchr.php - * @param string $haystack

- * The string from which to get the last occurrence - * of needle - *

- * @param string $needle

- * The string to find in haystack - *

- * @param bool $part [optional]

- * Determines which portion of haystack - * this function returns. - * If set to TRUE, it returns all of haystack - * from the beginning to the last occurrence of needle. - * If set to FALSE, it returns all of haystack - * from the last occurrence of needle to the end, - *

- * @param string $encoding [optional]

- * Character encoding name to use. - * If it is omitted, internal character encoding is used. - *

- * @return string the portion of haystack. - * or FALSE if needle is not found. - */ -function mb_strrchr ($haystack, $needle, $part = false, $encoding = null) {} - -/** - * (PHP 5 >= 5.2.0)
- * Finds first occurrence of a string within another, case insensitive - * @link http://php.net/manual/en/function.mb-stristr.php - * @param string $haystack

- * The string from which to get the first occurrence - * of needle - *

- * @param string $needle

- * The string to find in haystack - *

- * @param bool $before_needle [optional]

- * Determines which portion of haystack - * this function returns. - * If set to TRUE, it returns all of haystack - * from the beginning to the first occurrence of needle (excluding needle). - * If set to FALSE, it returns all of haystack - * from the first occurrence of needle to the end (including needle). - *

- * @param string $encoding [optional]

- * Character encoding name to use. - * If it is omitted, internal character encoding is used. - *

- * @return string the portion of haystack, - * or FALSE if needle is not found. - */ -function mb_stristr ($haystack, $needle, $before_needle = false, $encoding = null) {} - -/** - * (PHP 5 >= 5.2.0)
- * Finds the last occurrence of a character in a string within another, case insensitive - * @link http://php.net/manual/en/function.mb-strrichr.php - * @param string $haystack

- * The string from which to get the last occurrence - * of needle - *

- * @param string $needle

- * The string to find in haystack - *

- * @param bool $part [optional]

- * Determines which portion of haystack - * this function returns. - * If set to TRUE, it returns all of haystack - * from the beginning to the last occurrence of needle. - * If set to FALSE, it returns all of haystack - * from the last occurrence of needle to the end, - *

- * @param string $encoding [optional]

- * Character encoding name to use. - * If it is omitted, internal character encoding is used. - *

- * @return string the portion of haystack. - * or FALSE if needle is not found. - */ -function mb_strrichr ($haystack, $needle, $part = false, $encoding = null) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Count the number of substring occurrences - * @link http://php.net/manual/en/function.mb-substr-count.php - * @param string $haystack

- * The string being checked. - *

- * @param string $needle

- * The string being found. - *

- * @param string $encoding [optional] The encoding - * parameter is the character encoding. If it is omitted, the internal character - * encoding value will be used.

- * @return int The number of times the - * needle substring occurs in the - * haystack string. - */ -function mb_substr_count ($haystack, $needle, $encoding = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Get part of string - * @link http://php.net/manual/en/function.mb-substr.php - * @param string $str

- * The string to extract the substring from. - *

- * @param int $start

- * Position of first character to use from str. - *

- * @param int $length [optional]

- * Maximum number of characters to use from str. - *

- * @param string $encoding [optional] The encoding - * parameter is the character encoding. If it is omitted, the internal character - * encoding value will be used.

- * @return string mb_substr returns the portion of - * str specified by the - * start and - * length parameters. - */ -function mb_substr ($str, $start, $length = null, $encoding = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Get part of string - * @link http://php.net/manual/en/function.mb-strcut.php - * @param string $str

- * The string being cut. - *

- * @param int $start

- * Starting position in bytes. - *

- * @param int $length [optional]

- * Length in bytes. - *

- * @param string $encoding [optional] The encoding - * parameter is the character encoding. If it is omitted, the internal character - * encoding value will be used.

- * @return string mb_strcut returns the portion of - * str specified by the - * start and - * length parameters. - */ -function mb_strcut ($str, $start, $length = null, $encoding = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Return width of string - * @link http://php.net/manual/en/function.mb-strwidth.php - * @param string $str

- * The string being decoded. - *

- * @param string $encoding [optional] The encoding - * parameter is the character encoding. If it is omitted, the internal character - * encoding value will be used.

- * @return int The width of string str. - */ -function mb_strwidth ($str, $encoding = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Get truncated string with specified width - * @link http://php.net/manual/en/function.mb-strimwidth.php - * @param string $str

- * The string being decoded. - *

- * @param int $start

- * The start position offset. Number of - * characters from the beginning of string. (First character is 0) - *

- * @param int $width

- * The width of the desired trim. - *

- * @param string $trimmarker [optional]

- * A string that is added to the end of string - * when string is truncated. - *

- * @param string $encoding [optional] The encoding - * parameter is the character encoding. If it is omitted, the internal character - * encoding value will be used.

- * @return string The truncated string. If trimmarker is set, - * trimmarker is appended to the return value. - */ -function mb_strimwidth ($str, $start, $width, $trimmarker = null, $encoding = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Convert character encoding - * @link http://php.net/manual/en/function.mb-convert-encoding.php - * @param string $str

- * The string being encoded. - *

- * @param string $to_encoding

- * The type of encoding that str is being converted to. - *

- * @param mixed $from_encoding [optional]

- * Is specified by character code names before conversion. It is either - * an array, or a comma separated enumerated list. - * If from_encoding is not specified, the internal - * encoding will be used. - *

- *

- * See supported - * encodings. - *

- * @return string The encoded string. - */ -function mb_convert_encoding ($str, $to_encoding, $from_encoding = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Detect character encoding - * @link http://php.net/manual/en/function.mb-detect-encoding.php - * @param string $str

- * The string being detected. - *

- * @param mixed $encoding_list [optional]

- * encoding_list is list of character - * encoding. Encoding order may be specified by array or comma - * separated list string. - *

- *

- * If encoding_list is omitted, - * detect_order is used. - *

- * @param bool $strict [optional]

- * strict specifies whether to use - * the strict encoding detection or not. - * Default is FALSE. - *

- * @return string The detected character encoding or FALSE if the encoding cannot be - * detected from the given string. - */ -function mb_detect_encoding ($str, $encoding_list = 'mb_detect_order()', $strict = false) {} - -/** - * (PHP 5)
- * Returns an array of all supported encodings - * @link http://php.net/manual/en/function.mb-list-encodings.php - * @return array a numerically indexed array. - */ -function mb_list_encodings () {} - -/** - * (PHP 5 >= 5.3.0)
- * Get aliases of a known encoding type - * @link http://php.net/manual/en/function.mb-encoding-aliases.php - * @param string $encoding

- * The encoding type being checked, for aliases. - *

- * @return array a numerically indexed array of encoding aliases on success, - * or FALSE on failure - */ -function mb_encoding_aliases ($encoding) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Convert "kana" one from another ("zen-kaku", "han-kaku" and more) - * @link http://php.net/manual/en/function.mb-convert-kana.php - * @param string $str

- * The string being converted. - *

- * @param string $option [optional]

- * The conversion option. - *

- *

- * Specify with a combination of following options. - * - * Applicable Conversion Options - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
OptionMeaning
r - * Convert "zen-kaku" alphabets to "han-kaku" - *
R - * Convert "han-kaku" alphabets to "zen-kaku" - *
n - * Convert "zen-kaku" numbers to "han-kaku" - *
N - * Convert "han-kaku" numbers to "zen-kaku" - *
a - * Convert "zen-kaku" alphabets and numbers to "han-kaku" - *
A - * Convert "han-kaku" alphabets and numbers to "zen-kaku" - * (Characters included in "a", "A" options are - * U+0021 - U+007E excluding U+0022, U+0027, U+005C, U+007E) - *
s - * Convert "zen-kaku" space to "han-kaku" (U+3000 -> U+0020) - *
S - * Convert "han-kaku" space to "zen-kaku" (U+0020 -> U+3000) - *
k - * Convert "zen-kaku kata-kana" to "han-kaku kata-kana" - *
K - * Convert "han-kaku kata-kana" to "zen-kaku kata-kana" - *
h - * Convert "zen-kaku hira-gana" to "han-kaku kata-kana" - *
H - * Convert "han-kaku kata-kana" to "zen-kaku hira-gana" - *
c - * Convert "zen-kaku kata-kana" to "zen-kaku hira-gana" - *
C - * Convert "zen-kaku hira-gana" to "zen-kaku kata-kana" - *
V - * Collapse voiced sound notation and convert them into a character. Use with "K","H" - *
- *

- * @param string $encoding [optional] The encoding - * parameter is the character encoding. If it is omitted, the internal character - * encoding value will be used.

- * @return string The converted string. - */ -function mb_convert_kana ($str, $option = "KV", $encoding = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Encode string for MIME header - * @link http://php.net/manual/en/function.mb-encode-mimeheader.php - * @param string $str

- * The string being encoded. - *

- * @param string $charset [optional]

- * charset specifies the name of the character set - * in which str is represented in. The default value - * is determined by the current NLS setting (mbstring.language). - * mb_internal_encoding should be set to same encoding. - *

- * @param string $transfer_encoding [optional]

- * transfer_encoding specifies the scheme of MIME - * encoding. It should be either "B" (Base64) or - * "Q" (Quoted-Printable). Falls back to - * "B" if not given. - *

- * @param string $linefeed [optional]

- * linefeed specifies the EOL (end-of-line) marker - * with which mb_encode_mimeheader performs - * line-folding (a RFC term, - * the act of breaking a line longer than a certain length into multiple - * lines. The length is currently hard-coded to 74 characters). - * Falls back to "\r\n" (CRLF) if not given. - *

- * @param int $indent [optional]

- * Indentation of the first line (number of characters in the header - * before str). - *

- * @return string A converted version of the string represented in ASCII. - */ -function mb_encode_mimeheader ($str, $charset = null, $transfer_encoding = null, $linefeed = '"\r\n"', $indent = 0) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Decode string in MIME header field - * @link http://php.net/manual/en/function.mb-decode-mimeheader.php - * @param string $str

- * The string being decoded. - *

- * @return string The decoded string in internal character encoding. - */ -function mb_decode_mimeheader ($str) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Convert character code in variable(s) - * @link http://php.net/manual/en/function.mb-convert-variables.php - * @param string $to_encoding

- * The encoding that the string is being converted to. - *

- * @param mixed $from_encoding

- * from_encoding is specified as an array - * or comma separated string, it tries to detect encoding from - * from-coding. When from_encoding - * is omitted, detect_order is used. - *

- * @param mixed $vars

- * vars is the reference to the - * variable being converted. String, Array and Object are accepted. - * mb_convert_variables assumes all parameters - * have the same encoding. - *

- * @param mixed $_ [optional]

- * Additional vars. - *

- * @return string The character encoding before conversion for success, - * or FALSE for failure. - */ -function mb_convert_variables ($to_encoding, $from_encoding, &$vars, &$_ = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Encode character to HTML numeric string reference - * @link http://php.net/manual/en/function.mb-encode-numericentity.php - * @param string $str

- * The string being encoded. - *

- * @param array $convmap

- * convmap is array specifies code area to - * convert. - *

- * @param string $encoding The encoding - * parameter is the character encoding. If it is omitted, the internal character - * encoding value will be used.

- * @return string The converted string. - */ -function mb_encode_numericentity ($str, array $convmap, $encoding) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Decode HTML numeric string reference to character - * @link http://php.net/manual/en/function.mb-decode-numericentity.php - * @param string $str

- * The string being decoded. - *

- * @param array $convmap

- * convmap is an array that specifies - * the code area to convert. - *

- * @param string $encoding The encoding - * parameter is the character encoding. If it is omitted, the internal character - * encoding value will be used.

- * @return string The converted string. - */ -function mb_decode_numericentity ($str, array $convmap, $encoding) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Send encoded mail - * @link http://php.net/manual/en/function.mb-send-mail.php - * @param string $to

- * The mail addresses being sent to. Multiple - * recipients may be specified by putting a comma between each - * address in to. - * This parameter is not automatically encoded. - *

- * @param string $subject

- * The subject of the mail. - *

- * @param string $message

- * The message of the mail. - *

- * @param string $additional_headers [optional]

- * additional_headers is inserted at - * the end of the header. This is typically used to add extra - * headers. Multiple extra headers are separated with a - * newline ("\n"). - *

- * @param string $additional_parameter [optional]

- * additional_parameter is a MTA command line - * parameter. It is useful when setting the correct Return-Path - * header when using sendmail. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mb_send_mail ($to, $subject, $message, $additional_headers = null, $additional_parameter = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Get internal settings of mbstring - * @link http://php.net/manual/en/function.mb-get-info.php - * @param string $type [optional]

- * If type isn't specified or is specified to - * "all", an array having the elements "internal_encoding", - * "http_output", "http_input", "func_overload", "mail_charset", - * "mail_header_encoding", "mail_body_encoding" will be returned. - *

- *

- * If type is specified as "http_output", - * "http_input", "internal_encoding", "func_overload", - * the specified setting parameter will be returned. - *

- * @return mixed An array of type information if type - * is not specified, otherwise a specific type. - */ -function mb_get_info ($type = "all") {} - -/** - * (PHP 4 >= 4.4.3, PHP 5 >= 5.1.3)
- * Check if the string is valid for the specified encoding - * @link http://php.net/manual/en/function.mb-check-encoding.php - * @param string $var [optional]

- * The byte stream to check. If it is omitted, this function checks - * all the input from the beginning of the request. - *

- * @param string $encoding [optional]

- * The expected encoding. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mb_check_encoding ($var = null, $encoding = 'mb_internal_encoding()') {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Returns current encoding for multibyte regex as string - * @link http://php.net/manual/en/function.mb-regex-encoding.php - * @param string $encoding [optional] The encoding - * parameter is the character encoding. If it is omitted, the internal character - * encoding value will be used.

- * @return mixed - */ -function mb_regex_encoding ($encoding = null) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Set/Get the default options for mbregex functions - * @link http://php.net/manual/en/function.mb-regex-set-options.php - * @param string $options [optional]

- * The options to set. This is a a string where each - * character is an option. To set a mode, the mode - * character must be the last one set, however there - * can only be set one mode but multiple options. - *

- * - * Regex options - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
OptionMeaning
iAmbiguity match on
xEnables extended pattern form
m'.' matches with newlines
s'^' -> '\A', '$' -> '\Z'
pSame as both the m and s options
lFinds longest matches
nIgnores empty matches
eeval resulting code
- * - * Regex syntax modes - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
ModeMeaning
jJava (Sun java.util.regex)
uGNU regex
ggrep
cEmacs
rRuby
zPerl
bPOSIX Basic regex
dPOSIX Extended regex
- * @return string The previous options. If options is omitted, - * it returns the string that describes the current options. - */ -function mb_regex_set_options ($options = "msr") {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Regular expression match with multibyte support - * @link http://php.net/manual/en/function.mb-ereg.php - * @param string $pattern

- * The search pattern. - *

- * @param string $string

- * The search string. - *

- * @param array $regs [optional]

- * Contains a substring of the matched string. - *

- * @return int - */ -function mb_ereg ($pattern, $string, array $regs = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Regular expression match ignoring case with multibyte support - * @link http://php.net/manual/en/function.mb-eregi.php - * @param string $pattern

- * The regular expression pattern. - *

- * @param string $string

- * The string being searched. - *

- * @param array $regs [optional]

- * Contains a substring of the matched string. - *

- * @return int - */ -function mb_eregi ($pattern, $string, array $regs = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Replace regular expression with multibyte support - * @link http://php.net/manual/en/function.mb-ereg-replace.php - * @param string $pattern

- * The regular expression pattern. - *

- *

- * Multibyte characters may be used in pattern. - *

- * @param string $replacement

- * The replacement text. - *

- * @param string $string

- * The string being checked. - *

- * @param string $option [optional] Matching condition can be set by option - * parameter. If i is specified for this - * parameter, the case will be ignored. If x is - * specified, white space will be ignored. If m - * is specified, match will be executed in multiline mode and line - * break will be included in '.'. If p is - * specified, match will be executed in POSIX mode, line break - * will be considered as normal character. If e - * is specified, replacement string will be - * evaluated as PHP expression. - * @return string The resultant string on success, or FALSE on error. - */ -function mb_ereg_replace ($pattern, $replacement, $string, $option = "msr") {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Replace regular expression with multibyte support ignoring case - * @link http://php.net/manual/en/function.mb-eregi-replace.php - * @param string $pattern

- * The regular expression pattern. Multibyte characters may be used. The case will be ignored. - *

- * @param string $replace

- * The replacement text. - *

- * @param string $string

- * The searched string. - *

- * @param string $option [optional] option has the same meaning as in - * mb_ereg_replace. - * @return string The resultant string or FALSE on error. - */ -function mb_eregi_replace ($pattern, $replace, $string, $option = "msri") {} - -/** - * (No version information available, might only be in SVN)
- * Perform a regular expresssion seach and replace with multibyte support using a callback - * @link http://php.net/manual/en/function.mb-ereg-replace-callback.php - * @param string $pattern

- * The regular expression pattern. - *

- *

- * Multibyte characters may be used in pattern. - *

- * @param callable $callback

- * A callback that will be called and passed an array of matched elements - * in the subject string. The callback should - * return the replacement string. - *

- *

- * You'll often need the callback function - * for a mb_ereg_replace_callback in just one place. - * In this case you can use an - * anonymous function (since - * PHP 5.3.0) or create_function to - * declare an anonymous function as callback within the call to - * mb_ereg_replace_callback. By doing it this way - * you have all information for the call in one place and do not - * clutter the function namespace with a callback function's name - * not used anywhere else. - *

- * @param string $string

- * The string being checked. - *

- * @param string $option [optional]

- * Matching condition can be set by option - * parameter. If i is specified for this - * parameter, the case will be ignored. If x is - * specified, white space will be ignored. If m - * is specified, match will be executed in multiline mode and line - * break will be included in '.'. If p is - * specified, match will be executed in POSIX mode, line break - * will be considered as normal character. Note that e - * cannot be used for mb_ereg_replace_callback. - *

- * @return string The resultant string on success, or FALSE on error. - */ -function mb_ereg_replace_callback ($pattern, callable $callback, $string, $option = "msr") {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Split multibyte string using regular expression - * @link http://php.net/manual/en/function.mb-split.php - * @param string $pattern

- * The regular expression pattern. - *

- * @param string $string

- * The string being split. - *

- * @param int $limit [optional] If optional parameter limit is specified, - * it will be split in limit elements as - * maximum. - * @return array The result as an array. - */ -function mb_split ($pattern, $string, $limit = -1) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Regular expression match for multibyte string - * @link http://php.net/manual/en/function.mb-ereg-match.php - * @param string $pattern

- * The regular expression pattern. - *

- * @param string $string

- * The string being evaluated. - *

- * @param string $option [optional]

- *

- * @return bool - */ -function mb_ereg_match ($pattern, $string, $option = "msr") {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Multibyte regular expression match for predefined multibyte string - * @link http://php.net/manual/en/function.mb-ereg-search.php - * @param string $pattern [optional]

- * The search pattern. - *

- * @param string $option [optional]

- * The search option. - *

- * @return bool - */ -function mb_ereg_search ($pattern = null, $option = "ms") {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Returns position and length of a matched part of the multibyte regular expression for a predefined multibyte string - * @link http://php.net/manual/en/function.mb-ereg-search-pos.php - * @param string $pattern [optional]

- * The search pattern. - *

- * @param string $option [optional]

- * The search option. - *

- * @return array - */ -function mb_ereg_search_pos ($pattern = null, $option = "ms") {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Returns the matched part of a multibyte regular expression - * @link http://php.net/manual/en/function.mb-ereg-search-regs.php - * @param string $pattern [optional]

- * The search pattern. - *

- * @param string $option [optional]

- * The search option. - *

- * @return array - */ -function mb_ereg_search_regs ($pattern = null, $option = "ms") {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Setup string and regular expression for a multibyte regular expression match - * @link http://php.net/manual/en/function.mb-ereg-search-init.php - * @param string $string

- * The search string. - *

- * @param string $pattern [optional]

- * The search pattern. - *

- * @param string $option [optional]

- * The search option. - *

- * @return bool - */ -function mb_ereg_search_init ($string, $pattern = null, $option = "msr") {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Retrieve the result from the last multibyte regular expression match - * @link http://php.net/manual/en/function.mb-ereg-search-getregs.php - * @return array - */ -function mb_ereg_search_getregs () {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Returns start point for next regular expression match - * @link http://php.net/manual/en/function.mb-ereg-search-getpos.php - * @return int - */ -function mb_ereg_search_getpos () {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Set start point of next regular expression match - * @link http://php.net/manual/en/function.mb-ereg-search-setpos.php - * @param int $position

- * The position to set. - *

- * @return bool - */ -function mb_ereg_search_setpos ($position) {} - -/** - * @param $encoding [optional] - */ -function mbregex_encoding ($encoding) {} - -/** - * @param $pattern - * @param $string - * @param $registers [optional] - */ -function mbereg ($pattern, $string, &$registers) {} - -/** - * @param $pattern - * @param $string - * @param $registers [optional] - */ -function mberegi ($pattern, $string, &$registers) {} - -/** - * @param $pattern - * @param $replacement - * @param $string - * @param $option [optional] - */ -function mbereg_replace ($pattern, $replacement, $string, $option) {} - -/** - * @param $pattern - * @param $replacement - * @param $string - */ -function mberegi_replace ($pattern, $replacement, $string) {} - -/** - * @param $pattern - * @param $string - * @param $limit [optional] - */ -function mbsplit ($pattern, $string, $limit) {} - -/** - * @param $pattern - * @param $string - * @param $option [optional] - */ -function mbereg_match ($pattern, $string, $option) {} - -/** - * @param $pattern [optional] - * @param $option [optional] - */ -function mbereg_search ($pattern, $option) {} - -/** - * @param $pattern [optional] - * @param $option [optional] - */ -function mbereg_search_pos ($pattern, $option) {} - -/** - * @param $pattern [optional] - * @param $option [optional] - */ -function mbereg_search_regs ($pattern, $option) {} - -/** - * @param $string - * @param $pattern [optional] - * @param $option [optional] - */ -function mbereg_search_init ($string, $pattern, $option) {} - -function mbereg_search_getregs () {} - -function mbereg_search_getpos () {} - -/** - * @param $position - */ -function mbereg_search_setpos ($position) {} - -define ('MB_OVERLOAD_MAIL', 1); -define ('MB_OVERLOAD_STRING', 2); -define ('MB_OVERLOAD_REGEX', 4); -define ('MB_CASE_UPPER', 0); -define ('MB_CASE_LOWER', 1); -define ('MB_CASE_TITLE', 2); - -// End of mbstring v. -?> diff --git a/phpruntime/mcrypt.php b/phpruntime/mcrypt.php deleted file mode 100644 index 4c8fa82..0000000 --- a/phpruntime/mcrypt.php +++ /dev/null @@ -1,592 +0,0 @@ - - * Deprecated: Encrypts/decrypts data in ECB mode - * @link http://php.net/manual/en/function.mcrypt-ecb.php - * @param int $cipher - * @param string $key - * @param string $data - * @param int $mode - * @return string - */ -function mcrypt_ecb ($cipher, $key, $data, $mode) {} - -/** - * (PHP 4, PHP 5)
- * Encrypts/decrypts data in CBC mode - * @link http://php.net/manual/en/function.mcrypt-cbc.php - * @param int $cipher - * @param string $key - * @param string $data - * @param int $mode - * @param string $iv [optional] - * @return string - */ -function mcrypt_cbc ($cipher, $key, $data, $mode, $iv = null) {} - -/** - * (PHP 4, PHP 5)
- * Encrypts/decrypts data in CFB mode - * @link http://php.net/manual/en/function.mcrypt-cfb.php - * @param int $cipher - * @param string $key - * @param string $data - * @param int $mode - * @param string $iv - * @return string - */ -function mcrypt_cfb ($cipher, $key, $data, $mode, $iv) {} - -/** - * (PHP 4, PHP 5)
- * Encrypts/decrypts data in OFB mode - * @link http://php.net/manual/en/function.mcrypt-ofb.php - * @param int $cipher - * @param string $key - * @param string $data - * @param int $mode - * @param string $iv - * @return string - */ -function mcrypt_ofb ($cipher, $key, $data, $mode, $iv) {} - -/** - * (PHP 4, PHP 5)
- * Gets the key size of the specified cipher - * @link http://php.net/manual/en/function.mcrypt-get-key-size.php - * @param int $cipher One of the MCRYPT_ciphername constants, or the name of the algorithm as string.

- * @return int the maximum supported key size of the algorithm in bytes - * or FALSE on failure. - */ -function mcrypt_get_key_size ($cipher) {} - -/** - * (PHP 4, PHP 5)
- * Gets the block size of the specified cipher - * @link http://php.net/manual/en/function.mcrypt-get-block-size.php - * @param int $cipher One of the MCRYPT_ciphername constants, or the name of the algorithm as string.

- * @return int Gets the block size, as an integer. - */ -function mcrypt_get_block_size ($cipher) {} - -/** - * (PHP 4, PHP 5)
- * Gets the name of the specified cipher - * @link http://php.net/manual/en/function.mcrypt-get-cipher-name.php - * @param int $cipher One of the MCRYPT_ciphername constants, or the name of the algorithm as string.

- * @return string This function returns the name of the cipher or FALSE if the cipher does - * not exist. - */ -function mcrypt_get_cipher_name ($cipher) {} - -/** - * (PHP 4, PHP 5)
- * Creates an initialization vector (IV) from a random source - * @link http://php.net/manual/en/function.mcrypt-create-iv.php - * @param int $size

- * The size of the IV. - *

- * @param int $source [optional]

- * The source of the IV. The source can be - * MCRYPT_RAND (system random number generator), - * MCRYPT_DEV_RANDOM (read data from - * /dev/random) and - * MCRYPT_DEV_URANDOM (read data from - * /dev/urandom). Prior to 5.3.0, - * MCRYPT_RAND was the only one supported on Windows. - *

- * @return string the initialization vector, or FALSE on error. - */ -function mcrypt_create_iv ($size, $source = 'MCRYPT_DEV_RANDOM') {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Gets an array of all supported ciphers - * @link http://php.net/manual/en/function.mcrypt-list-algorithms.php - * @param string $lib_dir [optional]

- * Specifies the directory where all algorithms are located. If not - * specified, the value of the mcrypt.algorithms_dir - * php.ini directive is used. - *

- * @return array an array with all the supported algorithms. - */ -function mcrypt_list_algorithms ($lib_dir = 'ini_get("mcrypt.algorithms_dir")') {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Gets an array of all supported modes - * @link http://php.net/manual/en/function.mcrypt-list-modes.php - * @param string $lib_dir [optional]

- * Specifies the directory where all modes are located. If not - * specified, the value of the mcrypt.modes_dir - * php.ini directive is used. - *

- * @return array an array with all the supported modes. - */ -function mcrypt_list_modes ($lib_dir = 'ini_get("mcrypt.modes_dir")') {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Returns the size of the IV belonging to a specific cipher/mode combination - * @link http://php.net/manual/en/function.mcrypt-get-iv-size.php - * @param string $cipher One of the MCRYPT_ciphername constants, or the name of the algorithm as string.

- * @param string $mode One of the MCRYPT_MODE_modename constants, or one of the following strings: "ecb", "cbc", "cfb", "ofb", "nofb" or "stream".

- *

- * The IV is ignored in ECB mode as this mode does not require it. You will - * need to have the same IV (think: starting point) both at encryption and - * decryption stages, otherwise your encryption will fail. - *

- * @return int the size of the Initialization Vector (IV) in bytes. On error the - * function returns FALSE. If the IV is ignored in the specified cipher/mode - * combination zero is returned. - */ -function mcrypt_get_iv_size ($cipher, $mode) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Encrypts plaintext with given parameters - * @link http://php.net/manual/en/function.mcrypt-encrypt.php - * @param string $cipher One of the MCRYPT_ciphername constants, or the name of the algorithm as string.

- * @param string $key

- * The key with which the data will be encrypted. If it's smaller than - * the required keysize, it is padded with '\0'. It is - * better not to use ASCII strings for keys. - *

- *

- * It is recommended to use the mhash functions to create a key from a - * string. - *

- * @param string $data

- * The data that will be encrypted with the given cipher - * and mode. If the size of the data is not n * blocksize, - * the data will be padded with '\0'. - *

- *

- * The returned crypttext can be larger than the size of the data that was - * given by data. - *

- * @param string $mode One of the MCRYPT_MODE_modename constants, or one of the following strings: "ecb", "cbc", "cfb", "ofb", "nofb" or "stream".

- * @param string $iv [optional] Used for the initialization in CBC, CFB, OFB modes, and in some algorithms in STREAM mode. If you do not supply an IV, while it is needed for an algorithm, the function issues a warning and uses an IV with all its bytes set to "\0".

- * @return string the encrypted data, as a string. - */ -function mcrypt_encrypt ($cipher, $key, $data, $mode, $iv = null) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Decrypts crypttext with given parameters - * @link http://php.net/manual/en/function.mcrypt-decrypt.php - * @param string $cipher One of the MCRYPT_ciphername constants, or the name of the algorithm as string.

- * @param string $key

- * The key with which the data was encrypted. If it's smaller - * than the required keysize, it is padded with - * '\0'. - *

- * @param string $data

- * The data that will be decrypted with the given cipher - * and mode. If the size of the data is not n * blocksize, - * the data will be padded with '\0'. - *

- * @param string $mode One of the MCRYPT_MODE_modename constants, or one of the following strings: "ecb", "cbc", "cfb", "ofb", "nofb" or "stream".

- * @param string $iv [optional] Used for the initialization in CBC, CFB, OFB modes, and in some algorithms in STREAM mode. If you do not supply an IV, while it is needed for an algorithm, the function issues a warning and uses an IV with all its bytes set to "\0".

- * @return string the decrypted data as a string. - */ -function mcrypt_decrypt ($cipher, $key, $data, $mode, $iv = null) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Opens the module of the algorithm and the mode to be used - * @link http://php.net/manual/en/function.mcrypt-module-open.php - * @param string $algorithm One of the MCRYPT_ciphername constants, or the name of the algorithm as string.

- * @param string $algorithm_directory

- * The algorithm_directory parameter is used to locate - * the encryption module. When you supply a directory name, it is used. When - * you set it to an empty string (""), the value set by the - * mcrypt.algorithms_dir php.ini directive is used. When - * it is not set, the default directory that is used is the one that was compiled - * into libmcrypt (usually /usr/local/lib/libmcrypt). - *

- * @param string $mode One of the MCRYPT_MODE_modename constants, or one of the following strings: "ecb", "cbc", "cfb", "ofb", "nofb" or "stream".

- * @param string $mode_directory

- * The mode_directory parameter is used to locate - * the encryption module. When you supply a directory name, it is used. When - * you set it to an empty string (""), the value set by the - * mcrypt.modes_dir php.ini directive is used. When - * it is not set, the default directory that is used is the one that was compiled-in - * into libmcrypt (usually /usr/local/lib/libmcrypt). - *

- * @return resource Normally it returns an encryption descriptor, or FALSE on error. - */ -function mcrypt_module_open ($algorithm, $algorithm_directory, $mode, $mode_directory) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * This function initializes all buffers needed for encryption - * @link http://php.net/manual/en/function.mcrypt-generic-init.php - * @param resource $td

- * The encryption descriptor. - *

- * @param string $key

- * The maximum length of the key should be the one obtained by calling - * mcrypt_enc_get_key_size and every value smaller - * than this is legal. - *

- * @param string $iv

- * The IV should normally have the size of the algorithms block size, but - * you must obtain the size by calling - * mcrypt_enc_get_iv_size. IV is ignored in ECB. IV - * MUST exist in CFB, CBC, STREAM, nOFB and OFB modes. It needs to be - * random and unique (but not secret). The same IV must be used for - * encryption/decryption. If you do not want to use it you should set it - * to zeros, but this is not recommended. - *

- * @return int The function returns a negative value on error: -3 when the key length - * was incorrect, -4 when there was a memory allocation problem and any - * other return value is an unknown error. If an error occurs a warning will - * be displayed accordingly. FALSE is returned if incorrect parameters - * were passed. - */ -function mcrypt_generic_init ($td, $key, $iv) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * This function encrypts data - * @link http://php.net/manual/en/function.mcrypt-generic.php - * @param resource $td

- * The encryption descriptor. - *

- *

- * The encryption handle should always be initialized with - * mcrypt_generic_init with a key and an IV before - * calling this function. Where the encryption is done, you should free the - * encryption buffers by calling mcrypt_generic_deinit. - * See mcrypt_module_open for an example. - *

- * @param string $data

- * The data to encrypt. - *

- * @return string the encrypted data. - */ -function mcrypt_generic ($td, $data) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Decrypts data - * @link http://php.net/manual/en/function.mdecrypt-generic.php - * @param resource $td

- * An encryption descriptor returned by - * mcrypt_module_open - *

- * @param string $data

- * Encrypted data. - *

- * @return string - */ -function mdecrypt_generic ($td, $data) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5 <= 5.1.6)
- * This function terminates encryption - * @link http://php.net/manual/en/function.mcrypt-generic-end.php - * @param resource $td - * @return bool - */ -function mcrypt_generic_end ($td) {} - -/** - * (PHP 4 >= 4.0.7, PHP 5)
- * This function deinitializes an encryption module - * @link http://php.net/manual/en/function.mcrypt-generic-deinit.php - * @param resource $td

- * The encryption descriptor. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mcrypt_generic_deinit ($td) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Runs a self test on the opened module - * @link http://php.net/manual/en/function.mcrypt-enc-self-test.php - * @param resource $td

- * The encryption descriptor. - *

- * @return int If the self test succeeds it returns FALSE. In case of an error, it - * returns TRUE. - */ -function mcrypt_enc_self_test ($td) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Checks whether the encryption of the opened mode works on blocks - * @link http://php.net/manual/en/function.mcrypt-enc-is-block-algorithm-mode.php - * @param resource $td

- * The encryption descriptor. - *

- * @return bool TRUE if the mode is for use with block algorithms, otherwise it - * returns FALSE. - */ -function mcrypt_enc_is_block_algorithm_mode ($td) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Checks whether the algorithm of the opened mode is a block algorithm - * @link http://php.net/manual/en/function.mcrypt-enc-is-block-algorithm.php - * @param resource $td

- * The encryption descriptor. - *

- * @return bool TRUE if the algorithm is a block algorithm or FALSE if it is - * a stream one. - */ -function mcrypt_enc_is_block_algorithm ($td) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Checks whether the opened mode outputs blocks - * @link http://php.net/manual/en/function.mcrypt-enc-is-block-mode.php - * @param resource $td

- * The encryption descriptor. - *

- * @return bool TRUE if the mode outputs blocks of bytes, - * or FALSE if it outputs just bytes. - */ -function mcrypt_enc_is_block_mode ($td) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Returns the blocksize of the opened algorithm - * @link http://php.net/manual/en/function.mcrypt-enc-get-block-size.php - * @param resource $td

- * The encryption descriptor. - *

- * @return int the block size of the specified algorithm in bytes. - */ -function mcrypt_enc_get_block_size ($td) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Returns the maximum supported keysize of the opened mode - * @link http://php.net/manual/en/function.mcrypt-enc-get-key-size.php - * @param resource $td

- * The encryption descriptor. - *

- * @return int the maximum supported key size of the algorithm in bytes. - */ -function mcrypt_enc_get_key_size ($td) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Returns an array with the supported keysizes of the opened algorithm - * @link http://php.net/manual/en/function.mcrypt-enc-get-supported-key-sizes.php - * @param resource $td

- * The encryption descriptor. - *

- * @return array an array with the key sizes supported by the algorithm - * specified by the encryption descriptor. If it returns an empty - * array then all key sizes between 1 and - * mcrypt_enc_get_key_size are supported by the - * algorithm. - */ -function mcrypt_enc_get_supported_key_sizes ($td) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Returns the size of the IV of the opened algorithm - * @link http://php.net/manual/en/function.mcrypt-enc-get-iv-size.php - * @param resource $td

- * The encryption descriptor. - *

- * @return int the size of the IV, or 0 if the IV is ignored by the algorithm. - */ -function mcrypt_enc_get_iv_size ($td) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Returns the name of the opened algorithm - * @link http://php.net/manual/en/function.mcrypt-enc-get-algorithms-name.php - * @param resource $td

- * The encryption descriptor. - *

- * @return string the name of the opened algorithm as a string. - */ -function mcrypt_enc_get_algorithms_name ($td) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Returns the name of the opened mode - * @link http://php.net/manual/en/function.mcrypt-enc-get-modes-name.php - * @param resource $td

- * The encryption descriptor. - *

- * @return string the name as a string. - */ -function mcrypt_enc_get_modes_name ($td) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * This function runs a self test on the specified module - * @link http://php.net/manual/en/function.mcrypt-module-self-test.php - * @param string $algorithm One of the MCRYPT_ciphername constants, or the name of the algorithm as string.

- * @param string $lib_dir [optional]

- * The optional lib_dir parameter can contain the - * location where the algorithm module is on the system. - *

- * @return bool The function returns TRUE if the self test succeeds, or FALSE when it - * fails. - */ -function mcrypt_module_self_test ($algorithm, $lib_dir = null) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Returns if the specified module is a block algorithm or not - * @link http://php.net/manual/en/function.mcrypt-module-is-block-algorithm-mode.php - * @param string $mode

- * The mode to check. - *

- * @param string $lib_dir [optional]

- * The optional lib_dir parameter can contain the - * location where the algorithm module is on the system. - *

- * @return bool This function returns TRUE if the mode is for use with block - * algorithms, otherwise it returns FALSE. (e.g. FALSE for stream, and - * TRUE for cbc, cfb, ofb). - */ -function mcrypt_module_is_block_algorithm_mode ($mode, $lib_dir = null) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * This function checks whether the specified algorithm is a block algorithm - * @link http://php.net/manual/en/function.mcrypt-module-is-block-algorithm.php - * @param string $algorithm

- * The algorithm to check. - *

- * @param string $lib_dir [optional]

- * The optional lib_dir parameter can contain the - * location where the algorithm module is on the system. - *

- * @return bool This function returns TRUE if the specified algorithm is a block - * algorithm, or FALSE if it is a stream one. - */ -function mcrypt_module_is_block_algorithm ($algorithm, $lib_dir = null) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Returns if the specified mode outputs blocks or not - * @link http://php.net/manual/en/function.mcrypt-module-is-block-mode.php - * @param string $mode One of the MCRYPT_MODE_modename constants, or one of the following strings: "ecb", "cbc", "cfb", "ofb", "nofb" or "stream".

- * @param string $lib_dir [optional]

- * The optional lib_dir parameter can contain the - * location where the algorithm module is on the system. - *

- * @return bool This function returns TRUE if the mode outputs blocks of bytes or - * FALSE if it outputs just bytes. (e.g. TRUE for cbc and ecb, and - * FALSE for cfb and stream). - */ -function mcrypt_module_is_block_mode ($mode, $lib_dir = null) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Returns the blocksize of the specified algorithm - * @link http://php.net/manual/en/function.mcrypt-module-get-algo-block-size.php - * @param string $algorithm

- * The algorithm name. - *

- * @param string $lib_dir [optional]

- * This optional parameter can contain the location where the mode module - * is on the system. - *

- * @return int the block size of the algorithm specified in bytes. - */ -function mcrypt_module_get_algo_block_size ($algorithm, $lib_dir = null) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Returns the maximum supported keysize of the opened mode - * @link http://php.net/manual/en/function.mcrypt-module-get-algo-key-size.php - * @param string $algorithm

- * The algorithm name. - *

- * @param string $lib_dir [optional]

- * This optional parameter can contain the location where the mode module - * is on the system. - *

- * @return int This function returns the maximum supported key size of the - * algorithm specified in bytes. - */ -function mcrypt_module_get_algo_key_size ($algorithm, $lib_dir = null) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Returns an array with the supported keysizes of the opened algorithm - * @link http://php.net/manual/en/function.mcrypt-module-get-supported-key-sizes.php - * @param string $algorithm

- * The algorithm to be used. - *

- * @param string $lib_dir [optional]

- * The optional lib_dir parameter can contain the - * location where the algorithm module is on the system. - *

- * @return array an array with the key sizes supported by the specified algorithm. - * If it returns an empty array then all key sizes between 1 and - * mcrypt_module_get_algo_key_size are supported by the - * algorithm. - */ -function mcrypt_module_get_supported_key_sizes ($algorithm, $lib_dir = null) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Closes the mcrypt module - * @link http://php.net/manual/en/function.mcrypt-module-close.php - * @param resource $td

- * The encryption descriptor. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mcrypt_module_close ($td) {} - -define ('MCRYPT_ENCRYPT', 0); -define ('MCRYPT_DECRYPT', 1); -define ('MCRYPT_DEV_RANDOM', 0); -define ('MCRYPT_DEV_URANDOM', 1); -define ('MCRYPT_RAND', 2); -define ('MCRYPT_3DES', "tripledes"); -define ('MCRYPT_ARCFOUR_IV', "arcfour-iv"); -define ('MCRYPT_ARCFOUR', "arcfour"); -define ('MCRYPT_BLOWFISH', "blowfish"); -define ('MCRYPT_BLOWFISH_COMPAT', "blowfish-compat"); -define ('MCRYPT_CAST_128', "cast-128"); -define ('MCRYPT_CAST_256', "cast-256"); -define ('MCRYPT_CRYPT', "crypt"); -define ('MCRYPT_DES', "des"); -define ('MCRYPT_ENIGNA', "crypt"); -define ('MCRYPT_GOST', "gost"); -define ('MCRYPT_LOKI97', "loki97"); -define ('MCRYPT_PANAMA', "panama"); -define ('MCRYPT_RC2', "rc2"); -define ('MCRYPT_RIJNDAEL_128', "rijndael-128"); -define ('MCRYPT_RIJNDAEL_192', "rijndael-192"); -define ('MCRYPT_RIJNDAEL_256', "rijndael-256"); -define ('MCRYPT_SAFER64', "safer-sk64"); -define ('MCRYPT_SAFER128', "safer-sk128"); -define ('MCRYPT_SAFERPLUS', "saferplus"); -define ('MCRYPT_SERPENT', "serpent"); -define ('MCRYPT_THREEWAY', "threeway"); -define ('MCRYPT_TRIPLEDES', "tripledes"); -define ('MCRYPT_TWOFISH', "twofish"); -define ('MCRYPT_WAKE', "wake"); -define ('MCRYPT_XTEA', "xtea"); -define ('MCRYPT_IDEA', "idea"); -define ('MCRYPT_MARS', "mars"); -define ('MCRYPT_RC6', "rc6"); -define ('MCRYPT_SKIPJACK', "skipjack"); -define ('MCRYPT_MODE_CBC', "cbc"); -define ('MCRYPT_MODE_CFB', "cfb"); -define ('MCRYPT_MODE_ECB', "ecb"); -define ('MCRYPT_MODE_NOFB', "nofb"); -define ('MCRYPT_MODE_OFB', "ofb"); -define ('MCRYPT_MODE_STREAM', "stream"); - -// End of mcrypt v. -?> diff --git a/phpruntime/memcache.php b/phpruntime/memcache.php deleted file mode 100644 index 7d02f82..0000000 --- a/phpruntime/memcache.php +++ /dev/null @@ -1,281 +0,0 @@ - - * Open memcached server connection - * @link http://php.net/manual/en/memcache.connect.php - * @param string $host

- * Point to the host where memcached is listening for connections. This parameter - * may also specify other transports like unix:///path/to/memcached.sock - * to use UNIX domain sockets, in this case port must also - * be set to 0. - *

- * @param int $port [optional]

- * Point to the port where memcached is listening for connections. Set this - * parameter to 0 when using UNIX domain sockets. - *

- *

- * Please note: port defaults to - * memcache.default_port - * if not specified. For this reason it is wise to specify the port - * explicitly in this method call. - *

- * @param int $timeout [optional]

- * Value in seconds which will be used for connecting to the daemon. Think - * twice before changing the default value of 1 second - you can lose all - * the advantages of caching if your connection is too slow. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function connect ($host, $port = null, $timeout = null) {} - - /** - * (PECL memcache >= 0.4.0)
- * Open memcached server persistent connection - * @link http://php.net/manual/en/memcache.pconnect.php - * @param string $host

- * Point to the host where memcached is listening for connections. This parameter - * may also specify other transports like unix:///path/to/memcached.sock - * to use UNIX domain sockets, in this case port must also - * be set to 0. - *

- * @param int $port [optional]

- * Point to the port where memcached is listening for connections. Set this - * parameter to 0 when using UNIX domain sockets. - *

- * @param int $timeout [optional]

- * Value in seconds which will be used for connecting to the daemon. Think - * twice before changing the default value of 1 second - you can lose all - * the advantages of caching if your connection is too slow. - *

- * @return mixed a Memcache object or FALSE on failure. - */ - public function pconnect ($host, $port = null, $timeout = null) {} - - /** - * (PECL memcache >= 2.0.0)
- * Add a memcached server to connection pool - * @link http://php.net/manual/en/memcache.addserver.php - * @param string $host

- * Point to the host where memcached is listening for connections. This parameter - * may also specify other transports like unix:///path/to/memcached.sock - * to use UNIX domain sockets, in this case port must also - * be set to 0. - *

- * @param int $port [optional]

- * Point to the port where memcached is listening for connections. - * Set this - * parameter to 0 when using UNIX domain sockets. - *

- *

- * Please note: port defaults to - * memcache.default_port - * if not specified. For this reason it is wise to specify the port - * explicitly in this method call. - *

- * @param bool $persistent [optional]

- * Controls the use of a persistent connection. Default to TRUE. - *

- * @param int $weight [optional]

- * Number of buckets to create for this server which in turn control its - * probability of it being selected. The probability is relative to the - * total weight of all servers. - *

- * @param int $timeout [optional]

- * Value in seconds which will be used for connecting to the daemon. Think - * twice before changing the default value of 1 second - you can lose all - * the advantages of caching if your connection is too slow. - *

- * @param int $retry_interval [optional]

- * Controls how often a failed server will be retried, the default value - * is 15 seconds. Setting this parameter to -1 disables automatic retry. - * Neither this nor the persistent parameter has any - * effect when the extension is loaded dynamically via dl. - *

- *

- * Each failed connection struct has its own timeout and before it has expired - * the struct will be skipped when selecting backends to serve a request. Once - * expired the connection will be successfully reconnected or marked as failed - * for another retry_interval seconds. The typical - * effect is that each web server child will retry the connection about every - * retry_interval seconds when serving a page. - *

- * @param bool $status [optional]

- * Controls if the server should be flagged as online. Setting this parameter - * to FALSE and retry_interval to -1 allows a failed - * server to be kept in the pool so as not to affect the key distribution - * algorithm. Requests for this server will then failover or fail immediately - * depending on the memcache.allow_failover setting. - * Default to TRUE, meaning the server should be considered online. - *

- * @param callable $failure_callback [optional]

- * Allows the user to specify a callback function to run upon encountering an - * error. The callback is run before failover is attempted. The function takes - * two parameters, the hostname and port of the failed server. - *

- * @param int $timeoutms [optional]

- *

- * @return bool TRUE on success or FALSE on failure. - */ - public function addserver ($host, $port = 11211, $persistent = null, $weight = null, $timeout = null, $retry_interval = null, $status = null, callable $failure_callback = null, $timeoutms = null) {} - - public function setserverparams () {} - - public function setfailurecallback () {} - - public function getserverstatus () {} - - public function findserver () {} - - public function getversion () {} - - public function add () {} - - public function set () {} - - public function replace () {} - - public function cas () {} - - public function append () {} - - public function prepend () {} - - public function get () {} - - public function delete () {} - - public function getstats () {} - - public function getextendedstats () {} - - public function setcompressthreshold () {} - - public function increment () {} - - public function decrement () {} - - public function close () {} - - public function flush () {} - -} - -function memcache_connect () {} - -function memcache_pconnect () {} - -function memcache_add_server () {} - -function memcache_set_server_params () {} - -function memcache_set_failure_callback () {} - -function memcache_get_server_status () {} - -function memcache_get_version () {} - -function memcache_add () {} - -function memcache_set () {} - -function memcache_replace () {} - -function memcache_cas () {} - -function memcache_append () {} - -function memcache_prepend () {} - -function memcache_get () {} - -function memcache_delete () {} - -/** - * (PECL memcache >= 0.2.0)
- * Turn debug output on/off - * @link http://php.net/manual/en/function.memcache-debug.php - * @param bool $on_off

- * Turns debug output on if equals to TRUE. - * Turns debug output off if equals to FALSE. - *

- * @return bool TRUE if PHP was built with --enable-debug option, otherwise - * returns FALSE. - */ -function memcache_debug ($on_off) {} - -function memcache_get_stats () {} - -function memcache_get_extended_stats () {} - -function memcache_set_compress_threshold () {} - -function memcache_increment () {} - -function memcache_decrement () {} - -function memcache_close () {} - -function memcache_flush () {} - -define ('MEMCACHE_COMPRESSED', 2); -define ('MEMCACHE_HAVE_SESSION', 1); - -// End of memcache v.3.0.6 -?> diff --git a/phpruntime/memcached.php b/phpruntime/memcached.php deleted file mode 100644 index 5f846bf..0000000 --- a/phpruntime/memcached.php +++ /dev/null @@ -1,1224 +0,0 @@ -Enables or disables payload compression. When enabled, - * item values longer than a certain threshold (currently 100 bytes) will be - * compressed during storage and decompressed during retrieval - * transparently.

- *

Type: boolean, default: TRUE.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const OPT_COMPRESSION = -1001; - const OPT_COMPRESSION_TYPE = -1004; - - /** - *

This can be used to create a "domain" for your item keys. The value - * specified here will be prefixed to each of the keys. It cannot be - * longer than 128 characters and will reduce the - * maximum available key size. The prefix is applied only to the item keys, - * not to the server keys.

- *

Type: string, default: "".

- * @link http://php.net/manual/en/memcached.constants.php - */ - const OPT_PREFIX_KEY = -1002; - - /** - *

- * Specifies the serializer to use for serializing non-scalar values. - * The valid serializers are Memcached::SERIALIZER_PHP - * or Memcached::SERIALIZER_IGBINARY. The latter is - * supported only when memcached is configured with - * --enable-memcached-igbinary option and the - * igbinary extension is loaded. - *

- *

Type: integer, default: Memcached::SERIALIZER_PHP.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const OPT_SERIALIZER = -1003; - - /** - *

Indicates whether igbinary serializer support is available.

- *

Type: boolean.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const HAVE_IGBINARY = 0; - - /** - *

Indicates whether JSON serializer support is available.

- *

Type: boolean.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const HAVE_JSON = 0; - const HAVE_SESSION = 1; - const HAVE_SASL = 0; - - /** - *

Specifies the hashing algorithm used for the item keys. The valid - * values are supplied via Memcached::HASH_* constants. - * Each hash algorithm has its advantages and its disadvantages. Go with the - * default if you don't know or don't care.

- *

Type: integer, default: Memcached::HASH_DEFAULT

- * @link http://php.net/manual/en/memcached.constants.php - */ - const OPT_HASH = 2; - - /** - *

The default (Jenkins one-at-a-time) item key hashing algorithm.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const HASH_DEFAULT = 0; - - /** - *

MD5 item key hashing algorithm.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const HASH_MD5 = 1; - - /** - *

CRC item key hashing algorithm.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const HASH_CRC = 2; - - /** - *

FNV1_64 item key hashing algorithm.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const HASH_FNV1_64 = 3; - - /** - *

FNV1_64A item key hashing algorithm.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const HASH_FNV1A_64 = 4; - - /** - *

FNV1_32 item key hashing algorithm.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const HASH_FNV1_32 = 5; - - /** - *

FNV1_32A item key hashing algorithm.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const HASH_FNV1A_32 = 6; - - /** - *

Hsieh item key hashing algorithm.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const HASH_HSIEH = 7; - - /** - *

Murmur item key hashing algorithm.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const HASH_MURMUR = 8; - - /** - *

Specifies the method of distributing item keys to the servers. - * Currently supported methods are modulo and consistent hashing. Consistent - * hashing delivers better distribution and allows servers to be added to - * the cluster with minimal cache losses.

- *

Type: integer, default: Memcached::DISTRIBUTION_MODULA.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const OPT_DISTRIBUTION = 9; - - /** - *

Modulo-based key distribution algorithm.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const DISTRIBUTION_MODULA = 0; - - /** - *

Consistent hashing key distribution algorithm (based on libketama).

- * @link http://php.net/manual/en/memcached.constants.php - */ - const DISTRIBUTION_CONSISTENT = 1; - - /** - *

Enables or disables compatibility with libketama-like behavior. When - * enabled, the item key hashing algorithm is set to MD5 and distribution is - * set to be weighted consistent hashing distribution. This is useful - * because other libketama-based clients (Python, Ruby, etc.) with the same - * server configuration will be able to access the keys transparently. - *

- *

- * It is highly recommended to enable this option if you want to use - * consistent hashing, and it may be enabled by default in future - * releases. - *

- *

Type: boolean, default: FALSE.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const OPT_LIBKETAMA_COMPATIBLE = 16; - const OPT_LIBKETAMA_HASH = 17; - const OPT_TCP_KEEPALIVE = 32; - - /** - *

Enables or disables buffered I/O. Enabling buffered I/O causes - * storage commands to "buffer" instead of being sent. Any action that - * retrieves data causes this buffer to be sent to the remote connection. - * Quitting the connection or closing down the connection will also cause - * the buffered data to be pushed to the remote connection.

- *

Type: boolean, default: FALSE.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const OPT_BUFFER_WRITES = 10; - - /** - *

Enable the use of the binary protocol. Please note that you cannot - * toggle this option on an open connection.

- *

Type: boolean, default: FALSE.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const OPT_BINARY_PROTOCOL = 18; - - /** - *

Enables or disables asynchronous I/O. This is the fastest transport - * available for storage functions.

- *

Type: boolean, default: FALSE.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const OPT_NO_BLOCK = 0; - - /** - *

Enables or disables the no-delay feature for connecting sockets (may - * be faster in some environments).

- *

Type: boolean, default: FALSE.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const OPT_TCP_NODELAY = 1; - - /** - *

The maximum socket send buffer in bytes.

- *

Type: integer, default: varies by platform/kernel - * configuration.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const OPT_SOCKET_SEND_SIZE = 4; - - /** - *

The maximum socket receive buffer in bytes.

- *

Type: integer, default: varies by platform/kernel - * configuration.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const OPT_SOCKET_RECV_SIZE = 5; - - /** - *

In non-blocking mode this set the value of the timeout during socket - * connection, in milliseconds.

- *

Type: integer, default: 1000.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const OPT_CONNECT_TIMEOUT = 14; - - /** - *

The amount of time, in seconds, to wait until retrying a failed - * connection attempt.

- *

Type: integer, default: 0.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const OPT_RETRY_TIMEOUT = 15; - - /** - *

Socket sending timeout, in microseconds. In cases where you cannot - * use non-blocking I/O this will allow you to still have timeouts on the - * sending of data.

- *

Type: integer, default: 0.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const OPT_SEND_TIMEOUT = 19; - - /** - *

Socket reading timeout, in microseconds. In cases where you cannot - * use non-blocking I/O this will allow you to still have timeouts on the - * reading of data.

- *

Type: integer, default: 0.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const OPT_RECV_TIMEOUT = 20; - - /** - *

Timeout for connection polling, in milliseconds.

- *

Type: integer, default: 1000.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const OPT_POLL_TIMEOUT = 8; - - /** - *

Enables or disables caching of DNS lookups.

- *

Type: boolean, default: FALSE.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const OPT_CACHE_LOOKUPS = 6; - - /** - *

Specifies the failure limit for server connection attempts. The - * server will be removed after this many continuous connection - * failures.

- *

Type: integer, default: 0.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const OPT_SERVER_FAILURE_LIMIT = 21; - const OPT_AUTO_EJECT_HOSTS = 28; - const OPT_HASH_WITH_PREFIX_KEY = 25; - const OPT_NOREPLY = 26; - const OPT_SORT_HOSTS = 12; - const OPT_VERIFY_KEY = 13; - const OPT_USE_UDP = 27; - const OPT_NUMBER_OF_REPLICAS = 29; - const OPT_RANDOMIZE_REPLICA_READ = 30; - const OPT_REMOVE_FAILED_SERVERS = 35; - - /** - *

The operation was successful.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_SUCCESS = 0; - - /** - *

The operation failed in some fashion.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_FAILURE = 1; - - /** - *

DNS lookup failed.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_HOST_LOOKUP_FAILURE = 2; - - /** - *

Failed to read network data.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_UNKNOWN_READ_FAILURE = 7; - - /** - *

Bad command in memcached protocol.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_PROTOCOL_ERROR = 8; - - /** - *

Error on the client side.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_CLIENT_ERROR = 9; - - /** - *

Error on the server side.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_SERVER_ERROR = 10; - - /** - *

Failed to write network data.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_WRITE_FAILURE = 5; - - /** - *

Failed to do compare-and-swap: item you are trying to store has been - * modified since you last fetched it.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_DATA_EXISTS = 12; - - /** - *

Item was not stored: but not because of an error. This normally - * means that either the condition for an "add" or a "replace" command - * wasn't met, or that the item is in a delete queue.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_NOTSTORED = 14; - - /** - *

Item with this key was not found (with "get" operation or "cas" - * operations).

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_NOTFOUND = 16; - - /** - *

Partial network data read error.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_PARTIAL_READ = 18; - - /** - *

Some errors occurred during multi-get.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_SOME_ERRORS = 19; - - /** - *

Server list is empty.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_NO_SERVERS = 20; - - /** - *

End of result set.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_END = 21; - - /** - *

System error.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_ERRNO = 26; - - /** - *

The operation was buffered.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_BUFFERED = 32; - - /** - *

The operation timed out.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_TIMEOUT = 31; - - /** - *

Bad key.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_BAD_KEY_PROVIDED = 33; - const RES_STORED = 15; - const RES_DELETED = 22; - const RES_STAT = 24; - const RES_ITEM = 25; - const RES_NOT_SUPPORTED = 28; - const RES_FETCH_NOTFINISHED = 30; - const RES_SERVER_MARKED_DEAD = 35; - const RES_UNKNOWN_STAT_KEY = 36; - const RES_INVALID_HOST_PROTOCOL = 34; - const RES_MEMORY_ALLOCATION_FAILURE = 17; - - /** - *

Failed to create network socket.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_CONNECTION_SOCKET_CREATE_FAILURE = 11; - - /** - *

Payload failure: could not compress/decompress or serialize/unserialize the value.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const RES_PAYLOAD_FAILURE = -1001; - - /** - *

The default PHP serializer.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const SERIALIZER_PHP = 1; - - /** - *

The igbinary serializer. - * Instead of textual representation it stores PHP data structures in a - * compact binary form, resulting in space and time gains.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const SERIALIZER_IGBINARY = 2; - - /** - *

The JSON serializer. Requires PHP 5.2.10+.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const SERIALIZER_JSON = 3; - const SERIALIZER_JSON_ARRAY = 4; - const COMPRESSION_FASTLZ = 2; - const COMPRESSION_ZLIB = 1; - - /** - *

A flag for Memcached::getMulti and - * Memcached::getMultiByKey to ensure that the keys are - * returned in the same order as they were requested in. Non-existing keys - * get a default value of NULL.

- * @link http://php.net/manual/en/memcached.constants.php - */ - const GET_PRESERVE_ORDER = 1; - const GET_ERROR_RETURN_VALUE = false; - - - /** - * (PECL memcached >= 0.1.0)
- * Create a Memcached instance - * @link http://php.net/manual/en/memcached.construct.php - * @param $persistent_id [optional] - * @param $callback [optional] - */ - public function __construct ($persistent_id, $callback) {} - - /** - * (PECL memcached >= 0.1.0)
- * Return the result code of the last operation - * @link http://php.net/manual/en/memcached.getresultcode.php - * @return int Result code of the last Memcached operation. - */ - public function getResultCode () {} - - /** - * (PECL memcached >= 1.0.0)
- * Return the message describing the result of the last operation - * @link http://php.net/manual/en/memcached.getresultmessage.php - * @return string Message describing the result of the last Memcached operation. - */ - public function getResultMessage () {} - - /** - * (PECL memcached >= 0.1.0)
- * Retrieve an item - * @link http://php.net/manual/en/memcached.get.php - * @param string $key

- * The key of the item to retrieve. - *

- * @param callable $cache_cb [optional]

- * Read-through caching callback or NULL. - *

- * @param float $cas_token [optional]

- * The variable to store the CAS token in. - *

- * @return mixed the value stored in the cache or FALSE otherwise. - * The Memcached::getResultCode will return - * Memcached::RES_NOTFOUND if the key does not exist. - */ - public function get ($key, callable $cache_cb = null, &$cas_token = null) {} - - /** - * (PECL memcached >= 0.1.0)
- * Retrieve an item from a specific server - * @link http://php.net/manual/en/memcached.getbykey.php - * @param string $server_key

- * The key identifying the server to store the value on. - *

- * @param string $key

- * The key of the item to fetch. - *

- * @param callable $cache_cb [optional]

- * Read-through caching callback or NULL - *

- * @param float $cas_token [optional]

- * The variable to store the CAS token in. - *

- * @return mixed the value stored in the cache or FALSE otherwise. - * The Memcached::getResultCode will return - * Memcached::RES_NOTFOUND if the key does not exist. - */ - public function getByKey ($server_key, $key, callable $cache_cb = null, &$cas_token = null) {} - - /** - * (PECL memcached >= 0.1.0)
- * Retrieve multiple items - * @link http://php.net/manual/en/memcached.getmulti.php - * @param array $keys

- * Array of keys to retrieve. - *

- * @param array $cas_tokens [optional]

- * The variable to store the CAS tokens for the found items. - *

- * @param int $flags [optional]

- * The flags for the get operation. - *

- * @return mixed the array of found items or FALSE on failure. - * Use Memcached::getResultCode if necessary. - */ - public function getMulti (array $keys, array &$cas_tokens = null, $flags = null) {} - - /** - * (PECL memcached >= 0.1.0)
- * Retrieve multiple items from a specific server - * @link http://php.net/manual/en/memcached.getmultibykey.php - * @param string $server_key

- * The key identifying the server to store the value on. - *

- * @param array $keys

- * Array of keys to retrieve. - *

- * @param string $cas_tokens [optional]

- * The variable to store the CAS tokens for the found items. - *

- * @param int $flags [optional]

- * The flags for the get operation. - *

- * @return array the array of found items or FALSE on failure. - * Use Memcached::getResultCode if necessary. - */ - public function getMultiByKey ($server_key, array $keys, &$cas_tokens = null, $flags = null) {} - - /** - * (PECL memcached >= 0.1.0)
- * Request multiple items - * @link http://php.net/manual/en/memcached.getdelayed.php - * @param array $keys

- * Array of keys to request. - *

- * @param bool $with_cas [optional]

- * Whether to request CAS token values also. - *

- * @param callable $value_cb [optional]

- * The result callback or NULL. - *

- * @return bool TRUE on success or FALSE on failure. - * Use Memcached::getResultCode if necessary. - */ - public function getDelayed (array $keys, $with_cas = null, callable $value_cb = null) {} - - /** - * (PECL memcached >= 0.1.0)
- * Request multiple items from a specific server - * @link http://php.net/manual/en/memcached.getdelayedbykey.php - * @param string $server_key

- * The key identifying the server to store the value on. - *

- * @param array $keys

- * Array of keys to request. - *

- * @param bool $with_cas [optional]

- * Whether to request CAS token values also. - *

- * @param callable $value_cb [optional]

- * The result callback or NULL. - *

- * @return bool TRUE on success or FALSE on failure. - * Use Memcached::getResultCode if necessary. - */ - public function getDelayedByKey ($server_key, array $keys, $with_cas = null, callable $value_cb = null) {} - - /** - * (PECL memcached >= 0.1.0)
- * Fetch the next result - * @link http://php.net/manual/en/memcached.fetch.php - * @return array the next result or FALSE otherwise. - * The Memcached::getResultCode will return - * Memcached::RES_END if result set is exhausted. - */ - public function fetch () {} - - /** - * (PECL memcached >= 0.1.0)
- * Fetch all the remaining results - * @link http://php.net/manual/en/memcached.fetchall.php - * @return array the results or FALSE on failure. - * Use Memcached::getResultCode if necessary. - */ - public function fetchAll () {} - - /** - * (PECL memcached >= 0.1.0)
- * Store an item - * @link http://php.net/manual/en/memcached.set.php - * @param string $key

- * The key under which to store the value. - *

- * @param mixed $value

- * The value to store. - *

- * @param int $expiration [optional]

- * The expiration time, defaults to 0. See Expiration Times for more info. - *

- * @return bool TRUE on success or FALSE on failure. - * Use Memcached::getResultCode if necessary. - */ - public function set ($key, $value, $expiration = null) {} - - /** - * (PECL memcached >= 0.1.0)
- * Store an item on a specific server - * @link http://php.net/manual/en/memcached.setbykey.php - * @param string $server_key

- * The key identifying the server to store the value on. - *

- * @param string $key

- * The key under which to store the value. - *

- * @param mixed $value

- * The value to store. - *

- * @param int $expiration [optional]

- * The expiration time, defaults to 0. See Expiration Times for more info. - *

- * @return bool TRUE on success or FALSE on failure. - * Use Memcached::getResultCode if necessary. - */ - public function setByKey ($server_key, $key, $value, $expiration = null) {} - - /** - * @param $key - * @param $expiration - */ - public function touch ($key, $expiration) {} - - /** - * @param $server_key - * @param $key - * @param $expiration - */ - public function touchByKey ($server_key, $key, $expiration) {} - - /** - * (PECL memcached >= 0.1.0)
- * Store multiple items - * @link http://php.net/manual/en/memcached.setmulti.php - * @param array $items

- * An array of key/value pairs to store on the server. - *

- * @param int $expiration [optional]

- * The expiration time, defaults to 0. See Expiration Times for more info. - *

- * @return bool TRUE on success or FALSE on failure. - * Use Memcached::getResultCode if necessary. - */ - public function setMulti (array $items, $expiration = null) {} - - /** - * (PECL memcached >= 0.1.0)
- * Store multiple items on a specific server - * @link http://php.net/manual/en/memcached.setmultibykey.php - * @param string $server_key

- * The key identifying the server to store the value on. - *

- * @param array $items

- * An array of key/value pairs to store on the server. - *

- * @param int $expiration [optional]

- * The expiration time, defaults to 0. See Expiration Times for more info. - *

- * @return bool TRUE on success or FALSE on failure. - * Use Memcached::getResultCode if necessary. - */ - public function setMultiByKey ($server_key, array $items, $expiration = null) {} - - /** - * (PECL memcached >= 0.1.0)
- * Compare and swap an item - * @link http://php.net/manual/en/memcached.cas.php - * @param float $cas_token

- * Unique value associated with the existing item. Generated by memcache. - *

- * @param string $key

- * The key under which to store the value. - *

- * @param mixed $value

- * The value to store. - *

- * @param int $expiration [optional]

- * The expiration time, defaults to 0. See Expiration Times for more info. - *

- * @return bool TRUE on success or FALSE on failure. - * The Memcached::getResultCode will return - * Memcached::RES_DATA_EXISTS if the item you are trying - * to store has been modified since you last fetched it. - */ - public function cas ($cas_token, $key, $value, $expiration = null) {} - - /** - * (PECL memcached >= 0.1.0)
- * Compare and swap an item on a specific server - * @link http://php.net/manual/en/memcached.casbykey.php - * @param float $cas_token

- * Unique value associated with the existing item. Generated by memcache. - *

- * @param string $server_key

- * The key identifying the server to store the value on. - *

- * @param string $key

- * The key under which to store the value. - *

- * @param mixed $value

- * The value to store. - *

- * @param int $expiration [optional]

- * The expiration time, defaults to 0. See Expiration Times for more info. - *

- * @return bool TRUE on success or FALSE on failure. - * The Memcached::getResultCode will return - * Memcached::RES_DATA_EXISTS if the item you are trying - * to store has been modified since you last fetched it. - */ - public function casByKey ($cas_token, $server_key, $key, $value, $expiration = null) {} - - /** - * (PECL memcached >= 0.1.0)
- * Add an item under a new key - * @link http://php.net/manual/en/memcached.add.php - * @param string $key

- * The key under which to store the value. - *

- * @param mixed $value

- * The value to store. - *

- * @param int $expiration [optional]

- * The expiration time, defaults to 0. See Expiration Times for more info. - *

- * @return bool TRUE on success or FALSE on failure. - * The Memcached::getResultCode will return - * Memcached::RES_NOTSTORED if the key already exists. - */ - public function add ($key, $value, $expiration = null) {} - - /** - * (PECL memcached >= 0.1.0)
- * Add an item under a new key on a specific server - * @link http://php.net/manual/en/memcached.addbykey.php - * @param string $server_key

- * The key identifying the server to store the value on. - *

- * @param string $key

- * The key under which to store the value. - *

- * @param mixed $value

- * The value to store. - *

- * @param int $expiration [optional]

- * The expiration time, defaults to 0. See Expiration Times for more info. - *

- * @return bool TRUE on success or FALSE on failure. - * The Memcached::getResultCode will return - * Memcached::RES_NOTSTORED if the key already exists. - */ - public function addByKey ($server_key, $key, $value, $expiration = null) {} - - /** - * (PECL memcached >= 0.1.0)
- * Append data to an existing item - * @link http://php.net/manual/en/memcached.append.php - * @param string $key

- * The key under which to store the value. - *

- * @param string $value

- * The string to append. - *

- * @return bool TRUE on success or FALSE on failure. - * The Memcached::getResultCode will return - * Memcached::RES_NOTSTORED if the key does not exist. - */ - public function append ($key, $value) {} - - /** - * (PECL memcached >= 0.1.0)
- * Append data to an existing item on a specific server - * @link http://php.net/manual/en/memcached.appendbykey.php - * @param string $server_key

- * The key identifying the server to store the value on. - *

- * @param string $key

- * The key under which to store the value. - *

- * @param string $value

- * The string to append. - *

- * @return bool TRUE on success or FALSE on failure. - * The Memcached::getResultCode will return - * Memcached::RES_NOTSTORED if the key does not exist. - */ - public function appendByKey ($server_key, $key, $value) {} - - /** - * (PECL memcached >= 0.1.0)
- * Prepend data to an existing item - * @link http://php.net/manual/en/memcached.prepend.php - * @param string $key

- * The key of the item to prepend the data to. - *

- * @param string $value

- * The string to prepend. - *

- * @return bool TRUE on success or FALSE on failure. - * The Memcached::getResultCode will return - * Memcached::RES_NOTSTORED if the key does not exist. - */ - public function prepend ($key, $value) {} - - /** - * (PECL memcached >= 0.1.0)
- * Prepend data to an existing item on a specific server - * @link http://php.net/manual/en/memcached.prependbykey.php - * @param string $server_key

- * The key identifying the server to store the value on. - *

- * @param string $key

- * The key of the item to prepend the data to. - *

- * @param string $value

- * The string to prepend. - *

- * @return bool TRUE on success or FALSE on failure. - * The Memcached::getResultCode will return - * Memcached::RES_NOTSTORED if the key does not exist. - */ - public function prependByKey ($server_key, $key, $value) {} - - /** - * (PECL memcached >= 0.1.0)
- * Replace the item under an existing key - * @link http://php.net/manual/en/memcached.replace.php - * @param string $key

- * The key under which to store the value. - *

- * @param mixed $value

- * The value to store. - *

- * @param int $expiration [optional]

- * The expiration time, defaults to 0. See Expiration Times for more info. - *

- * @return bool TRUE on success or FALSE on failure. - * The Memcached::getResultCode will return - * Memcached::RES_NOTSTORED if the key does not exist. - */ - public function replace ($key, $value, $expiration = null) {} - - /** - * (PECL memcached >= 0.1.0)
- * Replace the item under an existing key on a specific server - * @link http://php.net/manual/en/memcached.replacebykey.php - * @param string $server_key

- * The key identifying the server to store the value on. - *

- * @param string $key

- * The key under which to store the value. - *

- * @param mixed $value

- * The value to store. - *

- * @param int $expiration [optional]

- * The expiration time, defaults to 0. See Expiration Times for more info. - *

- * @return bool TRUE on success or FALSE on failure. - * The Memcached::getResultCode will return - * Memcached::RES_NOTSTORED if the key does not exist. - */ - public function replaceByKey ($server_key, $key, $value, $expiration = null) {} - - /** - * (PECL memcached >= 0.1.0)
- * Delete an item - * @link http://php.net/manual/en/memcached.delete.php - * @param string $key

- * The key to be deleted. - *

- * @param int $time [optional]

- * The amount of time the server will wait to delete the item. - *

- * @return bool TRUE on success or FALSE on failure. - * The Memcached::getResultCode will return - * Memcached::RES_NOTFOUND if the key does not exist. - */ - public function delete ($key, $time = 0) {} - - /** - * @param $keys - * @param $time [optional] - */ - public function deleteMulti ($keys, $time) {} - - /** - * (PECL memcached >= 0.1.0)
- * Delete an item from a specific server - * @link http://php.net/manual/en/memcached.deletebykey.php - * @param string $server_key

- * The key identifying the server to store the value on. - *

- * @param string $key

- * The key to be deleted. - *

- * @param int $time [optional]

- * The amount of time the server will wait to delete the item. - *

- * @return bool TRUE on success or FALSE on failure. - * The Memcached::getResultCode will return - * Memcached::RES_NOTFOUND if the key does not exist. - */ - public function deleteByKey ($server_key, $key, $time = 0) {} - - /** - * @param $server_key - * @param $keys - * @param $time [optional] - */ - public function deleteMultiByKey ($server_key, $keys, $time) {} - - /** - * (PECL memcached >= 0.1.0)
- * Increment numeric item's value - * @link http://php.net/manual/en/memcached.increment.php - * @param string $key

- * The key of the item to increment. - *

- * @param int $offset [optional]

- * The amount by which to increment the item's value. - *

- * @return int new item's value on success or FALSE on failure. - * The Memcached::getResultCode will return - * Memcached::RES_NOTFOUND if the key does not exist. - */ - public function increment ($key, $offset = 1) {} - - /** - * (PECL memcached >= 0.1.0)
- * Decrement numeric item's value - * @link http://php.net/manual/en/memcached.decrement.php - * @param string $key

- * The key of the item to decrement. - *

- * @param int $offset [optional]

- * The amount by which to decrement the item's value. - *

- * @return int item's new value on success or FALSE on failure. - * The Memcached::getResultCode will return - * Memcached::RES_NOTFOUND if the key does not exist. - */ - public function decrement ($key, $offset = 1) {} - - /** - * @param $server_key - * @param $key - * @param $offset [optional] - * @param $initial_value [optional] - * @param $expiry [optional] - */ - public function incrementByKey ($server_key, $key, $offset, $initial_value, $expiry) {} - - /** - * @param $server_key - * @param $key - * @param $offset [optional] - * @param $initial_value [optional] - * @param $expiry [optional] - */ - public function decrementByKey ($server_key, $key, $offset, $initial_value, $expiry) {} - - /** - * (PECL memcached >= 0.1.0)
- * Add a server to the server pool - * @link http://php.net/manual/en/memcached.addserver.php - * @param string $host

- * The hostname of the memcache server. If the hostname is invalid, data-related - * operations will set - * Memcached::RES_HOST_LOOKUP_FAILURE result code. - *

- * @param int $port

- * The port on which memcache is running. Usually, this is - * 11211. - *

- * @param int $weight [optional]

- * The weight of the server relative to the total weight of all the - * servers in the pool. This controls the probability of the server being - * selected for operations. This is used only with consistent distribution - * option and usually corresponds to the amount of memory available to - * memcache on that server. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function addServer ($host, $port, $weight = 0) {} - - /** - * (PECL memcached >= 0.1.1)
- * Add multiple servers to the server pool - * @link http://php.net/manual/en/memcached.addservers.php - * @param array $servers - * @return bool TRUE on success or FALSE on failure. - */ - public function addServers (array $servers) {} - - /** - * (PECL memcached >= 0.1.0)
- * Get the list of the servers in the pool - * @link http://php.net/manual/en/memcached.getserverlist.php - * @return array The list of all servers in the server pool. - */ - public function getServerList () {} - - /** - * (PECL memcached >= 0.1.0)
- * Map a key to a server - * @link http://php.net/manual/en/memcached.getserverbykey.php - * @param string $server_key

- * The key identifying the server to store the value on. - *

- * @return array TRUE on success or FALSE on failure. - * Use Memcached::getResultCode if necessary. - */ - public function getServerByKey ($server_key) {} - - public function resetServerList () {} - - public function quit () {} - - /** - * (PECL memcached >= 0.1.0)
- * Get server pool statistics - * @link http://php.net/manual/en/memcached.getstats.php - * @return array Array of server statistics, one entry per server. - */ - public function getStats () {} - - /** - * (PECL memcached >= 0.1.5)
- * Get server pool version info - * @link http://php.net/manual/en/memcached.getversion.php - * @return array Array of server versions, one entry per server. - */ - public function getVersion () {} - - public function getAllKeys () {} - - /** - * (PECL memcached >= 0.1.0)
- * Invalidate all items in the cache - * @link http://php.net/manual/en/memcached.flush.php - * @param int $delay [optional]

- * Numer of seconds to wait before invalidating the items. - *

- * @return bool TRUE on success or FALSE on failure. - * Use Memcached::getResultCode if necessary. - */ - public function flush ($delay = 0) {} - - /** - * (PECL memcached >= 0.1.0)
- * Retrieve a Memcached option value - * @link http://php.net/manual/en/memcached.getoption.php - * @param int $option

- * One of the Memcached::OPT_* constants. - *

- * @return mixed the value of the requested option, or FALSE on - * error. - */ - public function getOption ($option) {} - - /** - * (PECL memcached >= 0.1.0)
- * Set a Memcached option - * @link http://php.net/manual/en/memcached.setoption.php - * @param int $option - * @param mixed $value - * @return bool TRUE on success or FALSE on failure. - */ - public function setOption ($option, $value) {} - - /** - * @param $options - */ - public function setOptions ($options) {} - - public function isPersistent () {} - - public function isPristine () {} - -} - -/** - * @link http://php.net/manual/en/class.memcachedexception.php - */ -class MemcachedException extends RuntimeException { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} -// End of memcached v.2.0.1 -?> diff --git a/phpruntime/mhash.php b/phpruntime/mhash.php deleted file mode 100644 index 5648b83..0000000 --- a/phpruntime/mhash.php +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/phpruntime/mongo.php b/phpruntime/mongo.php deleted file mode 100644 index 7261531..0000000 --- a/phpruntime/mongo.php +++ /dev/null @@ -1,4171 +0,0 @@ - - * The database name. - *

- * @return MongoDB a new db object. - */ - public function __get ($dbname) {} - - /** - * Gets a database - * @link http://php.net/manual/en/mongoclient.selectdb.php - * @param string $name

- * The database name. - *

- * @return MongoDB a new db object. - */ - public function selectDB ($name) {} - - /** - * Gets a database collection - * @link http://php.net/manual/en/mongoclient.selectcollection.php - * @param string $db

- * The database name. - *

- * @param string $collection

- * The collection name. - *

- * @return MongoCollection a new collection object. - */ - public function selectCollection ($db, $collection) {} - - /** - * Get the read preference for this connection - * @link http://php.net/manual/en/mongoclient.getreadpreference.php - * @return array This function returns an array describing the read preference. The array - * contains the values type for the numeric read preference - * mode, type_string for the name of the read preference - * mode, and tagsets containing a list of all tag set - * criteria. If no tag sets were specified, tagsets will not - * be present in the array. - */ - public function getReadPreference () {} - - /** - * Set the read preference for this connection - * @link http://php.net/manual/en/mongoclient.setreadpreference.php - * @param int $read_preference - * @param array $tags [optional] - * @return bool - */ - public function setReadPreference ($read_preference, array $tags = null) {} - - /** - * Drops a database [deprecated] - * @link http://php.net/manual/en/mongoclient.dropdb.php - * @param mixed $db

- * The database to drop. Can be a MongoDB object or the name of the database. - *

- * @return array the database response. - */ - public function dropDB ($db) {} - - /** - * Lists all of the databases available. - * @link http://php.net/manual/en/mongoclient.listdbs.php - * @return array an associative array containing three fields. The first field is - * databases, which in turn contains an array. Each element - * of the array is an associative array corresponding to a database, giving th - * database's name, size, and if it's empty. The other two fields are - * totalSize (in bytes) and ok, which is 1 - * if this method ran successfully. - */ - public function listDBs () {} - - /** - * Updates status for all associated hosts - * @link http://php.net/manual/en/mongoclient.gethosts.php - * @return array an array of information about the hosts in the set. Includes each - * host's hostname, its health (1 is healthy), its state (1 is primary, 2 is - * secondary, 0 is anything else), the amount of time it took to ping the - * server, and when the last ping occurred. For example, on a three-member - * replica set, it might look something like: - */ - public function getHosts () {} - - /** - * Closes this connection - * @link http://php.net/manual/en/mongoclient.close.php - * @param boolean|string $connection [optional]

- * If connection is not given, or FALSE then connection that would be - * selected for writes would be closed. In a single-node configuration, - * that is then the whole connection, but if you are connected to a - * replica set, close() will only close the - * connection to the primary server. - *

- *

- * If connection is TRUE then all connections as known by the connection - * manager will be closed. This can include connections that are not - * referenced in the connection string used to create the object that - * you are calling close on. - *

- *

- * If connection is a string argument, then it will only close the - * connection identified by this hash. Hashes are identifiers for a - * connection and can be obtained by calling - * MongoClient::getConnections. - *

- * @return bool if the connection was successfully closed. - */ - public function close ($connection = null) {} - -} - -/** - * A connection between PHP and MongoDB. - * @link http://php.net/manual/en/class.mongo.php - */ -class Mongo extends MongoClient { - const DEFAULT_HOST = "localhost"; - const DEFAULT_PORT = 27017; - const VERSION = "1.3.0"; - const RP_PRIMARY = "primary"; - const RP_PRIMARY_PREFERRED = "primaryPreferred"; - const RP_SECONDARY = "secondary"; - const RP_SECONDARY_PREFERRED = "secondaryPreferred"; - const RP_NEAREST = "nearest"; - - /** - * @var boolean - */ - public $connected; - /** - * @var string - */ - public $status; - /** - * @var string - */ - protected $server; - /** - * @var boolean - */ - protected $persistent; - - - /** - * (PECL mongo >=0.9.0)
- * The __construct purpose - * @link http://php.net/manual/en/mongo.construct.php - * @param $server [optional] - * @param $options [optional] - */ - public function __construct ($serverarray , $options) {} - - /** - * (PECL mongo >=0.9.0)
- * Connects with a database server - * @link http://php.net/manual/en/mongo.connectutil.php - * @return bool If the connection was successful. - */ - protected function connectUtil () {} - - /** - * (PECL mongo >=1.1.0)
- * Get slaveOkay setting for this connection - * @link http://php.net/manual/en/mongo.getslaveokay.php - * @return bool the value of slaveOkay for this instance. - */ - public function getSlaveOkay () {} - - /** - * (PECL mongo >=1.1.0)
- * Change slaveOkay setting for this connection - * @link http://php.net/manual/en/mongo.setslaveokay.php - * @param bool $ok [optional]

- * If reads should be sent to secondary members of a replica set for all - * possible queries using this MongoClient instance. - *

- * @return bool the former value of slaveOkay for this instance. - */ - public function setSlaveOkay ($ok = true) {} - - public function lastError () {} - - public function prevError () {} - - public function resetError () {} - - public function forceError () {} - - /** - * (PECL mongo >=1.1.0)
- * Returns the address being used by this for slaveOkay reads - * @link http://php.net/manual/en/mongo.getslave.php - * @return string The address of the secondary this connection is using for reads. - *

- *

- * This returns NULL if this is not connected to a replica set or not yet - * initialized. - */ - public function getSlave () {} - - /** - * (PECL mongo >=1.1.0)
- * Choose a new secondary for slaveOkay reads - * @link http://php.net/manual/en/mongo.switchslave.php - * @return string The address of the secondary this connection is using for reads. This may be - * the same as the previous address as addresses are randomly chosen. It may - * return only one address if only one secondary (or only the primary) is - * available. - *

- *

- * For example, if we had a three member replica set with a primary, secondary, - * and arbiter this method would always return the address of the secondary. - * If the secondary became unavailable, this method would always return the - * address of the primary. If the primary also became unavailable, this method - * would throw an exception, as an arbiter cannot handle reads. - */ - public function switchSlave () {} - - /** - * (No version information available, might only be in SVN)
- * Set the size for future connection pools. - * @link http://php.net/manual/en/mongo.setpoolsize.php - * @param int $size

- * The max number of connections future pools will be able to create. - * Negative numbers mean that the pool will spawn an infinite number of - * connections. - *

- * @return bool the former value of pool size. - */ - public static function setPoolSize ($size) {} - - /** - * (No version information available, might only be in SVN)
- * Get pool size for connection pools - * @link http://php.net/manual/en/mongo.getpoolsize.php - * @return int the current pool size. - */ - public static function getPoolSize () {} - - /** - * (No version information available, might only be in SVN)
- * Returns information about all connection pools. - * @link http://php.net/manual/en/mongo.pooldebug.php - * @return array Each connection pool has an identifier, which starts with the host. For each - * pool, this function shows the following fields: - * in use - *

- * The number of connections currently being used by - * MongoClient instances. - *

- * in pool - *

- * The number of connections currently in the pool (not being used). - *

- * remaining - *

- * The number of connections that could be created by this pool. For - * example, suppose a pool had 5 connections remaining and 3 connections in - * the pool. We could create 8 new instances of - * MongoClient before we exhausted this pool - * (assuming no instances of MongoClient went out of - * scope, returning their connections to the pool). - *

- *

- * A negative number means that this pool will spawn unlimited connections. - *

- *

- * Before a pool is created, you can change the max number of connections by - * calling Mongo::setPoolSize. Once a pool is showing - * up in the output of this function, its size cannot be changed. - *

- * timeout - *

- * The socket timeout for connections in this pool. This is how long - * connections in this pool will attempt to connect to a server before - * giving up. - *

- */ - public static function poolDebug () {} - - /** - * Return info about all open connections - * @link http://php.net/manual/en/mongoclient.getconnections.php - * @return void An array of open connections. - */ - public static function getConnections () {} - - /** - * Connects to a database server - * @link http://php.net/manual/en/mongoclient.connect.php - * @return bool If the connection was successful. - */ - public function connect () {} - - /** - * String representation of this connection - * @link http://php.net/manual/en/mongoclient.tostring.php - * @return string hostname and port for this connection. - */ - public function __toString () {} - - /** - * Gets a database - * @link http://php.net/manual/en/mongoclient.get.php - * @param string $dbname

- * The database name. - *

- * @return MongoDB a new db object. - */ - public function __get ($dbname) {} - - /** - * Gets a database - * @link http://php.net/manual/en/mongoclient.selectdb.php - * @param string $name

- * The database name. - *

- * @return MongoDB a new db object. - */ - public function selectDB ($name) {} - - /** - * Gets a database collection - * @link http://php.net/manual/en/mongoclient.selectcollection.php - * @param string $db

- * The database name. - *

- * @param string $collection

- * The collection name. - *

- * @return MongoCollection a new collection object. - */ - public function selectCollection ($db, $collection) {} - - /** - * Get the read preference for this connection - * @link http://php.net/manual/en/mongoclient.getreadpreference.php - * @return array This function returns an array describing the read preference. The array - * contains the values type for the numeric read preference - * mode, type_string for the name of the read preference - * mode, and tagsets containing a list of all tag set - * criteria. If no tag sets were specified, tagsets will not - * be present in the array. - */ - public function getReadPreference () {} - - /** - * Set the read preference for this connection - * @link http://php.net/manual/en/mongoclient.setreadpreference.php - * @param int $read_preference - * @param array $tags [optional] - * @return bool - */ - public function setReadPreference ($read_preference, array $tags = null) {} - - /** - * Drops a database [deprecated] - * @link http://php.net/manual/en/mongoclient.dropdb.php - * @param mixed $db

- * The database to drop. Can be a MongoDB object or the name of the database. - *

- * @return array the database response. - */ - public function dropDB ($db) {} - - /** - * Lists all of the databases available. - * @link http://php.net/manual/en/mongoclient.listdbs.php - * @return array an associative array containing three fields. The first field is - * databases, which in turn contains an array. Each element - * of the array is an associative array corresponding to a database, giving th - * database's name, size, and if it's empty. The other two fields are - * totalSize (in bytes) and ok, which is 1 - * if this method ran successfully. - */ - public function listDBs () {} - - /** - * Updates status for all associated hosts - * @link http://php.net/manual/en/mongoclient.gethosts.php - * @return array an array of information about the hosts in the set. Includes each - * host's hostname, its health (1 is healthy), its state (1 is primary, 2 is - * secondary, 0 is anything else), the amount of time it took to ping the - * server, and when the last ping occurred. For example, on a three-member - * replica set, it might look something like: - */ - public function getHosts () {} - - /** - * Closes this connection - * @link http://php.net/manual/en/mongoclient.close.php - * @param boolean|string $connection [optional]

- * If connection is not given, or FALSE then connection that would be - * selected for writes would be closed. In a single-node configuration, - * that is then the whole connection, but if you are connected to a - * replica set, close() will only close the - * connection to the primary server. - *

- *

- * If connection is TRUE then all connections as known by the connection - * manager will be closed. This can include connections that are not - * referenced in the connection string used to create the object that - * you are calling close on. - *

- *

- * If connection is a string argument, then it will only close the - * connection identified by this hash. Hashes are identifiers for a - * connection and can be obtained by calling - * MongoClient::getConnections. - *

- * @return bool if the connection was successfully closed. - */ - public function close ($connection = null) {} - -} - -/** - * Instances of this class are used to interact with a database. To get a - * database: - * Selecting a database - * - * $m = new MongoClient(); // connect - * $db = $m->selectDB("example"); - * - * Database names can use almost any character in the ASCII range. However, - * they cannot contain " ", "." or be the empty string. - * The name "system" is also reserved. - * @link http://php.net/manual/en/class.mongodb.php - */ -class MongoDB { - const PROFILING_OFF = 0; - const PROFILING_SLOW = 1; - const PROFILING_ON = 2; - - /** - * @var integer - */ - public $w; - /** - * @var integer - */ - public $wtimeout; - - - /** - * (PECL mongo >=0.9.0)
- * Creates a new database - * @link http://php.net/manual/en/mongodb.construct.php - * @param MongoClient $conn

- * Database connection. - *

- * @param string $name

- * Database name. - *

- */ - public function __construct (MongoClient $conn, $name) {} - - /** - * (PECL mongo >=0.9.0)
- * The name of this database - * @link http://php.net/manual/en/mongodb.--tostring.php - * @return string this database's name. - */ - public function __toString () {} - - /** - * (PECL mongo >=1.0.2)
- * Gets a collection - * @link http://php.net/manual/en/mongodb.get.php - * @param string $name

- * The name of the collection. - *

- * @return MongoCollection the collection. - */ - public function __get ($name) {} - - /** - * (PECL mongo >=0.9.0)
- * Fetches toolkit for dealing with files stored in this database - * @link http://php.net/manual/en/mongodb.getgridfs.php - * @param string $prefix [optional]

- * The prefix for the files and chunks collections. - *

- * @return MongoGridFS a new gridfs object for this database. - */ - public function getGridFS ($prefix = '"fs"') {} - - /** - * (PECL mongo >=1.1.0)
- * Get slaveOkay setting for this database - * @link http://php.net/manual/en/mongodb.getslaveokay.php - * @return bool the value of slaveOkay for this instance. - */ - public function getSlaveOkay () {} - - /** - * (PECL mongo >=1.1.0)
- * Change slaveOkay setting for this database - * @link http://php.net/manual/en/mongodb.setslaveokay.php - * @param bool $ok [optional]

- * If reads should be sent to secondary members of a replica set for all - * possible queries using this MongoDB instance. - *

- * @return bool the former value of slaveOkay for this instance. - */ - public function setSlaveOkay ($ok = true) {} - - /** - * (PECL mongo >=1.3.0)
- * Get the read preference for this database - * @link http://php.net/manual/en/mongodb.getreadpreference.php - * @return array This function returns an array describing the read preference. The array - * contains the values type for the numeric read preference - * mode, type_string for the name of the read preference - * mode, and tagsets containing a list of all tag set - * criteria. If no tag sets were specified, tagsets will not - * be present in the array. - */ - public function getReadPreference () {} - - /** - * (No version information available, might only be in SVN)
- * Set the read preference for this database - * @link http://php.net/manual/en/mongodb.setreadpreference.php - * @param int $read_preference - * @param array $tags [optional] - * @return bool - */ - public function setReadPreference ($read_preference, array $tags = null) {} - - /** - * (PECL mongo >=0.9.0)
- * Gets this database's profiling level - * @link http://php.net/manual/en/mongodb.getprofilinglevel.php - * @return int the profiling level. - */ - public function getProfilingLevel () {} - - /** - * (PECL mongo >=0.9.0)
- * Sets this database's profiling level - * @link http://php.net/manual/en/mongodb.setprofilinglevel.php - * @param int $level

- * Profiling level. - *

- * @return int the previous profiling level. - */ - public function setProfilingLevel ($level) {} - - /** - * (PECL mongo >=0.9.0)
- * Drops this database - * @link http://php.net/manual/en/mongodb.drop.php - * @return array the database response. - */ - public function drop () {} - - /** - * (PECL mongo >=0.9.0)
- * Repairs and compacts this database - * @link http://php.net/manual/en/mongodb.repair.php - * @param bool $preserve_cloned_files [optional]

- * If cloned files should be kept if the repair fails. - *

- * @param bool $backup_original_files [optional]

- * If original files should be backed up. - *

- * @return array db response. - */ - public function repair ($preserve_cloned_files = '&false;', $backup_original_files = '&false;') {} - - /** - * (PECL mongo >=0.9.0)
- * Gets a collection - * @link http://php.net/manual/en/mongodb.selectcollection.php - * @param string $name

- * The name of the collection. - *

- * @return MongoCollection the collection. - */ - public function selectCollection ($name) {} - - /** - * (PECL mongo >=0.9.0)
- * Creates a collection - * @link http://php.net/manual/en/mongodb.createcollection.php - * @param string $name

- * The name of the collection. - *

- * @param bool $capped [optional]

- * If the collection should be a fixed size. - *

- * @param int $size [optional]

- * If the collection is fixed size, its size in bytes. - *

- * @param int $max [optional]

- * If the collection is fixed size, the maximum number of elements to store in the collection. - *

- * @return MongoCollection a collection object representing the new collection. - */ - public function createCollection ($name, $capped = '&false;', $size = 0, $max = 0) {} - - /** - * (PECL mongo >=0.9.0)
- * Drops a collection [deprecated] - * @link http://php.net/manual/en/mongodb.dropcollection.php - * @param mixed $coll

- * MongoCollection or name of collection to drop. - *

- * @return array the database response. - */ - public function dropCollection ($coll) {} - - /** - * (PECL mongo >=1.3.0)
- * Get an of MongoCollection for this database - * @link http://php.net/manual/en/mongodb.listcollections.php - * @param bool $includeSystemCollections [optional]

- * Include system collections. - *

- * @return array an array of MongoCollections. - */ - public function listCollections ($includeSystemCollections = false) {} - - /** - * (No version information available, might only be in SVN)
- * Get all collections from this database - * @link http://php.net/manual/en/mongodb.getcollectionnames.php - * @param bool $includeSystemCollections [optional]

- * Include system collections. - *

- * @return array the names of the all the collections in the database as an array. - */ - public function getCollectionNames ($includeSystemCollections = false) {} - - /** - * (PECL mongo >=0.9.0)
- * Creates a database reference - * @link http://php.net/manual/en/mongodb.createdbref.php - * @param string $collection

- * The collection to which the database reference will point. - *

- * @param mixed $a

- * Object or _id to which to create a reference. If an object or - * associative array is given, this will create a reference using - * the _id field. - *

- * @return array a database reference array. - */ - public function createDBRef ($collection, $a) {} - - /** - * (PECL mongo >=0.9.0)
- * Fetches the document pointed to by a database reference - * @link http://php.net/manual/en/mongodb.getdbref.php - * @param array $ref

- * A database reference. - *

- * @return array the document pointed to by the reference. - */ - public function getDBRef (array $ref) {} - - /** - * (PECL mongo >=0.9.3)
- * Runs JavaScript code on the database server. - * @link http://php.net/manual/en/mongodb.execute.php - * @param mixed $code

- * MongoCode or string to execute. - *

- * @param array $args [optional]

- * Arguments to be passed to code. - *

- * @return array the result of the evaluation. - */ - public function execute ($code, array $args = 'array()') {} - - /** - * (PECL mongo >=0.9.2)
- * Execute a database command - * @link http://php.net/manual/en/mongodb.command.php - * @param array $command

- * The query to send. - *

- * @param array $options [optional]

- * This parameter is an associative array of the form - * array("optionname" => <boolean>, ...). Currently - * supported options are: - *

"timeout"

Integer, defaults to MongoCursor::$timeout. If "safe" is set, this sets how long (in milliseconds) for the client to wait for a database response. If the database does not respond within the timeout period, a MongoCursorTimeoutException will be thrown.

- *

- * @return array database response. - */ - public function command (array $command, array $options = 'array()') {} - - /** - * (PECL mongo >=0.9.5)
- * Check if there was an error on the most recent db operation performed - * @link http://php.net/manual/en/mongodb.lasterror.php - * @return array the error, if there was one. - */ - public function lastError () {} - - /** - * (PECL mongo >=0.9.5)
- * Checks for the last error thrown during a database operation - * @link http://php.net/manual/en/mongodb.preverror.php - * @return array the error and the number of operations ago it occurred. - */ - public function prevError () {} - - /** - * (PECL mongo >=0.9.5)
- * Clears any flagged errors on the database - * @link http://php.net/manual/en/mongodb.reseterror.php - * @return array the database response. - */ - public function resetError () {} - - /** - * (PECL mongo >=0.9.5)
- * Creates a database error - * @link http://php.net/manual/en/mongodb.forceerror.php - * @return bool the database response. - */ - public function forceError () {} - - /** - * (PECL mongo >=1.0.1)
- * Log in to this database - * @link http://php.net/manual/en/mongodb.authenticate.php - * @param string $username

- * The username. - *

- * @param string $password

- * The password (in plaintext). - *

- * @return array database response. If the login was successful, it will return - * - * array("ok" => 1); - * - * If something went wrong, it will return - * - * array("ok" => 0, "errmsg" => "auth fails"); - * - * ("auth fails" could be another message, depending on database version and what - * when wrong). - */ - public function authenticate ($username, $password) {} - -} - -/** - * Representations a database collection. - * @link http://php.net/manual/en/class.mongocollection.php - */ -class MongoCollection { - const ASCENDING = 1; - const DESCENDING = -1; - - /** - * @var integer - */ - public $w; - /** - * @var integer - */ - public $wtimeout; - - - /** - * (PECL mongo >=0.9.0)
- * Creates a new collection - * @link http://php.net/manual/en/mongocollection.construct.php - * @param MongoDB $db

- * Parent database. - *

- * @param string $name

- * Name for this collection. - *

- */ - public function __construct (MongoDB $db, $name) {} - - /** - * (PECL mongo >=0.9.0)
- * String representation of this collection - * @link http://php.net/manual/en/mongocollection.--tostring.php - * @return string the full name of this collection. - */ - public function __toString () {} - - /** - * (PECL mongo >=1.0.2)
- * Gets a collection - * @link http://php.net/manual/en/mongocollection.get.php - * @param string $name

- * The next string in the collection name. - *

- * @return MongoCollection the collection. - */ - public function __get ($name) {} - - /** - * (PECL mongo >=0.9.0)
- * Returns this collection's name - * @link http://php.net/manual/en/mongocollection.getname.php - * @return string the name of this collection. - */ - public function getName () {} - - /** - * (PECL mongo >=1.1.0)
- * Get slaveOkay setting for this collection - * @link http://php.net/manual/en/mongocollection.getslaveokay.php - * @return bool the value of slaveOkay for this instance. - */ - public function getSlaveOkay () {} - - /** - * (PECL mongo >=1.1.0)
- * Change slaveOkay setting for this collection - * @link http://php.net/manual/en/mongocollection.setslaveokay.php - * @param bool $ok [optional]

- * If reads should be sent to secondary members of a replica set for all - * possible queries using this MongoCollection - * instance. - *

- * @return bool the former value of slaveOkay for this instance. - */ - public function setSlaveOkay ($ok = true) {} - - /** - * (PECL mongo >=1.3.0)
- * Get the read preference for this collection - * @link http://php.net/manual/en/mongocollection.getreadpreference.php - * @return array This function returns an array describing the read preference. The array - * contains the values type for the numeric read preference - * mode, type_string for the name of the read preference - * mode, and tagsets containing a list of all tag set - * criteria. If no tag sets were specified, tagsets will not - * be present in the array. - */ - public function getReadPreference () {} - - /** - * (No version information available, might only be in SVN)
- * Set the read preference for this collection - * @link http://php.net/manual/en/mongocollection.setreadpreference.php - * @param int $read_preference - * @param array $tags [optional] - * @return bool - */ - public function setReadPreference ($read_preference, array $tags = null) {} - - /** - * (PECL mongo >=0.9.0)
- * Drops this collection - * @link http://php.net/manual/en/mongocollection.drop.php - * @return array the database response. - */ - public function drop () {} - - /** - * (PECL mongo >=0.9.0)
- * Validates this collection - * @link http://php.net/manual/en/mongocollection.validate.php - * @param bool $scan_data [optional]

- * Only validate indices, not the base collection. - *

- * @return array the database's evaluation of this object. - */ - public function validate ($scan_data = '&false;') {} - - /** - * (PECL mongo >=0.9.0)
- * Inserts an array into the collection - * @link http://php.net/manual/en/mongocollection.insert.php - * @param array $a

- * An array. - *

- * @param array $options [optional]

- * Options for the insert. - *

"w"

See WriteConcerns. The default value for MongoClient is 1.

- *

"fsync"

Boolean, defaults to FALSE. Forces the insert to be synced to disk before returning success. If TRUE, an acknowledged insert is implied and will override setting w to 0.

- *

"timeout"

Integer, defaults to MongoCursor::$timeout. If "safe" is set, this sets how long (in milliseconds) for the client to wait for a database response. If the database does not respond within the timeout period, a MongoCursorTimeoutException will be thrown.

- *

"safe"

Deprecated. Please use the WriteConcern w option.

- *

- * @return bool|array an array containing the status of the insertion if the - * "w" option is set. Otherwise, returns TRUE if the - * inserted array is not empty (a MongoException will be - * thrown if the inserted array is empty). - *

- *

- * If an array is returned, the following keys may be present: - * ok - *

- * This should almost be 1 (unless last_error itself failed). - *

- * err - *

- * If this field is non-null, an error occurred on the previous operation. - * If this field is set, it will be a string describing the error that - * occurred. - *

- * code - *

- * If a database error occurred, the relevant error code will be passed - * back to the client. - *

- * errmsg - *

- * This field is set if something goes wrong with a database command. It - * is coupled with ok being 0. For example, if - * w is set and times out, errmsg will be set to "timed - * out waiting for slaves" and ok will be 0. If this - * field is set, it will be a string describing the error that occurred. - *

- * n - *

- * If the last operation was an insert, an update or a remove, the number - * of objects affected will be returned. - *

- * wtimeout - *

- * If the previous option timed out waiting for replication. - *

- * waited - *

- * How long the operation waited before timing out. - *

- * wtime - *

- * If w was set and the operation succeeded, how long it took to - * replicate to w servers. - *

- * upserted - *

- * If an upsert occured, this field will contain the new record's - * _id field. For upserts, either this field or - * updatedExisting will be present (unless an error - * occurred). - *

- * updatedExisting - *

- * If an upsert updated an existing element, this field will be true. For - * upserts, either this field or upserted will be present (unless an error - * occurred). - *

- */ - public function insert (array $a, array $options = 'array()') {} - - /** - * (PECL mongo >=0.9.0)
- * Inserts multiple documents into this collection - * @link http://php.net/manual/en/mongocollection.batchinsert.php - * @param array $a

- * An array of arrays. - *

- * @param array $options [optional]

- * Options for the inserts. - *

"w"

See WriteConcerns. The default value for MongoClient is 1.

- *

"fsync"

Boolean, defaults to FALSE. Forces the insert to be synced to disk before returning success. If TRUE, an acknowledged insert is implied and will override setting w to 0.

- *

"timeout"

Integer, defaults to MongoCursor::$timeout. If "safe" is set, this sets how long (in milliseconds) for the client to wait for a database response. If the database does not respond within the timeout period, a MongoCursorTimeoutException will be thrown.

- *

- * "continueOnError" - *

- *

- * Boolean, defaults to FALSE. If set, the database will not stop - * processing a bulk insert if one fails (eg due to duplicate IDs). - * This makes bulk insert behave similarly to a series of single - * inserts, except that calling MongoDB::lastError - * will have an error set if any insert fails, not just the last one. - * If multiple errors occur, only the most recent will be reported by - * MongoDB::lastError. - *

- * @return mixed If the w parameter is set to acknowledge the write, - * returns an associative array with the status of the inserts ("ok") and any - * error that may have occured ("err"). Otherwise, returns TRUE if the - * batch insert was successfully sent, FALSE otherwise. - */ - public function batchInsert (array $a, array $options = 'array()') {} - - /** - * (PECL mongo >=0.9.0)
- * Update records based on a given criteria - * @link http://php.net/manual/en/mongocollection.update.php - * @param array $criteria

- * Description of the objects to update. - *

- * @param array $new_object

- * The object with which to update the matching records. - *

- * @param array $options [optional]

- * This parameter is an associative array of the form - * array("optionname" => <boolean>, ...). Currently - * supported options are: - *

"w"

See WriteConcerns. The default value for MongoClient is 1.

- *

- * "upsert" - *

- *

- * If no document matches $criteria, a new - * document will be inserted. - *

- *

- * If a new document would be inserted and - * $new_object contains atomic modifiers - * (i.e. $ operators), those operations will be - * applied to the $criteria parameter to create - * the new document. If $new_object does not - * contain atomic modifiers, it will be used as-is for the inserted - * document. See the upsert examples below for more information. - *

- * @return bool|array an array containing the status of the update if the - * "w" option is set. Otherwise, returns TRUE. - *

- *

- * Fields in the status array are described in the documentation for - * MongoCollection::insert. - */ - public function update (array $criteria, array $new_object, array $options = 'array()') {} - - /** - * (PECL mongo >=0.9.0)
- * Remove records from this collection - * @link http://php.net/manual/en/mongocollection.remove.php - * @param array $criteria [optional]

- * Description of records to remove. - *

- * @param array $options [optional]

- * Options for remove. - *

"w"

See WriteConcerns. The default value for MongoClient is 1.

- *

- * "justOne" - *

- *

- * Remove at most one record matching this criteria. - *

- * @return bool|array an array containing the status of the removal if the - * "w" option is set. Otherwise, returns TRUE. - *

- *

- * Fields in the status array are described in the documentation for - * MongoCollection::insert. - */ - public function remove (array $criteria = 'array()', array $options = 'array()') {} - - /** - * (PECL mongo >=0.9.0)
- * Querys this collection, returning a MongoCursor -for the result set - * @link http://php.net/manual/en/mongocollection.find.php - * @param array $query [optional]

- * The fields for which to search. MongoDB's query language is quite - * extensive. The PHP driver will in almost all cases pass the query - * straight through to the server, so reading the MongoDB core docs on - * find is a good idea. - *

- *

- * Please make sure that for all special query operators (starting with - * $) you use single quotes so that PHP doesn't try to - * replace "$exists" with the value of the variable - * $exists. - *

- * @param array $fields [optional]

- * Fields of the results to return. The array is in the format - * array('fieldname' => true, 'fieldname2' => true). - * The _id field is always returned. - *

- * @return MongoCursor a cursor for the search results. - */ - public function find (array $query = 'array()', array $fields = 'array()') {} - - /** - * (PECL mongo >=0.9.0)
- * Querys this collection, returning a single element - * @link http://php.net/manual/en/mongocollection.findone.php - * @param array $query [optional]

- * The fields for which to search. MongoDB's query language is quite - * extensive. The PHP driver will in almost all cases pass the query - * straight through to the server, so reading the MongoDB core docs on - * find is a good idea. - *

- *

- * Please make sure that for all special query operaters (starting with - * $) you use single quotes so that PHP doesn't try to - * replace "$exists" with the value of the variable - * $exists. - *

- * @param array $fields [optional]

- * Fields of the results to return. The array is in the format - * array('fieldname' => true, 'fieldname2' => true). - * The _id field is always returned. - *

- * @return array record matching the search or NULL. - */ - public function findOne (array $query = 'array()', array $fields = 'array()') {} - - /** - * Update a document and return it - * @link http://php.net/manual/en/mongocollection.findandmodify.php - * @param array $query

- * The query criteria to search for. - *

- * @param array $update [optional]

- * The update criteria. - *

- * @param array $fields [optional]

- * Optionally only return these fields. - *

- * @param array $options [optional]

- * An array of options to apply, such as remove the match document from the - * DB and return it. - * - * Option - * Description - * - * - * sort array - * - * Determines which document the operation will modify if the - * query selects multiple documents. findAndModify will modify the - * first document in the sort order specified by this argument. - * - * - * - * remove boolean - * - * Optional if update field exists. When TRUE, removes the selected - * document. The default is FALSE. - * - * - * - * update array - * - * Optional if remove field exists. - * Performs an update of the selected document. - * - * - * - * new boolean - * - * Optional. When TRUE, returns the modified document rather than the - * original. The findAndModify method ignores the new option for - * remove operations. The default is FALSE. - * - * - * - * upsert boolean - * - * Optional. Used in conjunction with the update field. When TRUE, the - * findAndModify command creates a new document if the query returns - * no documents. The default is false. In MongoDB 2.2, the - * findAndModify command returns NULL when upsert is TRUE. - * - * - * - * - * - * - * - *

- * @return void the original document, or the modified document when - * new is set. - */ - public function findAndModify (array $query, array $update = null, array $fields = null, array $options = null) {} - - /** - * (PECL mongo >=0.9.0)
- * Creates an index on the given field(s), or does nothing if the index -already exists - * @link http://php.net/manual/en/mongocollection.ensureindex.php - * @param string|array $key_keys - * @param array $options [optional]

- * This parameter is an associative array of the form - * array("optionname" => <boolean>, ...). Currently - * supported options are: - *

"w"

See WriteConcerns. The default value for MongoClient is 1.

- *

- * "unique" - *

- *

- * Create a unique index. - *

- *

- * A unique index cannot be created on a field if multiple existing - * documents do not contain the field. The field is effectively NULL - * for these documents and thus already non-unique. Sparse indexing may - * be used to overcome this, since it will prevent documents without the - * field from being indexed. - *

- * @return bool TRUE. - */ - public function ensureIndex ($key_keys, array $options = 'array()') {} - - /** - * (PECL mongo >=0.9.0)
- * Deletes an index from this collection - * @link http://php.net/manual/en/mongocollection.deleteindex.php - * @param string|array $keys

- * Field or fields from which to delete the index. - *

- * @return array the generated name of the key if successful, or NULL otherwise. - */ - public function deleteIndex ($keys) {} - - /** - * (PECL mongo >=0.9.0)
- * Delete all indices for this collection - * @link http://php.net/manual/en/mongocollection.deleteindexes.php - * @return array the database response. - */ - public function deleteIndexes () {} - - /** - * (PECL mongo >=0.9.0)
- * Returns information about indexes on this collection - * @link http://php.net/manual/en/mongocollection.getindexinfo.php - * @return array This function returns an array in which each elements describes an array. - * The elements contain the values name for the name of - * the index, ns for the namespace (the name of the - * collection), key containing a list of all the keys - * and their sort order that make up the index and _id - * containing a MongoID object with the ID of this index. - */ - public function getIndexInfo () {} - - /** - * (PECL mongo >=0.9.0)
- * Counts the number of documents in this collection - * @link http://php.net/manual/en/mongocollection.count.php - * @param array $query [optional]

- * Associative array or object with fields to match. - *

- * @param int $limit [optional]

- * Specifies an upper limit to the number returned. - *

- * @param int $skip [optional]

- * Specifies a number of results to skip before starting the count. - *

- * @return int the number of documents matching the query. - */ - public function count (array $query = 'array()', $limit = 0, $skip = 0) {} - - /** - * (PECL mongo >=0.9.0)
- * Saves an object to this collection - * @link http://php.net/manual/en/mongocollection.save.php - * @param array $a

- * Array to save. - *

- * @param array $options [optional]

- * Options for the save. - *

"w"

See WriteConcerns. The default value for MongoClient is 1.

- *

"fsync"

Boolean, defaults to FALSE. Forces the insert to be synced to disk before returning success. If TRUE, an acknowledged insert is implied and will override setting w to 0.

- *

"timeout"

Integer, defaults to MongoCursor::$timeout. If "safe" is set, this sets how long (in milliseconds) for the client to wait for a database response. If the database does not respond within the timeout period, a MongoCursorTimeoutException will be thrown.

- *

"safe"

Deprecated. Please use the WriteConcern w option.

- *

- * @return mixed If w was set, returns an array containing the status of the save. - * Otherwise, returns a boolean representing if the array was not empty (an empty array will not - * be inserted). - */ - public function save (array $a, array $options = 'array()') {} - - /** - * (PECL mongo >=0.9.0)
- * Creates a database reference - * @link http://php.net/manual/en/mongocollection.createdbref.php - * @param array $a

- * Object to which to create a reference. - *

- * @return array a database reference array. - */ - public function createDBRef (array $a) {} - - /** - * (PECL mongo >=0.9.0)
- * Fetches the document pointed to by a database reference - * @link http://php.net/manual/en/mongocollection.getdbref.php - * @param array $ref

- * A database reference. - *

- * @return array the database document pointed to by the reference. - */ - public function getDBRef (array $ref) {} - - /** - * (No version information available, might only be in SVN)
- * Converts keys specifying an index to its identifying string - * @link http://php.net/manual/en/mongocollection.toindexstring.php - * @param mixed $keys

- * Field or fields to convert to the identifying string - *

- * @return string a string that describes the index. - */ - protected static function toIndexString ($keys) {} - - /** - * (PECL mongo >=0.9.2)
- * Performs an operation similar to SQL's GROUP BY command - * @link http://php.net/manual/en/mongocollection.group.php - * @param mixed $keys

- * Fields to group by. If an array or non-code object is passed, it will be - * the key used to group results. - *

- *

1.0.4+: If keys is an instance of - * MongoCode, keys will be treated as - * a function that returns the key to group by (see the "Passing a - * keys function" example below). - *

- * @param array $initial

- * Initial value of the aggregation counter object. - *

- * @param MongoCode $reduce

- * A function that takes two arguments (the current document and the - * aggregation to this point) and does the aggregation. - *

- * @param array $options [optional]

- * Optional parameters to the group command. Valid options include: - *

- *

- * "condition" - *

- *

- * Criteria for including a document in the aggregation. - *

- * @return array an array containing the result. - */ - public function group ($keys, array $initial, MongoCode $reduce, array $options = 'array()') {} - - /** - * (PECL mongo >=1.2.11)
- * Retrieve a list of distinct values for the given key across a collection. - * @link http://php.net/manual/en/mongocollection.distinct.php - * @param string $key

- * The key to use. - *

- * @param array $query [optional]

- * An optional query parameters - *

- * @return array an array of distinct values, or FALSE on failure - */ - public function distinct ($key, array $query = null) {} - - /** - * (PECL mongo >=1.3.0)
- * Perform an aggregation using the aggregation framework - * @link http://php.net/manual/en/mongocollection.aggregate.php - * @param array $pipeline

- * An array of pipeline operators, or just the first operator. - *

- * @param array $op [optional]

- * The second pipeline operator. - *

- * @param array $_ [optional]

- * Additional pipeline operators. - *

- * @return array The result of the aggregation as an array. The ok will - * be set to 1 on success, 0 on failure. - */ - public function aggregate (array $pipeline, array $op = null, array $_ = null) {} - -} - -/** - * A cursor is used to iterate through the results of a database query. For - * example, to query the database and see all results, you could do: - * MongoCursor basic usage - * - * $cursor = $collection->find(); - * var_dump(iterator_to_array($cursor)); - * - * @link http://php.net/manual/en/class.mongocursor.php - */ -class MongoCursor implements Iterator, Traversable { - /** - * @var boolean - */ - public static $slaveOkay; - /** - * @var integer - */ - public static $timeout; - - - /** - * (PECL mongo >=0.9.0)
- * Create a new cursor - * @link http://php.net/manual/en/mongocursor.construct.php - * @param MongoClient $connection

- * Database connection. - *

- * @param string $ns

- * Full name of database and collection. - *

- * @param array $query [optional]

- * Database query. - *

- * @param array $fields [optional]

- * Fields to return. - *

- */ - public function __construct (MongoClient $connection, $ns, array $query = 'array()', array $fields = 'array()') {} - - /** - * (PECL mongo >=0.9.0)
- * Checks if there are any more elements in this cursor - * @link http://php.net/manual/en/mongocursor.hasnext.php - * @return bool if there is another element. - */ - public function hasNext () {} - - /** - * (PECL mongo >=0.9.0)
- * Return the next object to which this cursor points, and advance the cursor - * @link http://php.net/manual/en/mongocursor.getnext.php - * @return array the next object. - */ - public function getNext () {} - - /** - * (PECL mongo >=0.9.0)
- * Limits the number of results returned - * @link http://php.net/manual/en/mongocursor.limit.php - * @param int $num

- * The number of results to return. - *

- * @return MongoCursor this cursor. - */ - public function limit ($num) {} - - /** - * (PECL mongo >=1.0.11)
- * Limits the number of elements returned in one batch. - * @link http://php.net/manual/en/mongocursor.batchsize.php - * @param int $batchSize

- * The number of results to return per batch. Each batch requires a - * round-trip to the server. - *

- *

- * If batchSize is 2 or - * more, it represents the size of each batch of objects retrieved. - * It can be adjusted to optimize performance and limit data transfer. - *

- *

- * If batchSize is 1 or negative, it - * will limit of number returned documents to the absolute value of batchSize, - * and the cursor will be closed. For example if - * batchSize is -10, then the server will return a maximum - * of 10 documents and as many as can fit in 4MB, then close the cursor. - *

- *

- * A batchSize of 1 is special, and - * means the same as -1, i.e. a value of - * 1 makes the cursor only capable of returning - * one document. - *

- *

- * Note that this feature is different from - * MongoCursor::limit in that documents must fit within a - * maximum size, and it removes the need to send a request to close the cursor - * server-side. The batch size can be changed even after a cursor is iterated, - * in which case the setting will apply on the next batch retrieval. - *

- *

- * This cannot override MongoDB's limit on the amount of data it will return to - * the client (i.e., if you set batch size to 1,000,000,000, MongoDB will still - * only return 4-16MB of results per batch). - *

- *

- * To ensure consistent behavior, the rules of - * MongoCursor::batchSize and - * MongoCursor::limit behave a - * little complex but work "as expected". The rules are: hard limits override - * soft limits with preference given to MongoCursor::limit - * over MongoCursor::batchSize. After that, whichever is - * set and lower than the other will take precedence. See below. - * section for some examples. - *

- * @return MongoCursor this cursor. - */ - public function batchSize ($batchSize) {} - - /** - * (PECL mongo >=0.9.0)
- * Skips a number of results - * @link http://php.net/manual/en/mongocursor.skip.php - * @param int $num

- * The number of results to skip. - *

- * @return MongoCursor this cursor. - */ - public function skip ($num) {} - - /** - * (PECL mongo >=1.0.6)
- * Sets the fields for a query - * @link http://php.net/manual/en/mongocursor.fields.php - * @param array $f

- * Fields to return (or not return). - *

- * @return MongoCursor this cursor. - */ - public function fields (array $f) {} - - /** - * (PECL mongo >=1.0.4)
- * Adds a top-level key/value pair to a query - * @link http://php.net/manual/en/mongocursor.addoption.php - * @param string $key

- * Fieldname to add. - *

- * @param mixed $value

- * Value to add. - *

- * @return MongoCursor this cursor. - */ - public function addOption ($key, $value) {} - - /** - * (PECL mongo >=0.9.4)
- * Use snapshot mode for the query - * @link http://php.net/manual/en/mongocursor.snapshot.php - * @return MongoCursor this cursor. - */ - public function snapshot () {} - - /** - * (PECL mongo >=0.9.0)
- * Sorts the results by given fields - * @link http://php.net/manual/en/mongocursor.sort.php - * @param array $fields

- * An array of fields by which to sort. Each element in the array has as - * key the field name, and as value either 1 for - * ascending sort, or -1 for descending sort. - *

- *

- * Each result is first sorted on the first field in the array, then (if - * it exists) on the second field in the array, etc. This means that the - * order of the fields in the fields array is - * important. See also the examples section. - *

- * @return MongoCursor the same cursor that this method was called on. - */ - public function sort (array $fields) {} - - /** - * (PECL mongo >=0.9.0)
- * Gives the database a hint about the query - * @link http://php.net/manual/en/mongocursor.hint.php - * @param array $key_pattern

- * Indexes to use for the query. - *

- * @return MongoCursor this cursor. - */ - public function hint (array $key_pattern) {} - - /** - * (PECL mongo >=0.9.2)
- * Return an explanation of the query, often useful for optimization and debugging - * @link http://php.net/manual/en/mongocursor.explain.php - * @return array an explanation of the query. - */ - public function explain () {} - - /** - * (No version information available, might only be in SVN)
- * Sets arbitrary flags in case there is no method available the specific flag - * @link http://php.net/manual/en/mongocursor.setflag.php - * @param bool $flag

- * Which flag to set. You can not set flag 3 (OPLOG REPLAY) or flag 6 - * (EXHAUST) as the driver does not know how to handle them. You will get - * a warning if you try to use those. For available flags, please refer to - * the wire protocol - * documentation. - *

- * @param bool $set [optional]

- * Whether the flag should be set (TRUE) or unset (FALSE). - *

- * @return MongoCursor this cursor. - */ - public function setFlag ($flag, $set = true) {} - - /** - * (PECL mongo >=0.9.4)
- * Sets whether this query can be done on a secondary - * @link http://php.net/manual/en/mongocursor.slaveokay.php - * @param bool $okay [optional]

- * If it is okay to query the secondary. - *

- * @return MongoCursor this cursor. - */ - public function slaveOkay ($okay = true) {} - - /** - * (PECL mongo >=0.9.4)
- * Sets whether this cursor will be left open after fetching the last results - * @link http://php.net/manual/en/mongocursor.tailable.php - * @param bool $tail [optional]

- * If the cursor should be tailable. - *

- * @return MongoCursor this cursor. - */ - public function tailable ($tail = true) {} - - /** - * (PECL mongo >=1.0.1)
- * Sets whether this cursor will timeout - * @link http://php.net/manual/en/mongocursor.immortal.php - * @param bool $liveForever [optional]

- * If the cursor should be immortal. - *

- * @return MongoCursor this cursor. - */ - public function immortal ($liveForever = true) {} - - /** - * (No version information available, might only be in SVN)
- * Sets whether this cursor will wait for a while for a tailable cursor to return more data - * @link http://php.net/manual/en/mongocursor.awaitdata.php - * @param bool $wait [optional]

- * If the cursor should wait for more data to become available. - *

- * @return MongoCursor this cursor. - */ - public function awaitData ($wait = true) {} - - /** - * (PECL mongo >=1.2.0)
- * If this query should fetch partial results from mongos if a shard is down - * @link http://php.net/manual/en/mongocursor.partial.php - * @param bool $okay [optional]

- * If receiving partial results is okay. - *

- * @return MongoCursor this cursor. - */ - public function partial ($okay = true) {} - - /** - * (PECL mongo >=1.0.3)
- * Sets a client-side timeout for this query - * @link http://php.net/manual/en/mongocursor.timeout.php - * @param int $ms

- * The number of milliseconds for the cursor to wait for a response. By - * default, the cursor will wait forever. - *

- * @return MongoCursor This cursor. - */ - public function timeout ($ms) {} - - /** - * (No version information available, might only be in SVN)
- * Execute the query. - * @link http://php.net/manual/en/mongocursor.doquery.php - * @return void NULL. - */ - protected function doQuery () {} - - /** - * (PECL mongo >=1.0.5)
- * Gets the query, fields, limit, and skip for this cursor - * @link http://php.net/manual/en/mongocursor.info.php - * @return array the namespace, limit, skip, query, and fields for this cursor. - */ - public function info () {} - - /** - * (PECL mongo >=0.9.6)
- * Checks if there are documents that have not been sent yet from the database for this cursor - * @link http://php.net/manual/en/mongocursor.dead.php - * @return bool if there are more results that have not been sent to the client, yet. - */ - public function dead () {} - - /** - * (PECL mongo >=0.9.0)
- * Returns the current element - * @link http://php.net/manual/en/mongocursor.current.php - * @return array The current result as an associative array. - */ - public function current () {} - - /** - * (PECL mongo >=0.9.0)
- * Returns the current result's _id - * @link http://php.net/manual/en/mongocursor.key.php - * @return string The current result's _id as a string. - */ - public function key () {} - - /** - * (PECL mongo >=0.9.0)
- * Advances the cursor to the next result - * @link http://php.net/manual/en/mongocursor.next.php - * @return void NULL. - */ - public function next () {} - - /** - * (PECL mongo >=0.9.0)
- * Returns the cursor to the beginning of the result set - * @link http://php.net/manual/en/mongocursor.rewind.php - * @return void NULL. - */ - public function rewind () {} - - /** - * (PECL mongo >=0.9.0)
- * Checks if the cursor is reading a valid result. - * @link http://php.net/manual/en/mongocursor.valid.php - * @return bool If the current result is not null. - */ - public function valid () {} - - /** - * (PECL mongo >=0.9.0)
- * Clears the cursor - * @link http://php.net/manual/en/mongocursor.reset.php - * @return void NULL. - */ - public function reset () {} - - /** - * (PECL mongo >=0.9.2)
- * Counts the number of results for this query - * @link http://php.net/manual/en/mongocursor.count.php - * @param bool $foundOnly [optional]

- * Send cursor limit and skip information to the count function, if applicable. - *

- * @return int The number of documents returned by this cursor's query. - */ - public function count ($foundOnly = '&false;') {} - -} - -/** - * Utilities for storing and retrieving files from the database. - * @link http://php.net/manual/en/class.mongogridfs.php - */ -class MongoGridFS extends MongoCollection { - const ASCENDING = 1; - const DESCENDING = -1; - - /** - * @var integer - */ - public $w; - /** - * @var integer - */ - public $wtimeout; - public $chunks; - protected $filesName; - protected $chunksName; - - - /** - * (PECL mongo >=0.9.0)
- * Creates new file collections - * @link http://php.net/manual/en/mongogridfs.construct.php - * @param MongoDB $db

- * Database. - *

- * @param string $prefix [optional] - * @param mixed $chunks [optional] - */ - public function __construct (MongoDB $db, $prefix = '"fs"', $chunks = '"fs"') {} - - /** - * (PECL mongo >=0.9.0)
- * Drops the files and chunks collections - * @link http://php.net/manual/en/mongogridfs.drop.php - * @return array The database response. - */ - public function drop () {} - - /** - * (PECL mongo >=0.9.0)
- * Queries for files - * @link http://php.net/manual/en/mongogridfs.find.php - * @param array $query [optional]

- * The query. - *

- * @param array $fields [optional]

- * Fields to return. - *

- * @return MongoGridFSCursor A MongoGridFSCursor. - */ - public function find (array $query = 'array()', array $fields = 'array()') {} - - /** - * (PECL mongo >=0.9.0)
- * Stores a file in the database - * @link http://php.net/manual/en/mongogridfs.storefile.php - * @param string $filename

- * The name of the file. - *

- * @param array $extra [optional]

- * Other metadata to add to the file saved. - *

- * @param array $options [optional]

- * Options for the store. - *

"w"

See WriteConcerns. The default value for MongoClient is 1.

- *

- * @return mixed the _id of the saved object. - */ - public function storeFile ($filename, array $extra = 'array()', array $options = 'array()') {} - - /** - * (PECL mongo >=0.9.2)
- * Chunkifies and stores bytes in the database - * @link http://php.net/manual/en/mongogridfs.storebytes.php - * @param string $bytes

- * A string of bytes to store. - *

- * @param array $extra [optional]

- * Other metadata to add to the file saved. - *

- * @param array $options [optional]

- * Options for the store. - *

"w"

See WriteConcerns. The default value for MongoClient is 1.

- *

- * @return mixed The _id of the object saved. - */ - public function storeBytes ($bytes, array $extra = 'array()', array $options = 'array()') {} - - /** - * (PECL mongo >=0.9.0)
- * Returns a single file matching the criteria - * @link http://php.net/manual/en/mongogridfs.findone.php - * @param mixed $query [optional]

- * The filename or criteria for which to search. - *

- * @param mixed $fields [optional] - * @return MongoGridFSFile a MongoGridFSFile or NULL. - */ - public function findOne ($query = 'array()', $fields = 'array()') {} - - /** - * (PECL mongo >=0.9.0)
- * Removes files from the collections - * @link http://php.net/manual/en/mongogridfs.remove.php - * @param array $criteria [optional] - * @param array $options [optional]

- * Options for the remove. Valid options are: - *

- *

"w"

See WriteConcerns. The default value for MongoClient is 1.

- * @return bool if the removal was successfully sent to the database. - */ - public function remove (array $criteria = 'array()', array $options = 'array()') {} - - /** - * (PECL mongo >=0.9.0)
- * Saves an uploaded file to the database - * @link http://php.net/manual/en/mongogridfs.storeupload.php - * @param string $name

- * The name field of the uploaded file. - *

- * @param array $metadata [optional]

- * An array of extra fields for the uploaded file. - *

- * @return mixed the _id of the uploaded file. - */ - public function storeUpload ($name, array $metadata = null) {} - - /** - * (PECL mongo >=1.0.8)
- * Delete a file from the database - * @link http://php.net/manual/en/mongogridfs.delete.php - * @param mixed $id

- * _id of the file to remove. - *

- * @return bool if the remove was successfully sent to the database. - */ - public function delete ($id) {} - - /** - * (PECL mongo >=1.0.8)
- * Retrieve a file from the database - * @link http://php.net/manual/en/mongogridfs.get.php - * @param mixed $id

- * _id of the file to find. - *

- * @return MongoGridFSFile the file, if found, or NULL. - */ - public function get ($id) {} - - /** - * (PECL mongo >=1.0.8)
- * Stores a file in the database - * @link http://php.net/manual/en/mongogridfs.put.php - * @param string $filename

- * The name of the file. - *

- * @param array $extra [optional]

- * Other metadata to add to the file saved. - *

- * @return mixed the _id of the saved object. - */ - public function put ($filename, array $extra = 'array()') {} - - /** - * (PECL mongo >=0.9.0)
- * String representation of this collection - * @link http://php.net/manual/en/mongocollection.--tostring.php - * @return string the full name of this collection. - */ - public function __toString () {} - - /** - * (PECL mongo >=1.0.2)
- * Gets a collection - * @link http://php.net/manual/en/mongocollection.get.php - * @param string $name

- * The next string in the collection name. - *

- * @return MongoCollection the collection. - */ - public function __get ($name) {} - - /** - * (PECL mongo >=0.9.0)
- * Returns this collection's name - * @link http://php.net/manual/en/mongocollection.getname.php - * @return string the name of this collection. - */ - public function getName () {} - - /** - * (PECL mongo >=1.1.0)
- * Get slaveOkay setting for this collection - * @link http://php.net/manual/en/mongocollection.getslaveokay.php - * @return bool the value of slaveOkay for this instance. - */ - public function getSlaveOkay () {} - - /** - * (PECL mongo >=1.1.0)
- * Change slaveOkay setting for this collection - * @link http://php.net/manual/en/mongocollection.setslaveokay.php - * @param bool $ok [optional]

- * If reads should be sent to secondary members of a replica set for all - * possible queries using this MongoCollection - * instance. - *

- * @return bool the former value of slaveOkay for this instance. - */ - public function setSlaveOkay ($ok = true) {} - - /** - * (PECL mongo >=1.3.0)
- * Get the read preference for this collection - * @link http://php.net/manual/en/mongocollection.getreadpreference.php - * @return array This function returns an array describing the read preference. The array - * contains the values type for the numeric read preference - * mode, type_string for the name of the read preference - * mode, and tagsets containing a list of all tag set - * criteria. If no tag sets were specified, tagsets will not - * be present in the array. - */ - public function getReadPreference () {} - - /** - * (No version information available, might only be in SVN)
- * Set the read preference for this collection - * @link http://php.net/manual/en/mongocollection.setreadpreference.php - * @param int $read_preference - * @param array $tags [optional] - * @return bool - */ - public function setReadPreference ($read_preference, array $tags = null) {} - - /** - * (PECL mongo >=0.9.0)
- * Validates this collection - * @link http://php.net/manual/en/mongocollection.validate.php - * @param bool $scan_data [optional]

- * Only validate indices, not the base collection. - *

- * @return array the database's evaluation of this object. - */ - public function validate ($scan_data = '&false;') {} - - /** - * (PECL mongo >=0.9.0)
- * Inserts an array into the collection - * @link http://php.net/manual/en/mongocollection.insert.php - * @param array $a

- * An array. - *

- * @param array $options [optional]

- * Options for the insert. - *

"w"

See WriteConcerns. The default value for MongoClient is 1.

- *

"fsync"

Boolean, defaults to FALSE. Forces the insert to be synced to disk before returning success. If TRUE, an acknowledged insert is implied and will override setting w to 0.

- *

"timeout"

Integer, defaults to MongoCursor::$timeout. If "safe" is set, this sets how long (in milliseconds) for the client to wait for a database response. If the database does not respond within the timeout period, a MongoCursorTimeoutException will be thrown.

- *

"safe"

Deprecated. Please use the WriteConcern w option.

- *

- * @return bool|array an array containing the status of the insertion if the - * "w" option is set. Otherwise, returns TRUE if the - * inserted array is not empty (a MongoException will be - * thrown if the inserted array is empty). - *

- *

- * If an array is returned, the following keys may be present: - * ok - *

- * This should almost be 1 (unless last_error itself failed). - *

- * err - *

- * If this field is non-null, an error occurred on the previous operation. - * If this field is set, it will be a string describing the error that - * occurred. - *

- * code - *

- * If a database error occurred, the relevant error code will be passed - * back to the client. - *

- * errmsg - *

- * This field is set if something goes wrong with a database command. It - * is coupled with ok being 0. For example, if - * w is set and times out, errmsg will be set to "timed - * out waiting for slaves" and ok will be 0. If this - * field is set, it will be a string describing the error that occurred. - *

- * n - *

- * If the last operation was an insert, an update or a remove, the number - * of objects affected will be returned. - *

- * wtimeout - *

- * If the previous option timed out waiting for replication. - *

- * waited - *

- * How long the operation waited before timing out. - *

- * wtime - *

- * If w was set and the operation succeeded, how long it took to - * replicate to w servers. - *

- * upserted - *

- * If an upsert occured, this field will contain the new record's - * _id field. For upserts, either this field or - * updatedExisting will be present (unless an error - * occurred). - *

- * updatedExisting - *

- * If an upsert updated an existing element, this field will be true. For - * upserts, either this field or upserted will be present (unless an error - * occurred). - *

- */ - public function insert (array $a, array $options = 'array()') {} - - /** - * (PECL mongo >=0.9.0)
- * Inserts multiple documents into this collection - * @link http://php.net/manual/en/mongocollection.batchinsert.php - * @param array $a

- * An array of arrays. - *

- * @param array $options [optional]

- * Options for the inserts. - *

"w"

See WriteConcerns. The default value for MongoClient is 1.

- *

"fsync"

Boolean, defaults to FALSE. Forces the insert to be synced to disk before returning success. If TRUE, an acknowledged insert is implied and will override setting w to 0.

- *

"timeout"

Integer, defaults to MongoCursor::$timeout. If "safe" is set, this sets how long (in milliseconds) for the client to wait for a database response. If the database does not respond within the timeout period, a MongoCursorTimeoutException will be thrown.

- *

- * "continueOnError" - *

- *

- * Boolean, defaults to FALSE. If set, the database will not stop - * processing a bulk insert if one fails (eg due to duplicate IDs). - * This makes bulk insert behave similarly to a series of single - * inserts, except that calling MongoDB::lastError - * will have an error set if any insert fails, not just the last one. - * If multiple errors occur, only the most recent will be reported by - * MongoDB::lastError. - *

- * @return mixed If the w parameter is set to acknowledge the write, - * returns an associative array with the status of the inserts ("ok") and any - * error that may have occured ("err"). Otherwise, returns TRUE if the - * batch insert was successfully sent, FALSE otherwise. - */ - public function batchInsert (array $a, array $options = 'array()') {} - - /** - * (PECL mongo >=0.9.0)
- * Update records based on a given criteria - * @link http://php.net/manual/en/mongocollection.update.php - * @param array $criteria

- * Description of the objects to update. - *

- * @param array $new_object

- * The object with which to update the matching records. - *

- * @param array $options [optional]

- * This parameter is an associative array of the form - * array("optionname" => <boolean>, ...). Currently - * supported options are: - *

"w"

See WriteConcerns. The default value for MongoClient is 1.

- *

- * "upsert" - *

- *

- * If no document matches $criteria, a new - * document will be inserted. - *

- *

- * If a new document would be inserted and - * $new_object contains atomic modifiers - * (i.e. $ operators), those operations will be - * applied to the $criteria parameter to create - * the new document. If $new_object does not - * contain atomic modifiers, it will be used as-is for the inserted - * document. See the upsert examples below for more information. - *

- * @return bool|array an array containing the status of the update if the - * "w" option is set. Otherwise, returns TRUE. - *

- *

- * Fields in the status array are described in the documentation for - * MongoCollection::insert. - */ - public function update (array $criteria, array $new_object, array $options = 'array()') {} - - /** - * Update a document and return it - * @link http://php.net/manual/en/mongocollection.findandmodify.php - * @param array $query

- * The query criteria to search for. - *

- * @param array $update [optional]

- * The update criteria. - *

- * @param array $fields [optional]

- * Optionally only return these fields. - *

- * @param array $options [optional]

- * An array of options to apply, such as remove the match document from the - * DB and return it. - * - * Option - * Description - * - * - * sort array - * - * Determines which document the operation will modify if the - * query selects multiple documents. findAndModify will modify the - * first document in the sort order specified by this argument. - * - * - * - * remove boolean - * - * Optional if update field exists. When TRUE, removes the selected - * document. The default is FALSE. - * - * - * - * update array - * - * Optional if remove field exists. - * Performs an update of the selected document. - * - * - * - * new boolean - * - * Optional. When TRUE, returns the modified document rather than the - * original. The findAndModify method ignores the new option for - * remove operations. The default is FALSE. - * - * - * - * upsert boolean - * - * Optional. Used in conjunction with the update field. When TRUE, the - * findAndModify command creates a new document if the query returns - * no documents. The default is false. In MongoDB 2.2, the - * findAndModify command returns NULL when upsert is TRUE. - * - * - * - * - * - * - * - *

- * @return void the original document, or the modified document when - * new is set. - */ - public function findAndModify (array $query, array $update = null, array $fields = null, array $options = null) {} - - /** - * (PECL mongo >=0.9.0)
- * Creates an index on the given field(s), or does nothing if the index -already exists - * @link http://php.net/manual/en/mongocollection.ensureindex.php - * @param string|array $key_keys - * @param array $options [optional]

- * This parameter is an associative array of the form - * array("optionname" => <boolean>, ...). Currently - * supported options are: - *

"w"

See WriteConcerns. The default value for MongoClient is 1.

- *

- * "unique" - *

- *

- * Create a unique index. - *

- *

- * A unique index cannot be created on a field if multiple existing - * documents do not contain the field. The field is effectively NULL - * for these documents and thus already non-unique. Sparse indexing may - * be used to overcome this, since it will prevent documents without the - * field from being indexed. - *

- * @return bool TRUE. - */ - public function ensureIndex ($key_keys, array $options = 'array()') {} - - /** - * (PECL mongo >=0.9.0)
- * Deletes an index from this collection - * @link http://php.net/manual/en/mongocollection.deleteindex.php - * @param string|array $keys

- * Field or fields from which to delete the index. - *

- * @return array the generated name of the key if successful, or NULL otherwise. - */ - public function deleteIndex ($keys) {} - - /** - * (PECL mongo >=0.9.0)
- * Delete all indices for this collection - * @link http://php.net/manual/en/mongocollection.deleteindexes.php - * @return array the database response. - */ - public function deleteIndexes () {} - - /** - * (PECL mongo >=0.9.0)
- * Returns information about indexes on this collection - * @link http://php.net/manual/en/mongocollection.getindexinfo.php - * @return array This function returns an array in which each elements describes an array. - * The elements contain the values name for the name of - * the index, ns for the namespace (the name of the - * collection), key containing a list of all the keys - * and their sort order that make up the index and _id - * containing a MongoID object with the ID of this index. - */ - public function getIndexInfo () {} - - /** - * (PECL mongo >=0.9.0)
- * Counts the number of documents in this collection - * @link http://php.net/manual/en/mongocollection.count.php - * @param array $query [optional]

- * Associative array or object with fields to match. - *

- * @param int $limit [optional]

- * Specifies an upper limit to the number returned. - *

- * @param int $skip [optional]

- * Specifies a number of results to skip before starting the count. - *

- * @return int the number of documents matching the query. - */ - public function count (array $query = 'array()', $limit = 0, $skip = 0) {} - - /** - * (PECL mongo >=0.9.0)
- * Saves an object to this collection - * @link http://php.net/manual/en/mongocollection.save.php - * @param array $a

- * Array to save. - *

- * @param array $options [optional]

- * Options for the save. - *

"w"

See WriteConcerns. The default value for MongoClient is 1.

- *

"fsync"

Boolean, defaults to FALSE. Forces the insert to be synced to disk before returning success. If TRUE, an acknowledged insert is implied and will override setting w to 0.

- *

"timeout"

Integer, defaults to MongoCursor::$timeout. If "safe" is set, this sets how long (in milliseconds) for the client to wait for a database response. If the database does not respond within the timeout period, a MongoCursorTimeoutException will be thrown.

- *

"safe"

Deprecated. Please use the WriteConcern w option.

- *

- * @return mixed If w was set, returns an array containing the status of the save. - * Otherwise, returns a boolean representing if the array was not empty (an empty array will not - * be inserted). - */ - public function save (array $a, array $options = 'array()') {} - - /** - * (PECL mongo >=0.9.0)
- * Creates a database reference - * @link http://php.net/manual/en/mongocollection.createdbref.php - * @param array $a

- * Object to which to create a reference. - *

- * @return array a database reference array. - */ - public function createDBRef (array $a) {} - - /** - * (PECL mongo >=0.9.0)
- * Fetches the document pointed to by a database reference - * @link http://php.net/manual/en/mongocollection.getdbref.php - * @param array $ref

- * A database reference. - *

- * @return array the database document pointed to by the reference. - */ - public function getDBRef (array $ref) {} - - /** - * (No version information available, might only be in SVN)
- * Converts keys specifying an index to its identifying string - * @link http://php.net/manual/en/mongocollection.toindexstring.php - * @param mixed $keys

- * Field or fields to convert to the identifying string - *

- * @return string a string that describes the index. - */ - protected static function toIndexString ($keys) {} - - /** - * (PECL mongo >=0.9.2)
- * Performs an operation similar to SQL's GROUP BY command - * @link http://php.net/manual/en/mongocollection.group.php - * @param mixed $keys

- * Fields to group by. If an array or non-code object is passed, it will be - * the key used to group results. - *

- *

1.0.4+: If keys is an instance of - * MongoCode, keys will be treated as - * a function that returns the key to group by (see the "Passing a - * keys function" example below). - *

- * @param array $initial

- * Initial value of the aggregation counter object. - *

- * @param MongoCode $reduce

- * A function that takes two arguments (the current document and the - * aggregation to this point) and does the aggregation. - *

- * @param array $options [optional]

- * Optional parameters to the group command. Valid options include: - *

- *

- * "condition" - *

- *

- * Criteria for including a document in the aggregation. - *

- * @return array an array containing the result. - */ - public function group ($keys, array $initial, MongoCode $reduce, array $options = 'array()') {} - - /** - * (PECL mongo >=1.2.11)
- * Retrieve a list of distinct values for the given key across a collection. - * @link http://php.net/manual/en/mongocollection.distinct.php - * @param string $key

- * The key to use. - *

- * @param array $query [optional]

- * An optional query parameters - *

- * @return array an array of distinct values, or FALSE on failure - */ - public function distinct ($key, array $query = null) {} - - /** - * (PECL mongo >=1.3.0)
- * Perform an aggregation using the aggregation framework - * @link http://php.net/manual/en/mongocollection.aggregate.php - * @param array $pipeline

- * An array of pipeline operators, or just the first operator. - *

- * @param array $op [optional]

- * The second pipeline operator. - *

- * @param array $_ [optional]

- * Additional pipeline operators. - *

- * @return array The result of the aggregation as an array. The ok will - * be set to 1 on success, 0 on failure. - */ - public function aggregate (array $pipeline, array $op = null, array $_ = null) {} - -} - -/** - * A database file object. - * @link http://php.net/manual/en/class.mongogridfsfile.php - */ -class MongoGridFSFile { - /** - * @var array - */ - public $file; - /** - * @var MongoGridFS - */ - protected $gridfs; - - - /** - * (PECL mongo >=0.9.0)
- * Create a new GridFS file - * @link http://php.net/manual/en/mongogridfsfile.construct.php - * @param MongoGridFS $gridfs

- * The parent MongoGridFS instance. - *

- * @param array $file

- * A file from the database. - *

- */ - public function __construct (MongoGridFS $gridfs, array $file) {} - - /** - * (PECL mongo >=0.9.0)
- * Returns this file's filename - * @link http://php.net/manual/en/mongogridfsfile.getfilename.php - * @return string the filename. - */ - public function getFilename () {} - - /** - * (PECL mongo >=0.9.0)
- * Returns this file's size - * @link http://php.net/manual/en/mongogridfsfile.getsize.php - * @return int this file's size - */ - public function getSize () {} - - /** - * (PECL mongo >=0.9.0)
- * Writes this file to the filesystem - * @link http://php.net/manual/en/mongogridfsfile.write.php - * @param string $filename [optional]

- * The location to which to write the file. If none is given, - * the stored filename will be used. - *

- * @return int the number of bytes written. - */ - public function write ($filename = null) {} - - /** - * (PECL mongo >=0.9.0)
- * Returns this file's contents as a string of bytes - * @link http://php.net/manual/en/mongogridfsfile.getbytes.php - * @return string a string of the bytes in the file. - */ - public function getBytes () {} - - /** - * (No version information available, might only be in SVN)
- * Returns a resource that can be used to read the stored file - * @link http://php.net/manual/en/mongogridfsfile.getresource.php - * @return stream a resource that can be used to read the file with - */ - public function getResource () {} - -} - -/** - * Cursor for database file results. - * @link http://php.net/manual/en/class.mongogridfscursor.php - */ -class MongoGridFSCursor extends MongoCursor implements Traversable, Iterator { - /** - * @var boolean - */ - public static $slaveOkay; - /** - * @var integer - */ - public static $timeout; - protected $gridfs; - - - /** - * (PECL mongo >=0.9.0)
- * Create a new cursor - * @link http://php.net/manual/en/mongogridfscursor.construct.php - * @param MongoGridFS $gridfs

- * Related GridFS collection. - *

- * @param resource $connection

- * Database connection. - *

- * @param string $ns

- * Full name of database and collection. - *

- * @param array $query

- * Database query. - *

- * @param array $fields

- * Fields to return. - *

- */ - public function __construct (MongoGridFS $gridfs, $connection, $ns, array $query, array $fields) {} - - /** - * (PECL mongo >=0.9.0)
- * Return the next file to which this cursor points, and advance the cursor - * @link http://php.net/manual/en/mongogridfscursor.getnext.php - * @return MongoGridFSFile the next file. - */ - public function getNext () {} - - /** - * (PECL mongo >=0.9.0)
- * Returns the current file - * @link http://php.net/manual/en/mongogridfscursor.current.php - * @return MongoGridFSFile The current file. - */ - public function current () {} - - /** - * (PECL mongo >=0.9.0)
- * Returns the current result's filename - * @link http://php.net/manual/en/mongogridfscursor.key.php - * @return string The current result's _id as a string. - */ - public function key () {} - - /** - * (PECL mongo >=0.9.0)
- * Checks if there are any more elements in this cursor - * @link http://php.net/manual/en/mongocursor.hasnext.php - * @return bool if there is another element. - */ - public function hasNext () {} - - /** - * (PECL mongo >=0.9.0)
- * Limits the number of results returned - * @link http://php.net/manual/en/mongocursor.limit.php - * @param int $num

- * The number of results to return. - *

- * @return MongoCursor this cursor. - */ - public function limit ($num) {} - - /** - * (PECL mongo >=1.0.11)
- * Limits the number of elements returned in one batch. - * @link http://php.net/manual/en/mongocursor.batchsize.php - * @param int $batchSize

- * The number of results to return per batch. Each batch requires a - * round-trip to the server. - *

- *

- * If batchSize is 2 or - * more, it represents the size of each batch of objects retrieved. - * It can be adjusted to optimize performance and limit data transfer. - *

- *

- * If batchSize is 1 or negative, it - * will limit of number returned documents to the absolute value of batchSize, - * and the cursor will be closed. For example if - * batchSize is -10, then the server will return a maximum - * of 10 documents and as many as can fit in 4MB, then close the cursor. - *

- *

- * A batchSize of 1 is special, and - * means the same as -1, i.e. a value of - * 1 makes the cursor only capable of returning - * one document. - *

- *

- * Note that this feature is different from - * MongoCursor::limit in that documents must fit within a - * maximum size, and it removes the need to send a request to close the cursor - * server-side. The batch size can be changed even after a cursor is iterated, - * in which case the setting will apply on the next batch retrieval. - *

- *

- * This cannot override MongoDB's limit on the amount of data it will return to - * the client (i.e., if you set batch size to 1,000,000,000, MongoDB will still - * only return 4-16MB of results per batch). - *

- *

- * To ensure consistent behavior, the rules of - * MongoCursor::batchSize and - * MongoCursor::limit behave a - * little complex but work "as expected". The rules are: hard limits override - * soft limits with preference given to MongoCursor::limit - * over MongoCursor::batchSize. After that, whichever is - * set and lower than the other will take precedence. See below. - * section for some examples. - *

- * @return MongoCursor this cursor. - */ - public function batchSize ($batchSize) {} - - /** - * (PECL mongo >=0.9.0)
- * Skips a number of results - * @link http://php.net/manual/en/mongocursor.skip.php - * @param int $num

- * The number of results to skip. - *

- * @return MongoCursor this cursor. - */ - public function skip ($num) {} - - /** - * (PECL mongo >=1.0.6)
- * Sets the fields for a query - * @link http://php.net/manual/en/mongocursor.fields.php - * @param array $f

- * Fields to return (or not return). - *

- * @return MongoCursor this cursor. - */ - public function fields (array $f) {} - - /** - * (PECL mongo >=1.0.4)
- * Adds a top-level key/value pair to a query - * @link http://php.net/manual/en/mongocursor.addoption.php - * @param string $key

- * Fieldname to add. - *

- * @param mixed $value

- * Value to add. - *

- * @return MongoCursor this cursor. - */ - public function addOption ($key, $value) {} - - /** - * (PECL mongo >=0.9.4)
- * Use snapshot mode for the query - * @link http://php.net/manual/en/mongocursor.snapshot.php - * @return MongoCursor this cursor. - */ - public function snapshot () {} - - /** - * (PECL mongo >=0.9.0)
- * Sorts the results by given fields - * @link http://php.net/manual/en/mongocursor.sort.php - * @param array $fields

- * An array of fields by which to sort. Each element in the array has as - * key the field name, and as value either 1 for - * ascending sort, or -1 for descending sort. - *

- *

- * Each result is first sorted on the first field in the array, then (if - * it exists) on the second field in the array, etc. This means that the - * order of the fields in the fields array is - * important. See also the examples section. - *

- * @return MongoCursor the same cursor that this method was called on. - */ - public function sort (array $fields) {} - - /** - * (PECL mongo >=0.9.0)
- * Gives the database a hint about the query - * @link http://php.net/manual/en/mongocursor.hint.php - * @param array $key_pattern

- * Indexes to use for the query. - *

- * @return MongoCursor this cursor. - */ - public function hint (array $key_pattern) {} - - /** - * (PECL mongo >=0.9.2)
- * Return an explanation of the query, often useful for optimization and debugging - * @link http://php.net/manual/en/mongocursor.explain.php - * @return array an explanation of the query. - */ - public function explain () {} - - /** - * (No version information available, might only be in SVN)
- * Sets arbitrary flags in case there is no method available the specific flag - * @link http://php.net/manual/en/mongocursor.setflag.php - * @param bool $flag

- * Which flag to set. You can not set flag 3 (OPLOG REPLAY) or flag 6 - * (EXHAUST) as the driver does not know how to handle them. You will get - * a warning if you try to use those. For available flags, please refer to - * the wire protocol - * documentation. - *

- * @param bool $set [optional]

- * Whether the flag should be set (TRUE) or unset (FALSE). - *

- * @return MongoCursor this cursor. - */ - public function setFlag ($flag, $set = true) {} - - /** - * (PECL mongo >=0.9.4)
- * Sets whether this query can be done on a secondary - * @link http://php.net/manual/en/mongocursor.slaveokay.php - * @param bool $okay [optional]

- * If it is okay to query the secondary. - *

- * @return MongoCursor this cursor. - */ - public function slaveOkay ($okay = true) {} - - /** - * (PECL mongo >=0.9.4)
- * Sets whether this cursor will be left open after fetching the last results - * @link http://php.net/manual/en/mongocursor.tailable.php - * @param bool $tail [optional]

- * If the cursor should be tailable. - *

- * @return MongoCursor this cursor. - */ - public function tailable ($tail = true) {} - - /** - * (PECL mongo >=1.0.1)
- * Sets whether this cursor will timeout - * @link http://php.net/manual/en/mongocursor.immortal.php - * @param bool $liveForever [optional]

- * If the cursor should be immortal. - *

- * @return MongoCursor this cursor. - */ - public function immortal ($liveForever = true) {} - - /** - * (No version information available, might only be in SVN)
- * Sets whether this cursor will wait for a while for a tailable cursor to return more data - * @link http://php.net/manual/en/mongocursor.awaitdata.php - * @param bool $wait [optional]

- * If the cursor should wait for more data to become available. - *

- * @return MongoCursor this cursor. - */ - public function awaitData ($wait = true) {} - - /** - * (PECL mongo >=1.2.0)
- * If this query should fetch partial results from mongos if a shard is down - * @link http://php.net/manual/en/mongocursor.partial.php - * @param bool $okay [optional]

- * If receiving partial results is okay. - *

- * @return MongoCursor this cursor. - */ - public function partial ($okay = true) {} - - /** - * (PECL mongo >=1.0.3)
- * Sets a client-side timeout for this query - * @link http://php.net/manual/en/mongocursor.timeout.php - * @param int $ms

- * The number of milliseconds for the cursor to wait for a response. By - * default, the cursor will wait forever. - *

- * @return MongoCursor This cursor. - */ - public function timeout ($ms) {} - - /** - * (No version information available, might only be in SVN)
- * Execute the query. - * @link http://php.net/manual/en/mongocursor.doquery.php - * @return void NULL. - */ - protected function doQuery () {} - - /** - * (PECL mongo >=1.0.5)
- * Gets the query, fields, limit, and skip for this cursor - * @link http://php.net/manual/en/mongocursor.info.php - * @return array the namespace, limit, skip, query, and fields for this cursor. - */ - public function info () {} - - /** - * (PECL mongo >=0.9.6)
- * Checks if there are documents that have not been sent yet from the database for this cursor - * @link http://php.net/manual/en/mongocursor.dead.php - * @return bool if there are more results that have not been sent to the client, yet. - */ - public function dead () {} - - /** - * (PECL mongo >=0.9.0)
- * Advances the cursor to the next result - * @link http://php.net/manual/en/mongocursor.next.php - * @return void NULL. - */ - public function next () {} - - /** - * (PECL mongo >=0.9.0)
- * Returns the cursor to the beginning of the result set - * @link http://php.net/manual/en/mongocursor.rewind.php - * @return void NULL. - */ - public function rewind () {} - - /** - * (PECL mongo >=0.9.0)
- * Checks if the cursor is reading a valid result. - * @link http://php.net/manual/en/mongocursor.valid.php - * @return bool If the current result is not null. - */ - public function valid () {} - - /** - * (PECL mongo >=0.9.0)
- * Clears the cursor - * @link http://php.net/manual/en/mongocursor.reset.php - * @return void NULL. - */ - public function reset () {} - - /** - * (PECL mongo >=0.9.2)
- * Counts the number of results for this query - * @link http://php.net/manual/en/mongocursor.count.php - * @param bool $foundOnly [optional]

- * Send cursor limit and skip information to the count function, if applicable. - *

- * @return int The number of documents returned by this cursor's query. - */ - public function count ($foundOnly = '&false;') {} - -} - -/** - * A unique identifier created for database objects. If an object is inserted - * into the database without an _id field, an _id field will be added to it - * with a MongoId instance as its value. If the data - * has a naturally occuring unique field (say, a username or timestamp) it is - * fine to use this as the _id field instead, and it will not be replaced with - * a MongoId. - * @link http://php.net/manual/en/class.mongoid.php - */ -class MongoId { - public $id; - - - /** - * (PECL mongo >= 0.8.0)
- * Creates a new id - * @link http://php.net/manual/en/mongoid.construct.php - * @param string $id [optional]

- * A string to use as the id. Must be 24 hexidecimal characters. If an - * invalid string is passed to this constructor, the constructor will ignore - * it and create a new id value. - *

- */ - public function __construct ($id = null) {} - - /** - * (PECL mongo >= 0.8.0)
- * Returns a hexidecimal representation of this id - * @link http://php.net/manual/en/mongoid.tostring.php - * @return string This id. - */ - public function __toString () {} - - /** - * (PECL mongo >= 1.0.8)
- * Create a dummy MongoId - * @link http://php.net/manual/en/mongoid.set-state.php - * @param array $props

- * Theoretically, an array of properties used to create the new id. - * However, as MongoId instances have no properties, this is not used. - *

- * @return MongoId A new id with the value "000000000000000000000000". - */ - public static function __set_state (array $props) {} - - /** - * (PECL mongo >= 1.0.1)
- * Gets the number of seconds since the epoch that this id was created - * @link http://php.net/manual/en/mongoid.gettimestamp.php - * @return int the number of seconds since the epoch that this id was created. There are only - * four bytes of timestamp stored, so MongoDate is a better choice - * for storing exact or wide-ranging times. - */ - public function getTimestamp () {} - - /** - * (PECL mongo >= 1.0.8)
- * Gets the hostname being used for this machine's ids - * @link http://php.net/manual/en/mongoid.gethostname.php - * @return string the hostname. - */ - public static function getHostname () {} - - /** - * (PECL mongo >= 1.0.11)
- * Gets the process ID - * @link http://php.net/manual/en/mongoid.getpid.php - * @return int the PID of the MongoId. - */ - public function getPID () {} - - /** - * (PECL mongo >= 1.0.11)
- * Gets the incremented value to create this id - * @link http://php.net/manual/en/mongoid.getinc.php - * @return int the incremented value used to create this MongoId. - */ - public function getInc () {} - -} - -/** - * Represents JavaScript code for the database. - * @link http://php.net/manual/en/class.mongocode.php - */ -class MongoCode { - public $code; - public $scope; - - - /** - * (PECL mongo >= 0.8.3)
- * Creates a new code object - * @link http://php.net/manual/en/mongocode.construct.php - * @param string $code

- * A string of code. - *

- * @param array $scope [optional]

- * The scope to use for the code. - *

- */ - public function __construct ($code, array $scope = 'array()') {} - - /** - * (PECL mongo >= 0.8.3)
- * Returns this code as a string - * @link http://php.net/manual/en/mongocode.tostring.php - * @return string This code, the scope is not returned. - */ - public function __toString () {} - -} - -/** - * This class can be used to create regular expressions. Typically, these - * expressions will be used to query the database and find matching strings. - * More unusually, they can be saved to the database and retrieved. - * @link http://php.net/manual/en/class.mongoregex.php - */ -class MongoRegex { - /** - * @var string - */ - public $regex; - /** - * @var string - */ - public $flags; - - - /** - * (PECL mongo >= 0.8.1)
- * Creates a new regular expression - * @link http://php.net/manual/en/mongoregex.construct.php - * @param string $regex

- * Regular expression string of the form /expr/flags. - *

- */ - public function __construct ($regex) {} - - /** - * (PECL mongo >= 0.8.1)
- * A string representation of this regular expression - * @link http://php.net/manual/en/mongoregex.tostring.php - * @return string This regular expression in the form "/expr/flags". - */ - public function __toString () {} - -} - -/** - * Represent date objects for the database. This class should be used to save - * dates to the database and to query for dates. For example: - * @link http://php.net/manual/en/class.mongodate.php - */ -class MongoDate { - /** - * @var int - */ - public $sec; - /** - * @var int - */ - public $usec; - - - /** - * (PECL mongo >= 0.8.1)
- * Creates a new date. - * @link http://php.net/manual/en/mongodate.construct.php - * @param int $sec [optional]

- * Number of seconds since January 1st, 1970. - *

- * @param int $usec [optional]

- * Microseconds. - *

- */ - public function __construct ($sec = 'time()', $usec = 0) {} - - /** - * (PECL mongo >= 0.8.1)
- * Returns a string representation of this date - * @link http://php.net/manual/en/mongodate.tostring.php - * @return string This date. - */ - public function __toString () {} - -} - -/** - * An object that can be used to store or retrieve binary data from the database. - * @link http://php.net/manual/en/class.mongobindata.php - */ -class MongoBinData { - const FUNC = 1; - const BYTE_ARRAY = 2; - const UUID = 3; - const MD5 = 5; - const CUSTOM = 128; - - /** - * @var string - */ - public $bin; - /** - * @var int - */ - public $type; - - - /** - * (PECL mongo >= 0.8.1)
- * Creates a new binary data object. - * @link http://php.net/manual/en/mongobindata.construct.php - * @param string $data

- * Binary data. - *

- * @param int $type [optional]

- * Data type. - *

- */ - public function __construct ($data, $type = 2) {} - - /** - * (PECL mongo >= 0.8.1)
- * The string representation of this binary data object. - * @link http://php.net/manual/en/mongobindata.tostring.php - * @return string the string "<Mongo Binary Data>". To access the contents of a - * MongoBinData, use the bin field. - */ - public function __toString () {} - -} - -/** - * This class can be used to create lightweight links between objects in - * different collections. - * @link http://php.net/manual/en/class.mongodbref.php - */ -class MongoDBRef { - protected static $refKey; - protected static $idKey; - - - /** - * (PECL mongo >= 0.9.0)
- * Creates a new database reference - * @link http://php.net/manual/en/mongodbref.create.php - * @param string $collection

- * Collection name (without the database name). - *

- * @param mixed $id

- * The _id field of the object to which to link. - *

- * @param string $database [optional]

- * Database name. - *

- * @return array the reference. - */ - public static function create ($collection, $id, $database = null) {} - - /** - * (PECL mongo >= 0.9.0)
- * Checks if an array is a database reference - * @link http://php.net/manual/en/mongodbref.isref.php - * @param mixed $ref

- * Array or object to check. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public static function isRef ($ref) {} - - /** - * (PECL mongo >= 0.9.0)
- * Fetches the object pointed to by a reference - * @link http://php.net/manual/en/mongodbref.get.php - * @param MongoDB $db

- * Database to use. - *

- * @param array $ref

- * Reference to fetch. - *

- * @return array the document to which the reference refers or NULL if the document - * does not exist (the reference is broken). - */ - public static function get (MongoDB $db, array $ref) {} - -} - -/** - * Default Mongo exception. - * @link http://php.net/manual/en/class.mongoexception.php - */ -class MongoException extends Exception { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * Caused by accessing a cursor incorrectly or a error receiving a reply. Note - * that this can be thrown by any database request that receives a reply, not - * just queries. Writes, commands, and any other operation that sends - * information to the database and waits for a response can throw a - * MongoCursorException. The only exception is - * new MongoClient() (creating a new connection), which will - * only throw MongoConnectionExceptions. - * @link http://php.net/manual/en/class.mongocursorexception.php - */ -class MongoCursorException extends MongoException { - protected $message; - protected $code; - protected $file; - protected $line; - private $host; - private $fd; - - - /** - * (No version information available, might only be in SVN)
- * The hostname of the server that encountered the error - * @link http://php.net/manual/en/mongocursorexception.gethost.php - * @return string the hostname, or NULL if the hostname is unknown. - */ - public function getHost () {} - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * Caused by a query timing out. You can set the length of time to wait before - * this exception is thrown by calling - * MongoCursor::timeout on the cursor or setting - * MongoCursor::$timeout. The static variable is useful for - * queries such as database commands and - * MongoCollection::findOne, both of which implicitly use - * cursors. - * @link http://php.net/manual/en/class.mongocursortimeoutexception.php - */ -class MongoCursorTimeoutException extends MongoCursorException { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (No version information available, might only be in SVN)
- * The hostname of the server that encountered the error - * @link http://php.net/manual/en/mongocursorexception.gethost.php - * @return string the hostname, or NULL if the hostname is unknown. - */ - public function getHost () {} - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * Thrown when the driver fails to connect to the database. - * @link http://php.net/manual/en/class.mongoconnectionexception.php - */ -class MongoConnectionException extends MongoException { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * Thrown when there are errors reading or writing files - * to or from the database. - * @link http://php.net/manual/en/class.mongogridfsexception.php - */ -class MongoGridFSException extends MongoException { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * The MongoResultException is thrown by several command helpers (such as - * MongoCollection::findAndModify) in the event of - * failure. The original result document is available through - * MongoResultException::getDocument. - * @link http://php.net/manual/en/class.mongoresultexception.php - */ -class MongoResultException extends MongoException { - protected $message; - protected $code; - protected $file; - protected $line; - public $document; - - - /** - * Retrieve the full result document - * @link http://php.net/manual/en/mongoresultexception.getdocument.php - * @return array The full result document as an array, including partial data if available and - * additional keys. - */ - public function getDocument () {} - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * MongoTimestamp is used by sharding. If you're not - * looking to write sharding tools, what you probably want is - * MongoDate. - * @link http://php.net/manual/en/class.mongotimestamp.php - */ -class MongoTimestamp { - /** - * @var int - */ - public $sec; - /** - * @var int - */ - public $inc; - - - /** - * (PECL mongo >= 1.0.1)
- * Creates a new timestamp. - * @link http://php.net/manual/en/mongotimestamp.construct.php - * @param int $sec [optional]

- * Number of seconds since January 1st, 1970. - *

- * @param int $inc [optional]

- * Increment. - *

- */ - public function __construct ($sec = 'time()', $inc = null) {} - - /** - * (PECL mongo >= 1.0.1)
- * Returns a string representation of this timestamp - * @link http://php.net/manual/en/mongotimestamp.tostring.php - * @return string The seconds since epoch represented by this timestamp. - */ - public function __toString () {} - -} - -/** - * The class can be used to save 32-bit integers to the database on a 64-bit - * system. - * @link http://php.net/manual/en/class.mongoint32.php - */ -class MongoInt32 { - /** - * @var string - */ - public $value; - - - /** - * (PECL mongo >= 1.0.9)
- * Creates a new 32-bit integer. - * @link http://php.net/manual/en/mongoint32.construct.php - * @param string $value

- * A number. - *

- */ - public function __construct ($value) {} - - /** - * (PECL mongo >= 1.0.9)
- * Returns the string representation of this 32-bit integer. - * @link http://php.net/manual/en/mongoint32.tostring.php - * @return string the string representation of this integer. - */ - public function __toString () {} - -} - -/** - * The class can be used to save 64-bit integers to the database on a 32-bit - * system. - * @link http://php.net/manual/en/class.mongoint64.php - */ -class MongoInt64 { - /** - * @var string - */ - public $value; - - - /** - * (PECL mongo >= 1.0.9)
- * Creates a new 64-bit integer. - * @link http://php.net/manual/en/mongoint64.construct.php - * @param string $value

- * A number. - *

- */ - public function __construct ($value) {} - - /** - * (PECL mongo >= 1.0.9)
- * Returns the string representation of this 64-bit integer. - * @link http://php.net/manual/en/mongoint64.tostring.php - * @return string the string representation of this integer. - */ - public function __toString () {} - -} - -/** - * Logging can be used to get detailed information about what the driver is - * doing. The logging mechanism as used by MongoLog emits all log messages - * as a PHP notice. Depending on the server interface that you use, - * that means that they will either be sent to strerr (with PHP-CLI), or - * otherwise to the web server's error log. In order for log messages to - * be output by PHP their level (E_NOTICE) does need to be configured to - * be shown. That means the E_NOTICE bit needs to be part of PHP's - * error_reporting level and that display_errors is set to 1. - * @link http://php.net/manual/en/class.mongolog.php - */ -class MongoLog { - const NONE = 0; - const WARNING = 1; - const INFO = 2; - const FINE = 4; - const RS = 1; - const POOL = 1; - const PARSE = 16; - const CON = 2; - const IO = 4; - const SERVER = 8; - const ALL = 31; - - /** - * @var int - */ - private static $level; - /** - * @var int - */ - private static $module; - private static $callback; - - - /** - * (No version information available, might only be in SVN)
- * Sets logging level - * @link http://php.net/manual/en/mongolog.setlevel.php - * @param int $level

- * The levels you would like to log. - *

- * @return void - */ - public static function setLevel ($level) {} - - /** - * (No version information available, might only be in SVN)
- * Gets the log level - * @link http://php.net/manual/en/mongolog.getlevel.php - * @return int the current level. - */ - public static function getLevel () {} - - /** - * (No version information available, might only be in SVN)
- * Sets driver functionality to log - * @link http://php.net/manual/en/mongolog.setmodule.php - * @param int $module

- * The module(s) you would like to log. - *

- * @return void - */ - public static function setModule ($module) {} - - /** - * (No version information available, might only be in SVN)
- * Gets the modules currently being logged - * @link http://php.net/manual/en/mongolog.getmodule.php - * @return int the modules currently being logged. - */ - public static function getModule () {} - - /** - * Set a callback function to be called on events - * @link http://php.net/manual/en/mongolog.setcallback.php - * @param callable $log_function

- * The function to be called on events. - *

- *

- * The function should have the following prototype - *

- *

- * log_function - * intmodule - * intlevel - * stringmessage - * module - * One of the MongoLog - * module constants. - * @return void TRUE on success or FALSE on failure. - */ - public static function setCallback (callable $log_function) {} - - /** - * Retrieve the previously set callback function name - * @link http://php.net/manual/en/mongolog.getcallback.php - * @return void the callback function name, or FALSE if not set yet. - */ - public static function getCallback () {} - -} - -/** - * The current (1.3.0+) releases of the driver no longer supports pooling. - * This class and its methods are therefore deprecated and should not be - * used. - * @link http://php.net/manual/en/class.mongopool.php - */ -class MongoPool { - - /** - * (No version information available, might only be in SVN)
- * Returns information about all connection pools. - * @link http://php.net/manual/en/mongopool.info.php - * @return array Each connection pool has an identifier, which starts with the host. For each - * pool, this function shows the following fields: - * in use - *

- * The number of connections currently being used by - * Mongo instances. - *

- * in pool - *

- * The number of connections currently in the pool (not being used). - *

- * remaining - *

- * The number of connections that could be created by this pool. For - * example, suppose a pool had 5 connections remaining and 3 connections in - * the pool. We could create 8 new instances of - * MongoClient before we exhausted this pool - * (assuming no instances of MongoClient went out of - * scope, returning their connections to the pool). - *

- *

- * A negative number means that this pool will spawn unlimited connections. - *

- *

- * Before a pool is created, you can change the max number of connections by - * calling Mongo::setPoolSize. Once a pool is showing - * up in the output of this function, its size cannot be changed. - *

- * total - *

- * The total number of connections allowed for this pool. This should be - * greater than or equal to "in use" + "in pool" (or -1). - *

- * timeout - *

- * The socket timeout for connections in this pool. This is how long - * connections in this pool will attempt to connect to a server before - * giving up. - *

- * waiting - *

- * If you have capped the pool size, workers requesting connections from - * the pool may block until other workers return their connections. This - * field shows how many milliseconds workers have blocked for connections to - * be released. If this number keeps increasing, you may want to use - * MongoPool::setSize to add more connections to your - * pool. - *

- */ - public static function info () {} - - /** - * (No version information available, might only be in SVN)
- * Set the size for future connection pools. - * @link http://php.net/manual/en/mongopool.setsize.php - * @param int $size

- * The max number of connections future pools will be able to create. - * Negative numbers mean that the pool will spawn an infinite number of - * connections. - *

- * @return bool the former value of pool size. - */ - public static function setSize ($size) {} - - /** - * (No version information available, might only be in SVN)
- * Get pool size for connection pools - * @link http://php.net/manual/en/mongopool.getsize.php - * @return int the current pool size. - */ - public static function getSize () {} - -} - -/** - * MongoMaxKey is a special type used by the database - * that evaluates to greater than any other type. Thus, if a query is sorted - * by a given field in ascending order, any document with a - * MongoMaxKey as its value will be returned last. - * @link http://php.net/manual/en/class.mongomaxkey.php - */ -class MongoMaxKey { -} - -/** - * MongoMinKey is a special type used by the database - * that evaluates to less than any other type. Thus, if a query is sorted by a - * given field in ascending order, any document with a - * MongoMinKey as its value will be returned first. - * @link http://php.net/manual/en/class.mongominkey.php - */ -class MongoMinKey { -} - -/** - * (PECL mongo >=1.0.1)
- * Serializes a PHP variable into a BSON string - * @link http://php.net/manual/en/function.bson-encode.php - * @param mixed $anything

- * The variable to be serialized. - *

- * @return string the serialized string. - */ -function bson_encode ($anything) {} - -/** - * (PECL mongo >=1.0.1)
- * Deserializes a BSON object into a PHP array - * @link http://php.net/manual/en/function.bson-decode.php - * @param string $bson

- * The BSON to be deserialized. - *

- * @return array the deserialized BSON object. - */ -function bson_decode ($bson) {} - -// End of mongo v.1.3.0 -?> diff --git a/phpruntime/mssql.php b/phpruntime/mssql.php deleted file mode 100644 index 7b15836..0000000 --- a/phpruntime/mssql.php +++ /dev/null @@ -1,940 +0,0 @@ - - * Open MS SQL server connection - * @link http://php.net/manual/en/function.mssql-connect.php - * @param string $servername [optional]

- * The MS SQL server. It can also include a port number, e.g. - * hostname:port (Linux), or - * hostname,port (Windows). - *

- * @param string $username [optional]

- * The username. - *

- * @param string $password [optional]

- * The password. - *

- * @param bool $new_link [optional]

- * If a second call is made to mssql_connect with the - * same arguments, no new link will be established, but instead, the link - * identifier of the already opened link will be returned. This parameter - * modifies this behavior and makes mssql_connect - * always open a new link, even if mssql_connect was - * called before with the same parameters. - *

- * @return resource a MS SQL link identifier on success, or FALSE on error. - */ -function mssql_connect ($servername = null, $username = null, $password = null, $new_link = false) {} - -/** - * (PHP 4, PHP 5, PECL odbtp >= 1.1.1)
- * Open persistent MS SQL connection - * @link http://php.net/manual/en/function.mssql-pconnect.php - * @param string $servername [optional]

- * The MS SQL server. It can also include a port number. e.g. - * hostname:port. - *

- * @param string $username [optional]

- * The username. - *

- * @param string $password [optional]

- * The password. - *

- * @param bool $new_link [optional]

- * If a second call is made to mssql_pconnect with - * the same arguments, no new link will be established, but instead, the - * link identifier of the already opened link will be returned. This - * parameter modifies this behavior and makes - * mssql_pconnect always open a new link, even if - * mssql_pconnect was called before with the same - * parameters. - *

- * @return resource a positive MS SQL persistent link identifier on success, or - * FALSE on error. - */ -function mssql_pconnect ($servername = null, $username = null, $password = null, $new_link = false) {} - -/** - * (PHP 4, PHP 5, PECL odbtp >= 1.1.1)
- * Close MS SQL Server connection - * @link http://php.net/manual/en/function.mssql-close.php - * @param resource $link_identifier [optional]

- * A MS SQL link identifier, returned by - * mssql_connect. - *

- *

- * This function will not close persistent links generated by - * mssql_pconnect. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mssql_close ($link_identifier = null) {} - -/** - * (PHP 4, PHP 5, PECL odbtp >= 1.1.1)
- * Select MS SQL database - * @link http://php.net/manual/en/function.mssql-select-db.php - * @param string $database_name

- * The database name. - *

- *

- * To escape the name of a database that contains spaces, hyphens ("-"), - * or any other exceptional characters, the database name must be - * enclosed in brackets, as is shown in the example, below. This - * technique must also be applied when selecting a database name that is - * also a reserved word (such as primary). - *

- * @param resource $link_identifier [optional]

- * A MS SQL link identifier, returned by - * mssql_connect or - * mssql_pconnect. - *

- *

- * If no link identifier is specified, the last opened link is assumed. - * If no link is open, the function will try to establish a link as if - * mssql_connect was called, and use it. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mssql_select_db ($database_name, $link_identifier = null) {} - -/** - * (PHP 4, PHP 5, PECL odbtp >= 1.1.1)
- * Send MS SQL query - * @link http://php.net/manual/en/function.mssql-query.php - * @param string $query

- * An SQL query. - *

- * @param resource $link_identifier [optional]

- * A MS SQL link identifier, returned by - * mssql_connect or - * mssql_pconnect. - *

- *

- * If the link identifier isn't specified, the last opened link is - * assumed. If no link is open, the function tries to establish a link - * as if mssql_connect was called, and use it. - *

- * @param int $batch_size [optional]

- * The number of records to batch in the buffer. - *

- * @return mixed a MS SQL result resource on success, TRUE if no rows were - * returned, or FALSE on error. - */ -function mssql_query ($query, $link_identifier = null, $batch_size = 0) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5, PECL odbtp >= 1.1.1)
- * Returns the next batch of records - * @link http://php.net/manual/en/function.mssql-fetch-batch.php - * @param resource $result

- * The result resource that is being evaluated. This result comes from a - * call to mssql_query. - *

- * @return int the number of rows in the returned batch. - */ -function mssql_fetch_batch ($result) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5, PECL odbtp >= 1.1.1)
- * Returns the number of records affected by the query - * @link http://php.net/manual/en/function.mssql-rows-affected.php - * @param resource $link_identifier

- * A MS SQL link identifier, returned by - * mssql_connect or - * mssql_pconnect. - *

- * @return int the number of records affected by last operation. - */ -function mssql_rows_affected ($link_identifier) {} - -/** - * (PHP 4, PHP 5, PECL odbtp >= 1.1.1)
- * Free result memory - * @link http://php.net/manual/en/function.mssql-free-result.php - * @param resource $result

- * The result resource that is being freed. This result comes from a - * call to mssql_query. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mssql_free_result ($result) {} - -/** - * (PHP 4, PHP 5, PECL odbtp >= 1.1.1)
- * Returns the last message from the server - * @link http://php.net/manual/en/function.mssql-get-last-message.php - * @return string last error message from server, or an empty string if - * no error messages are returned from MSSQL. - */ -function mssql_get_last_message () {} - -/** - * (PHP 4, PHP 5, PECL odbtp >= 1.1.1)
- * Gets the number of rows in result - * @link http://php.net/manual/en/function.mssql-num-rows.php - * @param resource $result

- * The result resource that is being evaluated. This result comes from a - * call to mssql_query. - *

- * @return int the number of rows, as an integer. - */ -function mssql_num_rows ($result) {} - -/** - * (PHP 4, PHP 5, PECL odbtp >= 1.1.1)
- * Gets the number of fields in result - * @link http://php.net/manual/en/function.mssql-num-fields.php - * @param resource $result

- * The result resource that is being evaluated. This result comes from a - * call to mssql_query. - *

- * @return int the number of fields, as an integer. - */ -function mssql_num_fields ($result) {} - -/** - * (PHP 4, PHP 5, PECL odbtp >= 1.1.1)
- * Get field information - * @link http://php.net/manual/en/function.mssql-fetch-field.php - * @param resource $result

- * The result resource that is being evaluated. This result comes from a - * call to mssql_query. - *

- * @param int $field_offset [optional]

- * The numerical field offset. If the field offset is not specified, the - * next field that was not yet retrieved by this function is retrieved. The - * field_offset starts at 0. - *

- * @return object an object containing field information. - *

- *

- * The properties of the object are: - */ -function mssql_fetch_field ($result, $field_offset = -1) {} - -/** - * (PHP 4, PHP 5, PECL odbtp >= 1.1.1)
- * Get row as enumerated array - * @link http://php.net/manual/en/function.mssql-fetch-row.php - * @param resource $result

- * The result resource that is being evaluated. This result comes from a - * call to mssql_query. - *

- * @return array an array that corresponds to the fetched row, or FALSE if there - * are no more rows. - */ -function mssql_fetch_row ($result) {} - -/** - * (PHP 4, PHP 5, PECL odbtp >= 1.1.1)
- * Fetch a result row as an associative array, a numeric array, or both - * @link http://php.net/manual/en/function.mssql-fetch-array.php - * @param resource $result

- * The result resource that is being evaluated. This result comes from a - * call to mssql_query. - *

- * @param int $result_type [optional]

- * The type of array that is to be fetched. It's a constant and can take - * the following values: MSSQL_ASSOC, - * MSSQL_NUM, and - * MSSQL_BOTH. - *

- * @return array an array that corresponds to the fetched row, or FALSE if there - * are no more rows. - */ -function mssql_fetch_array ($result, $result_type = 'MSSQL_BOTH') {} - -/** - * (PHP 4 >= 4.2.0, PHP 5, PECL odbtp >= 1.1.1)
- * Returns an associative array of the current row in the result - * @link http://php.net/manual/en/function.mssql-fetch-assoc.php - * @param resource $result_id

- * The result resource that is being evaluated. This result comes from a - * call to mssql_query. - *

- * @return array an associative array that corresponds to the fetched row, or - * FALSE if there are no more rows. - */ -function mssql_fetch_assoc ($result_id) {} - -/** - * (PHP 4, PHP 5, PECL odbtp >= 1.1.1)
- * Fetch row as object - * @link http://php.net/manual/en/function.mssql-fetch-object.php - * @param resource $result

- * The result resource that is being evaluated. This result comes from a - * call to mssql_query. - *

- * @return object an object with properties that correspond to the fetched row, or - * FALSE if there are no more rows. - */ -function mssql_fetch_object ($result) {} - -/** - * (PHP 4, PHP 5, PECL odbtp >= 1.1.1)
- * Get the length of a field - * @link http://php.net/manual/en/function.mssql-field-length.php - * @param resource $result

- * The result resource that is being evaluated. This result comes from a - * call to mssql_query. - *

- * @param int $offset [optional]

- * The field offset, starts at 0. If omitted, the current field is used. - *

- * @return int The length of the specified field index on success or FALSE on failure. - */ -function mssql_field_length ($result, $offset = -1) {} - -/** - * (PHP 4, PHP 5, PECL odbtp >= 1.1.1)
- * Get the name of a field - * @link http://php.net/manual/en/function.mssql-field-name.php - * @param resource $result

- * The result resource that is being evaluated. This result comes from a - * call to mssql_query. - *

- * @param int $offset [optional]

- * The field offset, starts at 0. If omitted, the current field is used. - *

- * @return string The name of the specified field index on success or FALSE on failure. - */ -function mssql_field_name ($result, $offset = -1) {} - -/** - * (PHP 4, PHP 5, PECL odbtp >= 1.1.1)
- * Gets the type of a field - * @link http://php.net/manual/en/function.mssql-field-type.php - * @param resource $result

- * The result resource that is being evaluated. This result comes from a - * call to mssql_query. - *

- * @param int $offset [optional]

- * The field offset, starts at 0. If omitted, the current field is used. - *

- * @return string The type of the specified field index on success or FALSE on failure. - */ -function mssql_field_type ($result, $offset = -1) {} - -/** - * (PHP 4, PHP 5, PECL odbtp >= 1.1.1)
- * Moves internal row pointer - * @link http://php.net/manual/en/function.mssql-data-seek.php - * @param resource $result_identifier

- * The result resource that is being evaluated. - *

- * @param int $row_number

- * The desired row number of the new result pointer. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mssql_data_seek ($result_identifier, $row_number) {} - -/** - * (PHP 4, PHP 5, PECL odbtp >= 1.1.1)
- * Seeks to the specified field offset - * @link http://php.net/manual/en/function.mssql-field-seek.php - * @param resource $result

- * The result resource that is being evaluated. This result comes from a - * call to mssql_query. - *

- * @param int $field_offset

- * The field offset, starts at 0. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mssql_field_seek ($result, $field_offset) {} - -/** - * (PHP 4, PHP 5, PECL odbtp >= 1.1.1)
- * Get result data - * @link http://php.net/manual/en/function.mssql-result.php - * @param resource $result

- * The result resource that is being evaluated. This result comes from a - * call to mssql_query. - *

- * @param int $row

- * The row number. - *

- * @param mixed $field

- * Can be the field's offset, the field's name or the field's table dot - * field's name (tablename.fieldname). If the column name has been - * aliased ('select foo as bar from...'), it uses the alias instead of - * the column name. - *

- *

- * Specifying a numeric offset for the field - * argument is much quicker than specifying a - * fieldname or - * tablename.fieldname argument. - *

- * @return string the contents of the specified cell. - */ -function mssql_result ($result, $row, $field) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5, PECL odbtp >= 1.1.1)
- * Move the internal result pointer to the next result - * @link http://php.net/manual/en/function.mssql-next-result.php - * @param resource $result_id

- * The result resource that is being evaluated. This result comes from a - * call to mssql_query. - *

- * @return bool TRUE if an additional result set was available or FALSE - * otherwise. - */ -function mssql_next_result ($result_id) {} - -/** - * (PHP 4, PHP 5, PECL odbtp >= 1.1.1)
- * Sets the minimum error severity - * @link http://php.net/manual/en/function.mssql-min-error-severity.php - * @param int $severity

- * The new error severity. - *

- * @return void No value is returned. - */ -function mssql_min_error_severity ($severity) {} - -/** - * (PHP 4, PHP 5, PECL odbtp >= 1.1.1)
- * Sets the minimum message severity - * @link http://php.net/manual/en/function.mssql-min-message-severity.php - * @param int $severity

- * The new message severity. - *

- * @return void No value is returned. - */ -function mssql_min_message_severity ($severity) {} - -/** - * (PHP 4 >= 4.0.7, PHP 5, PECL odbtp >= 1.1.1)
- * Initializes a stored procedure or a remote stored procedure - * @link http://php.net/manual/en/function.mssql-init.php - * @param string $sp_name

- * Stored procedure name, like ownew.sp_name or - * otherdb.owner.sp_name. - *

- * @param resource $link_identifier [optional]

- * A MS SQL link identifier, returned by - * mssql_connect. - *

- * @return resource a resource identifier "statement", used in subsequent calls to - * mssql_bind and mssql_execute, - * or FALSE on errors. - */ -function mssql_init ($sp_name, $link_identifier = null) {} - -/** - * (PHP 4 >= 4.0.7, PHP 5, PECL odbtp >= 1.1.1)
- * Adds a parameter to a stored procedure or a remote stored procedure - * @link http://php.net/manual/en/function.mssql-bind.php - * @param resource $stmt

- * Statement resource, obtained with mssql_init. - *

- * @param string $param_name

- * The parameter name, as a string. - *

- *

- * You have to include the @ character, like in the - * T-SQL syntax. See the explanation included in - * mssql_execute. - *

- * @param mixed $var

- * The PHP variable you'll bind the MSSQL parameter to. It is passed by - * reference, to retrieve OUTPUT and RETVAL values after - * the procedure execution. - *

- * @param int $type

- * One of: SQLTEXT, - * SQLVARCHAR, SQLCHAR, - * SQLINT1, SQLINT2, - * SQLINT4, SQLBIT, - * SQLFLT4, SQLFLT8, - * SQLFLTN. - *

- * @param bool $is_output [optional]

- * Whether the value is an OUTPUT parameter or not. If it's an OUTPUT - * parameter and you don't mention it, it will be treated as a normal - * input parameter and no error will be thrown. - *

- * @param bool $is_null [optional]

- * Whether the parameter is NULL or not. Passing the NULL value as - * var will not do the job. - *

- * @param int $maxlen [optional]

- * Used with char/varchar values. You have to indicate the length of the - * data so if the parameter is a varchar(50), the type must be - * SQLVARCHAR and this value 50. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mssql_bind ($stmt, $param_name, &$var, $type, $is_output = false, $is_null = false, $maxlen = -1) {} - -/** - * (PHP 4 >= 4.0.7, PHP 5, PECL odbtp >= 1.1.1)
- * Executes a stored procedure on a MS SQL server database - * @link http://php.net/manual/en/function.mssql-execute.php - * @param resource $stmt

- * Statement handle obtained with mssql_init. - *

- * @param bool $skip_results [optional]

- * Whenever to skip the results or not. - *

- * @return mixed - */ -function mssql_execute ($stmt, $skip_results = false) {} - -/** - * (PHP 4 >= 4.3.2, PHP 5, PECL odbtp >= 1.1.1)
- * Free statement memory - * @link http://php.net/manual/en/function.mssql-free-statement.php - * @param resource $stmt

- * Statement resource, obtained with mssql_init. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mssql_free_statement ($stmt) {} - -/** - * (PHP 4 >= 4.0.7, PHP 5, PECL odbtp >= 1.1.1)
- * Converts a 16 byte binary GUID to a string - * @link http://php.net/manual/en/function.mssql-guid-string.php - * @param string $binary

- * A 16 byte binary GUID. - *

- * @param bool $short_format [optional]

- * Whenever to use short format. - *

- * @return string the converted string on success. - */ -function mssql_guid_string ($binary, $short_format = false) {} - -/** - * (PHP 4, PHP 5)
- * Opens a Sybase server connection - * @link http://php.net/manual/en/function.sybase-connect.php - * @param string $servername [optional]

- * The servername argument has to be a valid servername that is defined - * in the 'interfaces' file. - *

- * @param string $username [optional]

- * Sybase user name - *

- * @param string $password [optional]

- * Password associated with username. - *

- * @param string $charset [optional]

- * Specifies the charset for the connection - *

- * @param string $appname [optional]

- * Specifies an appname for the Sybase connection. - * This allow you to make separate connections in the same script to the - * same database. This may come handy when you have started a transaction - * in your current connection, and you need to be able to do a separate - * query which cannot be performed inside this transaction. - *

- * @param bool $new [optional]

- * Whether to open a new connection or use the existing one. - *

- * @return resource a positive Sybase link identifier on success, or FALSE on - * failure. - */ -function sybase_connect ($servername = null, $username = null, $password = null, $charset = null, $appname = null, $new = false) {} - -/** - * (PHP 4, PHP 5)
- * Open persistent Sybase connection - * @link http://php.net/manual/en/function.sybase-pconnect.php - * @param string $servername [optional]

- * The servername argument has to be a valid servername that is defined - * in the 'interfaces' file. - *

- * @param string $username [optional]

- * Sybase user name - *

- * @param string $password [optional]

- * Password associated with username. - *

- * @param string $charset [optional]

- * Specifies the charset for the connection - *

- * @param string $appname [optional]

- * Specifies an appname for the Sybase connection. - * This allow you to make separate connections in the same script to the - * same database. This may come handy when you have started a transaction - * in your current connection, and you need to be able to do a separate - * query which cannot be performed inside this transaction. - *

- * @return resource a positive Sybase persistent link identifier on success, or - * FALSE on error. - */ -function sybase_pconnect ($servername = null, $username = null, $password = null, $charset = null, $appname = null) {} - -/** - * (PHP 4, PHP 5)
- * Closes a Sybase connection - * @link http://php.net/manual/en/function.sybase-close.php - * @param resource $link_identifier [optional]

- * If the link identifier isn't specified, the last opened link is - * assumed. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function sybase_close ($link_identifier = null) {} - -/** - * (PHP 4, PHP 5)
- * Selects a Sybase database - * @link http://php.net/manual/en/function.sybase-select-db.php - * @param string $database_name - * @param resource $link_identifier [optional]

- * If no link identifier is specified, the last opened link is assumed. - * If no link is open, the function will try to establish a link as if - * sybase_connect was called, and use it. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function sybase_select_db ($database_name, $link_identifier = null) {} - -/** - * (PHP 4, PHP 5)
- * Sends a Sybase query - * @link http://php.net/manual/en/function.sybase-query.php - * @param string $query - * @param resource $link_identifier [optional]

- * If the link identifier isn't specified, the last opened link is - * assumed. If no link is open, the function tries to establish a link as - * if sybase_connect was called, and use it. - *

- * @return mixed a positive Sybase result identifier on success, FALSE on error, - * or TRUE if the query was successful but didn't return any columns. - */ -function sybase_query ($query, $link_identifier = null) {} - -/** - * @param $result - */ -function sybase_fetch_batch ($result) {} - -/** - * (PHP 4, PHP 5)
- * Gets number of affected rows in last query - * @link http://php.net/manual/en/function.sybase-affected-rows.php - * @param resource $link_identifier [optional]

- * If the link identifier isn't specified, the last opened link is assumed. - *

- * @return int the number of affected rows, as an integer. - */ -function sybase_affected_rows ($link_identifier = null) {} - -/** - * (PHP 4, PHP 5)
- * Frees result memory - * @link http://php.net/manual/en/function.sybase-free-result.php - * @param resource $result - * @return bool TRUE on success or FALSE on failure. - */ -function sybase_free_result ($result) {} - -/** - * (PHP 4, PHP 5)
- * Returns the last message from the server - * @link http://php.net/manual/en/function.sybase-get-last-message.php - * @return string the message as a string. - */ -function sybase_get_last_message () {} - -/** - * (PHP 4, PHP 5)
- * Get number of rows in a result set - * @link http://php.net/manual/en/function.sybase-num-rows.php - * @param resource $result - * @return int the number of rows as an integer. - */ -function sybase_num_rows ($result) {} - -/** - * (PHP 4, PHP 5)
- * Gets the number of fields in a result set - * @link http://php.net/manual/en/function.sybase-num-fields.php - * @param resource $result - * @return int the number of fields as an integer. - */ -function sybase_num_fields ($result) {} - -/** - * (PHP 4, PHP 5)
- * Get field information from a result - * @link http://php.net/manual/en/function.sybase-fetch-field.php - * @param resource $result - * @param int $field_offset [optional]

- * If the field offset isn't specified, the next field that wasn't yet - * retrieved by sybase_fetch_field is retrieved. - *

- * @return object an object containing field information. - *

- *

- * The properties of the object are: - */ -function sybase_fetch_field ($result, $field_offset = -1) {} - -/** - * (PHP 4, PHP 5)
- * Get a result row as an enumerated array - * @link http://php.net/manual/en/function.sybase-fetch-row.php - * @param resource $result - * @return array an array that corresponds to the fetched row, or FALSE if there - * are no more rows. Each result column is stored in an array offset, - * starting at offset 0. - */ -function sybase_fetch_row ($result) {} - -/** - * (PHP 4, PHP 5)
- * Fetch row as array - * @link http://php.net/manual/en/function.sybase-fetch-array.php - * @param resource $result - * @return array an array that corresponds to the fetched row, or FALSE if there - * are no more rows. - *

- *

- * When selecting fields with identical names (for instance, in a join), the - * associative indices will have a sequential number prepended. See the - * example for details. - */ -function sybase_fetch_array ($result) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Fetch a result row as an associative array - * @link http://php.net/manual/en/function.sybase-fetch-assoc.php - * @param resource $result - * @return array an array that corresponds to the fetched row, or FALSE if there - * are no more rows. - */ -function sybase_fetch_assoc ($result) {} - -/** - * (PHP 4, PHP 5)
- * Fetch a row as an object - * @link http://php.net/manual/en/function.sybase-fetch-object.php - * @param resource $result - * @param mixed $object [optional]

- * Use the second object to specify the type of object - * you want to return. If this parameter is omitted, the object will be of - * type stdClass. - *

- * @return object an object with properties that correspond to the fetched row, or - * FALSE if there are no more rows. - */ -function sybase_fetch_object ($result, $object = null) {} - -/** - * @param $result - * @param $offset [optional] - */ -function sybase_field_length ($result, $offset) {} - -/** - * @param $result - * @param $offset [optional] - */ -function sybase_field_name ($result, $offset) {} - -/** - * @param $result - * @param $offset [optional] - */ -function sybase_field_type ($result, $offset) {} - -/** - * (PHP 4, PHP 5)
- * Moves internal row pointer - * @link http://php.net/manual/en/function.sybase-data-seek.php - * @param resource $result_identifier - * @param int $row_number - * @return bool TRUE on success or FALSE on failure. - */ -function sybase_data_seek ($result_identifier, $row_number) {} - -/** - * (PHP 4, PHP 5)
- * Sets field offset - * @link http://php.net/manual/en/function.sybase-field-seek.php - * @param resource $result - * @param int $field_offset - * @return bool TRUE on success or FALSE on failure. - */ -function sybase_field_seek ($result, $field_offset) {} - -/** - * (PHP 4, PHP 5)
- * Get result data - * @link http://php.net/manual/en/function.sybase-result.php - * @param resource $result - * @param int $row - * @param mixed $field

- * The field argument can be the field's offset, or the field's name, or - * the field's table dot field's name (tablename.fieldname). If the - * column name has been aliased ('select foo as bar from...'), use the - * alias instead of the column name. - *

- * @return string sybase_result returns the contents of one cell from a - * Sybase result set. - */ -function sybase_result ($result, $row, $field) {} - -/** - * @param $result_id - */ -function sybase_next_result ($result_id) {} - -/** - * (PHP 4, PHP 5)
- * Sets minimum error severity - * @link http://php.net/manual/en/function.sybase-min-error-severity.php - * @param int $severity - * @return void No value is returned. - */ -function sybase_min_error_severity ($severity) {} - -/** - * (PHP 4, PHP 5)
- * Sets minimum message severity - * @link http://php.net/manual/en/function.sybase-min-message-severity.php - * @param int $severity - * @return void No value is returned. - */ -function sybase_min_message_severity ($severity) {} - -/** - * @param $sp_name - * @param $link_identifier [optional] - */ -function sybase_init ($sp_name, $link_identifier) {} - -/** - * @param $stmt - * @param $param_name - * @param $var - * @param $type - * @param $is_output [optional] - * @param $is_null [optional] - * @param $maxlen [optional] - */ -function sybase_bind ($stmt, $param_name, &$var, $type, $is_output, $is_null, $maxlen) {} - -/** - * @param $stmt - * @param $skip_results [optional] - */ -function sybase_execute ($stmt, $skip_results) {} - -/** - * @param $stmt - */ -function sybase_free_statement ($stmt) {} - -/** - * @param $binary - * @param $short_format [optional] - */ -function sybase_guid_string ($binary, $short_format) {} - - -/** - * Return an associative array. Used on - * mssql_fetch_array's - * result_type parameter. - * @link http://php.net/manual/en/mssql.constants.php - */ -define ('MSSQL_ASSOC', 1); - -/** - * Return an array with numeric keys. Used on - * mssql_fetch_array's - * result_type parameter. - * @link http://php.net/manual/en/mssql.constants.php - */ -define ('MSSQL_NUM', 2); - -/** - * Return an array with both numeric keys and - * keys with their field name. This is the - * default value for mssql_fetch_array's - * result_type parameter. - * @link http://php.net/manual/en/mssql.constants.php - */ -define ('MSSQL_BOTH', 3); - -/** - * Indicates the 'TEXT' type in MSSQL, used by - * mssql_bind's type - * parameter. - * @link http://php.net/manual/en/mssql.constants.php - */ -define ('SQLTEXT', 35); - -/** - * Indicates the 'VARCHAR' type in MSSQL, used by - * mssql_bind's type - * parameter. - * @link http://php.net/manual/en/mssql.constants.php - */ -define ('SQLVARCHAR', 39); - -/** - * Indicates the 'CHAR' type in MSSQL, used by - * mssql_bind's type - * parameter. - * @link http://php.net/manual/en/mssql.constants.php - */ -define ('SQLCHAR', 47); - -/** - * Represents one byte, with a range of -128 to 127. - * @link http://php.net/manual/en/mssql.constants.php - */ -define ('SQLINT1', 48); - -/** - * Represents two bytes, with a range of -32768 - * to 32767. - * @link http://php.net/manual/en/mssql.constants.php - */ -define ('SQLINT2', 52); - -/** - * Represents four bytes, with a range of -2147483648 - * to 2147483647. - * @link http://php.net/manual/en/mssql.constants.php - */ -define ('SQLINT4', 56); - -/** - * Indicates the 'BIT' type in MSSQL, used by - * mssql_bind's type - * parameter. - * @link http://php.net/manual/en/mssql.constants.php - */ -define ('SQLBIT', 50); - -/** - * Represents an four byte float. - * @link http://php.net/manual/en/mssql.constants.php - */ -define ('SQLFLT4', 59); - -/** - * Represents an eight byte float. - * @link http://php.net/manual/en/mssql.constants.php - */ -define ('SQLFLT8', 62); -define ('SQLFLTN', 109); - -// End of mssql v. -?> diff --git a/phpruntime/mysql.php b/phpruntime/mysql.php deleted file mode 100644 index 65ce573..0000000 --- a/phpruntime/mysql.php +++ /dev/null @@ -1,883 +0,0 @@ - - * Open a connection to a MySQL Server - * @link http://php.net/manual/en/function.mysql-connect.php - * @param string $server [optional]

- * The MySQL server. It can also include a port number. e.g. - * "hostname:port" or a path to a local socket e.g. ":/path/to/socket" for - * the localhost. - *

- *

- * If the PHP directive - * mysql.default_host is undefined (default), then the default - * value is 'localhost:3306'. In SQL safe mode, this parameter is ignored - * and value 'localhost:3306' is always used. - *

- * @param string $username [optional]

- * The username. Default value is defined by mysql.default_user. In - * SQL safe mode, this parameter is ignored and the name of the user that - * owns the server process is used. - *

- * @param string $password [optional]

- * The password. Default value is defined by mysql.default_password. In - * SQL safe mode, this parameter is ignored and empty password is used. - *

- * @param bool $new_link [optional]

- * If a second call is made to mysql_connect - * with the same arguments, no new link will be established, but - * instead, the link identifier of the already opened link will be - * returned. The new_link parameter modifies this - * behavior and makes mysql_connect always open - * a new link, even if mysql_connect was called - * before with the same parameters. - * In SQL safe mode, this parameter is ignored. - *

- * @param int $client_flags [optional]

- * The client_flags parameter can be a combination - * of the following constants: - * 128 (enable LOAD DATA LOCAL handling), - * MYSQL_CLIENT_SSL, - * MYSQL_CLIENT_COMPRESS, - * MYSQL_CLIENT_IGNORE_SPACE or - * MYSQL_CLIENT_INTERACTIVE. - * Read the section about for further information. - * In SQL safe mode, this parameter is ignored. - *

- * @return resource a MySQL link identifier on success or FALSE on failure. - */ -function mysql_connect ($server = 'ini_get("mysql.default_host")', $username = 'ini_get("mysql.default_user")', $password = 'ini_get("mysql.default_password")', $new_link = false, $client_flags = 0) {} - -/** - * (PHP 4, PHP 5)
- * Open a persistent connection to a MySQL server - * @link http://php.net/manual/en/function.mysql-pconnect.php - * @param string $server [optional]

- * The MySQL server. It can also include a port number. e.g. - * "hostname:port" or a path to a local socket e.g. ":/path/to/socket" for - * the localhost. - *

- *

- * If the PHP directive - * mysql.default_host is undefined (default), then the default - * value is 'localhost:3306' - *

- * @param string $username [optional]

- * The username. Default value is the name of the user that owns the - * server process. - *

- * @param string $password [optional]

- * The password. Default value is an empty password. - *

- * @param int $client_flags [optional]

- * The client_flags parameter can be a combination - * of the following constants: - * 128 (enable LOAD DATA LOCAL handling), - * MYSQL_CLIENT_SSL, - * MYSQL_CLIENT_COMPRESS, - * MYSQL_CLIENT_IGNORE_SPACE or - * MYSQL_CLIENT_INTERACTIVE. - *

- * @return resource a MySQL persistent link identifier on success, or FALSE on - * failure. - */ -function mysql_pconnect ($server = 'ini_get("mysql.default_host")', $username = 'ini_get("mysql.default_user")', $password = 'ini_get("mysql.default_password")', $client_flags = 0) {} - -/** - * (PHP 4, PHP 5)
- * Close MySQL connection - * @link http://php.net/manual/en/function.mysql-close.php - * @param resource $link_identifier [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function mysql_close ($link_identifier = NULL) {} - -/** - * (PHP 4, PHP 5)
- * Select a MySQL database - * @link http://php.net/manual/en/function.mysql-select-db.php - * @param string $database_name

- * The name of the database that is to be selected. - *

- * @param resource $link_identifier [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function mysql_select_db ($database_name, $link_identifier = NULL) {} - -/** - * (PHP 4, PHP 5)
- * Send a MySQL query - * @link http://php.net/manual/en/function.mysql-query.php - * @param string $query

- * An SQL query - *

- *

- * The query string should not end with a semicolon. - * Data inside the query should be properly escaped. - *

- * @param resource $link_identifier [optional] - * @return resource For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, - * mysql_query - * returns a resource on success, or FALSE on - * error. - *

- *

- * For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, - * mysql_query returns TRUE on success - * or FALSE on error. - *

- *

- * The returned result resource should be passed to - * mysql_fetch_array, and other - * functions for dealing with result tables, to access the returned data. - *

- *

- * Use mysql_num_rows to find out how many rows - * were returned for a SELECT statement or - * mysql_affected_rows to find out how many - * rows were affected by a DELETE, INSERT, REPLACE, or UPDATE - * statement. - *

- *

- * mysql_query will also fail and return FALSE - * if the user does not have permission to access the table(s) referenced by - * the query. - */ -function mysql_query ($query, $link_identifier = NULL) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Send an SQL query to MySQL without fetching and buffering the result rows. - * @link http://php.net/manual/en/function.mysql-unbuffered-query.php - * @param string $query

- * The SQL query to execute. - *

- *

- * Data inside the query should be properly escaped. - *

- * @param resource $link_identifier [optional] - * @return resource For SELECT, SHOW, DESCRIBE or EXPLAIN statements, - * mysql_unbuffered_query - * returns a resource on success, or FALSE on - * error. - *

- *

- * For other type of SQL statements, UPDATE, DELETE, DROP, etc, - * mysql_unbuffered_query returns TRUE on success - * or FALSE on error. - */ -function mysql_unbuffered_query ($query, $link_identifier = NULL) {} - -/** - * (PHP 4, PHP 5)
- * Selects a database and executes a query on it - * @link http://php.net/manual/en/function.mysql-db-query.php - * @param string $database

- * The name of the database that will be selected. - *

- * @param string $query

- * The MySQL query. - *

- *

- * Data inside the query should be properly escaped. - *

- * @param resource $link_identifier [optional] - * @return resource a positive MySQL result resource to the query result, - * or FALSE on error. The function also returns TRUE/FALSE for - * INSERT/UPDATE/DELETE - * queries to indicate success/failure. - */ -function mysql_db_query ($database, $query, $link_identifier = NULL) {} - -/** - * (PHP 4, PHP 5)
- * List databases available on a MySQL server - * @link http://php.net/manual/en/function.mysql-list-dbs.php - * @param resource $link_identifier [optional] - * @return resource a result pointer resource on success, or FALSE on - * failure. Use the mysql_tablename function to traverse - * this result pointer, or any function for result tables, such as - * mysql_fetch_array. - */ -function mysql_list_dbs ($link_identifier = NULL) {} - -/** - * (PHP 4, PHP 5)
- * List tables in a MySQL database - * @link http://php.net/manual/en/function.mysql-list-tables.php - * @param string $database

- * The name of the database - *

- * @param resource $link_identifier [optional] - * @return resource A result pointer resource on success or FALSE on failure. - *

- *

- * Use the mysql_tablename function to - * traverse this result pointer, or any function for result tables, - * such as mysql_fetch_array. - */ -function mysql_list_tables ($database, $link_identifier = NULL) {} - -/** - * (PHP 4, PHP 5)
- * List MySQL table fields - * @link http://php.net/manual/en/function.mysql-list-fields.php - * @param string $database_name

- * The name of the database that's being queried. - *

- * @param string $table_name

- * The name of the table that's being queried. - *

- * @param resource $link_identifier [optional] - * @return resource A result pointer resource on success, or FALSE on - * failure. - *

- *

- * The returned result can be used with mysql_field_flags, - * mysql_field_len, - * mysql_field_name and - * mysql_field_type. - */ -function mysql_list_fields ($database_name, $table_name, $link_identifier = NULL) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * List MySQL processes - * @link http://php.net/manual/en/function.mysql-list-processes.php - * @param resource $link_identifier [optional] - * @return resource A result pointer resource on success or FALSE on failure. - */ -function mysql_list_processes ($link_identifier = NULL) {} - -/** - * (PHP 4, PHP 5)
- * Returns the text of the error message from previous MySQL operation - * @link http://php.net/manual/en/function.mysql-error.php - * @param resource $link_identifier [optional] - * @return string the error text from the last MySQL function, or - * '' (empty string) if no error occurred. - */ -function mysql_error ($link_identifier = NULL) {} - -/** - * (PHP 4, PHP 5)
- * Returns the numerical value of the error message from previous MySQL operation - * @link http://php.net/manual/en/function.mysql-errno.php - * @param resource $link_identifier [optional] - * @return int the error number from the last MySQL function, or - * 0 (zero) if no error occurred. - */ -function mysql_errno ($link_identifier = NULL) {} - -/** - * (PHP 4, PHP 5)
- * Get number of affected rows in previous MySQL operation - * @link http://php.net/manual/en/function.mysql-affected-rows.php - * @param resource $link_identifier [optional] - * @return int the number of affected rows on success, and -1 if the last query - * failed. - *

- *

- * If the last query was a DELETE query with no WHERE clause, all - * of the records will have been deleted from the table but this - * function will return zero with MySQL versions prior to 4.1.2. - *

- *

- * When using UPDATE, MySQL will not update columns where the new value is the - * same as the old value. This creates the possibility that - * mysql_affected_rows may not actually equal the number - * of rows matched, only the number of rows that were literally affected by - * the query. - *

- *

- * The REPLACE statement first deletes the record with the same primary key - * and then inserts the new record. This function returns the number of - * deleted records plus the number of inserted records. - *

- *

- * In the case of "INSERT ... ON DUPLICATE KEY UPDATE" queries, the - * return value will be 1 if an insert was performed, - * or 2 for an update of an existing row. - */ -function mysql_affected_rows ($link_identifier = NULL) {} - -/** - * (PHP 4, PHP 5)
- * Get the ID generated in the last query - * @link http://php.net/manual/en/function.mysql-insert-id.php - * @param resource $link_identifier [optional] - * @return int The ID generated for an AUTO_INCREMENT column by the previous - * query on success, 0 if the previous - * query does not generate an AUTO_INCREMENT value, or FALSE if - * no MySQL connection was established. - */ -function mysql_insert_id ($link_identifier = NULL) {} - -/** - * (PHP 4, PHP 5)
- * Get result data - * @link http://php.net/manual/en/function.mysql-result.php - * @param resource $result - * @param int $row

- * The row number from the result that's being retrieved. Row numbers - * start at 0. - *

- * @param mixed $field [optional]

- * The name or offset of the field being retrieved. - *

- *

- * It can be the field's offset, the field's name, or the field's table - * dot field name (tablename.fieldname). If the column name has been - * aliased ('select foo as bar from...'), use the alias instead of the - * column name. If undefined, the first field is retrieved. - *

- * @return string The contents of one cell from a MySQL result set on success, or - * FALSE on failure. - */ -function mysql_result ($result, $row, $field = 0) {} - -/** - * (PHP 4, PHP 5)
- * Get number of rows in result - * @link http://php.net/manual/en/function.mysql-num-rows.php - * @param resource $result - * @return int The number of rows in a result set on success or FALSE on failure. - */ -function mysql_num_rows ($result) {} - -/** - * (PHP 4, PHP 5)
- * Get number of fields in result - * @link http://php.net/manual/en/function.mysql-num-fields.php - * @param resource $result - * @return int the number of fields in the result set resource on - * success or FALSE on failure. - */ -function mysql_num_fields ($result) {} - -/** - * (PHP 4, PHP 5)
- * Get a result row as an enumerated array - * @link http://php.net/manual/en/function.mysql-fetch-row.php - * @param resource $result - * @return array an numerical array of strings that corresponds to the fetched row, or - * FALSE if there are no more rows. - *

- *

- * mysql_fetch_row fetches one row of data from - * the result associated with the specified result identifier. The - * row is returned as an array. Each result column is stored in an - * array offset, starting at offset 0. - */ -function mysql_fetch_row ($result) {} - -/** - * (PHP 4, PHP 5)
- * Fetch a result row as an associative array, a numeric array, or both - * @link http://php.net/manual/en/function.mysql-fetch-array.php - * @param resource $result - * @param int $result_type [optional]

- * The type of array that is to be fetched. It's a constant and can - * take the following values: MYSQL_ASSOC, - * MYSQL_NUM, and - * MYSQL_BOTH. - *

- * @return array an array of strings that corresponds to the fetched row, or FALSE - * if there are no more rows. The type of returned array depends on - * how result_type is defined. By using - * MYSQL_BOTH (default), you'll get an array with both - * associative and number indices. Using MYSQL_ASSOC, you - * only get associative indices (as mysql_fetch_assoc - * works), using MYSQL_NUM, you only get number indices - * (as mysql_fetch_row works). - *

- *

- * If two or more columns of the result have the same field names, - * the last column will take precedence. To access the other column(s) - * of the same name, you must use the numeric index of the column or - * make an alias for the column. For aliased columns, you cannot - * access the contents with the original column name. - */ -function mysql_fetch_array ($result, $result_type = 'MYSQL_BOTH') {} - -/** - * (PHP 4 >= 4.0.3, PHP 5)
- * Fetch a result row as an associative array - * @link http://php.net/manual/en/function.mysql-fetch-assoc.php - * @param resource $result - * @return array an associative array of strings that corresponds to the fetched row, or - * FALSE if there are no more rows. - *

- *

- * If two or more columns of the result have the same field names, - * the last column will take precedence. To access the other - * column(s) of the same name, you either need to access the - * result with numeric indices by using - * mysql_fetch_row or add alias names. - * See the example at the mysql_fetch_array - * description about aliases. - */ -function mysql_fetch_assoc ($result) {} - -/** - * (PHP 4, PHP 5)
- * Fetch a result row as an object - * @link http://php.net/manual/en/function.mysql-fetch-object.php - * @param resource $result - * @param string $class_name [optional]

- * The name of the class to instantiate, set the properties of and return. - * If not specified, a stdClass object is returned. - *

- * @param array $params [optional]

- * An optional array of parameters to pass to the constructor - * for class_name objects. - *

- * @return object an object with string properties that correspond to the - * fetched row, or FALSE if there are no more rows. - */ -function mysql_fetch_object ($result, $class_name = null, array $params = null) {} - -/** - * (PHP 4, PHP 5)
- * Move internal result pointer - * @link http://php.net/manual/en/function.mysql-data-seek.php - * @param resource $result - * @param int $row_number

- * The desired row number of the new result pointer. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mysql_data_seek ($result, $row_number) {} - -/** - * (PHP 4, PHP 5)
- * Get the length of each output in a result - * @link http://php.net/manual/en/function.mysql-fetch-lengths.php - * @param resource $result - * @return array An array of lengths on success or FALSE on failure. - */ -function mysql_fetch_lengths ($result) {} - -/** - * (PHP 4, PHP 5)
- * Get column information from a result and return as an object - * @link http://php.net/manual/en/function.mysql-fetch-field.php - * @param resource $result - * @param int $field_offset [optional]

- * The numerical field offset. If the field offset is not specified, the - * next field that was not yet retrieved by this function is retrieved. - * The field_offset starts at 0. - *

- * @return object an object containing field information. The properties - * of the object are: - *

- *

- * name - column name - * table - name of the table the column belongs to, which is the alias name if one is defined - * max_length - maximum length of the column - * not_null - 1 if the column cannot be NULL - * primary_key - 1 if the column is a primary key - * unique_key - 1 if the column is a unique key - * multiple_key - 1 if the column is a non-unique key - * numeric - 1 if the column is numeric - * blob - 1 if the column is a BLOB - * type - the type of the column - * unsigned - 1 if the column is unsigned - * zerofill - 1 if the column is zero-filled - */ -function mysql_fetch_field ($result, $field_offset = 0) {} - -/** - * (PHP 4, PHP 5)
- * Set result pointer to a specified field offset - * @link http://php.net/manual/en/function.mysql-field-seek.php - * @param resource $result - * @param int $field_offset - * @return bool TRUE on success or FALSE on failure. - */ -function mysql_field_seek ($result, $field_offset) {} - -/** - * (PHP 4, PHP 5)
- * Free result memory - * @link http://php.net/manual/en/function.mysql-free-result.php - * @param resource $result - * @return bool TRUE on success or FALSE on failure. - *

- *

- * If a non-resource is used for the result, an - * error of level E_WARNING will be emitted. It's worth noting that - * mysql_query only returns a resource - * for SELECT, SHOW, EXPLAIN, and DESCRIBE queries. - */ -function mysql_free_result ($result) {} - -/** - * (PHP 4, PHP 5)
- * Get the name of the specified field in a result - * @link http://php.net/manual/en/function.mysql-field-name.php - * @param resource $result - * @param int $field_offset - * @return string The name of the specified field index on success or FALSE on failure. - */ -function mysql_field_name ($result, $field_offset) {} - -/** - * (PHP 4, PHP 5)
- * Get name of the table the specified field is in - * @link http://php.net/manual/en/function.mysql-field-table.php - * @param resource $result - * @param int $field_offset - * @return string The name of the table on success. - */ -function mysql_field_table ($result, $field_offset) {} - -/** - * (PHP 4, PHP 5)
- * Returns the length of the specified field - * @link http://php.net/manual/en/function.mysql-field-len.php - * @param resource $result - * @param int $field_offset - * @return int The length of the specified field index on success or FALSE on failure. - */ -function mysql_field_len ($result, $field_offset) {} - -/** - * (PHP 4, PHP 5)
- * Get the type of the specified field in a result - * @link http://php.net/manual/en/function.mysql-field-type.php - * @param resource $result - * @param int $field_offset - * @return string The returned field type - * will be one of "int", "real", - * "string", "blob", and others as - * detailed in the MySQL - * documentation. - */ -function mysql_field_type ($result, $field_offset) {} - -/** - * (PHP 4, PHP 5)
- * Get the flags associated with the specified field in a result - * @link http://php.net/manual/en/function.mysql-field-flags.php - * @param resource $result - * @param int $field_offset - * @return string a string of flags associated with the result or FALSE on failure. - *

- *

- * The following flags are reported, if your version of MySQL - * is current enough to support them: "not_null", - * "primary_key", "unique_key", - * "multiple_key", "blob", - * "unsigned", "zerofill", - * "binary", "enum", - * "auto_increment" and "timestamp". - */ -function mysql_field_flags ($result, $field_offset) {} - -/** - * (PHP 4 >= 4.0.3, PHP 5)
- * Escapes a string for use in a mysql_query - * @link http://php.net/manual/en/function.mysql-escape-string.php - * @param string $unescaped_string

- * The string that is to be escaped. - *

- * @return string the escaped string. - */ -function mysql_escape_string ($unescaped_string) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Escapes special characters in a string for use in an SQL statement - * @link http://php.net/manual/en/function.mysql-real-escape-string.php - * @param string $unescaped_string

- * The string that is to be escaped. - *

- * @param resource $link_identifier [optional] - * @return string the escaped string, or FALSE on error. - */ -function mysql_real_escape_string ($unescaped_string, $link_identifier = NULL) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Get current system status - * @link http://php.net/manual/en/function.mysql-stat.php - * @param resource $link_identifier [optional] - * @return string a string with the status for uptime, threads, queries, open tables, - * flush tables and queries per second. For a complete list of other status - * variables, you have to use the SHOW STATUS SQL command. - * If link_identifier is invalid, NULL is returned. - */ -function mysql_stat ($link_identifier = NULL) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Return the current thread ID - * @link http://php.net/manual/en/function.mysql-thread-id.php - * @param resource $link_identifier [optional] - * @return int The thread ID on success or FALSE on failure. - */ -function mysql_thread_id ($link_identifier = NULL) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Returns the name of the character set - * @link http://php.net/manual/en/function.mysql-client-encoding.php - * @param resource $link_identifier [optional] - * @return string the default character set name for the current connection. - */ -function mysql_client_encoding ($link_identifier = NULL) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Ping a server connection or reconnect if there is no connection - * @link http://php.net/manual/en/function.mysql-ping.php - * @param resource $link_identifier [optional] - * @return bool TRUE if the connection to the server MySQL server is working, - * otherwise FALSE. - */ -function mysql_ping ($link_identifier = NULL) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Get MySQL client info - * @link http://php.net/manual/en/function.mysql-get-client-info.php - * @return string The MySQL client version. - */ -function mysql_get_client_info () {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Get MySQL host info - * @link http://php.net/manual/en/function.mysql-get-host-info.php - * @param resource $link_identifier [optional] - * @return string a string describing the type of MySQL connection in use for the - * connection or FALSE on failure. - */ -function mysql_get_host_info ($link_identifier = NULL) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Get MySQL protocol info - * @link http://php.net/manual/en/function.mysql-get-proto-info.php - * @param resource $link_identifier [optional] - * @return int the MySQL protocol on success or FALSE on failure. - */ -function mysql_get_proto_info ($link_identifier = NULL) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Get MySQL server info - * @link http://php.net/manual/en/function.mysql-get-server-info.php - * @param resource $link_identifier [optional] - * @return string the MySQL server version on success or FALSE on failure. - */ -function mysql_get_server_info ($link_identifier = NULL) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Get information about the most recent query - * @link http://php.net/manual/en/function.mysql-info.php - * @param resource $link_identifier [optional] - * @return string information about the statement on success, or FALSE on - * failure. See the example below for which statements provide information, - * and what the returned value may look like. Statements that are not listed - * will return FALSE. - */ -function mysql_info ($link_identifier = NULL) {} - -/** - * (PHP 5 >= 5.2.3)
- * Sets the client character set - * @link http://php.net/manual/en/function.mysql-set-charset.php - * @param string $charset

- * A valid character set name. - *

- * @param resource $link_identifier [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function mysql_set_charset ($charset, $link_identifier = NULL) {} - -/** - * @param $database_name - * @param $query - * @param $link_identifier [optional] - */ -function mysql ($database_name, $query, $link_identifier) {} - -/** - * @param $result - * @param $field_index - */ -function mysql_fieldname ($result, $field_index) {} - -/** - * @param $result - * @param $field_offset - */ -function mysql_fieldtable ($result, $field_offset) {} - -/** - * @param $result - * @param $field_offset - */ -function mysql_fieldlen ($result, $field_offset) {} - -/** - * @param $result - * @param $field_offset - */ -function mysql_fieldtype ($result, $field_offset) {} - -/** - * @param $result - * @param $field_offset - */ -function mysql_fieldflags ($result, $field_offset) {} - -/** - * @param $database_name - * @param $link_identifier [optional] - */ -function mysql_selectdb ($database_name, $link_identifier) {} - -/** - * @param $result - */ -function mysql_freeresult ($result) {} - -/** - * @param $result - */ -function mysql_numfields ($result) {} - -/** - * @param $result - */ -function mysql_numrows ($result) {} - -/** - * @param $link_identifier [optional] - */ -function mysql_listdbs ($link_identifier) {} - -/** - * @param $database_name - * @param $link_identifier [optional] - */ -function mysql_listtables ($database_name, $link_identifier) {} - -/** - * @param $database_name - * @param $table_name - * @param $link_identifier [optional] - */ -function mysql_listfields ($database_name, $table_name, $link_identifier) {} - -/** - * (PHP 4, PHP 5)
- * Retrieves database name from the call to mysql_list_dbs - * @link http://php.net/manual/en/function.mysql-db-name.php - * @param resource $result

- * The result pointer from a call to mysql_list_dbs. - *

- * @param int $row

- * The index into the result set. - *

- * @param mixed $field [optional]

- * The field name. - *

- * @return string the database name on success, and FALSE on failure. If FALSE - * is returned, use mysql_error to determine the nature - * of the error. - */ -function mysql_db_name ($result, $row, $field = NULL) {} - -/** - * @param $result - * @param $row - * @param $field [optional] - */ -function mysql_dbname ($result, $row, $field) {} - -/** - * (PHP 4, PHP 5)
- * Get table name of field - * @link http://php.net/manual/en/function.mysql-tablename.php - * @param resource $result

- * A result pointer resource that's returned from - * mysql_list_tables. - *

- * @param int $i

- * The integer index (row/table number) - *

- * @return string The name of the table on success or FALSE on failure. - *

- *

- * Use the mysql_tablename function to - * traverse this result pointer, or any function for result tables, - * such as mysql_fetch_array. - */ -function mysql_tablename ($result, $i) {} - -/** - * @param $result - * @param $row - * @param $field [optional] - */ -function mysql_table_name ($result, $row, $field) {} - - -/** - * Columns are returned into the array having the fieldname as the array - * index. - * @link http://php.net/manual/en/mysql.constants.php - */ -define ('MYSQL_ASSOC', 1); - -/** - * Columns are returned into the array having a numerical index to the - * fields. This index starts with 0, the first field in the result. - * @link http://php.net/manual/en/mysql.constants.php - */ -define ('MYSQL_NUM', 2); - -/** - * Columns are returned into the array having both a numerical index - * and the fieldname as the array index. - * @link http://php.net/manual/en/mysql.constants.php - */ -define ('MYSQL_BOTH', 3); - -/** - * Use compression protocol - * @link http://php.net/manual/en/mysql.constants.php - */ -define ('MYSQL_CLIENT_COMPRESS', 32); - -/** - * Use SSL encryption. This flag is only available with version 4.x - * of the MySQL client library or newer. Version 3.23.x is bundled both - * with PHP 4 and Windows binaries of PHP 5. - * @link http://php.net/manual/en/mysql.constants.php - */ -define ('MYSQL_CLIENT_SSL', 2048); - -/** - * Allow interactive_timeout seconds (instead of wait_timeout) of - * inactivity before closing the connection. - * @link http://php.net/manual/en/mysql.constants.php - */ -define ('MYSQL_CLIENT_INTERACTIVE', 1024); - -/** - * Allow space after function names - * @link http://php.net/manual/en/mysql.constants.php - */ -define ('MYSQL_CLIENT_IGNORE_SPACE', 256); - -// End of mysql v.1.0 -?> diff --git a/phpruntime/mysqli.php b/phpruntime/mysqli.php deleted file mode 100644 index 4b92efc..0000000 --- a/phpruntime/mysqli.php +++ /dev/null @@ -1,3574 +0,0 @@ - - * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * MySQLi Driver. - * @link http://php.net/manual/en/class.mysqli-driver.php - */ -final class mysqli_driver { - /** - * @var string - */ - public $client_info; - /** - * @var string - */ - public $client_version; - /** - * @var string - */ - public $driver_version; - /** - * @var string - */ - public $embedded; - /** - * @var bool - */ - public $reconnect; - /** - * @var int - */ - public $report_mode; - -} - -/** - * Represents a connection between PHP and a MySQL database. - * @link http://php.net/manual/en/class.mysqli.php - */ -class mysqli { - public $affected_rows; - public $client_info; - public $client_version; - public $connect_errno; - public $connect_error; - public $errno; - public $error; - public $error_list; - public $field_count; - public $host_info; - public $info; - public $insert_id; - public $server_info; - public $server_version; - public $stat; - public $sqlstate; - public $protocol_version; - public $thread_id; - public $warning_count; - - - /** - * (PHP 5)
- * Turns on or off auto-committing database modifications - * @link http://php.net/manual/en/mysqli.autocommit.php - * @param bool $mode

- * Whether to turn on auto-commit or not. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function autocommit ($mode) {} - - /** - * (PHP 5)
- * Changes the user of the specified database connection - * @link http://php.net/manual/en/mysqli.change-user.php - * @param string $user

- * The MySQL user name. - *

- * @param string $password

- * The MySQL password. - *

- * @param string $database

- * The database to change to. - *

- *

- * If desired, the NULL value may be passed resulting in only changing - * the user and not selecting a database. To select a database in this - * case use the mysqli_select_db function. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function change_user ($user, $password, $database) {} - - /** - * (PHP 5)
- * Returns the default character set for the database connection - * @link http://php.net/manual/en/mysqli.character-set-name.php - * @return string The default character set for the current connection - */ - public function character_set_name () {} - - /** - * (PHP 5)
- * Closes a previously opened database connection - * @link http://php.net/manual/en/mysqli.close.php - * @return bool TRUE on success or FALSE on failure. - */ - public function close () {} - - /** - * (PHP 5)
- * Commits the current transaction - * @link http://php.net/manual/en/mysqli.commit.php - * @return bool TRUE on success or FALSE on failure. - */ - public function commit () {} - - /** - * @param $host [optional] - * @param $user [optional] - * @param $password [optional] - * @param $database [optional] - * @param $port [optional] - * @param $socket [optional] - */ - public function connect ($host, $user, $password, $database, $port, $socket) {} - - /** - * (PHP 5)
- * Dump debugging information into the log - * @link http://php.net/manual/en/mysqli.dump-debug-info.php - * @return bool TRUE on success or FALSE on failure. - */ - public function dump_debug_info () {} - - /** - * (PHP 5)
- * Performs debugging operations - * @link http://php.net/manual/en/mysqli.debug.php - * @param string $message

- * A string representing the debugging operation to perform - *

- * @return bool TRUE. - */ - public function debug ($message) {} - - /** - * (PHP 5 >= 5.1.0)
- * Returns a character set object - * @link http://php.net/manual/en/mysqli.get-charset.php - * @return object The function returns a character set object with the following properties: - * charset - *

Character set name

- * collation - *

Collation name

- * dir - *

Directory the charset description was fetched from (?) or "" for built-in character sets

- * min_length - *

Minimum character length in bytes

- * max_length - *

Maximum character length in bytes

- * number - *

Internal character set number

- * state - *

Character set status (?)

- */ - public function get_charset () {} - - /** - * (PHP 5)
- * Get MySQL client info - * @link http://php.net/manual/en/mysqli.get-client-info.php - * @return string A string that represents the MySQL client library version - */ - public function get_client_info () {} - - public function get_server_info () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get result of SHOW WARNINGS - * @link http://php.net/manual/en/mysqli.get-warnings.php - * @return mysqli_warning - */ - public function get_warnings () {} - - /** - * (PHP 5)
- * Initializes MySQLi and returns a resource for use with mysqli_real_connect() - * @link http://php.net/manual/en/mysqli.init.php - * @return mysqli an object. - */ - public function init () {} - - /** - * (PHP 5)
- * Asks the server to kill a MySQL thread - * @link http://php.net/manual/en/mysqli.kill.php - * @param int $processid - * @return bool TRUE on success or FALSE on failure. - */ - public function kill ($processid) {} - - /** - * (PHP 5)
- * Unsets user defined handler for load local infile command - * @link http://php.net/manual/en/mysqli.set-local-infile-default.php - * @param mysqli $link - * @return void No value is returned. - */ - public function set_local_infile_default (mysqli $link) {} - - /** - * (PHP 5)
- * Set callback function for LOAD DATA LOCAL INFILE command - * @link http://php.net/manual/en/mysqli.set-local-infile-handler.php - * @param mysqli $link - * @param callable $read_func

- * A callback function or object method taking the following parameters: - *

- * stream - *

A PHP stream associated with the SQL commands INFILE

- * @return bool TRUE on success or FALSE on failure. - */ - public function set_local_infile_handler (mysqli $link, callable $read_func) {} - - /** - * (PHP 5)
- * Performs a query on the database - * @link http://php.net/manual/en/mysqli.multi-query.php - * @param string $query

- * The query, as a string. - *

- *

- * Data inside the query should be properly escaped. - *

- * @return bool FALSE if the first statement failed. - * To retrieve subsequent errors from other statements you have to call - * mysqli_next_result first. - */ - public function multi_query ($query) {} - - /** - * @param $host [optional] - * @param $user [optional] - * @param $password [optional] - * @param $database [optional] - * @param $port [optional] - * @param $socket [optional] - */ - public function mysqli ($host, $user, $password, $database, $port, $socket) {} - - /** - * (PHP 5)
- * Check if there are any more query results from a multi query - * @link http://php.net/manual/en/mysqli.more-results.php - * @return bool TRUE on success or FALSE on failure. - */ - public function more_results () {} - - /** - * (PHP 5)
- * Prepare next result from multi_query - * @link http://php.net/manual/en/mysqli.next-result.php - * @return bool TRUE on success or FALSE on failure. - */ - public function next_result () {} - - /** - * (PHP 5)
- * Set options - * @link http://php.net/manual/en/mysqli.options.php - * @param int $option

- * The option that you want to set. It can be one of the following values: - * - * Valid options - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
NameDescription
MYSQLI_OPT_CONNECT_TIMEOUTconnection timeout in seconds (supported on Windows with TCP/IP since PHP 5.3.1)
MYSQLI_OPT_LOCAL_INFILEenable/disable use of LOAD LOCAL INFILE
MYSQLI_INIT_COMMANDcommand to execute after when connecting to MySQL server
MYSQLI_READ_DEFAULT_FILE - * Read options from named option file instead of my.cnf - *
MYSQLI_READ_DEFAULT_GROUP - * Read options from the named group from my.cnf - * or the file specified with MYSQL_READ_DEFAULT_FILE. - *
MYSQLI_SERVER_PUBLIC_KEY - * RSA public key file used with the SHA-256 based authentication. - *
- *

- * @param mixed $value

- * The value for the option. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function options ($option, $value) {} - - /** - * (PHP 5)
- * Pings a server connection, or tries to reconnect if the connection has gone down - * @link http://php.net/manual/en/mysqli.ping.php - * @return bool TRUE on success or FALSE on failure. - */ - public function ping () {} - - /** - * (PHP 5)
- * Prepare an SQL statement for execution - * @link http://php.net/manual/en/mysqli.prepare.php - * @param string $query

- * The query, as a string. - *

- *

- * You should not add a terminating semicolon or \g - * to the statement. - *

- *

- * This parameter can include one or more parameter markers in the SQL - * statement by embedding question mark (?) characters - * at the appropriate positions. - *

- *

- * The markers are legal only in certain places in SQL statements. - * For example, they are allowed in the VALUES() - * list of an INSERT statement (to specify column - * values for a row), or in a comparison with a column in a - * WHERE clause to specify a comparison value. - *

- *

- * However, they are not allowed for identifiers (such as table or - * column names), in the select list that names the columns to be - * returned by a SELECT statement, or to specify both - * operands of a binary operator such as the = equal - * sign. The latter restriction is necessary because it would be - * impossible to determine the parameter type. It's not allowed to - * compare marker with NULL by - * ? IS NULL too. In general, parameters are legal - * only in Data Manipulation Language (DML) statements, and not in Data - * Definition Language (DDL) statements. - *

- * @return mysqli_stmt mysqli_prepare returns a statement object or FALSE if an error occurred. - */ - public function prepare ($query) {} - - /** - * (PHP 5)
- * Performs a query on the database - * @link http://php.net/manual/en/mysqli.query.php - * @param string $query

- * The query string. - *

- *

- * Data inside the query should be properly escaped. - *

- * @param int $resultmode [optional]

- * Either the constant MYSQLI_USE_RESULT or - * MYSQLI_STORE_RESULT depending on the desired - * behavior. By default, MYSQLI_STORE_RESULT is used. - *

- *

- * If you use MYSQLI_USE_RESULT all subsequent calls - * will return error Commands out of sync unless you - * call mysqli_free_result - *

- *

- * With MYSQLI_ASYNC (available with mysqlnd), it is - * possible to perform query asynchronously. - * mysqli_poll is then used to get results from such - * queries. - *

- * @return mixed FALSE on failure. For successful SELECT, SHOW, DESCRIBE or - * EXPLAIN queries mysqli_query will return - * a mysqli_result object. For other successful queries mysqli_query will - * return TRUE. - */ - public function query ($query, $resultmode = 'MYSQLI_STORE_RESULT') {} - - /** - * (PHP 5)
- * Opens a connection to a mysql server - * @link http://php.net/manual/en/mysqli.real-connect.php - * @param string $host [optional]

- * Can be either a host name or an IP address. Passing the NULL value - * or the string "localhost" to this parameter, the local host is - * assumed. When possible, pipes will be used instead of the TCP/IP - * protocol. - *

- * @param string $username [optional]

- * The MySQL user name. - *

- * @param string $passwd [optional]

- * If provided or NULL, the MySQL server will attempt to authenticate - * the user against those user records which have no password only. This - * allows one username to be used with different permissions (depending - * on if a password as provided or not). - *

- * @param string $dbname [optional]

- * If provided will specify the default database to be used when - * performing queries. - *

- * @param int $port [optional]

- * Specifies the port number to attempt to connect to the MySQL server. - *

- * @param string $socket [optional]

- * Specifies the socket or named pipe that should be used. - *

- *

- * Specifying the socket parameter will not - * explicitly determine the type of connection to be used when - * connecting to the MySQL server. How the connection is made to the - * MySQL database is determined by the host - * parameter. - *

- * @param int $flags [optional]

- * With the parameter flags you can set different - * connection options: - *

- * - * Supported flags - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
NameDescription
MYSQLI_CLIENT_COMPRESSUse compression protocol
MYSQLI_CLIENT_FOUND_ROWSreturn number of matched rows, not the number of affected rows
MYSQLI_CLIENT_IGNORE_SPACEAllow spaces after function names. Makes all function names reserved words.
MYSQLI_CLIENT_INTERACTIVE - * Allow interactive_timeout seconds (instead of - * wait_timeout seconds) of inactivity before closing the connection - *
MYSQLI_CLIENT_SSLUse SSL (encryption)
- *

- * For security reasons the MULTI_STATEMENT flag is - * not supported in PHP. If you want to execute multiple queries use the - * mysqli_multi_query function. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function real_connect ($host = null, $username = null, $passwd = null, $dbname = null, $port = null, $socket = null, $flags = null) {} - - /** - * (PHP 5)
- * Escapes special characters in a string for use in an SQL statement, taking into account the current charset of the connection - * @link http://php.net/manual/en/mysqli.real-escape-string.php - * @param string $escapestr

- * The string to be escaped. - *

- *

- * Characters encoded are NUL (ASCII 0), \n, \r, \, ', ", and - * Control-Z. - *

- * @return string an escaped string. - */ - public function real_escape_string ($escapestr) {} - - /** - * @param $string_to_escape - */ - public function escape_string ($string_to_escape) {} - - /** - * (PHP 5)
- * Execute an SQL query - * @link http://php.net/manual/en/mysqli.real-query.php - * @param string $query

- * The query, as a string. - *

- *

- * Data inside the query should be properly escaped. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function real_query ($query) {} - - /** - * (PHP 5)
- * Rolls back current transaction - * @link http://php.net/manual/en/mysqli.rollback.php - * @return bool TRUE on success or FALSE on failure. - */ - public function rollback () {} - - /** - * (PHP 5)
- * Selects the default database for database queries - * @link http://php.net/manual/en/mysqli.select-db.php - * @param string $dbname

- * The database name. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function select_db ($dbname) {} - - /** - * (PHP 5 >= 5.0.5)
- * Sets the default client character set - * @link http://php.net/manual/en/mysqli.set-charset.php - * @param string $charset

- * The charset to be set as default. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function set_charset ($charset) {} - - /** - * @param $option - * @param $value - */ - public function set_opt ($option, $value) {} - - /** - * (PHP 5)
- * Used for establishing secure connections using SSL - * @link http://php.net/manual/en/mysqli.ssl-set.php - * @param string $key

- * The path name to the key file. - *

- * @param string $cert

- * The path name to the certificate file. - *

- * @param string $ca

- * The path name to the certificate authority file. - *

- * @param string $capath

- * The pathname to a directory that contains trusted SSL CA certificates - * in PEM format. - *

- * @param string $cipher

- * A list of allowable ciphers to use for SSL encryption. - *

- * @return bool This function always returns TRUE value. If SSL setup is - * incorrect mysqli_real_connect will return an error - * when you attempt to connect. - */ - public function ssl_set ($key, $cert, $ca, $capath, $cipher) {} - - /** - * (PHP 5)
- * Gets the current system status - * @link http://php.net/manual/en/mysqli.stat.php - * @return string A string describing the server status. FALSE if an error occurred. - */ - public function stat () {} - - /** - * (PHP 5)
- * Initializes a statement and returns an object for use with mysqli_stmt_prepare - * @link http://php.net/manual/en/mysqli.stmt-init.php - * @return mysqli_stmt an object. - */ - public function stmt_init () {} - - /** - * (PHP 5)
- * Transfers a result set from the last query - * @link http://php.net/manual/en/mysqli.store-result.php - * @return mysqli_result a buffered result object or FALSE if an error occurred. - *

- *

- * mysqli_store_result returns FALSE in case the query - * didn't return a result set (if the query was, for example an INSERT - * statement). This function also returns FALSE if the reading of the - * result set failed. You can check if you have got an error by checking - * if mysqli_error doesn't return an empty string, if - * mysqli_errno returns a non zero value, or if - * mysqli_field_count returns a non zero value. - * Also possible reason for this function returning FALSE after - * successful call to mysqli_query can be too large - * result set (memory for it cannot be allocated). If - * mysqli_field_count returns a non-zero value, the - * statement should have produced a non-empty result set. - */ - public function store_result () {} - - /** - * (PHP 5)
- * Returns whether thread safety is given or not - * @link http://php.net/manual/en/mysqli.thread-safe.php - * @return bool TRUE if the client library is thread-safe, otherwise FALSE. - */ - public function thread_safe () {} - - /** - * (PHP 5)
- * Initiate a result set retrieval - * @link http://php.net/manual/en/mysqli.use-result.php - * @return mysqli_result an unbuffered result object or FALSE if an error occurred. - */ - public function use_result () {} - - /** - * (PHP 5 <= 5.3.0)
- * Refreshes - * @link http://php.net/manual/en/mysqli.refresh.php - * @param int $options

- * The options to refresh, using the MYSQLI_REFRESH_* constants as documented - * within the MySQLi constants documentation. - *

- *

- * See also the official MySQL Refresh - * documentation. - *

- * @return bool TRUE if the refresh was a success, otherwise FALSE - */ - public function refresh ($options) {} - -} - -/** - * Represents a MySQL warning. - * @link http://php.net/manual/en/class.mysqli-warning.php - */ -final class mysqli_warning { - public $message; - public $sqlstate; - public $errno; - - - /** - * (PHP 5)
- * The __construct purpose - * @link http://php.net/manual/en/mysqli-warning.construct.php - */ - protected function __construct () {} - - /** - * (PHP 5)
- * The next purpose - * @link http://php.net/manual/en/mysqli-warning.next.php - * @return void - */ - public function next () {} - -} - -/** - * Represents the result set obtained from a query against the database. - * @link http://php.net/manual/en/class.mysqli-result.php - */ -class mysqli_result implements Traversable { - public $current_field; - public $field_count; - public $lengths; - public $num_rows; - public $type; - - - public function __construct () {} - - public function close () {} - - /** - * (PHP 5)
- * Frees the memory associated with a result - * @link http://php.net/manual/en/mysqli-result.free.php - * @return void No value is returned. - */ - public function free () {} - - /** - * (PHP 5)
- * Adjusts the result pointer to an arbitrary row in the result - * @link http://php.net/manual/en/mysqli-result.data-seek.php - * @param int $offset

- * The field offset. Must be between zero and the total number of rows - * minus one (0..mysqli_num_rows - 1). - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function data_seek ($offset) {} - - /** - * (PHP 5)
- * Returns the next field in the result set - * @link http://php.net/manual/en/mysqli-result.fetch-field.php - * @return object an object which contains field definition information or FALSE - * if no field information is available. - *

- *

- * - * Object properties - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
PropertyDescription
nameThe name of the column
orgnameOriginal column name if an alias was specified
tableThe name of the table this field belongs to (if not calculated)
orgtableOriginal table name if an alias was specified
defReserved for default value, currently always ""
dbDatabase (since PHP 5.3.6)
catalogThe catalog name, always "def" (since PHP 5.3.6)
max_lengthThe maximum width of the field for the result set.
lengthThe width of the field, as specified in the table definition.
charsetnrThe character set number for the field.
flagsAn integer representing the bit-flags for the field.
typeThe data type used for this field
decimalsThe number of decimals used (for integer fields)
- */ - public function fetch_field () {} - - /** - * (PHP 5)
- * Returns an array of objects representing the fields in a result set - * @link http://php.net/manual/en/mysqli-result.fetch-fields.php - * @return array an array of objects which contains field definition information or - * FALSE if no field information is available. - *

- *

- * - * Object properties - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
PropertyDescription
nameThe name of the column
orgnameOriginal column name if an alias was specified
tableThe name of the table this field belongs to (if not calculated)
orgtableOriginal table name if an alias was specified
max_lengthThe maximum width of the field for the result set.
lengthThe width of the field, as specified in the table definition.
charsetnrThe character set number for the field.
flagsAn integer representing the bit-flags for the field.
typeThe data type used for this field
decimalsThe number of decimals used (for integer fields)
- */ - public function fetch_fields () {} - - /** - * (PHP 5)
- * Fetch meta-data for a single field - * @link http://php.net/manual/en/mysqli-result.fetch-field-direct.php - * @param int $fieldnr

- * The field number. This value must be in the range from - * 0 to number of fields - 1. - *

- * @return object an object which contains field definition information or FALSE - * if no field information for specified fieldnr is - * available. - *

- *

- * - * Object attributes - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
AttributeDescription
nameThe name of the column
orgnameOriginal column name if an alias was specified
tableThe name of the table this field belongs to (if not calculated)
orgtableOriginal table name if an alias was specified
defThe default value for this field, represented as a string
max_lengthThe maximum width of the field for the result set.
lengthThe width of the field, as specified in the table definition.
charsetnrThe character set number for the field.
flagsAn integer representing the bit-flags for the field.
typeThe data type used for this field
decimalsThe number of decimals used (for integer fields)
- */ - public function fetch_field_direct ($fieldnr) {} - - /** - * (PHP 5)
- * Fetch a result row as an associative, a numeric array, or both - * @link http://php.net/manual/en/mysqli-result.fetch-array.php - * @param int $resulttype [optional]

- * This optional parameter is a constant indicating what type of array - * should be produced from the current row data. The possible values for - * this parameter are the constants MYSQLI_ASSOC, - * MYSQLI_NUM, or MYSQLI_BOTH. - *

- *

- * By using the MYSQLI_ASSOC constant this function - * will behave identically to the mysqli_fetch_assoc, - * while MYSQLI_NUM will behave identically to the - * mysqli_fetch_row function. The final option - * MYSQLI_BOTH will create a single array with the - * attributes of both. - *

- * @return mixed an array of strings that corresponds to the fetched row or NULL if there - * are no more rows in resultset. - */ - public function fetch_array ($resulttype = 'MYSQLI_BOTH') {} - - /** - * (PHP 5)
- * Fetch a result row as an associative array - * @link http://php.net/manual/en/mysqli-result.fetch-assoc.php - * @return array an associative array of strings representing the fetched row in the result - * set, where each key in the array represents the name of one of the result - * set's columns or NULL if there are no more rows in resultset. - *

- *

- * If two or more columns of the result have the same field names, the last - * column will take precedence. To access the other column(s) of the same - * name, you either need to access the result with numeric indices by using - * mysqli_fetch_row or add alias names. - */ - public function fetch_assoc () {} - - /** - * (PHP 5)
- * Returns the current row of a result set as an object - * @link http://php.net/manual/en/mysqli-result.fetch-object.php - * @param string $class_name [optional]

- * The name of the class to instantiate, set the properties of and return. - * If not specified, a stdClass object is returned. - *

- * @param array $params [optional]

- * An optional array of parameters to pass to the constructor - * for class_name objects. - *

- * @return object an object with string properties that corresponds to the fetched - * row or NULL if there are no more rows in resultset. - */ - public function fetch_object ($class_name = null, array $params = null) {} - - /** - * (PHP 5)
- * Get a result row as an enumerated array - * @link http://php.net/manual/en/mysqli-result.fetch-row.php - * @return mixed mysqli_fetch_row returns an array of strings that corresponds to the fetched row - * or NULL if there are no more rows in result set. - */ - public function fetch_row () {} - - /** - * (PHP 5)
- * Set result pointer to a specified field offset - * @link http://php.net/manual/en/mysqli-result.field-seek.php - * @param int $fieldnr

- * The field number. This value must be in the range from - * 0 to number of fields - 1. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function field_seek ($fieldnr) {} - - public function free_result () {} - -} - -/** - * Represents a prepared statement. - * @link http://php.net/manual/en/class.mysqli-stmt.php - */ -class mysqli_stmt { - public $affected_rows; - public $insert_id; - public $num_rows; - public $param_count; - public $field_count; - public $errno; - public $error; - public $error_list; - public $sqlstate; - public $id; - - - public function __construct () {} - - /** - * (PHP 5)
- * Used to get the current value of a statement attribute - * @link http://php.net/manual/en/mysqli-stmt.attr-get.php - * @param int $attr

- * The attribute that you want to get. - *

- * @return int FALSE if the attribute is not found, otherwise returns the value of the attribute. - */ - public function attr_get ($attr) {} - - /** - * (PHP 5)
- * Used to modify the behavior of a prepared statement - * @link http://php.net/manual/en/mysqli-stmt.attr-set.php - * @param int $attr

- * The attribute that you want to set. It can have one of the following values: - * - * Attribute values - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
CharacterDescription
MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH - * If set to 1, causes mysqli_stmt_store_result to - * update the metadata MYSQL_FIELD->max_length value. - *
MYSQLI_STMT_ATTR_CURSOR_TYPE - * Type of cursor to open for statement when mysqli_stmt_execute - * is invoked. mode can be MYSQLI_CURSOR_TYPE_NO_CURSOR - * (the default) or MYSQLI_CURSOR_TYPE_READ_ONLY. - *
MYSQLI_STMT_ATTR_PREFETCH_ROWS - * Number of rows to fetch from server at a time when using a cursor. - * mode can be in the range from 1 to the maximum - * value of unsigned long. The default is 1. - *
- *

- *

- * If you use the MYSQLI_STMT_ATTR_CURSOR_TYPE option with - * MYSQLI_CURSOR_TYPE_READ_ONLY, a cursor is opened for the - * statement when you invoke mysqli_stmt_execute. If there - * is already an open cursor from a previous mysqli_stmt_execute call, - * it closes the cursor before opening a new one. mysqli_stmt_reset - * also closes any open cursor before preparing the statement for re-execution. - * mysqli_stmt_free_result closes any open cursor. - *

- *

- * If you open a cursor for a prepared statement, mysqli_stmt_store_result - * is unnecessary. - *

- * @param int $mode

The value to assign to the attribute.

- * @return bool - */ - public function attr_set ($attr, $mode) {} - - /** - * (PHP 5)
- * Binds variables to a prepared statement as parameters - * @link http://php.net/manual/en/mysqli-stmt.bind-param.php - * @param string $types

- * A string that contains one or more characters which specify the types - * for the corresponding bind variables: - * - * Type specification chars - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
CharacterDescription
icorresponding variable has type integer
dcorresponding variable has type double
scorresponding variable has type string
bcorresponding variable is a blob and will be sent in packets
- *

- * @param mixed $var1

- * The number of variables and length of string - * types must match the parameters in the statement. - *

- * @param mixed $_ [optional] - * @return bool TRUE on success or FALSE on failure. - */ - public function bind_param ($types, &$var1, &$_ = null) {} - - /** - * (PHP 5)
- * Binds variables to a prepared statement for result storage - * @link http://php.net/manual/en/mysqli-stmt.bind-result.php - * @param mixed $var1

- * The variable to be bound. - *

- * @param mixed $_ [optional] - * @return bool TRUE on success or FALSE on failure. - */ - public function bind_result (&$var1, &$_ = null) {} - - /** - * (PHP 5)
- * Closes a prepared statement - * @link http://php.net/manual/en/mysqli-stmt.close.php - * @return bool TRUE on success or FALSE on failure. - */ - public function close () {} - - /** - * (PHP 5)
- * Seeks to an arbitrary row in statement result set - * @link http://php.net/manual/en/mysqli-stmt.data-seek.php - * @param int $offset

- * Must be between zero and the total number of rows minus one (0.. - * mysqli_stmt_num_rows - 1). - *

- * @return void No value is returned. - */ - public function data_seek ($offset) {} - - /** - * (PHP 5)
- * Executes a prepared Query - * @link http://php.net/manual/en/mysqli-stmt.execute.php - * @return bool TRUE on success or FALSE on failure. - */ - public function execute () {} - - /** - * (PHP 5)
- * Fetch results from a prepared statement into the bound variables - * @link http://php.net/manual/en/mysqli-stmt.fetch.php - * @return bool - */ - public function fetch () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get result of SHOW WARNINGS - * @link http://php.net/manual/en/mysqli-stmt.get-warnings.php - * @param mysqli_stmt $stmt - * @return object - */ - public function get_warnings (mysqli_stmt $stmt) {} - - /** - * (PHP 5)
- * Returns result set metadata from a prepared statement - * @link http://php.net/manual/en/mysqli-stmt.result-metadata.php - * @return mysqli_result a result object or FALSE if an error occurred. - */ - public function result_metadata () {} - - public function num_rows () {} - - /** - * (PHP 5)
- * Send data in blocks - * @link http://php.net/manual/en/mysqli-stmt.send-long-data.php - * @param int $param_nr

- * Indicates which parameter to associate the data with. Parameters are - * numbered beginning with 0. - *

- * @param string $data

- * A string containing data to be sent. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function send_long_data ($param_nr, $data) {} - - /** - * (PHP 5)
- * Frees stored result memory for the given statement handle - * @link http://php.net/manual/en/mysqli-stmt.free-result.php - * @return void No value is returned. - */ - public function free_result () {} - - /** - * (PHP 5)
- * Resets a prepared statement - * @link http://php.net/manual/en/mysqli-stmt.reset.php - * @return bool TRUE on success or FALSE on failure. - */ - public function reset () {} - - /** - * (PHP 5)
- * Prepare an SQL statement for execution - * @link http://php.net/manual/en/mysqli-stmt.prepare.php - * @param string $query

- * The query, as a string. It must consist of a single SQL statement. - *

- *

- * You can include one or more parameter markers in the SQL statement by - * embedding question mark (?) characters at the - * appropriate positions. - *

- *

- * You should not add a terminating semicolon or \g - * to the statement. - *

- *

- * The markers are legal only in certain places in SQL statements. - * For example, they are allowed in the VALUES() list of an INSERT statement - * (to specify column values for a row), or in a comparison with a column in - * a WHERE clause to specify a comparison value. - *

- *

- * However, they are not allowed for identifiers (such as table or column names), - * in the select list that names the columns to be returned by a SELECT statement), - * or to specify both operands of a binary operator such as the = - * equal sign. The latter restriction is necessary because it would be impossible - * to determine the parameter type. In general, parameters are legal only in Data - * Manipulation Language (DML) statements, and not in Data Definition Language - * (DDL) statements. - *

- * @return mixed TRUE on success or FALSE on failure. - */ - public function prepare ($query) {} - - /** - * (PHP 5)
- * Transfers a result set from a prepared statement - * @link http://php.net/manual/en/mysqli-stmt.store-result.php - * @return bool TRUE on success or FALSE on failure. - */ - public function store_result () {} - -} - -/** - * (PHP 5)
- * Gets the number of affected rows in a previous MySQL operation - * @link http://php.net/manual/en/mysqli.affected-rows.php - * @param mysqli $link - * @return int An integer greater than zero indicates the number of rows affected or - * retrieved. - * Zero indicates that no records where updated for an UPDATE statement, no - * rows matched the WHERE clause in the query or that no - * query has yet been executed. -1 indicates that the query returned an - * error. - *

- *

- * If the number of affected rows is greater than maximal int value, the - * number of affected rows will be returned as a string. - */ -function mysqli_affected_rows (mysqli $link) {} - -/** - * (PHP 5)
- * Turns on or off auto-committing database modifications - * @link http://php.net/manual/en/mysqli.autocommit.php - * @param mysqli $link - * @param bool $mode

- * Whether to turn on auto-commit or not. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_autocommit (mysqli $link, $mode) {} - -/** - * (PHP 5)
- * Changes the user of the specified database connection - * @link http://php.net/manual/en/mysqli.change-user.php - * @param mysqli $link - * @param string $user

- * The MySQL user name. - *

- * @param string $password

- * The MySQL password. - *

- * @param string $database

- * The database to change to. - *

- *

- * If desired, the NULL value may be passed resulting in only changing - * the user and not selecting a database. To select a database in this - * case use the mysqli_select_db function. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_change_user (mysqli $link, $user, $password, $database) {} - -/** - * (PHP 5)
- * Returns the default character set for the database connection - * @link http://php.net/manual/en/mysqli.character-set-name.php - * @param mysqli $link - * @return string The default character set for the current connection - */ -function mysqli_character_set_name (mysqli $link) {} - -/** - * (PHP 5)
- * Closes a previously opened database connection - * @link http://php.net/manual/en/mysqli.close.php - * @param mysqli $link - * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_close (mysqli $link) {} - -/** - * (PHP 5)
- * Commits the current transaction - * @link http://php.net/manual/en/mysqli.commit.php - * @param mysqli $link - * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_commit (mysqli $link) {} - -/** - * (PHP 5)
- * Alias of mysqli::__construct - * @link http://php.net/manual/en/function.mysqli-connect.php - * @param $host [optional] - * @param $user [optional] - * @param $password [optional] - * @param $database [optional] - * @param $port [optional] - * @param $socket [optional] - */ -function mysqli_connect ($host, $user, $password, $database, $port, $socket) {} - -/** - * (PHP 5)
- * Returns the error code from last connect call - * @link http://php.net/manual/en/mysqli.connect-errno.php - * @return int An error code value for the last call to mysqli_connect, if it failed. - * zero means no error occurred. - */ -function mysqli_connect_errno () {} - -/** - * (PHP 5)
- * Returns a string description of the last connect error - * @link http://php.net/manual/en/mysqli.connect-error.php - * @return string A string that describes the error. NULL is returned if no error occurred. - */ -function mysqli_connect_error () {} - -/** - * (PHP 5)
- * Adjusts the result pointer to an arbitrary row in the result - * @link http://php.net/manual/en/mysqli-result.data-seek.php - * @param mysqli_result $result - * @param int $offset

- * The field offset. Must be between zero and the total number of rows - * minus one (0..mysqli_num_rows - 1). - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_data_seek (mysqli_result $result, $offset) {} - -/** - * (PHP 5)
- * Dump debugging information into the log - * @link http://php.net/manual/en/mysqli.dump-debug-info.php - * @param mysqli $link - * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_dump_debug_info (mysqli $link) {} - -/** - * (PHP 5)
- * Performs debugging operations - * @link http://php.net/manual/en/mysqli.debug.php - * @param string $message

- * A string representing the debugging operation to perform - *

- * @return bool TRUE. - */ -function mysqli_debug ($message) {} - -/** - * (PHP 5)
- * Returns the error code for the most recent function call - * @link http://php.net/manual/en/mysqli.errno.php - * @param mysqli $link - * @return int An error code value for the last call, if it failed. zero means no error - * occurred. - */ -function mysqli_errno (mysqli $link) {} - -/** - * (PHP 5)
- * Returns a string description of the last error - * @link http://php.net/manual/en/mysqli.error.php - * @param mysqli $link - * @return string A string that describes the error. An empty string if no error occurred. - */ -function mysqli_error (mysqli $link) {} - -/** - * (PHP 5 >= 5.4.0)
- * Returns a list of errors from the last command executed - * @link http://php.net/manual/en/mysqli.error-list.php - * @param mysqli $link - * @return array A list of errors, each as an associative array - * containing the errno, error, and sqlstate. - */ -function mysqli_error_list (mysqli $link) {} - -/** - * (PHP 5)
- * Executes a prepared Query - * @link http://php.net/manual/en/mysqli-stmt.execute.php - * @param mysqli_stmt $stmt - * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_stmt_execute (mysqli_stmt $stmt) {} - -/** - * (PHP 5)
- * Alias for mysqli_stmt_execute - * @link http://php.net/manual/en/function.mysqli-execute.php - * @param $stmt - */ -function mysqli_execute ($stmt) {} - -/** - * (PHP 5)
- * Returns the next field in the result set - * @link http://php.net/manual/en/mysqli-result.fetch-field.php - * @param mysqli_result $result - * @return object an object which contains field definition information or FALSE - * if no field information is available. - *

- *

- * - * Object properties - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
PropertyDescription
nameThe name of the column
orgnameOriginal column name if an alias was specified
tableThe name of the table this field belongs to (if not calculated)
orgtableOriginal table name if an alias was specified
defReserved for default value, currently always ""
dbDatabase (since PHP 5.3.6)
catalogThe catalog name, always "def" (since PHP 5.3.6)
max_lengthThe maximum width of the field for the result set.
lengthThe width of the field, as specified in the table definition.
charsetnrThe character set number for the field.
flagsAn integer representing the bit-flags for the field.
typeThe data type used for this field
decimalsThe number of decimals used (for integer fields)
- */ -function mysqli_fetch_field (mysqli_result $result) {} - -/** - * (PHP 5)
- * Returns an array of objects representing the fields in a result set - * @link http://php.net/manual/en/mysqli-result.fetch-fields.php - * @param mysqli_result $result - * @return array an array of objects which contains field definition information or - * FALSE if no field information is available. - *

- *

- * - * Object properties - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
PropertyDescription
nameThe name of the column
orgnameOriginal column name if an alias was specified
tableThe name of the table this field belongs to (if not calculated)
orgtableOriginal table name if an alias was specified
max_lengthThe maximum width of the field for the result set.
lengthThe width of the field, as specified in the table definition.
charsetnrThe character set number for the field.
flagsAn integer representing the bit-flags for the field.
typeThe data type used for this field
decimalsThe number of decimals used (for integer fields)
- */ -function mysqli_fetch_fields (mysqli_result $result) {} - -/** - * (PHP 5)
- * Fetch meta-data for a single field - * @link http://php.net/manual/en/mysqli-result.fetch-field-direct.php - * @param mysqli_result $result - * @param int $fieldnr

- * The field number. This value must be in the range from - * 0 to number of fields - 1. - *

- * @return object an object which contains field definition information or FALSE - * if no field information for specified fieldnr is - * available. - *

- *

- * - * Object attributes - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
AttributeDescription
nameThe name of the column
orgnameOriginal column name if an alias was specified
tableThe name of the table this field belongs to (if not calculated)
orgtableOriginal table name if an alias was specified
defThe default value for this field, represented as a string
max_lengthThe maximum width of the field for the result set.
lengthThe width of the field, as specified in the table definition.
charsetnrThe character set number for the field.
flagsAn integer representing the bit-flags for the field.
typeThe data type used for this field
decimalsThe number of decimals used (for integer fields)
- */ -function mysqli_fetch_field_direct (mysqli_result $result, $fieldnr) {} - -/** - * (PHP 5)
- * Returns the lengths of the columns of the current row in the result set - * @link http://php.net/manual/en/mysqli-result.lengths.php - * @param mysqli_result $result - * @return array An array of integers representing the size of each column (not including - * any terminating null characters). FALSE if an error occurred. - *

- *

- * mysqli_fetch_lengths is valid only for the current - * row of the result set. It returns FALSE if you call it before calling - * mysqli_fetch_row/array/object or after retrieving all rows in the result. - */ -function mysqli_fetch_lengths (mysqli_result $result) {} - -/** - * (PHP 5)
- * Fetch a result row as an associative, a numeric array, or both - * @link http://php.net/manual/en/mysqli-result.fetch-array.php - * @param mysqli_result $result - * @param int $resulttype [optional]

- * This optional parameter is a constant indicating what type of array - * should be produced from the current row data. The possible values for - * this parameter are the constants MYSQLI_ASSOC, - * MYSQLI_NUM, or MYSQLI_BOTH. - *

- *

- * By using the MYSQLI_ASSOC constant this function - * will behave identically to the mysqli_fetch_assoc, - * while MYSQLI_NUM will behave identically to the - * mysqli_fetch_row function. The final option - * MYSQLI_BOTH will create a single array with the - * attributes of both. - *

- * @return mixed an array of strings that corresponds to the fetched row or NULL if there - * are no more rows in resultset. - */ -function mysqli_fetch_array (mysqli_result $result, $resulttype = 'MYSQLI_BOTH') {} - -/** - * (PHP 5)
- * Fetch a result row as an associative array - * @link http://php.net/manual/en/mysqli-result.fetch-assoc.php - * @param mysqli_result $result - * @return array an associative array of strings representing the fetched row in the result - * set, where each key in the array represents the name of one of the result - * set's columns or NULL if there are no more rows in resultset. - *

- *

- * If two or more columns of the result have the same field names, the last - * column will take precedence. To access the other column(s) of the same - * name, you either need to access the result with numeric indices by using - * mysqli_fetch_row or add alias names. - */ -function mysqli_fetch_assoc (mysqli_result $result) {} - -/** - * (PHP 5)
- * Returns the current row of a result set as an object - * @link http://php.net/manual/en/mysqli-result.fetch-object.php - * @param mysqli_result $result - * @param string $class_name [optional]

- * The name of the class to instantiate, set the properties of and return. - * If not specified, a stdClass object is returned. - *

- * @param array $params [optional]

- * An optional array of parameters to pass to the constructor - * for class_name objects. - *

- * @return object an object with string properties that corresponds to the fetched - * row or NULL if there are no more rows in resultset. - */ -function mysqli_fetch_object (mysqli_result $result, $class_name = null, array $params = null) {} - -/** - * (PHP 5)
- * Get a result row as an enumerated array - * @link http://php.net/manual/en/mysqli-result.fetch-row.php - * @param mysqli_result $result - * @return mixed mysqli_fetch_row returns an array of strings that corresponds to the fetched row - * or NULL if there are no more rows in result set. - */ -function mysqli_fetch_row (mysqli_result $result) {} - -/** - * (PHP 5)
- * Returns the number of columns for the most recent query - * @link http://php.net/manual/en/mysqli.field-count.php - * @param mysqli $link - * @return int An integer representing the number of fields in a result set. - */ -function mysqli_field_count (mysqli $link) {} - -/** - * (PHP 5)
- * Set result pointer to a specified field offset - * @link http://php.net/manual/en/mysqli-result.field-seek.php - * @param mysqli_result $result - * @param int $fieldnr

- * The field number. This value must be in the range from - * 0 to number of fields - 1. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_field_seek (mysqli_result $result, $fieldnr) {} - -/** - * (PHP 5)
- * Get current field offset of a result pointer - * @link http://php.net/manual/en/mysqli-result.current-field.php - * @param mysqli_result $result - * @return int current offset of field cursor. - */ -function mysqli_field_tell (mysqli_result $result) {} - -/** - * (PHP 5)
- * Frees the memory associated with a result - * @link http://php.net/manual/en/mysqli-result.free.php - * @param $result - * @return void No value is returned. - */ -function mysqli_free_result ($result) {} - -/** - * (PHP 5 >= 5.1.0)
- * Returns a character set object - * @link http://php.net/manual/en/mysqli.get-charset.php - * @param mysqli $link - * @return object The function returns a character set object with the following properties: - * charset - *

Character set name

- * collation - *

Collation name

- * dir - *

Directory the charset description was fetched from (?) or "" for built-in character sets

- * min_length - *

Minimum character length in bytes

- * max_length - *

Maximum character length in bytes

- * number - *

Internal character set number

- * state - *

Character set status (?)

- */ -function mysqli_get_charset (mysqli $link) {} - -/** - * (PHP 5)
- * Get MySQL client info - * @link http://php.net/manual/en/mysqli.client-info.php - * @param mysqli $link - * @return string A string that represents the MySQL client library version - */ -function mysqli_get_client_info (mysqli $link) {} - -/** - * (PHP 5)
- * Returns the MySQL client version as a string - * @link http://php.net/manual/en/mysqli.client-version.php - * @param mysqli $link - * @return int A number that represents the MySQL client library version in format: - * main_version*10000 + minor_version *100 + sub_version. - * For example, 4.1.0 is returned as 40100. - *

- *

- * This is useful to quickly determine the version of the client library - * to know if some capability exists. - */ -function mysqli_get_client_version (mysqli $link) {} - -/** - * (PHP 5)
- * Returns a string representing the type of connection used - * @link http://php.net/manual/en/mysqli.get-host-info.php - * @param mysqli $link - * @return string A character string representing the server hostname and the connection type. - */ -function mysqli_get_host_info (mysqli $link) {} - -/** - * (PHP 5)
- * Returns the version of the MySQL protocol used - * @link http://php.net/manual/en/mysqli.get-proto-info.php - * @param mysqli $link - * @return int an integer representing the protocol version. - */ -function mysqli_get_proto_info (mysqli $link) {} - -/** - * (PHP 5)
- * Returns the version of the MySQL server - * @link http://php.net/manual/en/mysqli.get-server-info.php - * @param mysqli $link - * @return string A character string representing the server version. - */ -function mysqli_get_server_info (mysqli $link) {} - -/** - * (PHP 5)
- * Returns the version of the MySQL server as an integer - * @link http://php.net/manual/en/mysqli.get-server-version.php - * @param mysqli $link - * @return int An integer representing the server version. - *

- *

- * The form of this version number is - * main_version * 10000 + minor_version * 100 + sub_version - * (i.e. version 4.1.0 is 40100). - */ -function mysqli_get_server_version (mysqli $link) {} - -/** - * (PHP 5 >= 5.1.0)
- * Get result of SHOW WARNINGS - * @link http://php.net/manual/en/mysqli.get-warnings.php - * @param mysqli $link - * @return mysqli_warning - */ -function mysqli_get_warnings (mysqli $link) {} - -/** - * (PHP 5)
- * Initializes MySQLi and returns a resource for use with mysqli_real_connect() - * @link http://php.net/manual/en/mysqli.init.php - * @return mysqli an object. - */ -function mysqli_init () {} - -/** - * (PHP 5)
- * Retrieves information about the most recently executed query - * @link http://php.net/manual/en/mysqli.info.php - * @param mysqli $link - * @return string A character string representing additional information about the most recently executed query. - */ -function mysqli_info (mysqli $link) {} - -/** - * (PHP 5)
- * Returns the auto generated id used in the last query - * @link http://php.net/manual/en/mysqli.insert-id.php - * @param mysqli $link - * @return mixed The value of the AUTO_INCREMENT field that was updated - * by the previous query. Returns zero if there was no previous query on the - * connection or if the query did not update an AUTO_INCREMENT - * value. - *

- *

- * If the number is greater than maximal int value, mysqli_insert_id - * will return a string. - */ -function mysqli_insert_id (mysqli $link) {} - -/** - * (PHP 5)
- * Asks the server to kill a MySQL thread - * @link http://php.net/manual/en/mysqli.kill.php - * @param mysqli $link - * @param int $processid - * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_kill (mysqli $link, $processid) {} - -/** - * (PHP 5)
- * Unsets user defined handler for load local infile command - * @link http://php.net/manual/en/mysqli.set-local-infile-default.php - * @param mysqli $link - * @return void No value is returned. - */ -function mysqli_set_local_infile_default (mysqli $link) {} - -/** - * (PHP 5)
- * Set callback function for LOAD DATA LOCAL INFILE command - * @link http://php.net/manual/en/mysqli.set-local-infile-handler.php - * @param mysqli $link - * @param callable $read_func

- * A callback function or object method taking the following parameters: - *

- * stream - *

A PHP stream associated with the SQL commands INFILE

- * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_set_local_infile_handler (mysqli $link, callable $read_func) {} - -/** - * (PHP 5)
- * Check if there are any more query results from a multi query - * @link http://php.net/manual/en/mysqli.more-results.php - * @param mysqli $link - * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_more_results (mysqli $link) {} - -/** - * (PHP 5)
- * Performs a query on the database - * @link http://php.net/manual/en/mysqli.multi-query.php - * @param mysqli $link - * @param string $query

- * The query, as a string. - *

- *

- * Data inside the query should be properly escaped. - *

- * @return bool FALSE if the first statement failed. - * To retrieve subsequent errors from other statements you have to call - * mysqli_next_result first. - */ -function mysqli_multi_query (mysqli $link, $query) {} - -/** - * (PHP 5)
- * Prepare next result from multi_query - * @link http://php.net/manual/en/mysqli.next-result.php - * @param mysqli $link - * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_next_result (mysqli $link) {} - -/** - * (PHP 5)
- * Get the number of fields in a result - * @link http://php.net/manual/en/mysqli-result.field-count.php - * @param mysqli_result $result - * @return int The number of fields from a result set. - */ -function mysqli_num_fields (mysqli_result $result) {} - -/** - * (PHP 5)
- * Gets the number of rows in a result - * @link http://php.net/manual/en/mysqli-result.num-rows.php - * @param mysqli_result $result - * @return int number of rows in the result set. - *

- *

- * If the number of rows is greater than MAXINT, the number - * will be returned as a string. - */ -function mysqli_num_rows (mysqli_result $result) {} - -/** - * (PHP 5)
- * Set options - * @link http://php.net/manual/en/mysqli.options.php - * @param mysqli $link - * @param int $option

- * The option that you want to set. It can be one of the following values: - * - * Valid options - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
NameDescription
MYSQLI_OPT_CONNECT_TIMEOUTconnection timeout in seconds (supported on Windows with TCP/IP since PHP 5.3.1)
MYSQLI_OPT_LOCAL_INFILEenable/disable use of LOAD LOCAL INFILE
MYSQLI_INIT_COMMANDcommand to execute after when connecting to MySQL server
MYSQLI_READ_DEFAULT_FILE - * Read options from named option file instead of my.cnf - *
MYSQLI_READ_DEFAULT_GROUP - * Read options from the named group from my.cnf - * or the file specified with MYSQL_READ_DEFAULT_FILE. - *
MYSQLI_SERVER_PUBLIC_KEY - * RSA public key file used with the SHA-256 based authentication. - *
- *

- * @param mixed $value

- * The value for the option. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_options (mysqli $link, $option, $value) {} - -/** - * (PHP 5)
- * Pings a server connection, or tries to reconnect if the connection has gone down - * @link http://php.net/manual/en/mysqli.ping.php - * @param mysqli $link - * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_ping (mysqli $link) {} - -/** - * (PHP 5)
- * Prepare an SQL statement for execution - * @link http://php.net/manual/en/mysqli.prepare.php - * @param mysqli $link - * @param string $query

- * The query, as a string. - *

- *

- * You should not add a terminating semicolon or \g - * to the statement. - *

- *

- * This parameter can include one or more parameter markers in the SQL - * statement by embedding question mark (?) characters - * at the appropriate positions. - *

- *

- * The markers are legal only in certain places in SQL statements. - * For example, they are allowed in the VALUES() - * list of an INSERT statement (to specify column - * values for a row), or in a comparison with a column in a - * WHERE clause to specify a comparison value. - *

- *

- * However, they are not allowed for identifiers (such as table or - * column names), in the select list that names the columns to be - * returned by a SELECT statement, or to specify both - * operands of a binary operator such as the = equal - * sign. The latter restriction is necessary because it would be - * impossible to determine the parameter type. It's not allowed to - * compare marker with NULL by - * ? IS NULL too. In general, parameters are legal - * only in Data Manipulation Language (DML) statements, and not in Data - * Definition Language (DDL) statements. - *

- * @return mysqli_stmt mysqli_prepare returns a statement object or FALSE if an error occurred. - */ -function mysqli_prepare (mysqli $link, $query) {} - -/** - * (PHP 5)
- * Enables or disables internal report functions - * @link http://php.net/manual/en/function.mysqli-report.php - * @param int $flags

- * - * Supported flags - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
NameDescription
MYSQLI_REPORT_OFFTurns reporting off
MYSQLI_REPORT_ERRORReport errors from mysqli function calls
MYSQLI_REPORT_STRICT - * Throw mysqli_sql_exception for errors - * instead of warnings - *
MYSQLI_REPORT_INDEXReport if no index or bad index was used in a query
MYSQLI_REPORT_ALLSet all options (report all)
- *

- * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_report ($flags) {} - -/** - * (PHP 5)
- * Performs a query on the database - * @link http://php.net/manual/en/mysqli.query.php - * @param mysqli $link - * @param string $query

- * The query string. - *

- *

- * Data inside the query should be properly escaped. - *

- * @param int $resultmode [optional]

- * Either the constant MYSQLI_USE_RESULT or - * MYSQLI_STORE_RESULT depending on the desired - * behavior. By default, MYSQLI_STORE_RESULT is used. - *

- *

- * If you use MYSQLI_USE_RESULT all subsequent calls - * will return error Commands out of sync unless you - * call mysqli_free_result - *

- *

- * With MYSQLI_ASYNC (available with mysqlnd), it is - * possible to perform query asynchronously. - * mysqli_poll is then used to get results from such - * queries. - *

- * @return mixed FALSE on failure. For successful SELECT, SHOW, DESCRIBE or - * EXPLAIN queries mysqli_query will return - * a mysqli_result object. For other successful queries mysqli_query will - * return TRUE. - */ -function mysqli_query (mysqli $link, $query, $resultmode = 'MYSQLI_STORE_RESULT') {} - -/** - * (PHP 5)
- * Opens a connection to a mysql server - * @link http://php.net/manual/en/mysqli.real-connect.php - * @param mysqli $link - * @param string $host [optional]

- * Can be either a host name or an IP address. Passing the NULL value - * or the string "localhost" to this parameter, the local host is - * assumed. When possible, pipes will be used instead of the TCP/IP - * protocol. - *

- * @param string $username [optional]

- * The MySQL user name. - *

- * @param string $passwd [optional]

- * If provided or NULL, the MySQL server will attempt to authenticate - * the user against those user records which have no password only. This - * allows one username to be used with different permissions (depending - * on if a password as provided or not). - *

- * @param string $dbname [optional]

- * If provided will specify the default database to be used when - * performing queries. - *

- * @param int $port [optional]

- * Specifies the port number to attempt to connect to the MySQL server. - *

- * @param string $socket [optional]

- * Specifies the socket or named pipe that should be used. - *

- *

- * Specifying the socket parameter will not - * explicitly determine the type of connection to be used when - * connecting to the MySQL server. How the connection is made to the - * MySQL database is determined by the host - * parameter. - *

- * @param int $flags [optional]

- * With the parameter flags you can set different - * connection options: - *

- * - * Supported flags - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
NameDescription
MYSQLI_CLIENT_COMPRESSUse compression protocol
MYSQLI_CLIENT_FOUND_ROWSreturn number of matched rows, not the number of affected rows
MYSQLI_CLIENT_IGNORE_SPACEAllow spaces after function names. Makes all function names reserved words.
MYSQLI_CLIENT_INTERACTIVE - * Allow interactive_timeout seconds (instead of - * wait_timeout seconds) of inactivity before closing the connection - *
MYSQLI_CLIENT_SSLUse SSL (encryption)
- *

- * For security reasons the MULTI_STATEMENT flag is - * not supported in PHP. If you want to execute multiple queries use the - * mysqli_multi_query function. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_real_connect (mysqli $link, $host = null, $username = null, $passwd = null, $dbname = null, $port = null, $socket = null, $flags = null) {} - -/** - * (PHP 5)
- * Escapes special characters in a string for use in an SQL statement, taking into account the current charset of the connection - * @link http://php.net/manual/en/mysqli.real-escape-string.php - * @param string $escapestr

- * The string to be escaped. - *

- *

- * Characters encoded are NUL (ASCII 0), \n, \r, \, ', ", and - * Control-Z. - *

- * @return string an escaped string. - */ -function mysqli_real_escape_string ($escapestr) {} - -/** - * (PHP 5)
- * Execute an SQL query - * @link http://php.net/manual/en/mysqli.real-query.php - * @param mysqli $link - * @param string $query

- * The query, as a string. - *

- *

- * Data inside the query should be properly escaped. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_real_query (mysqli $link, $query) {} - -/** - * (PHP 5)
- * Rolls back current transaction - * @link http://php.net/manual/en/mysqli.rollback.php - * @param mysqli $link - * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_rollback (mysqli $link) {} - -/** - * (PHP 5)
- * Selects the default database for database queries - * @link http://php.net/manual/en/mysqli.select-db.php - * @param mysqli $link - * @param string $dbname

- * The database name. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_select_db (mysqli $link, $dbname) {} - -/** - * (PHP 5 >= 5.0.5)
- * Sets the default client character set - * @link http://php.net/manual/en/mysqli.set-charset.php - * @param mysqli $link - * @param string $charset

- * The charset to be set as default. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_set_charset (mysqli $link, $charset) {} - -/** - * (PHP 5)
- * Returns the total number of rows changed, deleted, or -inserted by the last executed statement - * @link http://php.net/manual/en/mysqli-stmt.affected-rows.php - * @param mysqli_stmt $stmt - * @return int An integer greater than zero indicates the number of rows affected or - * retrieved. - * Zero indicates that no records where updated for an UPDATE/DELETE - * statement, no rows matched the WHERE clause in the query or that no query - * has yet been executed. -1 indicates that the query has returned an error. - * NULL indicates an invalid argument was supplied to the function. - *

- *

- * If the number of affected rows is greater than maximal PHP int value, the - * number of affected rows will be returned as a string value. - */ -function mysqli_stmt_affected_rows (mysqli_stmt $stmt) {} - -/** - * (PHP 5)
- * Used to get the current value of a statement attribute - * @link http://php.net/manual/en/mysqli-stmt.attr-get.php - * @param mysqli_stmt $stmt - * @param int $attr

- * The attribute that you want to get. - *

- * @return int FALSE if the attribute is not found, otherwise returns the value of the attribute. - */ -function mysqli_stmt_attr_get (mysqli_stmt $stmt, $attr) {} - -/** - * (PHP 5)
- * Used to modify the behavior of a prepared statement - * @link http://php.net/manual/en/mysqli-stmt.attr-set.php - * @param mysqli_stmt $stmt - * @param int $attr

- * The attribute that you want to set. It can have one of the following values: - * - * Attribute values - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
CharacterDescription
MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH - * If set to 1, causes mysqli_stmt_store_result to - * update the metadata MYSQL_FIELD->max_length value. - *
MYSQLI_STMT_ATTR_CURSOR_TYPE - * Type of cursor to open for statement when mysqli_stmt_execute - * is invoked. mode can be MYSQLI_CURSOR_TYPE_NO_CURSOR - * (the default) or MYSQLI_CURSOR_TYPE_READ_ONLY. - *
MYSQLI_STMT_ATTR_PREFETCH_ROWS - * Number of rows to fetch from server at a time when using a cursor. - * mode can be in the range from 1 to the maximum - * value of unsigned long. The default is 1. - *
- *

- *

- * If you use the MYSQLI_STMT_ATTR_CURSOR_TYPE option with - * MYSQLI_CURSOR_TYPE_READ_ONLY, a cursor is opened for the - * statement when you invoke mysqli_stmt_execute. If there - * is already an open cursor from a previous mysqli_stmt_execute call, - * it closes the cursor before opening a new one. mysqli_stmt_reset - * also closes any open cursor before preparing the statement for re-execution. - * mysqli_stmt_free_result closes any open cursor. - *

- *

- * If you open a cursor for a prepared statement, mysqli_stmt_store_result - * is unnecessary. - *

- * @param int $mode

The value to assign to the attribute.

- * @return bool - */ -function mysqli_stmt_attr_set (mysqli_stmt $stmt, $attr, $mode) {} - -/** - * (PHP 5)
- * Binds variables to a prepared statement as parameters - * @link http://php.net/manual/en/mysqli-stmt.bind-param.php - * @param mysqli_stmt $stmt - * @param string $types

- * A string that contains one or more characters which specify the types - * for the corresponding bind variables: - * - * Type specification chars - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
CharacterDescription
icorresponding variable has type integer
dcorresponding variable has type double
scorresponding variable has type string
bcorresponding variable is a blob and will be sent in packets
- *

- * @param mixed $var1

- * The number of variables and length of string - * types must match the parameters in the statement. - *

- * @param mixed $_ [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_stmt_bind_param (mysqli_stmt $stmt, $types, &$var1, &$_ = null) {} - -/** - * (PHP 5)
- * Binds variables to a prepared statement for result storage - * @link http://php.net/manual/en/mysqli-stmt.bind-result.php - * @param mysqli_stmt $stmt - * @param mixed $var1

- * The variable to be bound. - *

- * @param mixed $_ [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_stmt_bind_result (mysqli_stmt $stmt, &$var1, &$_ = null) {} - -/** - * (PHP 5)
- * Closes a prepared statement - * @link http://php.net/manual/en/mysqli-stmt.close.php - * @param mysqli_stmt $stmt - * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_stmt_close (mysqli_stmt $stmt) {} - -/** - * (PHP 5)
- * Seeks to an arbitrary row in statement result set - * @link http://php.net/manual/en/mysqli-stmt.data-seek.php - * @param mysqli_stmt $stmt - * @param int $offset

- * Must be between zero and the total number of rows minus one (0.. - * mysqli_stmt_num_rows - 1). - *

- * @return void No value is returned. - */ -function mysqli_stmt_data_seek (mysqli_stmt $stmt, $offset) {} - -/** - * (PHP 5)
- * Returns the error code for the most recent statement call - * @link http://php.net/manual/en/mysqli-stmt.errno.php - * @param mysqli_stmt $stmt - * @return int An error code value. Zero means no error occurred. - */ -function mysqli_stmt_errno (mysqli_stmt $stmt) {} - -/** - * (PHP 5)
- * Returns a string description for last statement error - * @link http://php.net/manual/en/mysqli-stmt.error.php - * @param mysqli_stmt $stmt - * @return string A string that describes the error. An empty string if no error occurred. - */ -function mysqli_stmt_error (mysqli_stmt $stmt) {} - -/** - * (PHP 5 >= 5.4.0)
- * Returns a list of errors from the last statement executed - * @link http://php.net/manual/en/mysqli-stmt.error-list.php - * @param mysqli_stmt $stmt - * @return array A list of errors, each as an associative array - * containing the errno, error, and sqlstate. - */ -function mysqli_stmt_error_list (mysqli_stmt $stmt) {} - -/** - * (PHP 5)
- * Fetch results from a prepared statement into the bound variables - * @link http://php.net/manual/en/mysqli-stmt.fetch.php - * @param mysqli_stmt $stmt - * @return bool - */ -function mysqli_stmt_fetch (mysqli_stmt $stmt) {} - -/** - * (PHP 5)
- * Returns the number of field in the given statement - * @link http://php.net/manual/en/mysqli-stmt.field-count.php - * @param mysqli_stmt $stmt - * @return int - */ -function mysqli_stmt_field_count (mysqli_stmt $stmt) {} - -/** - * (PHP 5)
- * Frees stored result memory for the given statement handle - * @link http://php.net/manual/en/mysqli-stmt.free-result.php - * @param mysqli_stmt $stmt - * @return void No value is returned. - */ -function mysqli_stmt_free_result (mysqli_stmt $stmt) {} - -/** - * (PHP 5 >= 5.1.0)
- * Get result of SHOW WARNINGS - * @link http://php.net/manual/en/mysqli-stmt.get-warnings.php - * @param mysqli_stmt $stmt - * @return object - */ -function mysqli_stmt_get_warnings (mysqli_stmt $stmt) {} - -/** - * (PHP 5)
- * Initializes a statement and returns an object for use with mysqli_stmt_prepare - * @link http://php.net/manual/en/mysqli.stmt-init.php - * @param mysqli $link - * @return mysqli_stmt an object. - */ -function mysqli_stmt_init (mysqli $link) {} - -/** - * (PHP 5)
- * Get the ID generated from the previous INSERT operation - * @link http://php.net/manual/en/mysqli-stmt.insert-id.php - * @param mysqli_stmt $stmt - * @return mixed - */ -function mysqli_stmt_insert_id (mysqli_stmt $stmt) {} - -/** - * (PHP 5)
- * Return the number of rows in statements result set - * @link http://php.net/manual/en/mysqli-stmt.num-rows.php - * @param mysqli_stmt $stmt - * @return int An integer representing the number of rows in result set. - */ -function mysqli_stmt_num_rows (mysqli_stmt $stmt) {} - -/** - * (PHP 5)
- * Returns the number of parameter for the given statement - * @link http://php.net/manual/en/mysqli-stmt.param-count.php - * @param mysqli_stmt $stmt - * @return int an integer representing the number of parameters. - */ -function mysqli_stmt_param_count (mysqli_stmt $stmt) {} - -/** - * (PHP 5)
- * Prepare an SQL statement for execution - * @link http://php.net/manual/en/mysqli-stmt.prepare.php - * @param mysqli_stmt $stmt - * @param string $query

- * The query, as a string. It must consist of a single SQL statement. - *

- *

- * You can include one or more parameter markers in the SQL statement by - * embedding question mark (?) characters at the - * appropriate positions. - *

- *

- * You should not add a terminating semicolon or \g - * to the statement. - *

- *

- * The markers are legal only in certain places in SQL statements. - * For example, they are allowed in the VALUES() list of an INSERT statement - * (to specify column values for a row), or in a comparison with a column in - * a WHERE clause to specify a comparison value. - *

- *

- * However, they are not allowed for identifiers (such as table or column names), - * in the select list that names the columns to be returned by a SELECT statement), - * or to specify both operands of a binary operator such as the = - * equal sign. The latter restriction is necessary because it would be impossible - * to determine the parameter type. In general, parameters are legal only in Data - * Manipulation Language (DML) statements, and not in Data Definition Language - * (DDL) statements. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_stmt_prepare (mysqli_stmt $stmt, $query) {} - -/** - * (PHP 5)
- * Resets a prepared statement - * @link http://php.net/manual/en/mysqli-stmt.reset.php - * @param mysqli_stmt $stmt - * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_stmt_reset (mysqli_stmt $stmt) {} - -/** - * (PHP 5)
- * Returns result set metadata from a prepared statement - * @link http://php.net/manual/en/mysqli-stmt.result-metadata.php - * @param mysqli_stmt $stmt - * @return mysqli_result a result object or FALSE if an error occurred. - */ -function mysqli_stmt_result_metadata (mysqli_stmt $stmt) {} - -/** - * (PHP 5)
- * Send data in blocks - * @link http://php.net/manual/en/mysqli-stmt.send-long-data.php - * @param mysqli_stmt $stmt - * @param int $param_nr

- * Indicates which parameter to associate the data with. Parameters are - * numbered beginning with 0. - *

- * @param string $data

- * A string containing data to be sent. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_stmt_send_long_data (mysqli_stmt $stmt, $param_nr, $data) {} - -/** - * (PHP 5)
- * Transfers a result set from a prepared statement - * @link http://php.net/manual/en/mysqli-stmt.store-result.php - * @param mysqli_stmt $stmt - * @return bool TRUE on success or FALSE on failure. - */ -function mysqli_stmt_store_result (mysqli_stmt $stmt) {} - -/** - * (PHP 5)
- * Returns SQLSTATE error from previous statement operation - * @link http://php.net/manual/en/mysqli-stmt.sqlstate.php - * @param mysqli_stmt $stmt - * @return string a string containing the SQLSTATE error code for the last error. - * The error code consists of five characters. '00000' means no error. - */ -function mysqli_stmt_sqlstate (mysqli_stmt $stmt) {} - -/** - * (PHP 5)
- * Returns the SQLSTATE error from previous MySQL operation - * @link http://php.net/manual/en/mysqli.sqlstate.php - * @param mysqli $link - * @return string a string containing the SQLSTATE error code for the last error. - * The error code consists of five characters. '00000' means no error. - */ -function mysqli_sqlstate (mysqli $link) {} - -/** - * (PHP 5)
- * Used for establishing secure connections using SSL - * @link http://php.net/manual/en/mysqli.ssl-set.php - * @param mysqli $link - * @param string $key

- * The path name to the key file. - *

- * @param string $cert

- * The path name to the certificate file. - *

- * @param string $ca

- * The path name to the certificate authority file. - *

- * @param string $capath

- * The pathname to a directory that contains trusted SSL CA certificates - * in PEM format. - *

- * @param string $cipher

- * A list of allowable ciphers to use for SSL encryption. - *

- * @return bool This function always returns TRUE value. If SSL setup is - * incorrect mysqli_real_connect will return an error - * when you attempt to connect. - */ -function mysqli_ssl_set (mysqli $link, $key, $cert, $ca, $capath, $cipher) {} - -/** - * (PHP 5)
- * Gets the current system status - * @link http://php.net/manual/en/mysqli.stat.php - * @param mysqli $link - * @return string A string describing the server status. FALSE if an error occurred. - */ -function mysqli_stat (mysqli $link) {} - -/** - * (PHP 5)
- * Transfers a result set from the last query - * @link http://php.net/manual/en/mysqli.store-result.php - * @param mysqli $link - * @return mysqli_result a buffered result object or FALSE if an error occurred. - *

- *

- * mysqli_store_result returns FALSE in case the query - * didn't return a result set (if the query was, for example an INSERT - * statement). This function also returns FALSE if the reading of the - * result set failed. You can check if you have got an error by checking - * if mysqli_error doesn't return an empty string, if - * mysqli_errno returns a non zero value, or if - * mysqli_field_count returns a non zero value. - * Also possible reason for this function returning FALSE after - * successful call to mysqli_query can be too large - * result set (memory for it cannot be allocated). If - * mysqli_field_count returns a non-zero value, the - * statement should have produced a non-empty result set. - */ -function mysqli_store_result (mysqli $link) {} - -/** - * (PHP 5)
- * Returns the thread ID for the current connection - * @link http://php.net/manual/en/mysqli.thread-id.php - * @param mysqli $link - * @return int the Thread ID for the current connection. - */ -function mysqli_thread_id (mysqli $link) {} - -/** - * (PHP 5)
- * Returns whether thread safety is given or not - * @link http://php.net/manual/en/mysqli.thread-safe.php - * @return bool TRUE if the client library is thread-safe, otherwise FALSE. - */ -function mysqli_thread_safe () {} - -/** - * (PHP 5)
- * Initiate a result set retrieval - * @link http://php.net/manual/en/mysqli.use-result.php - * @param mysqli $link - * @return mysqli_result an unbuffered result object or FALSE if an error occurred. - */ -function mysqli_use_result (mysqli $link) {} - -/** - * (PHP 5)
- * Returns the number of warnings from the last query for the given link - * @link http://php.net/manual/en/mysqli.warning-count.php - * @param mysqli $link - * @return int Number of warnings or zero if there are no warnings. - */ -function mysqli_warning_count (mysqli $link) {} - -/** - * (PHP 5 <= 5.3.0)
- * Refreshes - * @link http://php.net/manual/en/mysqli.refresh.php - * @param resource $link - * @param int $options

- * The options to refresh, using the MYSQLI_REFRESH_* constants as documented - * within the MySQLi constants documentation. - *

- *

- * See also the official MySQL Refresh - * documentation. - *

- * @return int TRUE if the refresh was a success, otherwise FALSE - */ -function mysqli_refresh ($link, $options) {} - -/** - * (PHP 5)
- * Alias of mysqli_real_escape_string - * @link http://php.net/manual/en/function.mysqli-escape-string.php - * @param $link - * @param $query - */ -function mysqli_escape_string ($link, $query) {} - -/** - * (PHP 5)
- * Alias of mysqli_options - * @link http://php.net/manual/en/function.mysqli-set-opt.php - */ -function mysqli_set_opt () {} - - -/** - *

- * Read options from the named group from my.cnf - * or the file specified with MYSQLI_READ_DEFAULT_FILE - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_READ_DEFAULT_GROUP', 5); - -/** - *

- * Read options from the named option file instead of from my.cnf - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_READ_DEFAULT_FILE', 4); - -/** - *

- * Connect timeout in seconds - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_OPT_CONNECT_TIMEOUT', 0); - -/** - *

- * Enables command LOAD LOCAL INFILE - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_OPT_LOCAL_INFILE', 8); - -/** - *

- * Command to execute when connecting to MySQL server. Will automatically be re-executed when reconnecting. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_INIT_COMMAND', 3); -define ('MYSQLI_OPT_SSL_VERIFY_SERVER_CERT', 21); - -/** - *

- * Use SSL (encrypted protocol). This option should not be set by application programs; - * it is set internally in the MySQL client library - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_CLIENT_SSL', 2048); - -/** - *

- * Use compression protocol - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_CLIENT_COMPRESS', 32); - -/** - *

- * Allow interactive_timeout seconds - * (instead of wait_timeout seconds) of inactivity before - * closing the connection. The client's session - * wait_timeout variable will be set to - * the value of the session interactive_timeout variable. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_CLIENT_INTERACTIVE', 1024); - -/** - *

- * Allow spaces after function names. Makes all functions names reserved words. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_CLIENT_IGNORE_SPACE', 256); - -/** - *

- * Don't allow the db_name.tbl_name.col_name syntax. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_CLIENT_NO_SCHEMA', 16); -define ('MYSQLI_CLIENT_FOUND_ROWS', 2); - -/** - *

- * For using buffered resultsets - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_STORE_RESULT', 0); - -/** - *

- * For using unbuffered resultsets - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_USE_RESULT', 1); - -/** - *

- * Columns are returned into the array having the fieldname as the array index. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_ASSOC', 1); - -/** - *

- * Columns are returned into the array having an enumerated index. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_NUM', 2); - -/** - *

- * Columns are returned into the array having both a numerical index and the fieldname as the associative index. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_BOTH', 3); - -/** - *

- *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH', 0); - -/** - *

- *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_STMT_ATTR_CURSOR_TYPE', 1); - -/** - *

- *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_CURSOR_TYPE_NO_CURSOR', 0); - -/** - *

- *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_CURSOR_TYPE_READ_ONLY', 1); - -/** - *

- *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_CURSOR_TYPE_FOR_UPDATE', 2); - -/** - *

- *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_CURSOR_TYPE_SCROLLABLE', 4); - -/** - *

- *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_STMT_ATTR_PREFETCH_ROWS', 2); - -/** - *

- * Indicates that a field is defined as NOT NULL - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_NOT_NULL_FLAG', 1); - -/** - *

- * Field is part of a primary index - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_PRI_KEY_FLAG', 2); - -/** - *

- * Field is part of a unique index. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_UNIQUE_KEY_FLAG', 4); - -/** - *

- * Field is part of an index. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_MULTIPLE_KEY_FLAG', 8); - -/** - *

- * Field is defined as BLOB - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_BLOB_FLAG', 16); - -/** - *

- * Field is defined as UNSIGNED - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_UNSIGNED_FLAG', 32); - -/** - *

- * Field is defined as ZEROFILL - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_ZEROFILL_FLAG', 64); - -/** - *

- * Field is defined as AUTO_INCREMENT - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_AUTO_INCREMENT_FLAG', 512); - -/** - *

- * Field is defined as TIMESTAMP - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TIMESTAMP_FLAG', 1024); - -/** - *

- * Field is defined as SET - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_SET_FLAG', 2048); - -/** - *

- * Field is defined as NUMERIC - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_NUM_FLAG', 32768); - -/** - *

- * Field is part of an multi-index - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_PART_KEY_FLAG', 16384); - -/** - *

- * Field is part of GROUP BY - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_GROUP_FLAG', 32768); - -/** - *

- * Field is defined as ENUM. Available since PHP 5.3.0. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_ENUM_FLAG', 256); -define ('MYSQLI_BINARY_FLAG', 128); -define ('MYSQLI_NO_DEFAULT_VALUE_FLAG', 4096); - -/** - *

- * Field is defined as DECIMAL - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_DECIMAL', 0); - -/** - *

- * Field is defined as TINYINT - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_TINY', 1); - -/** - *

- * Field is defined as SMALLINT - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_SHORT', 2); - -/** - *

- * Field is defined as INT - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_LONG', 3); - -/** - *

- * Field is defined as FLOAT - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_FLOAT', 4); - -/** - *

- * Field is defined as DOUBLE - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_DOUBLE', 5); - -/** - *

- * Field is defined as DEFAULT NULL - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_NULL', 6); - -/** - *

- * Field is defined as TIMESTAMP - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_TIMESTAMP', 7); - -/** - *

- * Field is defined as BIGINT - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_LONGLONG', 8); - -/** - *

- * Field is defined as MEDIUMINT - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_INT24', 9); - -/** - *

- * Field is defined as DATE - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_DATE', 10); - -/** - *

- * Field is defined as TIME - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_TIME', 11); - -/** - *

- * Field is defined as DATETIME - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_DATETIME', 12); - -/** - *

- * Field is defined as YEAR - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_YEAR', 13); - -/** - *

- * Field is defined as DATE - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_NEWDATE', 14); - -/** - *

- * Field is defined as ENUM - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_ENUM', 247); - -/** - *

- * Field is defined as SET - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_SET', 248); - -/** - *

- * Field is defined as TINYBLOB - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_TINY_BLOB', 249); - -/** - *

- * Field is defined as MEDIUMBLOB - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_MEDIUM_BLOB', 250); - -/** - *

- * Field is defined as LONGBLOB - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_LONG_BLOB', 251); - -/** - *

- * Field is defined as BLOB - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_BLOB', 252); - -/** - *

- * Field is defined as VARCHAR - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_VAR_STRING', 253); - -/** - *

- * Field is defined as CHAR or BINARY - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_STRING', 254); - -/** - *

- * Field is defined as TINYINT. - * For CHAR, see MYSQLI_TYPE_STRING - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_CHAR', 1); - -/** - *

- * Field is defined as INTERVAL - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_INTERVAL', 247); - -/** - *

- * Field is defined as GEOMETRY - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_GEOMETRY', 255); - -/** - *

- * Precision math DECIMAL or NUMERIC field (MySQL 5.0.3 and up) - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_NEWDECIMAL', 246); - -/** - *

- * Field is defined as BIT (MySQL 5.0.3 and up) - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_TYPE_BIT', 16); - -/** - *

- *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_SET_CHARSET_NAME', 7); -define ('MYSQLI_SET_CHARSET_DIR', 6); - -/** - *

- * No more data available for bind variable - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_NO_DATA', 100); - -/** - *

- * Data truncation occurred. Available since PHP 5.1.0 and MySQL 5.0.5. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_DATA_TRUNCATED', 101); - -/** - *

- * Report if no index or bad index was used in a query. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_REPORT_INDEX', 4); - -/** - *

- * Report errors from mysqli function calls. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_REPORT_ERROR', 1); - -/** - *

- * Throw a mysqli_sql_exception for errors instead of warnings. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_REPORT_STRICT', 2); - -/** - *

- * Set all options on (report all). - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_REPORT_ALL', 255); - -/** - *

- * Turns reporting off. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_REPORT_OFF', 0); - -/** - *

- * Is set to 1 if mysqli_debug functionality is enabled. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_DEBUG_TRACE_ENABLED', 0); - -/** - *

- *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED', 16); - -/** - *

- *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_SERVER_QUERY_NO_INDEX_USED', 32); -define ('MYSQLI_SERVER_QUERY_WAS_SLOW', 2048); -define ('MYSQLI_SERVER_PS_OUT_PARAMS', 4096); - -/** - *

- * Refreshes the grant tables. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_REFRESH_GRANT', 1); - -/** - *

- * Flushes the logs, like executing the - * FLUSH LOGS SQL statement. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_REFRESH_LOG', 2); - -/** - *

- * Flushes the table cache, like executing the - * FLUSH TABLES SQL statement. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_REFRESH_TABLES', 4); - -/** - *

- * Flushes the host cache, like executing the - * FLUSH HOSTS SQL statement. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_REFRESH_HOSTS', 8); - -/** - *

- * Reset the status variables, like executing the - * FLUSH STATUS SQL statement. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_REFRESH_STATUS', 16); - -/** - *

- * Flushes the thread cache. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_REFRESH_THREADS', 32); - -/** - *

- * On a slave replication server: resets the master server information, and - * restarts the slave. Like executing the RESET SLAVE - * SQL statement. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_REFRESH_SLAVE', 64); - -/** - *

- * On a master replication server: removes the binary log files listed in the - * binary log index, and truncates the index file. Like executing the - * RESET MASTER SQL statement. - *

- * @link http://php.net/manual/en/mysqli.constants.php - */ -define ('MYSQLI_REFRESH_MASTER', 128); - -// End of mysqli v.0.1 -?> diff --git a/phpruntime/oci8.php b/phpruntime/oci8.php deleted file mode 100644 index d99f238..0000000 --- a/phpruntime/oci8.php +++ /dev/null @@ -1,2365 +0,0 @@ - - * Returns large object's contents - * @link http://php.net/manual/en/oci-lob.load.php - * @return string the contents of the object, or FALSE on errors. - */ - public function load () {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Returns the current position of internal pointer of large object - * @link http://php.net/manual/en/oci-lob.tell.php - * @return int current position of a LOB's internal pointer or FALSE if an - * error occurred. - */ - public function tell () {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Truncates large object - * @link http://php.net/manual/en/oci-lob.truncate.php - * @param int $length [optional]

- * If provided, this method will truncate the LOB to - * length bytes. Otherwise, it will completely - * purge the LOB. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function truncate ($length = 0) {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Erases a specified portion of the internal LOB data - * @link http://php.net/manual/en/oci-lob.erase.php - * @param int $offset [optional] - * @param int $length [optional] - * @return int the actual number of characters/bytes erased or FALSE on failure. - */ - public function erase ($offset = null, $length = null) {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Flushes/writes buffer of the LOB to the server - * @link http://php.net/manual/en/oci-lob.flush.php - * @param int $flag [optional]

- * By default, resources are not freed, but using flag - * OCI_LOB_BUFFER_FREE you can do it explicitly. - * Be sure you know what you're doing - next read/write operation to the - * same part of LOB will involve a round-trip to the server and initialize - * new buffer resources. It is recommended to use - * OCI_LOB_BUFFER_FREE flag only when you are not - * going to work with the LOB anymore. - *

- * @return bool TRUE on success or FALSE on failure. - *

- *

- * Returns FALSE if buffering was not enabled or an error occurred. - */ - public function flush ($flag = null) {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Changes current state of buffering for the large object - * @link http://php.net/manual/en/oci-lob.setbuffering.php - * @param bool $on_off

- * TRUE for on and FALSE for off. - *

- * @return bool TRUE on success or FALSE on failure. Repeated calls to this method with the same flag will - * return TRUE. - */ - public function setbuffering ($on_off) {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Returns current state of buffering for the large object - * @link http://php.net/manual/en/oci-lob.getbuffering.php - * @return bool FALSE if buffering for the large object is off and TRUE if - * buffering is used. - */ - public function getbuffering () {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Moves the internal pointer to the beginning of the large object - * @link http://php.net/manual/en/oci-lob.rewind.php - * @return bool TRUE on success or FALSE on failure. - */ - public function rewind () {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Reads part of the large object - * @link http://php.net/manual/en/oci-lob.read.php - * @param int $length

- * The length of data to read, in bytes. - *

- * @return string the contents as a string, or FALSE on failure. - */ - public function read ($length) {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Tests for end-of-file on a large object's descriptor - * @link http://php.net/manual/en/oci-lob.eof.php - * @return bool TRUE if internal pointer of large object is at the end of LOB. - * Otherwise returns FALSE. - */ - public function eof () {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Sets the internal pointer of the large object - * @link http://php.net/manual/en/oci-lob.seek.php - * @param int $offset

- * Indicates the amount of bytes, on which internal pointer should be - * moved from the position, pointed by whence. - *

- * @param int $whence [optional]

- * May be one of: - * OCI_SEEK_SET - sets the position equal to - * offset - * OCI_SEEK_CUR - adds offset - * bytes to the current position - * OCI_SEEK_END - adds offset - * bytes to the end of large object (use negative value to move to a position - * before the end of large object) - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function seek ($offset, $whence = 'OCI_SEEK_SET') {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Writes data to the large object - * @link http://php.net/manual/en/oci-lob.write.php - * @param string $data

- * The data to write in the LOB. - *

- * @param int $length [optional]

- * If this parameter is given, writing will stop after - * length bytes have been written or the end of - * data is reached, whichever comes first. - *

- * @return int the number of bytes written or FALSE on failure. - */ - public function write ($data, $length = null) {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Appends data from the large object to another large object - * @link http://php.net/manual/en/oci-lob.append.php - * @param OCI_Lob $lob_from

- * The copied LOB. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function append (OCI_Lob $lob_from) {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Returns size of large object - * @link http://php.net/manual/en/oci-lob.size.php - * @return int length of large object value or FALSE on failure. - * Empty objects have zero length. - */ - public function size () {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Alias of OCI-Lob::export - * @link http://php.net/manual/en/oci-lob.writetofile.php - * @param $filename - * @param $start [optional] - * @param $length [optional] - */ - public function writetofile ($filename, $start, $length) {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Exports LOB's contents to a file - * @link http://php.net/manual/en/oci-lob.export.php - * @param string $filename

- * Path to the file. - *

- * @param int $start [optional]

- * Indicates from where to start exporting. - *

- * @param int $length [optional]

- * Indicates the length of data to be exported. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function export ($filename, $start = null, $length = null) {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Imports file data to the LOB - * @link http://php.net/manual/en/oci-lob.import.php - * @param string $filename

- * Path to the file. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function import ($filename) {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Writes a temporary large object - * @link http://php.net/manual/en/oci-lob.writetemporary.php - * @param string $data

- * The data to write. - *

- * @param int $lob_type [optional]

- * Can be one of the following: - * OCI_TEMP_BLOB is used to create temporary BLOBs - * OCI_TEMP_CLOB is used to create - * temporary CLOBs - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function writetemporary ($data, $lob_type = 'OCI_TEMP_CLOB') {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Closes LOB descriptor - * @link http://php.net/manual/en/oci-lob.close.php - * @return bool TRUE on success or FALSE on failure. - */ - public function close () {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Saves data to the large object - * @link http://php.net/manual/en/oci-lob.save.php - * @param string $data

- * The data to be saved. - *

- * @param int $offset [optional]

- * Can be used to indicate offset from the beginning of the large object. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function save ($data, $offset = null) {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Alias of OCI-Lob::import - * @link http://php.net/manual/en/oci-lob.savefile.php - * @param $filename - */ - public function savefile ($filename) {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Frees resources associated with the LOB descriptor - * @link http://php.net/manual/en/oci-lob.free.php - * @return bool TRUE on success or FALSE on failure. - */ - public function free () {} - -} - -class OCI_Collection { - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Appends element to the collection - * @link http://php.net/manual/en/oci-collection.append.php - * @param mixed $value

- * The value to be added to the collection. Can be a string or a number. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function append ($value) {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Returns value of the element - * @link http://php.net/manual/en/oci-collection.getelem.php - * @param int $index

- * The element index. First index is 0. - *

- * @return mixed FALSE if such element doesn't exist; NULL if element is NULL; - * string if element is column of a string datatype or number if element is - * numeric field. - */ - public function getelem ($index) {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Assigns a value to the element of the collection - * @link http://php.net/manual/en/oci-collection.assignelem.php - * @param int $index

- * The element index. First index is 0. - *

- * @param mixed $value

- * Can be a string or a number. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function assignelem ($index, $value) {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Assigns a value to the collection from another existing collection - * @link http://php.net/manual/en/oci-collection.assign.php - * @param OCI_Collection $from

- * An instance of OCI-Collection. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function assign (OCI_Collection $from) {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Returns size of the collection - * @link http://php.net/manual/en/oci-collection.size.php - * @return int the number of elements in the collection or FALSE on error. - */ - public function size () {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Returns the maximum number of elements in the collection - * @link http://php.net/manual/en/oci-collection.max.php - * @return int the maximum number as an integer, or FALSE on errors. - *

- *

- * If the returned value is 0, then the number of elements is not limited. - */ - public function max () {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Trims elements from the end of the collection - * @link http://php.net/manual/en/oci-collection.trim.php - * @param int $num

- * The number of elements to be trimmed. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function trim ($num) {} - - /** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Frees the resources associated with the collection object - * @link http://php.net/manual/en/oci-collection.free.php - * @return bool TRUE on success or FALSE on failure. - */ - public function free () {} - -} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Associates a PHP variable with a column for query fetches - * @link http://php.net/manual/en/function.oci-define-by-name.php - * @param resource $statement A valid OCI8 statement - * identifier created by oci_parse and executed - * by oci_execute, or a REF - * CURSOR statement identifier.

- * @param string $column_name

- * The column name used in the query. - *

- *

- * Use uppercase for Oracle's default, non-case sensitive column - * names. Use the exact column name case for case-sensitive - * column names. - *

- * @param mixed $variable

- * The PHP variable that will contain the returned column value. - *

- * @param int $type [optional]

- * The data type to be returned. Generally not needed. Note that - * Oracle-style data conversions are not performed. For example, - * SQLT_INT will be ignored and the returned - * data type will still be SQLT_CHR. - *

- *

- * You can optionally use oci_new_descriptor - * to allocate LOB/ROWID/BFILE descriptors. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function oci_define_by_name ($statement, $column_name, &$variable, $type = 'SQLT_CHR') {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Binds a PHP variable to an Oracle placeholder - * @link http://php.net/manual/en/function.oci-bind-by-name.php - * @param resource $statement

- * A valid OCI8 statement identifer. - *

- * @param string $bv_name

- * The colon-prefixed bind variable placeholder used in the - * statement. The colon is optional - * in bv_name. Oracle does not use question - * marks for placeholders. - *

- * @param mixed $variable

- * The PHP variable to be associated with bv_name - *

- * @param int $maxlength [optional]

- * Sets the maximum length for the data. If you set it to -1, this - * function will use the current length - * of variable to set the maximum - * length. In this case the variable must - * exist and contain data - * when oci_bind_by_name is called. - *

- * @param int $type [optional]

- * The datatype that Oracle will treat the data as. The - * default type used - * is SQLT_CHR. Oracle will convert the data - * between this type and the database column (or PL/SQL variable - * type), when possible. - *

- *

- * If you need to bind an abstract datatype (LOB/ROWID/BFILE) you - * need to allocate it first using the - * oci_new_descriptor function. The - * length is not used for abstract datatypes - * and should be set to -1. - *

- *

- * Possible values for type are: - *

- * SQLT_BFILEE or OCI_B_BFILE - * - for BFILEs; - *

- * @return bool TRUE on success or FALSE on failure. - */ -function oci_bind_by_name ($statement, $bv_name, &$variable, $maxlength = -1, $type = 'SQLT_CHR') {} - -/** - * (PHP 5 >= 5.1.2, PECL OCI8 >= 1.2.0)
- * Binds a PHP array to an Oracle PL/SQL array parameter - * @link http://php.net/manual/en/function.oci-bind-array-by-name.php - * @param resource $statement

- * A valid OCI statement identifier. - *

- * @param string $name

- * The Oracle placeholder. - *

- * @param array $var_array

- * An array. - *

- * @param int $max_table_length

- * Sets the maximum length both for incoming and result arrays. - *

- * @param int $max_item_length [optional]

- * Sets maximum length for array items. If not specified or equals to -1, - * oci_bind_array_by_name will find the longest - * element in the incoming array and will use it as the maximum length. - *

- * @param int $type [optional]

- * Should be used to set the type of PL/SQL array items. See list of - * available types below: - *

- *

- *

- * SQLT_NUM - for arrays of NUMBER. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function oci_bind_array_by_name ($statement, $name, array &$var_array, $max_table_length, $max_item_length = -1, $type = 'SQLT_AFC') {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Checks if the field is NULL - * @link http://php.net/manual/en/function.oci-field-is-null.php - * @param resource $statement

- * A valid OCI statement identifier. - *

- * @param mixed $field

- * Can be a field's index or a field's name (uppercased). - *

- * @return bool TRUE if field is NULL, FALSE otherwise. - */ -function oci_field_is_null ($statement, $field) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Returns the name of a field from the statement - * @link http://php.net/manual/en/function.oci-field-name.php - * @param resource $statement

- * A valid OCI statement identifier. - *

- * @param int $field

- * Can be the field's index (1-based) or name. - *

- * @return string the name as a string, or FALSE on errors. - */ -function oci_field_name ($statement, $field) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Returns field's size - * @link http://php.net/manual/en/function.oci-field-size.php - * @param resource $statement

- * A valid OCI statement identifier. - *

- * @param mixed $field

- * Can be the field's index (1-based) or name. - *

- * @return int the size of a field in bytes, or FALSE on - * errors. - */ -function oci_field_size ($statement, $field) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Tell the scale of the field - * @link http://php.net/manual/en/function.oci-field-scale.php - * @param resource $statement

- * A valid OCI statement identifier. - *

- * @param int $field

- * Can be the field's index (1-based) or name. - *

- * @return int the scale as an integer, or FALSE on errors. - */ -function oci_field_scale ($statement, $field) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Tell the precision of a field - * @link http://php.net/manual/en/function.oci-field-precision.php - * @param resource $statement

- * A valid OCI statement identifier. - *

- * @param int $field

- * Can be the field's index (1-based) or name. - *

- * @return int the precision as an integer, or FALSE on errors. - */ -function oci_field_precision ($statement, $field) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Returns field's data type - * @link http://php.net/manual/en/function.oci-field-type.php - * @param resource $statement

- * A valid OCI statement identifier. - *

- * @param int $field

- * Can be the field's index (1-based) or name. - *

- * @return mixed the field data type as a string, or FALSE on errors. - */ -function oci_field_type ($statement, $field) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Tell the raw Oracle data type of the field - * @link http://php.net/manual/en/function.oci-field-type-raw.php - * @param resource $statement

- * A valid OCI statement identifier. - *

- * @param int $field

- * Can be the field's index (1-based) or name. - *

- * @return int Oracle's raw data type as a string, or FALSE on errors. - */ -function oci_field_type_raw ($statement, $field) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Executes a statement - * @link http://php.net/manual/en/function.oci-execute.php - * @param resource $statement

- * A valid OCI statement identifier. - *

- * @param int $mode [optional]

- * An optional second parameter can be one of the following constants: - * - * Execution Modes - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
ConstantDescription
OCI_COMMIT_ON_SUCCESSAutomatically commit all outstanding changes for - * this connection when the statement has succeeded. This - * is the default.
OCI_DEFAULTObsolete as of PHP 5.3.2 (PECL OCI8 1.4) but still - * available for backward compatibility. Use the - * equivalent OCI_NO_AUTO_COMMIT in new - * code.
OCI_DESCRIBE_ONLYMake query meta data available to functions - * like oci_field_name but do not - * create a result set. Any subsequent fetch call such - * as oci_fetch_array will - * fail.
OCI_NO_AUTO_COMMITDo not automatically commit changes. Prior to PHP - * 5.3.2 (PECL OCI8 1.4) - * use OCI_DEFAULT which is an alias - * for OCI_NO_AUTO_COMMIT.
- *

- *

- * Using OCI_NO_AUTO_COMMIT mode starts a - * transaction. Transactions are automatically rolled back when - * the connection is closed, or when the script ends. Explicitly - * call oci_commit to commit a transaction, - * or oci_rollback to abort it. - *

- *

- * When inserting or updating data, using transactions is - * recommended for relational data consistency and for performance - * reasons. - *

- *

- * If OCI_NO_AUTO_COMMIT mode is used for any - * statement including queries, and - * oci_commit - * or oci_rollback is not subsequently - * called, then OCI8 will perform a rollback at the end of the - * script even if no data was changed. To avoid an unnecessary - * rollback, many scripts do not - * use OCI_NO_AUTO_COMMIT mode for queries or - * PL/SQL. Be careful to ensure the appropriate transactional - * consistency for the application when - * using oci_execute with different modes in - * the same script. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function oci_execute ($statement, $mode = 'OCI_COMMIT_ON_SUCCESS') {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Cancels reading from cursor - * @link http://php.net/manual/en/function.oci-cancel.php - * @param resource $statement

- * An OCI statement. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function oci_cancel ($statement) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Fetches the next row from a query into internal buffers - * @link http://php.net/manual/en/function.oci-fetch.php - * @param resource $statement A valid OCI8 statement - * identifier created by oci_parse and executed - * by oci_execute, or a REF - * CURSOR statement identifier.

- * @return bool TRUE on success or FALSE if there are no more rows in the - * statement. - */ -function oci_fetch ($statement) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Returns the next row from a query as an object - * @link http://php.net/manual/en/function.oci-fetch-object.php - * @param resource $statement A valid OCI8 statement - * identifier created by oci_parse and executed - * by oci_execute, or a REF - * CURSOR statement identifier.

- * @return object an object. Each attribute of the object corresponds to a - * column of the row. If there are no more rows in - * the statement then FALSE is returned. - *

- *

- * Any LOB columns are returned as LOB descriptors. - *

- *

- * DATE columns are returned as strings formatted - * to the current date format. The default format can be changed with - * Oracle environment variables such as NLS_LANG or - * by a previously executed ALTER SESSION SET - * NLS_DATE_FORMAT command. - *

- *

- * Oracle's default, non-case sensitive column names will have - * uppercase attribute names. Case-sensitive column names will have - * attribute names using the exact column case. - * Use var_dump on the result object to verify - * the appropriate case to use for each query. - *

- *

- * Attribute values will be NULL for any NULL - * data fields. - */ -function oci_fetch_object ($statement) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Returns the next row from a query as a numeric array - * @link http://php.net/manual/en/function.oci-fetch-row.php - * @param resource $statement A valid OCI8 statement - * identifier created by oci_parse and executed - * by oci_execute, or a REF - * CURSOR statement identifier.

- * @return array a numerically indexed array. If there are no more rows in - * the statement then FALSE is returned. - */ -function oci_fetch_row ($statement) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Returns the next row from a query as an associative array - * @link http://php.net/manual/en/function.oci-fetch-assoc.php - * @param resource $statement A valid OCI8 statement - * identifier created by oci_parse and executed - * by oci_execute, or a REF - * CURSOR statement identifier.

- * @return array an associative array. If there are no more rows in - * the statement then FALSE is returned. - */ -function oci_fetch_assoc ($statement) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Returns the next row from a query as an associative or numeric array - * @link http://php.net/manual/en/function.oci-fetch-array.php - * @param resource $statement A valid OCI8 statement - * identifier created by oci_parse and executed - * by oci_execute, or a REF - * CURSOR statement identifier.

- * @param int $mode [optional]

- * An optional second parameter can be any combination of the following - * constants: - * - * oci_fetch_array Modes - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
ConstantDescription
OCI_BOTHReturns an array with both associative and numeric - * indices. This is the same - * as OCI_ASSOC - * + OCI_NUM and is the default - * behavior.
OCI_ASSOCReturns an associative array.
OCI_NUMReturns a numeric array.
OCI_RETURN_NULLSCreates elements for NULL fields. The element - * values will be a PHP NULL. - *
OCI_RETURN_LOBSReturns the contents of LOBs instead of the LOB - * descriptors.
- *

- *

- * The default mode is OCI_BOTH. - *

- *

- * Use the addition operator "+" to specify more than - * one mode at a time. - *

- * @return array an array with associative and/or numeric indices. If there - * are no more rows in the statement then - * FALSE is returned. - *

- *

- * By default, LOB columns are returned as LOB descriptors. - *

- *

- * DATE columns are returned as strings formatted - * to the current date format. The default format can be changed with - * Oracle environment variables such as NLS_LANG or - * by a previously executed ALTER SESSION SET - * NLS_DATE_FORMAT command. - *

- *

- * Oracle's default, non-case sensitive column names will have - * uppercase associative indices in the result array. Case-sensitive - * column names will have array indices using the exact column case. - * Use var_dump on the result array to verify the - * appropriate case to use for each query. - */ -function oci_fetch_array ($statement, $mode = null) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Fetches the next row into an array (deprecated) - * @link http://php.net/manual/en/function.ocifetchinto.php - */ -function ocifetchinto ($statement, array &$result, $mode = 'OCI_ASSOC + OCI_NUM') {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Fetches multiple rows from a query into a two-dimensional array - * @link http://php.net/manual/en/function.oci-fetch-all.php - * @param resource $statement A valid OCI8 statement - * identifier created by oci_parse and executed - * by oci_execute, or a REF - * CURSOR statement identifier.

- * @param array $output

- * The variable to contain the returned rows. - *

- *

- * LOB columns are returned as strings, where Oracle supports - * conversion. - *

- *

- * See oci_fetch_array for more information - * on how data and types are fetched. - *

- * @param int $skip [optional]

- * The number of initial rows to discard when fetching the - * result. The default value is 0, so the first row onwards is - * returned. - *

- * @param int $maxrows [optional]

- * The number of rows to return. The default is -1 meaning return - * all the rows from skip + 1 onwards. - *

- * @param int $flags [optional]

- * Parameter flags indicates the array - * structure and whether associative arrays should be used. - * - * oci_fetch_all Array Structure Modes - * - * - * - * - * - * - * - * - * - * - * - * - *
ConstantDescription
OCI_FETCHSTATEMENT_BY_ROWThe outer array will contain one sub-array per query - * row.
OCI_FETCHSTATEMENT_BY_COLUMNThe outer array will contain one sub-array per query - * column. This is the default.
- *

- *

- * Arrays can be indexed by column heading or numerically. - * - * oci_fetch_all Array Index Modes - * - * - * - * - * - * - * - * - * - * - * - * - *
ConstantDescription
OCI_NUMNumeric indexes are used for each column's array.
OCI_ASSOCAssociative indexes are used for each column's - * array. This is the default.
- *

- *

- * Use the addition operator "+" to choose a combination - * of array structure and index modes. - *

- *

- * Oracle's default, non-case sensitive column names will have - * uppercase array keys. Case-sensitive column names will have - * array keys using the exact column case. - * Use var_dump - * on output to verify the appropriate case - * to use for each query. - *

- *

- * Queries that have more than one column with the same name - * should use column aliases. Otherwise only one of the columns - * will appear in an associative array. - *

- * @return int the number of rows in output, which - * may be 0 or more, or FALSE on failure. - */ -function oci_fetch_all ($statement, array &$output, $skip = 0, $maxrows = -1, $flags = 'OCI_FETCHSTATEMENT_BY_COLUMN + OCI_ASSOC') {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Frees all resources associated with statement or cursor - * @link http://php.net/manual/en/function.oci-free-statement.php - * @param resource $statement

- * A valid OCI statement identifier. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function oci_free_statement ($statement) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Enables or disables internal debug output - * @link http://php.net/manual/en/function.oci-internal-debug.php - * @param bool $onoff

- * Set this to FALSE to turn debug output off or TRUE to turn it on. - *

- * @return void No value is returned. - */ -function oci_internal_debug ($onoff) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Returns the number of result columns in a statement - * @link http://php.net/manual/en/function.oci-num-fields.php - * @param resource $statement

- * A valid OCI statement identifier. - *

- * @return int the number of columns as an integer, or FALSE on errors. - */ -function oci_num_fields ($statement) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Prepares an Oracle statement for execution - * @link http://php.net/manual/en/function.oci-parse.php - * @param resource $connection

- * An Oracle connection identifier, returned by - * oci_connect, oci_pconnect, or oci_new_connect. - *

- * @param string $sql_text

- * The SQL or PL/SQL statement. - *

- *

- * SQL statements should not end with a - * semi-colon (";"). PL/SQL - * statements should end with a semi-colon - * (";"). - *

- * @return resource a statement handle on success, or FALSE on error. - */ -function oci_parse ($connection, $sql_text) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Allocates and returns a new cursor (statement handle) - * @link http://php.net/manual/en/function.oci-new-cursor.php - * @param resource $connection

- * An Oracle connection identifier, returned by - * oci_connect or oci_pconnect. - *

- * @return resource a new statement handle, or FALSE on error. - */ -function oci_new_cursor ($connection) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Returns field's value from the fetched row - * @link http://php.net/manual/en/function.oci-result.php - * @param resource $statement - * @param mixed $field

- * Can be either use the column number (1-based) or the column name (in - * uppercase). - *

- * @return mixed everything as strings except for abstract types (ROWIDs, LOBs and - * FILEs). Returns FALSE on error. - */ -function oci_result ($statement, $field) {} - -/** - * (PHP 5.3.7, PECL OCI8 >= 1.4.6)
- * Returns the Oracle client library version - * @link http://php.net/manual/en/function.oci-client-version.php - * @return string the version number as a string. - */ -function oci_client_version () {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Returns the Oracle Database version - * @link http://php.net/manual/en/function.oci-server-version.php - * @param resource $connection - * @return string the version information as a string or FALSE on error. - */ -function oci_server_version ($connection) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Returns the type of a statement - * @link http://php.net/manual/en/function.oci-statement-type.php - * @param resource $statement

- * A valid OCI8 statement identifier from oci_parse. - *

- * @return string the type of statement as one of the - * following strings. - * - * Statement type - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Return StringNotes
ALTER
BEGIN
CALLIntroduced in PHP 5.2.1 (PECL OCI8 1.2.3)
CREATE
DECLARE
DELETE
DROP
INSERT
SELECT
UPDATE
UNKNOWN
- *

- *

- * Returns FALSE on error. - */ -function oci_statement_type ($statement) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Returns number of rows affected during statement execution - * @link http://php.net/manual/en/function.oci-num-rows.php - * @param resource $statement

- * A valid OCI statement identifier. - *

- * @return int the number of rows affected as an integer, or FALSE on errors. - */ -function oci_num_rows ($statement) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Closes an Oracle connection - * @link http://php.net/manual/en/function.oci-close.php - * @param resource $connection

- * An Oracle connection identifier returned by - * oci_connect, oci_pconnect, - * or oci_new_connect. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function oci_close ($connection) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Connect to an Oracle database - * @link http://php.net/manual/en/function.oci-connect.php - * @param string $username

- * The Oracle user name. - *

- * @param string $password

- * The password for username. - *

- * @param string $connection_string [optional] Contains - * the Oracle instance to connect to. It can be - * an Easy Connect - * string, or a Connect Name from - * the tnsnames.ora file, or the name of a local - * Oracle instance. - *

- * If not specified, PHP uses - * environment variables such as TWO_TASK (on Linux) - * or LOCAL (on Windows) - * and ORACLE_SID to determine the - * Oracle instance to connect to. - *

- * To use the Easy Connect naming method, PHP must be linked with Oracle - * 10g or greater Client libraries. The Easy Connect string for Oracle - * 10g is of the form: - * [//]host_name[:port][/service_name]. With Oracle - * 11g, the syntax is: - * [//]host_name[:port][/service_name][:server_type][/instance_name]. - * Service names can be found by running the Oracle - * utility lsnrctl status on the database server - * machine. - *

- * The tnsnames.ora file can be in the Oracle Net - * search path, which - * includes $ORACLE_HOME/network/admin - * and /etc. Alternatively - * set TNS_ADMIN so - * that $TNS_ADMIN/tnsnames.ora is read. Make sure - * the web daemon has read access to the file. - *

- * @param string $character_set [optional] Determines - * the character set used by the Oracle Client libraries. The character - * set does not need to match the character set used by the database. If - * it doesn't match, Oracle will do its best to convert data to and from - * the database character set. Depending on the character sets this may - * not give usable results. Conversion also adds some time overhead. - *

- * If not specified, the - * Oracle Client libraries determine a character set from - * the NLS_LANG environment variable. - *

- * Passing this parameter can - * reduce connection time. - *

- * @param int $session_mode [optional] This - * parameter is available since version PHP 5 (PECL OCI8 1.1) and accepts the - * following values: OCI_DEFAULT, - * OCI_SYSOPER and OCI_SYSDBA. - * If either OCI_SYSOPER or - * OCI_SYSDBA were specified, this function will try - * to establish privileged connection using external credentials. - * Privileged connections are disabled by default. To enable them you - * need to set oci8.privileged_connect - * to On. - *

- * PHP 5.3 (PECL OCI8 1.3.4) introduced the - * OCI_CRED_EXT mode value. This tells Oracle to use - * External or OS authentication, which must be configured in the - * database. The OCI_CRED_EXT flag can only be used - * with username of "/" and a empty password. - * oci8.privileged_connect - * may be On or Off. - *

- * OCI_CRED_EXT may be combined with the - * OCI_SYSOPER or - * OCI_SYSDBA modes. - *

- * OCI_CRED_EXT is not supported on Windows for - * security reasons. - *

- * @return resource a connection identifier or FALSE on error. - */ -function oci_connect ($username, $password, $connection_string = null, $character_set = null, $session_mode = null) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Connect to the Oracle server using a unique connection - * @link http://php.net/manual/en/function.oci-new-connect.php - * @param string $username

- * The Oracle user name. - *

- * @param string $password

- * The password for username. - *

- * @param string $connection_string [optional] Contains - * the Oracle instance to connect to. It can be - * an Easy Connect - * string, or a Connect Name from - * the tnsnames.ora file, or the name of a local - * Oracle instance. - *

- * If not specified, PHP uses - * environment variables such as TWO_TASK (on Linux) - * or LOCAL (on Windows) - * and ORACLE_SID to determine the - * Oracle instance to connect to. - *

- * To use the Easy Connect naming method, PHP must be linked with Oracle - * 10g or greater Client libraries. The Easy Connect string for Oracle - * 10g is of the form: - * [//]host_name[:port][/service_name]. With Oracle - * 11g, the syntax is: - * [//]host_name[:port][/service_name][:server_type][/instance_name]. - * Service names can be found by running the Oracle - * utility lsnrctl status on the database server - * machine. - *

- * The tnsnames.ora file can be in the Oracle Net - * search path, which - * includes $ORACLE_HOME/network/admin - * and /etc. Alternatively - * set TNS_ADMIN so - * that $TNS_ADMIN/tnsnames.ora is read. Make sure - * the web daemon has read access to the file. - *

- * @param string $character_set [optional] Determines - * the character set used by the Oracle Client libraries. The character - * set does not need to match the character set used by the database. If - * it doesn't match, Oracle will do its best to convert data to and from - * the database character set. Depending on the character sets this may - * not give usable results. Conversion also adds some time overhead. - *

- * If not specified, the - * Oracle Client libraries determine a character set from - * the NLS_LANG environment variable. - *

- * Passing this parameter can - * reduce connection time. - *

- * @param int $session_mode [optional] This - * parameter is available since version PHP 5 (PECL OCI8 1.1) and accepts the - * following values: OCI_DEFAULT, - * OCI_SYSOPER and OCI_SYSDBA. - * If either OCI_SYSOPER or - * OCI_SYSDBA were specified, this function will try - * to establish privileged connection using external credentials. - * Privileged connections are disabled by default. To enable them you - * need to set oci8.privileged_connect - * to On. - *

- * PHP 5.3 (PECL OCI8 1.3.4) introduced the - * OCI_CRED_EXT mode value. This tells Oracle to use - * External or OS authentication, which must be configured in the - * database. The OCI_CRED_EXT flag can only be used - * with username of "/" and a empty password. - * oci8.privileged_connect - * may be On or Off. - *

- * OCI_CRED_EXT may be combined with the - * OCI_SYSOPER or - * OCI_SYSDBA modes. - *

- * OCI_CRED_EXT is not supported on Windows for - * security reasons. - *

- * @return resource a connection identifier or FALSE on error. - */ -function oci_new_connect ($username, $password, $connection_string = null, $character_set = null, $session_mode = null) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Connect to an Oracle database using a persistent connection - * @link http://php.net/manual/en/function.oci-pconnect.php - * @param string $username

- * The Oracle user name. - *

- * @param string $password

- * The password for username. - *

- * @param string $connection_string [optional] Contains - * the Oracle instance to connect to. It can be - * an Easy Connect - * string, or a Connect Name from - * the tnsnames.ora file, or the name of a local - * Oracle instance. - *

- * If not specified, PHP uses - * environment variables such as TWO_TASK (on Linux) - * or LOCAL (on Windows) - * and ORACLE_SID to determine the - * Oracle instance to connect to. - *

- * To use the Easy Connect naming method, PHP must be linked with Oracle - * 10g or greater Client libraries. The Easy Connect string for Oracle - * 10g is of the form: - * [//]host_name[:port][/service_name]. With Oracle - * 11g, the syntax is: - * [//]host_name[:port][/service_name][:server_type][/instance_name]. - * Service names can be found by running the Oracle - * utility lsnrctl status on the database server - * machine. - *

- * The tnsnames.ora file can be in the Oracle Net - * search path, which - * includes $ORACLE_HOME/network/admin - * and /etc. Alternatively - * set TNS_ADMIN so - * that $TNS_ADMIN/tnsnames.ora is read. Make sure - * the web daemon has read access to the file. - *

- * @param string $character_set [optional] Determines - * the character set used by the Oracle Client libraries. The character - * set does not need to match the character set used by the database. If - * it doesn't match, Oracle will do its best to convert data to and from - * the database character set. Depending on the character sets this may - * not give usable results. Conversion also adds some time overhead. - *

- * If not specified, the - * Oracle Client libraries determine a character set from - * the NLS_LANG environment variable. - *

- * Passing this parameter can - * reduce connection time. - *

- * @param int $session_mode [optional] This - * parameter is available since version PHP 5 (PECL OCI8 1.1) and accepts the - * following values: OCI_DEFAULT, - * OCI_SYSOPER and OCI_SYSDBA. - * If either OCI_SYSOPER or - * OCI_SYSDBA were specified, this function will try - * to establish privileged connection using external credentials. - * Privileged connections are disabled by default. To enable them you - * need to set oci8.privileged_connect - * to On. - *

- * PHP 5.3 (PECL OCI8 1.3.4) introduced the - * OCI_CRED_EXT mode value. This tells Oracle to use - * External or OS authentication, which must be configured in the - * database. The OCI_CRED_EXT flag can only be used - * with username of "/" and a empty password. - * oci8.privileged_connect - * may be On or Off. - *

- * OCI_CRED_EXT may be combined with the - * OCI_SYSOPER or - * OCI_SYSDBA modes. - *

- * OCI_CRED_EXT is not supported on Windows for - * security reasons. - *

- * @return resource a connection identifier or FALSE on error. - */ -function oci_pconnect ($username, $password, $connection_string = null, $character_set = null, $session_mode = null) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Returns the last error found - * @link http://php.net/manual/en/function.oci-error.php - * @param resource $resource [optional]

- * For most errors, resource is the - * resource handle that was passed to the failing function call. - * For connection errors with oci_connect, - * oci_new_connect or - * oci_pconnect do not pass resource. - *

- * @return array If no error is found, oci_error returns - * FALSE. Otherwise, oci_error returns the - * error information as an associative array. - *

- *

- * - * oci_error Array Description - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Array keyTypeDescription
codeinteger - * The Oracle error number. - *
messagestring - * The Oracle error text. - *
offsetinteger - * The byte position of an error in the SQL statement. If there - * was no statement, this is 0 - *
sqltextstring - * The SQL statement text. If there was no statement, this is - * an empty string. - *
- */ -function oci_error ($resource = null) {} - -/** - * @param $lob_descriptor - */ -function oci_free_descriptor ($lob_descriptor) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Compares two LOB/FILE locators for equality - * @link http://php.net/manual/en/function.oci-lob-is-equal.php - * @param OCI_Lob $lob1

- * A LOB identifier. - *

- * @param OCI_Lob $lob2

- * A LOB identifier. - *

- * @return bool TRUE if these objects are equal, FALSE otherwise. - */ -function oci_lob_is_equal (OCI_Lob $lob1, OCI_Lob $lob2) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Copies large object - * @link http://php.net/manual/en/function.oci-lob-copy.php - * @param OCI_Lob $lob_to

- * The destination LOB. - *

- * @param OCI_Lob $lob_from

- * The copied LOB. - *

- * @param int $length [optional]

- * Indicates the length of data to be copied. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function oci_lob_copy (OCI_Lob $lob_to, OCI_Lob $lob_from, $length = 0) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Commits the outstanding database transaction - * @link http://php.net/manual/en/function.oci-commit.php - * @param resource $connection

- * An Oracle connection identifier, returned by - * oci_connect, oci_pconnect, or oci_new_connect. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function oci_commit ($connection) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Rolls back the outstanding database transaction - * @link http://php.net/manual/en/function.oci-rollback.php - * @param resource $connection

- * An Oracle connection identifier, returned by - * oci_connect, oci_pconnect - * or oci_new_connect. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function oci_rollback ($connection) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Initializes a new empty LOB or FILE descriptor - * @link http://php.net/manual/en/function.oci-new-descriptor.php - * @param resource $connection

- * An Oracle connection identifier, returned by - * oci_connect or oci_pconnect. - *

- * @param int $type [optional]

- * Valid values for type are: - * OCI_DTYPE_FILE, OCI_DTYPE_LOB and - * OCI_DTYPE_ROWID. - *

- * @return OCI_Lob a new LOB or FILE descriptor on success, FALSE on error. - */ -function oci_new_descriptor ($connection, $type = 'OCI_DTYPE_LOB') {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Sets number of rows to be prefetched by queries - * @link http://php.net/manual/en/function.oci-set-prefetch.php - * @param resource $statement A valid OCI8 statement - * identifier created by oci_parse and executed - * by oci_execute, or a REF - * CURSOR statement identifier.

- * @param int $rows

- * The number of rows to be prefetched, >= 0 - *

- * @return bool TRUE on success or FALSE on failure. - */ -function oci_set_prefetch ($statement, $rows) {} - -/** - * (PHP 5.3.2, PECL OCI8 >= 1.4.0)
- * Sets the client identifier - * @link http://php.net/manual/en/function.oci-set-client-identifier.php - * @param resource $connection An Oracle connection identifier, - * returned by oci_connect, oci_pconnect, - * or oci_new_connect.

- * @param string $client_identifier

- * User chosen string up to 64 bytes long. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function oci_set_client_identifier ($connection, $client_identifier) {} - -/** - * (PHP 5.3.2, PECL OCI8 >= 1.4.0)
- * Sets the database edition - * @link http://php.net/manual/en/function.oci-set-edition.php - * @param string $edition

- * Oracle Database edition name previously created with the SQL - * "CREATE EDITION" command. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function oci_set_edition ($edition) {} - -/** - * (PHP 5.3.2, PECL OCI8 >= 1.4.0)
- * Sets the module name - * @link http://php.net/manual/en/function.oci-set-module-name.php - * @param resource $connection An Oracle connection identifier, - * returned by oci_connect, oci_pconnect, - * or oci_new_connect.

- * @param string $module_name

- * User chosen string up to 48 bytes long. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function oci_set_module_name ($connection, $module_name) {} - -/** - * (PHP 5.3.2, PECL OCI8 >= 1.4.0)
- * Sets the action name - * @link http://php.net/manual/en/function.oci-set-action.php - * @param resource $connection An Oracle connection identifier, - * returned by oci_connect, oci_pconnect, - * or oci_new_connect.

- * @param string $action_name

- * User chosen string up to 32 bytes long. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function oci_set_action ($connection, $action_name) {} - -/** - * (PHP 5.3.2, PECL OCI8 >= 1.4.0)
- * Sets the client information - * @link http://php.net/manual/en/function.oci-set-client-info.php - * @param resource $connection An Oracle connection identifier, - * returned by oci_connect, oci_pconnect, - * or oci_new_connect.

- * @param string $client_info

- * User chosen string up to 64 bytes long. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function oci_set_client_info ($connection, $client_info) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Changes password of Oracle's user - * @link http://php.net/manual/en/function.oci-password-change.php - * @param resource $connection

- * An Oracle connection identifier, returned by - * oci_connect or oci_pconnect. - *

- * @param string $username

- * The Oracle user name. - *

- * @param string $old_password

- * The old password. - *

- * @param string $new_password

- * The new password to be set. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function oci_password_change ($connection, $username, $old_password, $new_password) {} - -/** - * (PHP 5, PECL OCI8 >= 1.1.0)
- * Allocates new collection object - * @link http://php.net/manual/en/function.oci-new-collection.php - * @param resource $connection

- * An Oracle connection identifier, returned by - * oci_connect or oci_pconnect. - *

- * @param string $tdo

- * Should be a valid named type (uppercase). - *

- * @param string $schema [optional]

- * Should point to the scheme, where the named type was created. The name - * of the current user is the default value. - *

- * @return OCI_Collection a new OCICollection object or FALSE on - * error. - */ -function oci_new_collection ($connection, $tdo, $schema = null) {} - -/** - * @param $statement_resource - */ -function oci_free_cursor ($statement_resource) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_free_statement - * @link http://php.net/manual/en/function.ocifreecursor.php - */ -function ocifreecursor ($statement_resource) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_bind_by_name - * @link http://php.net/manual/en/function.ocibindbyname.php - */ -function ocibindbyname ($statement_resource, $column_name, &$variable, $maximum_length, $type) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_define_by_name - * @link http://php.net/manual/en/function.ocidefinebyname.php - */ -function ocidefinebyname ($statement_resource, $column_name, &$variable, $type) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_field_is_null - * @link http://php.net/manual/en/function.ocicolumnisnull.php - */ -function ocicolumnisnull ($statement_resource, $column_number_or_name) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_field_name - * @link http://php.net/manual/en/function.ocicolumnname.php - */ -function ocicolumnname ($statement_resource, $column_number) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_field_size - * @link http://php.net/manual/en/function.ocicolumnsize.php - */ -function ocicolumnsize ($statement_resource, $column_number_or_name) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_field_scale - * @link http://php.net/manual/en/function.ocicolumnscale.php - */ -function ocicolumnscale ($statement_resource, $column_number) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_field_precision - * @link http://php.net/manual/en/function.ocicolumnprecision.php - */ -function ocicolumnprecision ($statement_resource, $column_number) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_field_type - * @link http://php.net/manual/en/function.ocicolumntype.php - */ -function ocicolumntype ($statement_resource, $column_number) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_field_type_raw - * @link http://php.net/manual/en/function.ocicolumntyperaw.php - */ -function ocicolumntyperaw ($statement_resource, $column_number) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_execute - * @link http://php.net/manual/en/function.ociexecute.php - */ -function ociexecute ($statement_resource, $mode) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_cancel - * @link http://php.net/manual/en/function.ocicancel.php - */ -function ocicancel ($statement_resource) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_fetch - * @link http://php.net/manual/en/function.ocifetch.php - */ -function ocifetch ($statement_resource) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_fetch_all - * @link http://php.net/manual/en/function.ocifetchstatement.php - */ -function ocifetchstatement ($statement_resource, &$output, $skip, $maximum_rows, $flags) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_free_statement - * @link http://php.net/manual/en/function.ocifreestatement.php - */ -function ocifreestatement ($statement_resource) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_internal_debug - * @link http://php.net/manual/en/function.ociinternaldebug.php - */ -function ociinternaldebug ($mode) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_num_fields - * @link http://php.net/manual/en/function.ocinumcols.php - */ -function ocinumcols ($statement_resource) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_parse - * @link http://php.net/manual/en/function.ociparse.php - */ -function ociparse ($connection_resource, $sql_text) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_new_cursor - * @link http://php.net/manual/en/function.ocinewcursor.php - */ -function ocinewcursor ($connection_resource) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_result - * @link http://php.net/manual/en/function.ociresult.php - */ -function ociresult ($statement_resource, $column_number_or_name) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_server_version - * @link http://php.net/manual/en/function.ociserverversion.php - */ -function ociserverversion ($connection_resource) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_statement_type - * @link http://php.net/manual/en/function.ocistatementtype.php - */ -function ocistatementtype ($statement_resource) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_num_rows - * @link http://php.net/manual/en/function.ocirowcount.php - */ -function ocirowcount ($statement_resource) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_close - * @link http://php.net/manual/en/function.ocilogoff.php - */ -function ocilogoff ($connection_resource) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_connect - * @link http://php.net/manual/en/function.ocilogon.php - */ -function ocilogon ($username, $password, $connection_string, $character_set, $session_mode) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_new_connect - * @link http://php.net/manual/en/function.ocinlogon.php - */ -function ocinlogon ($username, $password, $connection_string, $character_set, $session_mode) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_pconnect - * @link http://php.net/manual/en/function.ociplogon.php - */ -function ociplogon ($username, $password, $connection_string, $character_set, $session_mode) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_error - * @link http://php.net/manual/en/function.ocierror.php - */ -function ocierror ($connection_or_statement_resource) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of OCI-Lob::free - * @link http://php.net/manual/en/function.ocifreedesc.php - */ -function ocifreedesc ($lob_descriptor) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of OCI-Lob::save - * @link http://php.net/manual/en/function.ocisavelob.php - */ -function ocisavelob ($lob_descriptor, $data, $offset) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of OCI-Lob::import - * @link http://php.net/manual/en/function.ocisavelobfile.php - */ -function ocisavelobfile ($lob_descriptor, $filename) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of OCI-Lob::export - * @link http://php.net/manual/en/function.ociwritelobtofile.php - */ -function ociwritelobtofile ($lob_descriptor, $filename, $start, $length) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of OCI-Lob::load - * @link http://php.net/manual/en/function.ociloadlob.php - */ -function ociloadlob ($lob_descriptor) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_commit - * @link http://php.net/manual/en/function.ocicommit.php - */ -function ocicommit ($connection_resource) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_rollback - * @link http://php.net/manual/en/function.ocirollback.php - */ -function ocirollback ($connection_resource) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_new_descriptor - * @link http://php.net/manual/en/function.ocinewdescriptor.php - */ -function ocinewdescriptor ($connection_resource, $type) {} - -/** - * (PHP 4, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_set_prefetch - * @link http://php.net/manual/en/function.ocisetprefetch.php - */ -function ocisetprefetch ($statement_resource, $number_of_rows) {} - -/** - * @param $connection_resource_or_connection_string - * @param $username - * @param $old_password - * @param $new_password - */ -function ocipasswordchange ($connection_resource_or_connection_string, $username, $old_password, $new_password) {} - -/** - * (PHP 4 >= 4.0.7, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of OCI-Collection::free - * @link http://php.net/manual/en/function.ocifreecollection.php - */ -function ocifreecollection ($collection) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of oci_new_collection - * @link http://php.net/manual/en/function.ocinewcollection.php - */ -function ocinewcollection ($connection_resource, $type_name, $schema_name) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of OCI-Collection::append - * @link http://php.net/manual/en/function.ocicollappend.php - */ -function ocicollappend ($collection, $value) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of OCI-Collection::getElem - * @link http://php.net/manual/en/function.ocicollgetelem.php - */ -function ocicollgetelem ($collection, $index) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of OCI-Collection::assignElem - * @link http://php.net/manual/en/function.ocicollassignelem.php - */ -function ocicollassignelem ($collection, $index, $value) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of OCI-Collection::size - * @link http://php.net/manual/en/function.ocicollsize.php - */ -function ocicollsize ($collection) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of OCI-Collection::max - * @link http://php.net/manual/en/function.ocicollmax.php - */ -function ocicollmax ($collection) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5, PECL OCI8 >= 1.0.0)
- * Alias of OCI-Collection::trim - * @link http://php.net/manual/en/function.ocicolltrim.php - */ -function ocicolltrim ($collection, $number) {} - - -/** - * Statement execution mode - * for oci_execute. The transaction is - * not automatically committed when using this mode. From PHP - * 5.3.2 (PECL OCI8 1.4) onwards, - * OCI_NO_AUTO_COMMIT is preferred instead - * of OCI_DEFAULT. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_DEFAULT', 0); - -/** - * Used with oci_connect to connect with - * the SYSOPER privilege. The php.ini setting - * oci8.privileged_connect - * should be enabled to use this. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_SYSOPER', 4); - -/** - * Used with oci_connect to connect with - * the SYSDBA privilege. The php.ini setting - * oci8.privileged_connect - * should be enabled to use this. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_SYSDBA', 2); - -/** - * Used with oci_connect for using - * Oracles' External or OS authentication. Introduced in PHP - * 5.3 and PECL OCI8 1.3.4. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_CRED_EXT', -2147483648); - -/** - * Statement execution mode - * for oci_execute. Use this mode if you - * want meta data such as the column names but don't want to - * fetch rows from the query. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_DESCRIBE_ONLY', 16); - -/** - * Statement execution mode for oci_execute - * call. Automatically commit changes when the statement has - * succeeded. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_COMMIT_ON_SUCCESS', 32); - -/** - * Statement execution mode - * for oci_execute. The statement is not - * committed automatically when using this mode. For - * readability in new code, use this value instead of the - * obsolete OCI_DEFAULT constant. - * Introduced in PHP 5.3.2 (PECL OCI8 1.4). - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_NO_AUTO_COMMIT', 0); - -/** - * Obsolete. Statement fetch mode. Used when the application - * knows in advance exactly how many rows it will be fetching. - * This mode turns prefetching off for Oracle release 8 or - * later mode. The cursor is canceled after the desired rows - * are fetched which may result in reduced server-side - * resource usage. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_EXACT_FETCH', 2); - -/** - * Used with to set the seek position. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_SEEK_SET', 0); - -/** - * Used with to set the seek position. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_SEEK_CUR', 1); - -/** - * Used with to set the seek position. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_SEEK_END', 2); - -/** - * Used with to free - * buffers used. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_LOB_BUFFER_FREE', 1); - -/** - * The same as OCI_B_BFILE. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_BFILEE', 114); - -/** - * The same as OCI_B_CFILEE. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_CFILEE', 115); - -/** - * The same as OCI_B_CLOB. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_CLOB', 112); - -/** - * The same as OCI_B_BLOB. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_BLOB', 113); - -/** - * The same as OCI_B_ROWID. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_RDD', 104); - -/** - * The same as OCI_B_INT. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_INT', 3); - -/** - * The same as OCI_B_NUM. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_NUM', 2); - -/** - * The same as OCI_B_CURSOR. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_RSET', 116); - -/** - * Used with oci_bind_array_by_name to bind arrays of - * CHAR. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_AFC', 96); - -/** - * Used with oci_bind_array_by_name to bind arrays of - * VARCHAR2. - * Also used with oci_bind_by_name. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_CHR', 1); - -/** - * Used with oci_bind_array_by_name to bind arrays of - * VARCHAR. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_VCS', 9); - -/** - * Used with oci_bind_array_by_name to bind arrays of - * VARCHAR2. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_AVC', 97); - -/** - * Used with oci_bind_array_by_name to bind arrays of - * STRING. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_STR', 5); - -/** - * Used with oci_bind_array_by_name to bind arrays of - * LONG VARCHAR. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_LVC', 94); - -/** - * Used with oci_bind_array_by_name to bind arrays of - * FLOAT. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_FLT', 4); - -/** - * Not supported. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_UIN', 68); - -/** - * Used with oci_bind_by_name to bind LONG values. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_LNG', 8); - -/** - * Used with oci_bind_by_name to bind LONG RAW values. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_LBI', 24); - -/** - * The same as OCI_B_BIN. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_BIN', 23); - -/** - * Used with oci_bind_array_by_name to bind arrays of - * LONG. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_ODT', 156); - -/** - * Not supported. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_BDOUBLE', 22); - -/** - * Not supported. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_BFLOAT', 21); - -/** - * Used with oci_bind_by_name when binding - * named data types. Note: in PHP < 5.0 it was called - * OCI_B_SQLT_NTY. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_B_NTY', 108); - -/** - * The same as OCI_B_NTY. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('SQLT_NTY', 108); - -/** - * Obsolete. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_SYSDATE', "SYSDATE"); - -/** - * Used with oci_bind_by_name when binding - * BFILEs. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_B_BFILE', 114); - -/** - * Used with oci_bind_by_name when binding - * CFILEs. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_B_CFILEE', 115); - -/** - * Used with oci_bind_by_name when binding - * CLOBs. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_B_CLOB', 112); - -/** - * Used with oci_bind_by_name when - * binding BLOBs. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_B_BLOB', 113); - -/** - * Used with oci_bind_by_name when binding - * ROWIDs. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_B_ROWID', 104); - -/** - * Used with oci_bind_by_name when binding - * cursors, previously allocated - * with oci_new_descriptor. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_B_CURSOR', 116); - -/** - * Used with oci_bind_by_name to bind RAW values. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_B_BIN', 23); - -/** - * Used with oci_bind_array_by_name to bind arrays of - * INTEGER. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_B_INT', 3); - -/** - * Used with oci_bind_array_by_name to bind arrays of - * NUMBER. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_B_NUM', 2); - -/** - * Default mode of oci_fetch_all. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_FETCHSTATEMENT_BY_COLUMN', 16); - -/** - * Alternative mode of oci_fetch_all. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_FETCHSTATEMENT_BY_ROW', 32); - -/** - * Used with oci_fetch_all and - * oci_fetch_array to get results as an associative - * array. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_ASSOC', 1); - -/** - * Used with oci_fetch_all and - * oci_fetch_array to get results as an - * enumerated array. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_NUM', 2); - -/** - * Used with oci_fetch_all and - * oci_fetch_array to get results as an - * array with both associative and number indices. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_BOTH', 3); - -/** - * Used with oci_fetch_array to get empty - * array elements if the row items value is NULL. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_RETURN_NULLS', 4); - -/** - * Used with oci_fetch_array to get the - * data value of the LOB instead of the descriptor. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_RETURN_LOBS', 8); - -/** - * This flag tells oci_new_descriptor to - * initialize a new FILE descriptor. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_DTYPE_FILE', 56); - -/** - * This flag tells oci_new_descriptor to - * initialize a new LOB descriptor. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_DTYPE_LOB', 50); - -/** - * This flag tells oci_new_descriptor to - * initialize a new ROWID descriptor. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_DTYPE_ROWID', 54); - -/** - * The same as OCI_DTYPE_FILE. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_D_FILE', 56); - -/** - * The same as OCI_DTYPE_LOB. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_D_LOB', 50); - -/** - * The same as OCI_DTYPE_ROWID. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_D_ROWID', 54); - -/** - * Used with - * to indicate that a temporary CLOB should be created. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_TEMP_CLOB', 2); - -/** - * Used with - * to indicate that a temporary BLOB should be created. - * @link http://php.net/manual/en/oci8.constants.php - */ -define ('OCI_TEMP_BLOB', 1); - -// End of oci8 v.1.4.9 -?> diff --git a/phpruntime/odbc.php b/phpruntime/odbc.php deleted file mode 100644 index 2d84282..0000000 --- a/phpruntime/odbc.php +++ /dev/null @@ -1,972 +0,0 @@ - - * Toggle autocommit behaviour - * @link http://php.net/manual/en/function.odbc-autocommit.php - * @param resource $connection_id The ODBC connection identifier, - * see odbc_connect for details.

- * @param bool $OnOff [optional]

- * If OnOff is TRUE, auto-commit is enabled, if - * it is FALSE auto-commit is disabled. - *

- * @return mixed Without the OnOff parameter, this function returns - * auto-commit status for connection_id. Non-zero is - * returned if auto-commit is on, 0 if it is off, or FALSE if an error - * occurs. - *

- *

- * If OnOff is set, this function returns TRUE on - * success and FALSE on failure. - */ -function odbc_autocommit ($connection_id, $OnOff = false) {} - -/** - * (PHP 4, PHP 5)
- * Handling of binary column data - * @link http://php.net/manual/en/function.odbc-binmode.php - * @param resource $result_id

- * The result identifier. - *

- *

- * If result_id is 0, the - * settings apply as default for new results. - * Default for longreadlen is 4096 and - * mode defaults to - * ODBC_BINMODE_RETURN. Handling of binary long - * columns is also affected by odbc_longreadlen. - *

- * @param int $mode

- * Possible values for mode are: - * ODBC_BINMODE_PASSTHRU: Passthru BINARY data - * @return bool TRUE on success or FALSE on failure. - */ -function odbc_binmode ($result_id, $mode) {} - -/** - * (PHP 4, PHP 5)
- * Close an ODBC connection - * @link http://php.net/manual/en/function.odbc-close.php - * @param resource $connection_id The ODBC connection identifier, - * see odbc_connect for details.

- * @return void No value is returned. - */ -function odbc_close ($connection_id) {} - -/** - * (PHP 4, PHP 5)
- * Close all ODBC connections - * @link http://php.net/manual/en/function.odbc-close-all.php - * @return void No value is returned. - */ -function odbc_close_all () {} - -/** - * (PHP 4, PHP 5)
- * Lists the column names in specified tables - * @link http://php.net/manual/en/function.odbc-columns.php - * @param resource $connection_id The ODBC connection identifier, - * see odbc_connect for details.

- * @param string $qualifier [optional]

- * The qualifier. - *

- * @param string $schema [optional]

- * The owner. - *

- * @param string $table_name [optional]

- * The table name. - *

- * @param string $column_name [optional]

- * The column name. - *

- * @return resource an ODBC result identifier or FALSE on failure. - *

- *

- * The result set has the following columns: - * TABLE_QUALIFIER - * TABLE_SCHEM - * TABLE_NAME - * COLUMN_NAME - * DATA_TYPE - * TYPE_NAME - * PRECISION - * LENGTH - * SCALE - * RADIX - * NULLABLE - * REMARKS - *

- *

- * The result set is ordered by TABLE_QUALIFIER, TABLE_SCHEM and - * TABLE_NAME. - */ -function odbc_columns ($connection_id, $qualifier = null, $schema = null, $table_name = null, $column_name = null) {} - -/** - * (PHP 4, PHP 5)
- * Commit an ODBC transaction - * @link http://php.net/manual/en/function.odbc-commit.php - * @param resource $connection_id The ODBC connection identifier, - * see odbc_connect for details.

- * @return bool TRUE on success or FALSE on failure. - */ -function odbc_commit ($connection_id) {} - -/** - * (PHP 4, PHP 5)
- * Connect to a datasource - * @link http://php.net/manual/en/function.odbc-connect.php - * @param string $dsn

- * The database source name for the connection. Alternatively, a - * DSN-less connection string can be used. - *

- * @param string $user

- * The username. - *

- * @param string $password

- * The password. - *

- * @param int $cursor_type [optional]

- * This sets the type of cursor to be used - * for this connection. This parameter is not normally needed, but - * can be useful for working around problems with some ODBC drivers. - *

- * The following constants are defined for cursortype: - *

- * SQL_CUR_USE_IF_NEEDED - * @return resource an ODBC connection or (FALSE) on error. - */ -function odbc_connect ($dsn, $user, $password, $cursor_type = null) {} - -/** - * (PHP 4, PHP 5)
- * Get cursorname - * @link http://php.net/manual/en/function.odbc-cursor.php - * @param resource $result_id

- * The result identifier. - *

- * @return string the cursor name, as a string. - */ -function odbc_cursor ($result_id) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Returns information about a current connection - * @link http://php.net/manual/en/function.odbc-data-source.php - * @param resource $connection_id The ODBC connection identifier, - * see odbc_connect for details.

- * @param int $fetch_type

- * The fetch_type can be one of two constant types: - * SQL_FETCH_FIRST, SQL_FETCH_NEXT. - * Use SQL_FETCH_FIRST the first time this function is - * called, thereafter use the SQL_FETCH_NEXT. - *

- * @return array FALSE on error, and an array upon success. - */ -function odbc_data_source ($connection_id, $fetch_type) {} - -/** - * (PHP 4, PHP 5)
- * Execute a prepared statement - * @link http://php.net/manual/en/function.odbc-execute.php - * @param resource $result_id

- * The result id resource, from odbc_prepare. - *

- * @param array $parameters_array [optional]

- * Parameters in parameter_array will be - * substituted for placeholders in the prepared statement in order. - * Elements of this array will be converted to strings by calling this - * function. - *

- *

- * Any parameters in parameter_array which - * start and end with single quotes will be taken as the name of a - * file to read and send to the database server as the data for the - * appropriate placeholder. - *

- * If you wish to store a string which actually begins and ends with - * single quotes, you must add a space or other non-single-quote character - * to the beginning or end of the parameter, which will prevent the - * parameter from being taken as a file name. If this is not an option, - * then you must use another mechanism to store the string, such as - * executing the query directly with odbc_exec). - * @return bool TRUE on success or FALSE on failure. - */ -function odbc_execute ($result_id, array $parameters_array = null) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Get the last error code - * @link http://php.net/manual/en/function.odbc-error.php - * @param resource $connection_id [optional] The ODBC connection identifier, - * see odbc_connect for details.

- * @return string If connection_id is specified, the last state - * of that connection is returned, else the last state of any connection - * is returned. - *

- *

- * This function returns meaningful value only if last odbc query failed - * (i.e. odbc_exec returned FALSE). - */ -function odbc_error ($connection_id = null) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Get the last error message - * @link http://php.net/manual/en/function.odbc-errormsg.php - * @param resource $connection_id [optional] The ODBC connection identifier, - * see odbc_connect for details.

- * @return string If connection_id is specified, the last state - * of that connection is returned, else the last state of any connection - * is returned. - *

- *

- * This function returns meaningful value only if last odbc query failed - * (i.e. odbc_exec returned FALSE). - */ -function odbc_errormsg ($connection_id = null) {} - -/** - * (PHP 4, PHP 5)
- * Prepare and execute an SQL statement - * @link http://php.net/manual/en/function.odbc-exec.php - * @param resource $connection_id The ODBC connection identifier, - * see odbc_connect for details.

- * @param string $query_string

- * The SQL statement. - *

- * @param int $flags [optional]

- * This parameter is currently not used. - *

- * @return resource an ODBC result identifier if the SQL command was executed - * successfully, or FALSE on error. - */ -function odbc_exec ($connection_id, $query_string, $flags = null) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Fetch a result row as an associative array - * @link http://php.net/manual/en/function.odbc-fetch-array.php - * @param resource $result

- * The result resource from odbc_exec. - *

- * @param int $rownumber [optional]

- * Optionally choose which row number to retrieve. - *

- * @return array an array that corresponds to the fetched row, or FALSE if there - * are no more rows. - */ -function odbc_fetch_array ($result, $rownumber = null) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Fetch a result row as an object - * @link http://php.net/manual/en/function.odbc-fetch-object.php - * @param resource $result

- * The result resource from odbc_exec. - *

- * @param int $rownumber [optional]

- * Optionally choose which row number to retrieve. - *

- * @return object an object that corresponds to the fetched row, or FALSE if there - * are no more rows. - */ -function odbc_fetch_object ($result, $rownumber = null) {} - -/** - * (PHP 4, PHP 5)
- * Fetch a row - * @link http://php.net/manual/en/function.odbc-fetch-row.php - * @param resource $result_id

- * The result identifier. - *

- * @param int $row_number [optional]

- * If row_number is not specified, - * odbc_fetch_row will try to fetch the next row in - * the result set. Calls to odbc_fetch_row with and - * without row_number can be mixed. - *

- *

- * To step through the result more than once, you can call - * odbc_fetch_row with - * row_number 1, and then continue doing - * odbc_fetch_row without - * row_number to review the result. If a driver - * doesn't support fetching rows by number, the - * row_number parameter is ignored. - *

- * @return bool TRUE if there was a row, FALSE otherwise. - */ -function odbc_fetch_row ($result_id, $row_number = null) {} - -/** - * (PHP 4, PHP 5)
- * Fetch one result row into array - * @link http://php.net/manual/en/function.odbc-fetch-into.php - * @param resource $result_id

- * The result resource. - *

- * @param array $result_array

- * The result array - * that can be of any type since it will be converted to type - * array. The array will contain the column values starting at array - * index 0. - *

- * @param int $rownumber [optional]

- * The row number. - *

- * @return int the number of columns in the result; - * FALSE on error. - */ -function odbc_fetch_into ($result_id, array &$result_array, $rownumber = null) {} - -/** - * (PHP 4, PHP 5)
- * Get the length (precision) of a field - * @link http://php.net/manual/en/function.odbc-field-len.php - * @param resource $result_id

- * The result identifier. - *

- * @param int $field_number

- * The field number. Field numbering starts at 1. - *

- * @return int the field name as a string, or FALSE on error. - */ -function odbc_field_len ($result_id, $field_number) {} - -/** - * (PHP 4, PHP 5)
- * Get the scale of a field - * @link http://php.net/manual/en/function.odbc-field-scale.php - * @param resource $result_id

- * The result identifier. - *

- * @param int $field_number

- * The field number. Field numbering starts at 1. - *

- * @return int the field scale as a integer, or FALSE on error. - */ -function odbc_field_scale ($result_id, $field_number) {} - -/** - * (PHP 4, PHP 5)
- * Get the columnname - * @link http://php.net/manual/en/function.odbc-field-name.php - * @param resource $result_id

- * The result identifier. - *

- * @param int $field_number

- * The field number. Field numbering starts at 1. - *

- * @return string the field name as a string, or FALSE on error. - */ -function odbc_field_name ($result_id, $field_number) {} - -/** - * (PHP 4, PHP 5)
- * Datatype of a field - * @link http://php.net/manual/en/function.odbc-field-type.php - * @param resource $result_id

- * The result identifier. - *

- * @param int $field_number

- * The field number. Field numbering starts at 1. - *

- * @return string the field type as a string, or FALSE on error. - */ -function odbc_field_type ($result_id, $field_number) {} - -/** - * (PHP 4, PHP 5)
- * Return column number - * @link http://php.net/manual/en/function.odbc-field-num.php - * @param resource $result_id

- * The result identifier. - *

- * @param string $field_name

- * The field name. - *

- * @return int the field number as a integer, or FALSE on error. - * Field numbering starts at 1. - */ -function odbc_field_num ($result_id, $field_name) {} - -/** - * (PHP 4, PHP 5)
- * Free resources associated with a result - * @link http://php.net/manual/en/function.odbc-free-result.php - * @param resource $result_id

- * The result identifier. - *

- * @return bool Always returns TRUE. - */ -function odbc_free_result ($result_id) {} - -/** - * (PHP 4, PHP 5)
- * Retrieves information about data types supported by the data source - * @link http://php.net/manual/en/function.odbc-gettypeinfo.php - * @param resource $connection_id The ODBC connection identifier, - * see odbc_connect for details.

- * @param int $data_type [optional]

- * The data type, which can be used to restrict the information to a - * single data type. - *

- * @return resource an ODBC result identifier or - * FALSE on failure. - *

- *

- * The result set has the following columns: - * TYPE_NAME - * DATA_TYPE - * PRECISION - * LITERAL_PREFIX - * LITERAL_SUFFIX - * CREATE_PARAMS - * NULLABLE - * CASE_SENSITIVE - * SEARCHABLE - * UNSIGNED_ATTRIBUTE - * MONEY - * AUTO_INCREMENT - * LOCAL_TYPE_NAME - * MINIMUM_SCALE - * MAXIMUM_SCALE - *

- *

- * The result set is ordered by DATA_TYPE and TYPE_NAME. - */ -function odbc_gettypeinfo ($connection_id, $data_type = null) {} - -/** - * (PHP 4, PHP 5)
- * Handling of LONG columns - * @link http://php.net/manual/en/function.odbc-longreadlen.php - * @param resource $result_id

- * The result identifier. - *

- * @param int $length

- * The number of bytes returned to PHP is controlled by the parameter - * length. If it is set to 0, Long column data is passed through to the - * client. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function odbc_longreadlen ($result_id, $length) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Checks if multiple results are available - * @link http://php.net/manual/en/function.odbc-next-result.php - * @param resource $result_id

- * The result identifier. - *

- * @return bool TRUE if there are more result sets, FALSE otherwise. - */ -function odbc_next_result ($result_id) {} - -/** - * (PHP 4, PHP 5)
- * Number of columns in a result - * @link http://php.net/manual/en/function.odbc-num-fields.php - * @param resource $result_id

- * The result identifier returned by odbc_exec. - *

- * @return int the number of fields, or -1 on error. - */ -function odbc_num_fields ($result_id) {} - -/** - * (PHP 4, PHP 5)
- * Number of rows in a result - * @link http://php.net/manual/en/function.odbc-num-rows.php - * @param resource $result_id

- * The result identifier returned by odbc_exec. - *

- * @return int the number of rows in an ODBC result. - * This function will return -1 on error. - */ -function odbc_num_rows ($result_id) {} - -/** - * (PHP 4, PHP 5)
- * Open a persistent database connection - * @link http://php.net/manual/en/function.odbc-pconnect.php - * @param string $dsn - * @param string $user - * @param string $password - * @param int $cursor_type [optional] - * @return resource an ODBC connection id or 0 (FALSE) on - * error. - */ -function odbc_pconnect ($dsn, $user, $password, $cursor_type = null) {} - -/** - * (PHP 4, PHP 5)
- * Prepares a statement for execution - * @link http://php.net/manual/en/function.odbc-prepare.php - * @param resource $connection_id The ODBC connection identifier, - * see odbc_connect for details.

- * @param string $query_string

- * The query string statement being prepared. - *

- * @return resource an ODBC result identifier if the SQL command was prepared - * successfully. Returns FALSE on error. - */ -function odbc_prepare ($connection_id, $query_string) {} - -/** - * (PHP 4, PHP 5)
- * Get result data - * @link http://php.net/manual/en/function.odbc-result.php - * @param resource $result_id

- * The ODBC resource. - *

- * @param mixed $field

- * The field name being retrieved. It can either be an integer containing - * the column number of the field you want; or it can be a string - * containing the name of the field. - *

- * @return mixed the string contents of the field, FALSE on error, NULL for - * NULL data, or TRUE for binary data. - */ -function odbc_result ($result_id, $field) {} - -/** - * (PHP 4, PHP 5)
- * Print result as HTML table - * @link http://php.net/manual/en/function.odbc-result-all.php - * @param resource $result_id

- * The result identifier. - *

- * @param string $format [optional]

- * Additional overall table formatting. - *

- * @return int the number of rows in the result or FALSE on error. - */ -function odbc_result_all ($result_id, $format = null) {} - -/** - * (PHP 4, PHP 5)
- * Rollback a transaction - * @link http://php.net/manual/en/function.odbc-rollback.php - * @param resource $connection_id The ODBC connection identifier, - * see odbc_connect for details.

- * @return bool TRUE on success or FALSE on failure. - */ -function odbc_rollback ($connection_id) {} - -/** - * (PHP 4, PHP 5)
- * Adjust ODBC settings - * @link http://php.net/manual/en/function.odbc-setoption.php - * @param resource $id

- * Is a connection id or result id on which to change the settings. - * For SQLSetConnectOption(), this is a connection id. - * For SQLSetStmtOption(), this is a result id. - *

- * @param int $function

- * Is the ODBC function to use. The value should be - * 1 for SQLSetConnectOption() and - * 2 for SQLSetStmtOption(). - *

- * @param int $option

- * The option to set. - *

- * @param int $param

- * The value for the given option. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function odbc_setoption ($id, $function, $option, $param) {} - -/** - * (PHP 4, PHP 5)
- * Retrieves special columns - * @link http://php.net/manual/en/function.odbc-specialcolumns.php - * @param resource $connection_id The ODBC connection identifier, - * see odbc_connect for details.

- * @param int $type When the type argument is SQL_BEST_ROWID, - * odbc_specialcolumns returns the - * column or columns that uniquely identify each row in the table. - * When the type argument is SQL_ROWVER, - * odbc_specialcolumns returns the column or columns in the - * specified table, if any, that are automatically updated by the data source - * when any value in the row is updated by any transaction. - * @param string $qualifier

- * The qualifier. - *

- * @param string $owner

- * The owner. - *

- * @param string $table

- * The table. - *

- * @param int $scope

- * The scope, which orders the result set. - *

- * @param int $nullable

- * The nullable option. - *

- * @return resource an ODBC result identifier or FALSE on - * failure. - *

- *

- * The result set has the following columns: - * SCOPE - * COLUMN_NAME - * DATA_TYPE - * TYPE_NAME - * PRECISION - * LENGTH - * SCALE - * PSEUDO_COLUMN - */ -function odbc_specialcolumns ($connection_id, $type, $qualifier, $owner, $table, $scope, $nullable) {} - -/** - * (PHP 4, PHP 5)
- * Retrieve statistics about a table - * @link http://php.net/manual/en/function.odbc-statistics.php - * @param resource $connection_id The ODBC connection identifier, - * see odbc_connect for details.

- * @param string $qualifier

- * The qualifier. - *

- * @param string $owner

- * The owner. - *

- * @param string $table_name

- * The table name. - *

- * @param int $unique

- * The unique attribute. - *

- * @param int $accuracy

- * The accuracy. - *

- * @return resource an ODBC result identifier or FALSE on failure. - *

- *

- * The result set has the following columns: - * TABLE_QUALIFIER - * TABLE_OWNER - * TABLE_NAME - * NON_UNIQUE - * INDEX_QUALIFIER - * INDEX_NAME - * TYPE - * SEQ_IN_INDEX - * COLUMN_NAME - * COLLATION - * CARDINALITY - * PAGES - * FILTER_CONDITION - */ -function odbc_statistics ($connection_id, $qualifier, $owner, $table_name, $unique, $accuracy) {} - -/** - * (PHP 4, PHP 5)
- * Get the list of table names stored in a specific data source - * @link http://php.net/manual/en/function.odbc-tables.php - * @param resource $connection_id The ODBC connection identifier, - * see odbc_connect for details.

- * @param string $qualifier [optional]

- * The qualifier. - *

- * @param string $owner [optional]

- * The owner. Accepts search patterns ('%' to match zero or more - * characters and '_' to match a single character). - *

- * @param string $name [optional]

- * The name. Accepts search patterns ('%' to match zero or more - * characters and '_' to match a single character). - *

- * @param string $types [optional]

- * If table_type is not an empty string, it - * must contain a list of comma-separated values for the types of - * interest; each value may be enclosed in single quotes (') or - * unquoted. For example, "'TABLE','VIEW'" or "TABLE, VIEW". If the - * data source does not support a specified table type, - * odbc_tables does not return any results for - * that type. - *

- * @return resource an ODBC result identifier containing the information - * or FALSE on failure. - *

- *

- * The result set has the following columns: - * TABLE_QUALIFIER - * TABLE_OWNER - * TABLE_NAME - * TABLE_TYPE - * REMARKS - */ -function odbc_tables ($connection_id, $qualifier = null, $owner = null, $name = null, $types = null) {} - -/** - * (PHP 4, PHP 5)
- * Gets the primary keys for a table - * @link http://php.net/manual/en/function.odbc-primarykeys.php - * @param resource $connection_id The ODBC connection identifier, - * see odbc_connect for details.

- * @param string $qualifier - * @param string $owner - * @param string $table - * @return resource an ODBC result identifier or FALSE on failure. - *

- *

- * The result set has the following columns: - * TABLE_QUALIFIER - * TABLE_OWNER - * TABLE_NAME - * COLUMN_NAME - * KEY_SEQ - * PK_NAME - */ -function odbc_primarykeys ($connection_id, $qualifier, $owner, $table) {} - -/** - * (PHP 4, PHP 5)
- * Lists columns and associated privileges for the given table - * @link http://php.net/manual/en/function.odbc-columnprivileges.php - * @param resource $connection_id The ODBC connection identifier, - * see odbc_connect for details.

- * @param string $qualifier

- * The qualifier. - *

- * @param string $owner

- * The owner. - *

- * @param string $table_name

- * The table name. - *

- * @param string $column_name

- * The column_name argument accepts search - * patterns ('%' to match zero or more characters and '_' to match a - * single character). - *

- * @return resource an ODBC result identifier or FALSE on failure. - * This result identifier can be used to fetch a list of columns and - * associated privileges. - *

- *

- * The result set has the following columns: - * TABLE_QUALIFIER - * TABLE_OWNER - * TABLE_NAME - * GRANTOR - * GRANTEE - * PRIVILEGE - * IS_GRANTABLE - *

- *

- * The result set is ordered by TABLE_QUALIFIER, TABLE_OWNER and - * TABLE_NAME. - */ -function odbc_columnprivileges ($connection_id, $qualifier, $owner, $table_name, $column_name) {} - -/** - * (PHP 4, PHP 5)
- * Lists tables and the privileges associated with each table - * @link http://php.net/manual/en/function.odbc-tableprivileges.php - * @param resource $connection_id The ODBC connection identifier, - * see odbc_connect for details.

- * @param string $qualifier

- * The qualifier. - *

- * @param string $owner

- * The owner. Accepts the following search patterns: - * ('%' to match zero or more characters and '_' to match a single character) - *

- * @param string $name

- * The name. Accepts the following search patterns: - * ('%' to match zero or more characters and '_' to match a single character) - *

- * @return resource An ODBC result identifier or FALSE on failure. - *

- *

- * The result set has the following columns: - * TABLE_QUALIFIER - * TABLE_OWNER - * TABLE_NAME - * GRANTOR - * GRANTEE - * PRIVILEGE - * IS_GRANTABLE - */ -function odbc_tableprivileges ($connection_id, $qualifier, $owner, $name) {} - -/** - * (PHP 4, PHP 5)
- * Retrieves a list of foreign keys - * @link http://php.net/manual/en/function.odbc-foreignkeys.php - * @param resource $connection_id The ODBC connection identifier, - * see odbc_connect for details.

- * @param string $pk_qualifier

- * The primary key qualifier. - *

- * @param string $pk_owner

- * The primary key owner. - *

- * @param string $pk_table

- * The primary key table. - *

- * @param string $fk_qualifier

- * The foreign key qualifier. - *

- * @param string $fk_owner

- * The foreign key owner. - *

- * @param string $fk_table

- * The foreign key table. - *

- * @return resource an ODBC result identifier or FALSE on failure. - *

- *

- * The result set has the following columns: - * PKTABLE_QUALIFIER - * PKTABLE_OWNER - * PKTABLE_NAME - * PKCOLUMN_NAME - * FKTABLE_QUALIFIER - * FKTABLE_OWNER - * FKTABLE_NAME - * FKCOLUMN_NAME - * KEY_SEQ - * UPDATE_RULE - * DELETE_RULE - * FK_NAME - * PK_NAME - *

- * If pk_table contains a table name, - * odbc_foreignkeys returns a result set - * containing the primary key of the specified table and all of the - * foreign keys that refer to it. - * If fk_table contains a table name, - * odbc_foreignkeys returns a result set - * containing all of the foreign keys in the specified table and the - * primary keys (in other tables) to which they refer. - * If both pk_table and - * fk_table contain table names, - * odbc_foreignkeys returns the foreign keys in - * the table specified in fk_table that refer - * to the primary key of the table specified in - * pk_table - */ -function odbc_foreignkeys ($connection_id, $pk_qualifier, $pk_owner, $pk_table, $fk_qualifier, $fk_owner, $fk_table) {} - -/** - * (PHP 4, PHP 5)
- * Get the list of procedures stored in a specific data source - * @link http://php.net/manual/en/function.odbc-procedures.php - * @param resource $connection_id The ODBC connection identifier, - * see odbc_connect for details.

- * @return resource an ODBC - * result identifier containing the information or FALSE on failure. - *

- *

- * The result set has the following columns: - * PROCEDURE_QUALIFIER - * PROCEDURE_OWNER - * PROCEDURE_NAME - * NUM_INPUT_PARAMS - * NUM_OUTPUT_PARAMS - * NUM_RESULT_SETS - * REMARKS - * PROCEDURE_TYPE - */ -function odbc_procedures ($connection_id) {} - -/** - * (PHP 4, PHP 5)
- * Retrieve information about parameters to procedures - * @link http://php.net/manual/en/function.odbc-procedurecolumns.php - * @param resource $connection_id The ODBC connection identifier, - * see odbc_connect for details.

- * @return resource the list of input and output parameters, as well as the - * columns that make up the result set for the specified procedures. - * Returns an ODBC result identifier or FALSE on failure. - *

- *

- * The result set has the following columns: - * PROCEDURE_QUALIFIER - * PROCEDURE_OWNER - * PROCEDURE_NAME - * COLUMN_NAME - * COLUMN_TYPE - * DATA_TYPE - * TYPE_NAME - * PRECISION - * LENGTH - * SCALE - * RADIX - * NULLABLE - * REMARKS - */ -function odbc_procedurecolumns ($connection_id) {} - -/** - * (PHP 4, PHP 5)
- * Alias of odbc_exec - * @link http://php.net/manual/en/function.odbc-do.php - * @param $connection_id - * @param $query - * @param $flags [optional] - */ -function odbc_do ($connection_id, $query, $flags) {} - -/** - * (PHP 4, PHP 5)
- * Alias of odbc_field_len - * @link http://php.net/manual/en/function.odbc-field-precision.php - * @param $result_id - * @param $field_number - */ -function odbc_field_precision ($result_id, $field_number) {} - -define ('ODBC_TYPE', "unixODBC"); -define ('ODBC_BINMODE_PASSTHRU', 0); -define ('ODBC_BINMODE_RETURN', 1); -define ('ODBC_BINMODE_CONVERT', 2); -define ('SQL_ODBC_CURSORS', 110); -define ('SQL_CUR_USE_DRIVER', 2); -define ('SQL_CUR_USE_IF_NEEDED', 0); -define ('SQL_CUR_USE_ODBC', 1); -define ('SQL_CONCURRENCY', 7); -define ('SQL_CONCUR_READ_ONLY', 1); -define ('SQL_CONCUR_LOCK', 2); -define ('SQL_CONCUR_ROWVER', 3); -define ('SQL_CONCUR_VALUES', 4); -define ('SQL_CURSOR_TYPE', 6); -define ('SQL_CURSOR_FORWARD_ONLY', 0); -define ('SQL_CURSOR_KEYSET_DRIVEN', 1); -define ('SQL_CURSOR_DYNAMIC', 2); -define ('SQL_CURSOR_STATIC', 3); -define ('SQL_KEYSET_SIZE', 8); -define ('SQL_FETCH_FIRST', 2); -define ('SQL_FETCH_NEXT', 1); -define ('SQL_CHAR', 1); -define ('SQL_VARCHAR', 12); -define ('SQL_LONGVARCHAR', -1); -define ('SQL_DECIMAL', 3); -define ('SQL_NUMERIC', 2); -define ('SQL_BIT', -7); -define ('SQL_TINYINT', -6); -define ('SQL_SMALLINT', 5); -define ('SQL_INTEGER', 4); -define ('SQL_BIGINT', -5); -define ('SQL_REAL', 7); -define ('SQL_FLOAT', 6); -define ('SQL_DOUBLE', 8); -define ('SQL_BINARY', -2); -define ('SQL_VARBINARY', -3); -define ('SQL_LONGVARBINARY', -4); -define ('SQL_DATE', 9); -define ('SQL_TIME', 10); -define ('SQL_TIMESTAMP', 11); - -// End of odbc v.1.0 -?> diff --git a/phpruntime/openssl.php b/phpruntime/openssl.php deleted file mode 100644 index c46b1c5..0000000 --- a/phpruntime/openssl.php +++ /dev/null @@ -1,1052 +0,0 @@ - - * Frees a private key - * @link http://php.net/manual/en/function.openssl-pkey-free.php - * @param resource $key

- * Resource holding the key. - *

- * @return void No value is returned. - */ -function openssl_pkey_free ($key) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Generates a new private key - * @link http://php.net/manual/en/function.openssl-pkey-new.php - * @param array $configargs [optional]

- * You can finetune the key generation (such as specifying the number of - * bits) using configargs. See - * openssl_csr_new for more information about - * configargs. - *

- * @return resource a resource identifier for the pkey on success, or FALSE on - * error. - */ -function openssl_pkey_new (array $configargs = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Gets an exportable representation of a key into a string - * @link http://php.net/manual/en/function.openssl-pkey-export.php - * @param mixed $key - * @param string $out - * @param string $passphrase [optional]

- * The key is optionally protected by passphrase. - *

- * @param array $configargs [optional]

- * configargs can be used to fine-tune the export - * process by specifying and/or overriding options for the openssl - * configuration file. See openssl_csr_new for more - * information about configargs. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function openssl_pkey_export ($key, &$out, $passphrase = null, array $configargs = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Gets an exportable representation of a key into a file - * @link http://php.net/manual/en/function.openssl-pkey-export-to-file.php - * @param mixed $key - * @param string $outfilename

- * Path to the output file. - *

- * @param string $passphrase [optional]

- * The key can be optionally protected by a - * passphrase. - *

- * @param array $configargs [optional]

- * configargs can be used to fine-tune the export - * process by specifying and/or overriding options for the openssl - * configuration file. See openssl_csr_new for more - * information about configargs. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function openssl_pkey_export_to_file ($key, $outfilename, $passphrase = null, array $configargs = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Get a private key - * @link http://php.net/manual/en/function.openssl-pkey-get-private.php - * @param mixed $key

- * key can be one of the following: - * a string having the format - * file://path/to/file.pem. The named file must - * contain a PEM encoded certificate/private key (it may contain both). - * @param string $passphrase [optional]

- * The optional parameter passphrase must be used - * if the specified key is encrypted (protected by a passphrase). - *

- * @return resource a positive key resource identifier on success, or FALSE on error. - */ -function openssl_pkey_get_private ($key, $passphrase = "") {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Extract public key from certificate and prepare it for use - * @link http://php.net/manual/en/function.openssl-pkey-get-public.php - * @param mixed $certificate

- * certificate can be one of the following: - * an X.509 certificate resource - * @return resource a positive key resource identifier on success, or FALSE on error. - */ -function openssl_pkey_get_public ($certificate) {} - -/** - * (PHP 5 >= 5.2.0)
- * Returns an array with the key details - * @link http://php.net/manual/en/function.openssl-pkey-get-details.php - * @param resource $key

- * Resource holding the key. - *

- * @return array an array with the key details in success or FALSE in failure. - * Returned array has indexes bits (number of bits), - * key (string representation of the public key) and - * type (type of the key which is one of - * OPENSSL_KEYTYPE_RSA, - * OPENSSL_KEYTYPE_DSA, - * OPENSSL_KEYTYPE_DH, - * OPENSSL_KEYTYPE_EC or -1 meaning unknown). - *

- *

- * Depending on the key type used, additional details may be returned. Note that - * some elements may not always be available. - */ -function openssl_pkey_get_details ($key) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Free key resource - * @link http://php.net/manual/en/function.openssl-free-key.php - * @param resource $key_identifier - * @return void No value is returned. - */ -function openssl_free_key ($key_identifier) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Alias of openssl_pkey_get_private - * @link http://php.net/manual/en/function.openssl-get-privatekey.php - * @param $key - * @param $passphrase [optional] - */ -function openssl_get_privatekey ($key, $passphrase) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Alias of openssl_pkey_get_public - * @link http://php.net/manual/en/function.openssl-get-publickey.php - * @param $cert - */ -function openssl_get_publickey ($cert) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Parse an X.509 certificate and return a resource identifier for -it - * @link http://php.net/manual/en/function.openssl-x509-read.php - * @param mixed $x509certdata - * @return resource a resource identifier on success or FALSE on failure. - */ -function openssl_x509_read ($x509certdata) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Free certificate resource - * @link http://php.net/manual/en/function.openssl-x509-free.php - * @param resource $x509cert - * @return void No value is returned. - */ -function openssl_x509_free ($x509cert) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Parse an X509 certificate and return the information as an array - * @link http://php.net/manual/en/function.openssl-x509-parse.php - * @param mixed $x509cert - * @param bool $shortnames [optional]

- * shortnames controls how the data is indexed in the - * array - if shortnames is TRUE (the default) then - * fields will be indexed with the short name form, otherwise, the long name - * form will be used - e.g.: CN is the shortname form of commonName. - *

- * @return array The structure of the returned data is (deliberately) not - * yet documented, as it is still subject to change. - */ -function openssl_x509_parse ($x509cert, $shortnames = true) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Verifies if a certificate can be used for a particular purpose - * @link http://php.net/manual/en/function.openssl-x509-checkpurpose.php - * @param mixed $x509cert

- * The examined certificate. - *

- * @param int $purpose

- * - * openssl_x509_checkpurpose purposes - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
ConstantDescription
X509_PURPOSE_SSL_CLIENTCan the certificate be used for the client side of an SSL - * connection?
X509_PURPOSE_SSL_SERVERCan the certificate be used for the server side of an SSL - * connection?
X509_PURPOSE_NS_SSL_SERVERCan the cert be used for Netscape SSL server?
X509_PURPOSE_SMIME_SIGNCan the cert be used to sign S/MIME email?
X509_PURPOSE_SMIME_ENCRYPTCan the cert be used to encrypt S/MIME email?
X509_PURPOSE_CRL_SIGNCan the cert be used to sign a certificate revocation list - * (CRL)?
X509_PURPOSE_ANYCan the cert be used for Any/All purposes?
- * These options are not bitfields - you may specify one only! - *

- * @param array $cainfo [optional]

- * cainfo should be an array of trusted CA files/dirs - * as described in Certificate - * Verification. - *

- * @param string $untrustedfile [optional]

- * If specified, this should be the name of a PEM encoded file holding - * certificates that can be used to help verify the certificate, although - * no trust is placed in the certificates that come from that file. - *

- * @return int TRUE if the certificate can be used for the intended purpose, - * FALSE if it cannot, or -1 on error. - */ -function openssl_x509_checkpurpose ($x509cert, $purpose, array $cainfo = 'array()', $untrustedfile = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Checks if a private key corresponds to a certificate - * @link http://php.net/manual/en/function.openssl-x509-check-private-key.php - * @param mixed $cert

- * The certificate. - *

- * @param mixed $key

- * The private key. - *

- * @return bool TRUE if key is the private key that - * corresponds to cert, or FALSE otherwise. - */ -function openssl_x509_check_private_key ($cert, $key) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Exports a certificate as a string - * @link http://php.net/manual/en/function.openssl-x509-export.php - * @param mixed $x509 - * @param string $output

- * On success, this will hold the PEM. - *

- * @param bool $notext [optional] The optional parameter notext affects - * the verbosity of the output; if it is FALSE, then additional human-readable - * information is included in the output. The default value of - * notext is TRUE. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function openssl_x509_export ($x509, &$output, $notext = '&true;') {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Exports a certificate to file - * @link http://php.net/manual/en/function.openssl-x509-export-to-file.php - * @param mixed $x509 - * @param string $outfilename

- * Path to the output file. - *

- * @param bool $notext [optional] The optional parameter notext affects - * the verbosity of the output; if it is FALSE, then additional human-readable - * information is included in the output. The default value of - * notext is TRUE. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function openssl_x509_export_to_file ($x509, $outfilename, $notext = '&true;') {} - -/** - * (PHP 5 >= 5.2.2)
- * Exports a PKCS#12 Compatible Certificate Store File to variable. - * @link http://php.net/manual/en/function.openssl-pkcs12-export.php - * @param mixed $x509 - * @param string $out

- * On success, this will hold the PKCS#12. - *

- * @param mixed $priv_key

- * Private key component of PKCS#12 file. - *

- * @param string $pass

- * Encryption password for unlocking the PKCS#12 file. - *

- * @param array $args [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function openssl_pkcs12_export ($x509, &$out, $priv_key, $pass, array $args = null) {} - -/** - * (PHP 5 >= 5.2.2)
- * Exports a PKCS#12 Compatible Certificate Store File - * @link http://php.net/manual/en/function.openssl-pkcs12-export-to-file.php - * @param mixed $x509 - * @param string $filename

- * Path to the output file. - *

- * @param mixed $priv_key

- * Private key component of PKCS#12 file. - *

- * @param string $pass

- * Encryption password for unlocking the PKCS#12 file. - *

- * @param array $args [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function openssl_pkcs12_export_to_file ($x509, $filename, $priv_key, $pass, array $args = null) {} - -/** - * (PHP 5 >= 5.2.2)
- * Parse a PKCS#12 Certificate Store into an array - * @link http://php.net/manual/en/function.openssl-pkcs12-read.php - * @param string $pkcs12 - * @param array $certs

- * On success, this will hold the Certificate Store Data. - *

- * @param string $pass

- * Encryption password for unlocking the PKCS#12 file. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function openssl_pkcs12_read ($pkcs12, array &$certs, $pass) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Generates a CSR - * @link http://php.net/manual/en/function.openssl-csr-new.php - * @param array $dn

- * The Distinguished Name to be used in the certificate. - *

- * @param resource $privkey

- * privkey should be set to a private key that was - * previously generated by openssl_pkey_new (or - * otherwise obtained from the other openssl_pkey family of functions). - * The corresponding public portion of the key will be used to sign the - * CSR. - *

- * @param array $configargs [optional]

- * By default, the information in your system openssl.conf - * is used to initialize the request; you can specify a configuration file - * section by setting the config_section_section key of - * configargs. You can also specify an alternative - * openssl configuration file by setting the value of the - * config key to the path of the file you want to use. - * The following keys, if present in configargs - * behave as their equivalents in the openssl.conf, as - * listed in the table below. - * - * Configuration overrides - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
configargs keytypeopenssl.conf equivalentdescription
digest_algstringdefault_mdSelects which digest method to use
x509_extensionsstringx509_extensionsSelects which extensions should be used when creating an x509 - * certificate
req_extensionsstringreq_extensionsSelects which extensions should be used when creating a CSR
private_key_bitsintegerdefault_bitsSpecifies how many bits should be used to generate a private - * key
private_key_typeintegernoneSpecifies the type of private key to create. This can be one - * of OPENSSL_KEYTYPE_DSA, - * OPENSSL_KEYTYPE_DH or - * OPENSSL_KEYTYPE_RSA. - * The default value is OPENSSL_KEYTYPE_RSA which - * is currently the only supported key type. - *
encrypt_keybooleanencrypt_keyShould an exported key (with passphrase) be encrypted?
encrypt_key_cipherintegernone - * One of cipher constants. - *
- *

- * @param array $extraattribs [optional]

- * extraattribs is used to specify additional - * configuration options for the CSR. Both dn and - * extraattribs are associative arrays whose keys are - * converted to OIDs and applied to the relevant part of the request. - *

- * @return mixed the CSR. - */ -function openssl_csr_new (array $dn, &$privkey, array $configargs = null, array $extraattribs = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Exports a CSR as a string - * @link http://php.net/manual/en/function.openssl-csr-export.php - * @param resource $csr - * @param string $out - * @param bool $notext [optional] The optional parameter notext affects - * the verbosity of the output; if it is FALSE, then additional human-readable - * information is included in the output. The default value of - * notext is TRUE. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function openssl_csr_export ($csr, &$out, $notext = true) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Exports a CSR to a file - * @link http://php.net/manual/en/function.openssl-csr-export-to-file.php - * @param resource $csr - * @param string $outfilename

- * Path to the output file. - *

- * @param bool $notext [optional] The optional parameter notext affects - * the verbosity of the output; if it is FALSE, then additional human-readable - * information is included in the output. The default value of - * notext is TRUE. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function openssl_csr_export_to_file ($csr, $outfilename, $notext = true) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Sign a CSR with another certificate (or itself) and generate a certificate - * @link http://php.net/manual/en/function.openssl-csr-sign.php - * @param mixed $csr

- * A CSR previously generated by openssl_csr_new. - * It can also be the path to a PEM encoded CSR when specified as - * file://path/to/csr or an exported string generated - * by openssl_csr_export. - *

- * @param mixed $cacert

- * The generated certificate will be signed by cacert. - * If cacert is NULL, the generated certificate - * will be a self-signed certificate. - *

- * @param mixed $priv_key

- * priv_key is the private key that corresponds to - * cacert. - *

- * @param int $days

- * days specifies the length of time for which the - * generated certificate will be valid, in days. - *

- * @param array $configargs [optional]

- * You can finetune the CSR signing by configargs. - * See openssl_csr_new for more information about - * configargs. - *

- * @param int $serial [optional]

- * An optional the serial number of issued certificate. If not specified - * it will default to 0. - *

- * @return resource an x509 certificate resource on success, FALSE on failure. - */ -function openssl_csr_sign ($csr, $cacert, $priv_key, $days, array $configargs = null, $serial = 0) {} - -/** - * (PHP 5 >= 5.2.0)
- * Returns the subject of a CERT - * @link http://php.net/manual/en/function.openssl-csr-get-subject.php - * @param mixed $csr - * @param bool $use_shortnames [optional] - * @return array - */ -function openssl_csr_get_subject ($csr, $use_shortnames = true) {} - -/** - * (PHP 5 >= 5.2.0)
- * Returns the public key of a CERT - * @link http://php.net/manual/en/function.openssl-csr-get-public-key.php - * @param mixed $csr - * @param bool $use_shortnames [optional] - * @return resource - */ -function openssl_csr_get_public_key ($csr, $use_shortnames = true) {} - -/** - * (PHP 5 >= 5.3.0)
- * Computes a digest - * @link http://php.net/manual/en/function.openssl-digest.php - * @param string $data

- * The data. - *

- * @param string $method

- * The digest method. - *

- * @param bool $raw_output [optional]

- * Setting to TRUE will return as raw output data, otherwise the return - * value is binhex encoded. - *

- * @return string the digested hash value on success or FALSE on failure. - */ -function openssl_digest ($data, $method, $raw_output = false) {} - -/** - * (PHP 5 >= 5.3.0)
- * Encrypts data - * @link http://php.net/manual/en/function.openssl-encrypt.php - * @param string $data

- * The data. - *

- * @param string $method

- * The cipher method. - *

- * @param string $password

- * The password. - *

- * @param bool $raw_output [optional]

- * Setting to TRUE will return as raw output data, otherwise the return - * value is base64 encoded. - *

- * @param string $iv [optional]

- * A non-NULL Initialization Vector. - *

- * @return string the encrypted string on success or FALSE on failure. - */ -function openssl_encrypt ($data, $method, $password, $raw_output = false, $iv = "") {} - -/** - * (PHP 5 >= 5.3.0)
- * Decrypts data - * @link http://php.net/manual/en/function.openssl-decrypt.php - * @param string $data

- * The data. - *

- * @param string $method

- * The cipher method. - *

- * @param string $password

- * The password. - *

- * @param bool $raw_input [optional]

- * Setting to TRUE will take a raw encoded string, - * otherwise a base64 string is assumed for the - * data parameter. - *

- * @param string $iv [optional]

- * A non-NULL Initialization Vector. - *

- * @return string The decrypted string on success or FALSE on failure. - */ -function openssl_decrypt ($data, $method, $password, $raw_input = false, $iv = "") {} - -/** - * (PHP 5 >= PHP 5.3.3)
- * Gets the cipher iv length - * @link http://php.net/manual/en/function.openssl-cipher-iv-length.php - * @param string $method

- * The method. - *

- * @return int the cipher length on success, or FALSE on failure. - */ -function openssl_cipher_iv_length ($method) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Generate signature - * @link http://php.net/manual/en/function.openssl-sign.php - * @param string $data - * @param string $signature

- * If the call was successful the signature is returned in - * signature. - *

- * @param mixed $priv_key_id - * @param int $signature_alg [optional]

- * For more information see the list of Signature Algorithms. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function openssl_sign ($data, &$signature, $priv_key_id, $signature_alg = 'OPENSSL_ALGO_SHA1') {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Verify signature - * @link http://php.net/manual/en/function.openssl-verify.php - * @param string $data - * @param string $signature - * @param mixed $pub_key_id - * @param int $signature_alg [optional]

- * For more information see the list of Signature Algorithms. - *

- * @return int 1 if the signature is correct, 0 if it is incorrect, and - * -1 on error. - */ -function openssl_verify ($data, $signature, $pub_key_id, $signature_alg = 'OPENSSL_ALGO_SHA1') {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Seal (encrypt) data - * @link http://php.net/manual/en/function.openssl-seal.php - * @param string $data - * @param string $sealed_data - * @param array $env_keys - * @param array $pub_key_ids - * @param string $method [optional] - * @return int the length of the sealed data on success, or FALSE on error. - * If successful the sealed data is returned in - * sealed_data, and the envelope keys in - * env_keys. - */ -function openssl_seal ($data, &$sealed_data, array &$env_keys, array $pub_key_ids, $method = null) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Open sealed data - * @link http://php.net/manual/en/function.openssl-open.php - * @param string $sealed_data - * @param string $open_data

- * If the call is successful the opened data is returned in this - * parameter. - *

- * @param string $env_key - * @param mixed $priv_key_id - * @param string $method [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function openssl_open ($sealed_data, &$open_data, $env_key, $priv_key_id, $method = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Verifies the signature of an S/MIME signed message - * @link http://php.net/manual/en/function.openssl-pkcs7-verify.php - * @param string $filename

- * Path to the message. - *

- * @param int $flags

- * flags can be used to affect how the signature is - * verified - see PKCS7 constants - * for more information. - *

- * @param string $outfilename [optional]

- * If the outfilename is specified, it should be a - * string holding the name of a file into which the certificates of the - * persons that signed the messages will be stored in PEM format. - *

- * @param array $cainfo [optional]

- * If the cainfo is specified, it should hold - * information about the trusted CA certificates to use in the verification - * process - see certificate - * verification for more information about this parameter. - *

- * @param string $extracerts [optional]

- * If the extracerts is specified, it is the filename - * of a file containing a bunch of certificates to use as untrusted CAs. - *

- * @param string $content [optional]

- * You can specify a filename with content that will - * be filled with the verified data, but with the signature information - * stripped. - *

- * @return mixed TRUE if the signature is verified, FALSE if it is not correct - * (the message has been tampered with, or the signing certificate is invalid), - * or -1 on error. - */ -function openssl_pkcs7_verify ($filename, $flags, $outfilename = null, array $cainfo = null, $extracerts = null, $content = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Decrypts an S/MIME encrypted message - * @link http://php.net/manual/en/function.openssl-pkcs7-decrypt.php - * @param string $infilename - * @param string $outfilename

- * The decrypted message is written to the file specified by - * outfilename. - *

- * @param mixed $recipcert - * @param mixed $recipkey [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function openssl_pkcs7_decrypt ($infilename, $outfilename, $recipcert, $recipkey = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Sign an S/MIME message - * @link http://php.net/manual/en/function.openssl-pkcs7-sign.php - * @param string $infilename - * @param string $outfilename - * @param mixed $signcert - * @param mixed $privkey - * @param array $headers

- * headers is an array of headers that - * will be prepended to the data after it has been signed (see - * openssl_pkcs7_encrypt for more information about - * the format of this parameter). - *

- * @param int $flags [optional]

- * flags can be used to alter the output - see PKCS7 constants. - *

- * @param string $extracerts [optional]

- * extracerts specifies the name of a file containing - * a bunch of extra certificates to include in the signature which can for - * example be used to help the recipient to verify the certificate that you used. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function openssl_pkcs7_sign ($infilename, $outfilename, $signcert, $privkey, array $headers, $flags = 'PKCS7_DETACHED', $extracerts = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Encrypt an S/MIME message - * @link http://php.net/manual/en/function.openssl-pkcs7-encrypt.php - * @param string $infile - * @param string $outfile - * @param mixed $recipcerts

- * Either a lone X.509 certificate, or an array of X.509 certificates. - *

- * @param array $headers

- * headers is an array of headers that - * will be prepended to the data after it has been encrypted. - *

- *

- * headers can be either an associative array - * keyed by header name, or an indexed array, where each element contains - * a single header line. - *

- * @param int $flags [optional]

- * flags can be used to specify options that affect - * the encoding process - see PKCS7 - * constants. - *

- * @param int $cipherid [optional]

- * One of cipher constants. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function openssl_pkcs7_encrypt ($infile, $outfile, $recipcerts, array $headers, $flags = 0, $cipherid = 'OPENSSL_CIPHER_RC2_40') {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Encrypts data with private key - * @link http://php.net/manual/en/function.openssl-private-encrypt.php - * @param string $data - * @param string $crypted - * @param mixed $key - * @param int $padding [optional]

- * padding can be one of - * OPENSSL_PKCS1_PADDING, - * OPENSSL_NO_PADDING. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function openssl_private_encrypt ($data, &$crypted, $key, $padding = 'OPENSSL_PKCS1_PADDING') {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Decrypts data with private key - * @link http://php.net/manual/en/function.openssl-private-decrypt.php - * @param string $data - * @param string $decrypted - * @param mixed $key

- * key must be the private key corresponding that - * was used to encrypt the data. - *

- * @param int $padding [optional]

- * padding can be one of - * OPENSSL_PKCS1_PADDING, - * OPENSSL_SSLV23_PADDING, - * OPENSSL_PKCS1_OAEP_PADDING, - * OPENSSL_NO_PADDING. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function openssl_private_decrypt ($data, &$decrypted, $key, $padding = 'OPENSSL_PKCS1_PADDING') {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Encrypts data with public key - * @link http://php.net/manual/en/function.openssl-public-encrypt.php - * @param string $data - * @param string $crypted

- * This will hold the result of the encryption. - *

- * @param mixed $key

- * The public key. - *

- * @param int $padding [optional]

- * padding can be one of - * OPENSSL_PKCS1_PADDING, - * OPENSSL_SSLV23_PADDING, - * OPENSSL_PKCS1_OAEP_PADDING, - * OPENSSL_NO_PADDING. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function openssl_public_encrypt ($data, &$crypted, $key, $padding = 'OPENSSL_PKCS1_PADDING') {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Decrypts data with public key - * @link http://php.net/manual/en/function.openssl-public-decrypt.php - * @param string $data - * @param string $decrypted - * @param mixed $key

- * key must be the public key corresponding that - * was used to encrypt the data. - *

- * @param int $padding [optional]

- * padding can be one of - * OPENSSL_PKCS1_PADDING, - * OPENSSL_NO_PADDING. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function openssl_public_decrypt ($data, &$decrypted, $key, $padding = 'OPENSSL_PKCS1_PADDING') {} - -/** - * (PHP 5 >= 5.3.0)
- * Gets available digest methods - * @link http://php.net/manual/en/function.openssl-get-md-methods.php - * @param bool $aliases [optional]

- * Set to TRUE if digest aliases should be included within the - * returned array. - *

- * @return array An array of available digest methods. - */ -function openssl_get_md_methods ($aliases = false) {} - -/** - * (PHP 5 >= 5.3.0)
- * Gets available cipher methods - * @link http://php.net/manual/en/function.openssl-get-cipher-methods.php - * @param bool $aliases [optional]

- * Set to TRUE if cipher aliases should be included within the - * returned array. - *

- * @return array An array of available cipher methods. - */ -function openssl_get_cipher_methods ($aliases = false) {} - -/** - * (No version information available, might only be in SVN)
- * Computes shared secret for public value of remote DH key and local DH key - * @link http://php.net/manual/en/function.openssl-dh-compute-key.php - * @param string $pub_key

- * Public key - *

- * @param resource $dh_key

- * DH key - *

- * @return string computed key on success or FALSE on failure. - */ -function openssl_dh_compute_key ($pub_key, $dh_key) {} - -/** - * (PHP 5 >= 5.3.0)
- * Generate a pseudo-random string of bytes - * @link http://php.net/manual/en/function.openssl-random-pseudo-bytes.php - * @param int $length

- * The length of the desired string of bytes. Must be a positive integer. PHP will - * try to cast this parameter to a non-null integer to use it. - *

- * @param bool $crypto_strong [optional]

- * If passed into the function, this will hold a boolean value that determines - * if the algorithm used was "cryptographically strong", e.g., safe for usage with GPG, - * passwords, etc. TRUE if it did, otherwise FALSE - *

- * @return string the generated string of bytes on success, or FALSE on failure. - */ -function openssl_random_pseudo_bytes ($length, &$crypto_strong = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Return openSSL error message - * @link http://php.net/manual/en/function.openssl-error-string.php - * @return string an error message string, or FALSE if there are no more error - * messages to return. - */ -function openssl_error_string () {} - -define ('OPENSSL_VERSION_TEXT', "OpenSSL 1.0.1c 10 May 2012"); -define ('OPENSSL_VERSION_NUMBER', 268439615); -define ('X509_PURPOSE_SSL_CLIENT', 1); -define ('X509_PURPOSE_SSL_SERVER', 2); -define ('X509_PURPOSE_NS_SSL_SERVER', 3); -define ('X509_PURPOSE_SMIME_SIGN', 4); -define ('X509_PURPOSE_SMIME_ENCRYPT', 5); -define ('X509_PURPOSE_CRL_SIGN', 6); -define ('X509_PURPOSE_ANY', 7); - -/** - * Used as default algorithm by openssl_sign and - * openssl_verify. - * @link http://php.net/manual/en/openssl.constants.php - */ -define ('OPENSSL_ALGO_SHA1', 1); -define ('OPENSSL_ALGO_MD5', 2); -define ('OPENSSL_ALGO_MD4', 3); -define ('OPENSSL_ALGO_DSS1', 5); - -/** - * When signing a message, use cleartext signing with the MIME - * type "multipart/signed". This is the default - * if you do not specify any flags to - * openssl_pkcs7_sign. - * If you turn this option off, the message will be signed using - * opaque signing, which is more resistant to translation by mail relays - * but cannot be read by mail agents that do not support S/MIME. - * @link http://php.net/manual/en/openssl.constants.php - */ -define ('PKCS7_DETACHED', 64); - -/** - * Adds text/plain content type headers to encrypted/signed - * message. If decrypting or verifying, it strips those headers from - * the output - if the decrypted or verified message is not of MIME type - * text/plain then an error will occur. - * @link http://php.net/manual/en/openssl.constants.php - */ -define ('PKCS7_TEXT', 1); - -/** - * When verifying a message, certificates (if - * any) included in the message are normally searched for the - * signing certificate. With this option only the - * certificates specified in the extracerts - * parameter of openssl_pkcs7_verify are - * used. The supplied certificates can still be used as - * untrusted CAs however. - * @link http://php.net/manual/en/openssl.constants.php - */ -define ('PKCS7_NOINTERN', 16); - -/** - * Do not verify the signers certificate of a signed - * message. - * @link http://php.net/manual/en/openssl.constants.php - */ -define ('PKCS7_NOVERIFY', 32); - -/** - * Do not chain verification of signers certificates: that is - * don't use the certificates in the signed message as untrusted CAs. - * @link http://php.net/manual/en/openssl.constants.php - */ -define ('PKCS7_NOCHAIN', 8); - -/** - * When signing a message the signer's certificate is normally - * included - with this option it is excluded. This will reduce the - * size of the signed message but the verifier must have a copy of the - * signers certificate available locally (passed using the - * extracerts to - * openssl_pkcs7_verify for example). - * @link http://php.net/manual/en/openssl.constants.php - */ -define ('PKCS7_NOCERTS', 2); - -/** - * Normally when a message is signed, a set of attributes are - * included which include the signing time and the supported symmetric - * algorithms. With this option they are not included. - * @link http://php.net/manual/en/openssl.constants.php - */ -define ('PKCS7_NOATTR', 256); - -/** - * Normally the input message is converted to "canonical" format - * which is effectively using CR and LF - * as end of line: as required by the S/MIME specification. When this - * option is present, no translation occurs. This is useful when - * handling binary data which may not be in MIME format. - * @link http://php.net/manual/en/openssl.constants.php - */ -define ('PKCS7_BINARY', 128); - -/** - * Don't try and verify the signatures on a message - * @link http://php.net/manual/en/openssl.constants.php - */ -define ('PKCS7_NOSIGS', 4); -define ('OPENSSL_PKCS1_PADDING', 1); -define ('OPENSSL_SSLV23_PADDING', 2); -define ('OPENSSL_NO_PADDING', 3); -define ('OPENSSL_PKCS1_OAEP_PADDING', 4); -define ('OPENSSL_CIPHER_RC2_40', 0); -define ('OPENSSL_CIPHER_RC2_128', 1); -define ('OPENSSL_CIPHER_RC2_64', 2); -define ('OPENSSL_CIPHER_DES', 3); -define ('OPENSSL_CIPHER_3DES', 4); -define ('OPENSSL_CIPHER_AES_128_CBC', 5); -define ('OPENSSL_CIPHER_AES_192_CBC', 6); -define ('OPENSSL_CIPHER_AES_256_CBC', 7); -define ('OPENSSL_KEYTYPE_RSA', 0); -define ('OPENSSL_KEYTYPE_DSA', 1); -define ('OPENSSL_KEYTYPE_DH', 2); -define ('OPENSSL_KEYTYPE_EC', 3); -define ('OPENSSL_RAW_DATA', 1); -define ('OPENSSL_ZERO_PADDING', 2); - -/** - * Whether SNI support is available or not. - * @link http://php.net/manual/en/openssl.constants.php - */ -define ('OPENSSL_TLSEXT_SERVER_NAME', 1); - -// End of openssl v. -?> diff --git a/phpruntime/pcntl.php b/phpruntime/pcntl.php deleted file mode 100644 index ec89b27..0000000 --- a/phpruntime/pcntl.php +++ /dev/null @@ -1,758 +0,0 @@ - - * Forks the currently running process - * @link http://php.net/manual/en/function.pcntl-fork.php - * @return int On success, the PID of the child process is returned in the - * parent's thread of execution, and a 0 is returned in the child's - * thread of execution. On failure, a -1 will be returned in the - * parent's context, no child process will be created, and a PHP - * error is raised. - */ -function pcntl_fork () {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Waits on or returns the status of a forked child - * @link http://php.net/manual/en/function.pcntl-waitpid.php - * @param int $pid

- * The value of pid can be one of the following: - * - * possible values for pid - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
< -1 - * wait for any child process whose process group ID is equal to - * the absolute value of pid. - *
-1 - * wait for any child process; this is the same behaviour that - * the wait function exhibits. - *
0 - * wait for any child process whose process group ID is equal to - * that of the calling process. - *
> 0 - * wait for the child whose process ID is equal to the value of - * pid. - *
- *

- *

- * Specifying -1 as the pid is - * equivalent to the functionality pcntl_wait provides - * (minus options). - *

- * @param int $status

- * pcntl_waitpid will store status information - * in the status parameter which can be - * evaluated using the following functions: - * pcntl_wifexited, - * pcntl_wifstopped, - * pcntl_wifsignaled, - * pcntl_wexitstatus, - * pcntl_wtermsig and - * pcntl_wstopsig. - *

- * @param int $options [optional]

- * The value of options is the value of zero - * or more of the following two global constants - * OR'ed together: - * - * possible values for options - * - * - * - * - * - * - * - * - *
WNOHANG - * return immediately if no child has exited. - *
WUNTRACED - * return for children which are stopped, and whose status has - * not been reported. - *
- *

- * @return int pcntl_waitpid returns the process ID of the - * child which exited, -1 on error or zero if WNOHANG was used and no - * child was available - */ -function pcntl_waitpid ($pid, &$status, $options = 0) {} - -/** - * (PHP 5)
- * Waits on or returns the status of a forked child - * @link http://php.net/manual/en/function.pcntl-wait.php - * @param int $status

- * pcntl_wait will store status information - * in the status parameter which can be - * evaluated using the following functions: - * pcntl_wifexited, - * pcntl_wifstopped, - * pcntl_wifsignaled, - * pcntl_wexitstatus, - * pcntl_wtermsig and - * pcntl_wstopsig. - *

- * @param int $options [optional]

- * If wait3 is available on your system (mostly BSD-style systems), you can - * provide the optional options parameter. If this - * parameter is not provided, wait will be used for the system call. If - * wait3 is not available, providing a value for options - * will have no effect. The value of options - * is the value of zero or more of the following two constants - * OR'ed together: - * - * Possible values for options - * - * - * - * - * - * - * - * - *
WNOHANG - * Return immediately if no child has exited. - *
WUNTRACED - * Return for children which are stopped, and whose status has - * not been reported. - *
- *

- * @return int pcntl_wait returns the process ID of the - * child which exited, -1 on error or zero if WNOHANG was provided as an - * option (on wait3-available systems) and no child was available. - */ -function pcntl_wait (&$status, $options = 0) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Installs a signal handler - * @link http://php.net/manual/en/function.pcntl-signal.php - * @param int $signo

- * The signal number. - *

- * @param callable $handler

- * The signal handler which may be the name of a user created function, - * or method, or either of the two global constants - * SIG_IGN or SIG_DFL. - *

- *

- * Note that when you set a handler to an object method, that object's - * reference count is increased which makes it persist until you either - * change the handler to something else, or your script ends. - *

- * @param bool $restart_syscalls [optional]

- * Specifies whether system call restarting should be used when this - * signal arrives. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pcntl_signal ($signo, callable $handler, $restart_syscalls = true) {} - -/** - * (PHP 5 >= 5.3.0)
- * Calls signal handlers for pending signals - * @link http://php.net/manual/en/function.pcntl-signal-dispatch.php - * @return bool TRUE on success or FALSE on failure. - */ -function pcntl_signal_dispatch () {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Checks if status code represents a normal exit - * @link http://php.net/manual/en/function.pcntl-wifexited.php - * @param int $status The status - * parameter is the status parameter supplied to a successful - * call to pcntl_waitpid.

- * @return bool TRUE if the child status code represents a normal exit, FALSE - * otherwise. - */ -function pcntl_wifexited ($status) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Checks whether the child process is currently stopped - * @link http://php.net/manual/en/function.pcntl-wifstopped.php - * @param int $status The status - * parameter is the status parameter supplied to a successful - * call to pcntl_waitpid.

- * @return bool TRUE if the child process which caused the return is - * currently stopped, FALSE otherwise. - */ -function pcntl_wifstopped ($status) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Checks whether the status code represents a termination due to a signal - * @link http://php.net/manual/en/function.pcntl-wifsignaled.php - * @param int $status The status - * parameter is the status parameter supplied to a successful - * call to pcntl_waitpid.

- * @return bool TRUE if the child process exited because of a signal which was - * not caught, FALSE otherwise. - */ -function pcntl_wifsignaled ($status) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Returns the return code of a terminated child - * @link http://php.net/manual/en/function.pcntl-wexitstatus.php - * @param int $status The status - * parameter is the status parameter supplied to a successful - * call to pcntl_waitpid.

- * @return int the return code, as an integer. - */ -function pcntl_wexitstatus ($status) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Returns the signal which caused the child to terminate - * @link http://php.net/manual/en/function.pcntl-wtermsig.php - * @param int $status The status - * parameter is the status parameter supplied to a successful - * call to pcntl_waitpid.

- * @return int the signal number, as an integer. - */ -function pcntl_wtermsig ($status) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Returns the signal which caused the child to stop - * @link http://php.net/manual/en/function.pcntl-wstopsig.php - * @param int $status The status - * parameter is the status parameter supplied to a successful - * call to pcntl_waitpid.

- * @return int the signal number. - */ -function pcntl_wstopsig ($status) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Executes specified program in current process space - * @link http://php.net/manual/en/function.pcntl-exec.php - * @param string $path

- * path must be the path to a binary executable or a - * script with a valid path pointing to an executable in the shebang ( - * #!/usr/local/bin/perl for example) as the first line. See your system's - * man execve(2) page for additional information. - *

- * @param array $args [optional]

- * args is an array of argument strings passed to the - * program. - *

- * @param array $envs [optional]

- * envs is an array of strings which are passed as - * environment to the program. The array is in the format of name => value, - * the key being the name of the environmental variable and the value being - * the value of that variable. - *

- * @return void FALSE on error and does not return on success. - */ -function pcntl_exec ($path, array $args = null, array $envs = null) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Set an alarm clock for delivery of a signal - * @link http://php.net/manual/en/function.pcntl-alarm.php - * @param int $seconds

- * The number of seconds to wait. If seconds is - * zero, no new alarm is created. - *

- * @return int the time in seconds that any previously scheduled alarm had - * remaining before it was to be delivered, or 0 if there - * was no previously scheduled alarm. - */ -function pcntl_alarm ($seconds) {} - -function pcntl_get_last_error () {} - -function pcntl_errno () {} - -/** - * @param $errno - */ -function pcntl_strerror ($errno) {} - -/** - * (PHP 5)
- * Get the priority of any process - * @link http://php.net/manual/en/function.pcntl-getpriority.php - * @param int $pid [optional]

- * If not specified, the pid of the current process is used. - *

- * @param int $process_identifier [optional]

- * One of PRIO_PGRP, PRIO_USER - * or PRIO_PROCESS. - *

- * @return int pcntl_getpriority returns the priority of the process - * or FALSE on error. A lower numerical value causes more favorable - * scheduling. - */ -function pcntl_getpriority ($pid = 'getmypid()', $process_identifier = 'PRIO_PROCESS') {} - -/** - * (PHP 5)
- * Change the priority of any process - * @link http://php.net/manual/en/function.pcntl-setpriority.php - * @param int $priority

- * priority is generally a value in the range - * -20 to 20. The default priority - * is 0 while a lower numerical value causes more - * favorable scheduling. Because priority levels can differ between - * system types and kernel versions, please see your system's setpriority(2) - * man page for specific details. - *

- * @param int $pid [optional]

- * If not specified, the pid of the current process is used. - *

- * @param int $process_identifier [optional]

- * One of PRIO_PGRP, PRIO_USER - * or PRIO_PROCESS. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pcntl_setpriority ($priority, $pid = 'getmypid()', $process_identifier = 'PRIO_PROCESS') {} - -/** - * (PHP 5 >= 5.3.0)
- * Sets and retrieves blocked signals - * @link http://php.net/manual/en/function.pcntl-sigprocmask.php - * @param int $how

- * Sets the behavior of pcntl_sigprocmask. Possible - * values: - * SIG_BLOCK: Add the signals to the - * currently blocked signals. - * SIG_UNBLOCK: Remove the signals from the - * currently blocked signals. - * SIG_SETMASK: Replace the currently - * blocked signals by the given list of signals. - *

- * @param array $set

- * List of signals. - *

- * @param array $oldset [optional]

- * The oldset parameter is set to an array - * containing the list of the previously blocked signals. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pcntl_sigprocmask ($how, array $set, array &$oldset = null) {} - -/** - * (PHP 5 >= 5.3.0)
- * Waits for signals - * @link http://php.net/manual/en/function.pcntl-sigwaitinfo.php - * @param array $set

- * Array of signals to wait for. - *

- * @param array $siginfo [optional]

- * The siginfo parameter is set to an array containing - * informations about the signal. - *

- *

- * The following elements are set for all signals: - * signo: Signal number - * errno: An error number - * code: Signal code - *

- *

- * The following elements may be set for the SIGCHLD signal: - * status: Exit value or signal - * utime: User time consumed - * stime: System time consumed - * pid: Sending process ID - * uid: Real user ID of sending process - *

- *

- * The following elements may be set for the SIGILL, - * SIGFPE, SIGSEGV and - * SIGBUS signals: - * addr: Memory location which caused fault - *

- *

- * The following element may be set for the SIGPOLL - * signal: - * band: Band event - * fd: File descriptor number - *

- * @return int On success, pcntl_sigwaitinfo returns a signal number. - */ -function pcntl_sigwaitinfo (array $set, array &$siginfo = null) {} - -/** - * (PHP 5 >= 5.3.0)
- * Waits for signals, with a timeout - * @link http://php.net/manual/en/function.pcntl-sigtimedwait.php - * @param array $set

- * Array of signals to wait for. - *

- * @param array $siginfo [optional]

- * The siginfo is set to an array containing - * informations about the signal. See - * pcntl_sigwaitinfo. - *

- * @param int $seconds [optional]

- * Timeout in seconds. - *

- * @param int $nanoseconds [optional]

- * Timeout in nanoseconds. - *

- * @return int On success, pcntl_sigtimedwait returns a signal number. - */ -function pcntl_sigtimedwait (array $set, array &$siginfo = null, $seconds = 0, $nanoseconds = 0) {} - -define ('WNOHANG', 1); -define ('WUNTRACED', 2); -define ('SIG_IGN', 1); -define ('SIG_DFL', 0); -define ('SIG_ERR', -1); -define ('SIGHUP', 1); -define ('SIGINT', 2); -define ('SIGQUIT', 3); -define ('SIGILL', 4); -define ('SIGTRAP', 5); -define ('SIGABRT', 6); -define ('SIGIOT', 6); -define ('SIGBUS', 7); -define ('SIGFPE', 8); -define ('SIGKILL', 9); -define ('SIGUSR1', 10); -define ('SIGSEGV', 11); -define ('SIGUSR2', 12); -define ('SIGPIPE', 13); -define ('SIGALRM', 14); -define ('SIGTERM', 15); -define ('SIGSTKFLT', 16); -define ('SIGCLD', 17); -define ('SIGCHLD', 17); -define ('SIGCONT', 18); -define ('SIGSTOP', 19); -define ('SIGTSTP', 20); -define ('SIGTTIN', 21); -define ('SIGTTOU', 22); -define ('SIGURG', 23); -define ('SIGXCPU', 24); -define ('SIGXFSZ', 25); -define ('SIGVTALRM', 26); -define ('SIGPROF', 27); -define ('SIGWINCH', 28); -define ('SIGPOLL', 29); -define ('SIGIO', 29); -define ('SIGPWR', 30); -define ('SIGSYS', 31); -define ('SIGBABY', 31); -define ('PRIO_PGRP', 1); -define ('PRIO_USER', 2); -define ('PRIO_PROCESS', 0); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('SIG_BLOCK', 0); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('SIG_UNBLOCK', 1); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('SIG_SETMASK', 2); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('SI_USER', 0); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('SI_KERNEL', 128); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('SI_QUEUE', -1); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('SI_TIMER', -2); -define ('SI_MESGQ', -3); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('SI_ASYNCIO', -4); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('SI_SIGIO', -5); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('SI_TKILL', -6); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('CLD_EXITED', 1); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('CLD_KILLED', 2); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('CLD_DUMPED', 3); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('CLD_TRAPPED', 4); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('CLD_STOPPED', 5); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('CLD_CONTINUED', 6); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('TRAP_BRKPT', 1); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('TRAP_TRACE', 2); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('POLL_IN', 1); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('POLL_OUT', 2); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('POLL_MSG', 3); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('POLL_ERR', 4); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('POLL_PRI', 5); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('POLL_HUP', 6); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('ILL_ILLOPC', 1); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('ILL_ILLOPN', 2); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('ILL_ILLADR', 3); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('ILL_ILLTRP', 4); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('ILL_PRVOPC', 5); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('ILL_PRVREG', 6); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('ILL_COPROC', 7); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('ILL_BADSTK', 8); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('FPE_INTDIV', 1); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('FPE_INTOVF', 2); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('FPE_FLTDIV', 3); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('FPE_FLTOVF', 4); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('FPE_FLTUND', 7); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('FPE_FLTRES', 6); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('FPE_FLTINV', 7); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('FPE_FLTSUB', 8); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('SEGV_MAPERR', 1); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('SEGV_ACCERR', 2); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('BUS_ADRALN', 1); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('BUS_ADRERR', 2); - -/** - * Available since PHP 5.3.0. - * @link http://php.net/manual/en/pcntl.constants.php - */ -define ('BUS_OBJERR', 3); -define ('PCNTL_EINTR', 4); -define ('PCNTL_ECHILD', 10); -define ('PCNTL_EINVAL', 22); -define ('PCNTL_EAGAIN', 11); -define ('PCNTL_ESRCH', 3); -define ('PCNTL_EACCES', 13); -define ('PCNTL_EPERM', 1); -define ('PCNTL_ENOMEM', 12); -define ('PCNTL_E2BIG', 7); -define ('PCNTL_EFAULT', 14); -define ('PCNTL_EIO', 5); -define ('PCNTL_EISDIR', 21); -define ('PCNTL_ELIBBAD', 80); -define ('PCNTL_ELOOP', 40); -define ('PCNTL_EMFILE', 24); -define ('PCNTL_ENAMETOOLONG', 36); -define ('PCNTL_ENFILE', 23); -define ('PCNTL_ENOENT', 2); -define ('PCNTL_ENOEXEC', 8); -define ('PCNTL_ENOTDIR', 20); -define ('PCNTL_ETXTBSY', 26); - -// End of pcntl v. -?> diff --git a/phpruntime/pcre.php b/phpruntime/pcre.php deleted file mode 100644 index 7b27cbd..0000000 --- a/phpruntime/pcre.php +++ /dev/null @@ -1,499 +0,0 @@ - - * Perform a regular expression match - * @link http://php.net/manual/en/function.preg-match.php - * @param string $pattern

- * The pattern to search for, as a string. - *

- * @param string $subject

- * The input string. - *

- * @param array $matches [optional]

- * If matches is provided, then it is filled with - * the results of search. $matches[0] will contain the - * text that matched the full pattern, $matches[1] - * will have the text that matched the first captured parenthesized - * subpattern, and so on. - *

- * @param int $flags [optional]

- * flags can be the following flag: - * PREG_OFFSET_CAPTURE - * If this flag is passed, for every occurring match the appendant string - * offset will also be returned. Note that this changes the value of - * matches into an array where every element is an - * array consisting of the matched string at offset 0 - * and its string offset into subject at offset - * 1. - * @param int $offset [optional]

- * Normally, the search starts from the beginning of the subject string. - * The optional parameter offset can be used to - * specify the alternate place from which to start the search (in bytes). - *

- *

- * Using offset is not equivalent to passing - * substr($subject, $offset) to - * preg_match in place of the subject string, - * because pattern can contain assertions such as - * ^, $ or - * (?<=x). Compare: - * - * $subject = "abcdef"; - * $pattern = '/^def/'; - * preg_match($pattern, $subject, $matches, PREG_OFFSET_CAPTURE, 3); - * print_r($matches); - * - * The above example will output:

- *
- * Array
- * (
- * )
- * 
- *

- * while this example - *

- * - * $subject = "abcdef"; - * $pattern = '/^def/'; - * preg_match($pattern, substr($subject,3), $matches, PREG_OFFSET_CAPTURE); - * print_r($matches); - * - *

- * will produce - *

- *
- * Array
- * (
- * [0] => Array
- * (
- * [0] => def
- * [1] => 0
- * )
- * )
- * 
- *

- * @return int preg_match returns 1 if the pattern - * matches given subject, 0 if it does not, or FALSE - * if an error occurred. - */ -function preg_match ($pattern, $subject, array &$matches = null, $flags = 0, $offset = 0) {} - -/** - * (PHP 4, PHP 5)
- * Perform a global regular expression match - * @link http://php.net/manual/en/function.preg-match-all.php - * @param string $pattern

- * The pattern to search for, as a string. - *

- * @param string $subject

- * The input string. - *

- * @param array $matches [optional]

- * Normally, the search starts from the beginning of the subject string. - * The optional parameter offset can be used to - * specify the alternate place from which to start the search (in bytes). - *

- *

- * Using offset is not equivalent to passing - * substr($subject, $offset) to - * preg_match_all in place of the subject string, - * because pattern can contain assertions such as - * ^, $ or - * (?<=x). See preg_match - * for examples. - *

- * @param int $flags [optional]

- * Can be a combination of the following flags (note that it doesn't make - * sense to use PREG_PATTERN_ORDER together with - * PREG_SET_ORDER): - * PREG_PATTERN_ORDER - *

- * Orders results so that $matches[0] is an array of full - * pattern matches, $matches[1] is an array of strings matched by - * the first parenthesized subpattern, and so on. - *

- *

- * - * preg_match_all("|]+>(.*)]+>|U", - * "example: this is a test", - * $out, PREG_PATTERN_ORDER); - * echo $out[0][0] . ", " . $out[0][1] . "\n"; - * echo $out[1][0] . ", " . $out[1][1] . "\n"; - * - * The above example will output:

- *
- * example: , this is a test
- * example: , this is a test
- * 
- *

- * So, $out[0] contains array of strings that matched full pattern, - * and $out[1] contains array of strings enclosed by tags. - *

- *

- * @param int $offset [optional] - * @return int the number of full pattern matches (which might be zero), - * or FALSE if an error occurred. - */ -function preg_match_all ($pattern, $subject, array &$matches = null, $flags = 'PREG_PATTERN_ORDER', $offset = 0) {} - -/** - * (PHP 4, PHP 5)
- * Perform a regular expression search and replace - * @link http://php.net/manual/en/function.preg-replace.php - * @param mixed $pattern

- * The pattern to search for. It can be either a string or an array with - * strings. - *

- *

- * Several PCRE modifiers - * are also available, including 'e' (PREG_REPLACE_EVAL), which - * is specific to this function. - *

- * @param mixed $replacement

- * The string or an array with strings to replace. If this parameter is a - * string and the pattern parameter is an array, - * all patterns will be replaced by that string. If both - * pattern and replacement - * parameters are arrays, each pattern will be - * replaced by the replacement counterpart. If - * there are fewer elements in the replacement - * array than in the pattern array, any extra - * patterns will be replaced by an empty string. - *

- *

- * replacement may contain references of the form - * \\n or (since PHP 4.0.4) - * $n, with the latter form - * being the preferred one. Every such reference will be replaced by the text - * captured by the n'th parenthesized pattern. - * n can be from 0 to 99, and - * \\0 or $0 refers to the text matched - * by the whole pattern. Opening parentheses are counted from left to right - * (starting from 1) to obtain the number of the capturing subpattern. - * To use backslash in replacement, it must be doubled - * ("\\\\" PHP string). - *

- *

- * When working with a replacement pattern where a backreference is - * immediately followed by another number (i.e.: placing a literal number - * immediately after a matched pattern), you cannot use the familiar - * \\1 notation for your backreference. - * \\11, for example, would confuse - * preg_replace since it does not know whether you - * want the \\1 backreference followed by a literal - * 1, or the \\11 backreference - * followed by nothing. In this case the solution is to use - * \${1}1. This creates an isolated - * $1 backreference, leaving the 1 - * as a literal. - *

- *

- * When using the e modifier, this function escapes - * some characters (namely ', ", - * \ and NULL) in the strings that replace the - * backreferences. This is done to ensure that no syntax errors arise - * from backreference usage with either single or double quotes (e.g. - * 'strlen(\'$1\')+strlen("$2")'). Make sure you are - * aware of PHP's string - * syntax to know exactly how the interpreted string will look. - *

- * @param mixed $subject

- * The string or an array with strings to search and replace. - *

- *

- * If subject is an array, then the search and - * replace is performed on every entry of subject, - * and the return value is an array as well. - *

- * @param int $limit [optional]

- * The maximum possible replacements for each pattern in each - * subject string. Defaults to - * -1 (no limit). - *

- * @param int $count [optional]

- * If specified, this variable will be filled with the number of - * replacements done. - *

- * @return mixed preg_replace returns an array if the - * subject parameter is an array, or a string - * otherwise. - *

- *

- * If matches are found, the new subject will - * be returned, otherwise subject will be - * returned unchanged or NULL if an error occurred. - */ -function preg_replace ($pattern, $replacement, $subject, $limit = -1, &$count = null) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Perform a regular expression search and replace using a callback - * @link http://php.net/manual/en/function.preg-replace-callback.php - * @param mixed $pattern

- * The pattern to search for. It can be either a string or an array with - * strings. - *

- * @param callable $callback

- * A callback that will be called and passed an array of matched elements - * in the subject string. The callback should - * return the replacement string. - *

- *

- * You'll often need the callback function - * for a preg_replace_callback in just one place. - * In this case you can use an - * anonymous function (since - * PHP 5.3.0) or create_function to - * declare an anonymous function as callback within the call to - * preg_replace_callback. By doing it this way - * you have all information for the call in one place and do not - * clutter the function namespace with a callback function's name - * not used anywhere else. - *

- *

- * preg_replace_callback and - * create_function - * - * /* a unix-style command line filter to convert uppercase - * * letters at the beginning of paragraphs to lowercase * / - * $fp = fopen("php://stdin", "r") or die("can't read stdin"); - * while (!feof($fp)) { - * $line = fgets($fp); - * $line = preg_replace_callback( - * '|

\s*\w|', - * create_function( - * // single quotes are essential here, - * // or alternative escape all $ as \$ - * '$matches', - * 'return strtolower($matches[0]);' - * ), - * $line - * ); - * echo $line; - * } - * fclose($fp); - * - *

- * @param mixed $subject

- * The string or an array with strings to search and replace. - *

- * @param int $limit [optional]

- * The maximum possible replacements for each pattern in each - * subject string. Defaults to - * -1 (no limit). - *

- * @param int $count [optional]

- * If specified, this variable will be filled with the number of - * replacements done. - *

- * @return mixed preg_replace_callback returns an array if the - * subject parameter is an array, or a string - * otherwise. On errors the return value is NULL - *

- *

- * If matches are found, the new subject will be returned, otherwise - * subject will be returned unchanged. - */ -function preg_replace_callback ($pattern, callable $callback, $subject, $limit = -1, &$count = null) {} - -/** - * (PHP 5 >= 5.3.0)
- * Perform a regular expression search and replace - * @link http://php.net/manual/en/function.preg-filter.php - * @param mixed $pattern - * @param mixed $replacement - * @param mixed $subject - * @param int $limit [optional] - * @param int $count [optional] - * @return mixed an array if the subject - * parameter is an array, or a string otherwise. - *

- *

- * If no matches are found or an error occurred, an empty array - * is returned when subject is an array - * or NULL otherwise. - */ -function preg_filter ($pattern, $replacement, $subject, $limit = -1, &$count = null) {} - -/** - * (PHP 4, PHP 5)
- * Split string by a regular expression - * @link http://php.net/manual/en/function.preg-split.php - * @param string $pattern

- * The pattern to search for, as a string. - *

- * @param string $subject

- * The input string. - *

- * @param int $limit [optional]

- * If specified, then only substrings up to limit - * are returned with the rest of the string being placed in the last - * substring. A limit of -1, 0 or NULL means "no limit" - * and, as is standard across PHP, you can use NULL to skip to the - * flags parameter. - *

- * @param int $flags [optional]

- * flags can be any combination of the following - * flags (combined with the | bitwise operator): - * PREG_SPLIT_NO_EMPTY - * If this flag is set, only non-empty pieces will be returned by - * preg_split. - * @return array an array containing substrings of subject - * split along boundaries matched by pattern. - */ -function preg_split ($pattern, $subject, $limit = -1, $flags = 0) {} - -/** - * (PHP 4, PHP 5)
- * Quote regular expression characters - * @link http://php.net/manual/en/function.preg-quote.php - * @param string $str

- * The input string. - *

- * @param string $delimiter [optional]

- * If the optional delimiter is specified, it - * will also be escaped. This is useful for escaping the delimiter - * that is required by the PCRE functions. The / is the most commonly - * used delimiter. - *

- * @return string the quoted string. - */ -function preg_quote ($str, $delimiter = null) {} - -/** - * (PHP 4, PHP 5)
- * Return array entries that match the pattern - * @link http://php.net/manual/en/function.preg-grep.php - * @param string $pattern

- * The pattern to search for, as a string. - *

- * @param array $input

- * The input array. - *

- * @param int $flags [optional]

- * If set to PREG_GREP_INVERT, this function returns - * the elements of the input array that do not match - * the given pattern. - *

- * @return array an array indexed using the keys from the - * input array. - */ -function preg_grep ($pattern, array $input, $flags = 0) {} - -/** - * (PHP 5 >= 5.2.0)
- * Returns the error code of the last PCRE regex execution - * @link http://php.net/manual/en/function.preg-last-error.php - * @return int one of the following constants (explained on their own page): - * PREG_NO_ERROR - * PREG_INTERNAL_ERROR - * PREG_BACKTRACK_LIMIT_ERROR (see also pcre.backtrack_limit) - * PREG_RECURSION_LIMIT_ERROR (see also pcre.recursion_limit) - * PREG_BAD_UTF8_ERROR - * PREG_BAD_UTF8_OFFSET_ERROR (since PHP 5.3.0) - */ -function preg_last_error () {} - - -/** - * Orders results so that $matches[0] is an array of full pattern - * matches, $matches[1] is an array of strings matched by the first - * parenthesized subpattern, and so on. This flag is only used with - * preg_match_all. - * @link http://php.net/manual/en/pcre.constants.php - */ -define ('PREG_PATTERN_ORDER', 1); - -/** - * Orders results so that $matches[0] is an array of first set of - * matches, $matches[1] is an array of second set of matches, and so - * on. This flag is only used with preg_match_all. - * @link http://php.net/manual/en/pcre.constants.php - */ -define ('PREG_SET_ORDER', 2); - -/** - * See the description of - * PREG_SPLIT_OFFSET_CAPTURE. - * @link http://php.net/manual/en/pcre.constants.php - */ -define ('PREG_OFFSET_CAPTURE', 256); - -/** - * This flag tells preg_split to return only non-empty - * pieces. - * @link http://php.net/manual/en/pcre.constants.php - */ -define ('PREG_SPLIT_NO_EMPTY', 1); - -/** - * This flag tells preg_split to capture - * parenthesized expression in the delimiter pattern as well. - * @link http://php.net/manual/en/pcre.constants.php - */ -define ('PREG_SPLIT_DELIM_CAPTURE', 2); - -/** - * If this flag is set, for every occurring match the appendant string - * offset will also be returned. Note that this changes the return - * values in an array where every element is an array consisting of the - * matched string at offset 0 and its string offset within subject at - * offset 1. This flag is only used for preg_split. - * @link http://php.net/manual/en/pcre.constants.php - */ -define ('PREG_SPLIT_OFFSET_CAPTURE', 4); -define ('PREG_GREP_INVERT', 1); - -/** - * Returned by preg_last_error if there were no - * errors. - * @link http://php.net/manual/en/pcre.constants.php - */ -define ('PREG_NO_ERROR', 0); - -/** - * Returned by preg_last_error if there was an - * internal PCRE error. - * @link http://php.net/manual/en/pcre.constants.php - */ -define ('PREG_INTERNAL_ERROR', 1); - -/** - * Returned by preg_last_error if backtrack limit was exhausted. - * @link http://php.net/manual/en/pcre.constants.php - */ -define ('PREG_BACKTRACK_LIMIT_ERROR', 2); - -/** - * Returned by preg_last_error if recursion limit was exhausted. - * @link http://php.net/manual/en/pcre.constants.php - */ -define ('PREG_RECURSION_LIMIT_ERROR', 3); - -/** - * Returned by preg_last_error if the last error was - * caused by malformed UTF-8 data (only when running a regex in UTF-8 mode). - * @link http://php.net/manual/en/pcre.constants.php - */ -define ('PREG_BAD_UTF8_ERROR', 4); - -/** - * Returned by preg_last_error if the offset didn't - * correspond to the begin of a valid UTF-8 code point (only when running - * a regex in UTF-8 - * mode). - * @link http://php.net/manual/en/pcre.constants.php - */ -define ('PREG_BAD_UTF8_OFFSET_ERROR', 5); - -/** - * PCRE version and release date (e.g. "7.0 18-Dec-2006"). - * @link http://php.net/manual/en/pcre.constants.php - */ -define ('PCRE_VERSION', "8.30 2012-02-04"); - -// End of pcre v. -?> diff --git a/phpruntime/pdo_dblib.php b/phpruntime/pdo_dblib.php deleted file mode 100644 index d5ccbdb..0000000 --- a/phpruntime/pdo_dblib.php +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/phpruntime/pdo_mysql.php b/phpruntime/pdo_mysql.php deleted file mode 100644 index b6fdd63..0000000 --- a/phpruntime/pdo_mysql.php +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/phpruntime/pdo_pgsql.php b/phpruntime/pdo_pgsql.php deleted file mode 100644 index e551b7a..0000000 --- a/phpruntime/pdo_pgsql.php +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/phpruntime/pdo_sqlite.php b/phpruntime/pdo_sqlite.php deleted file mode 100644 index d33f2d2..0000000 --- a/phpruntime/pdo_sqlite.php +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/phpruntime/pgsql.php b/phpruntime/pgsql.php deleted file mode 100644 index 3e52ce8..0000000 --- a/phpruntime/pgsql.php +++ /dev/null @@ -1,2079 +0,0 @@ - - * Open a PostgreSQL connection - * @link http://php.net/manual/en/function.pg-connect.php - * @param string $connection_string

- * The connection_string can be empty to use all default parameters, or it - * can contain one or more parameter settings separated by whitespace. - * Each parameter setting is in the form keyword = value. Spaces around - * the equal sign are optional. To write an empty value or a value - * containing spaces, surround it with single quotes, e.g., keyword = - * 'a value'. Single quotes and backslashes within the value must be - * escaped with a backslash, i.e., \' and \\. - *

- *

- * The currently recognized parameter keywords are: - * host, hostaddr, port, - * dbname (defaults to value of user), - * user, - * password, connect_timeout, - * options, tty (ignored), sslmode, - * requiressl (deprecated in favor of sslmode), and - * service. Which of these arguments exist depends - * on your PostgreSQL version. - *

- *

- * The options parameter can be used to set command line parameters - * to be invoked by the server. - *

- * @param int $connect_type [optional]

- * If PGSQL_CONNECT_FORCE_NEW is passed, then a new connection - * is created, even if the connection_string is identical to - * an existing connection. - *

- * @return resource PostgreSQL connection resource on success, FALSE on failure. - */ -function pg_connect ($connection_string, $connect_type = null) {} - -/** - * (PHP 4, PHP 5)
- * Open a persistent PostgreSQL connection - * @link http://php.net/manual/en/function.pg-pconnect.php - * @param string $connection_string

- * The connection_string can be empty to use all default parameters, or it - * can contain one or more parameter settings separated by whitespace. - * Each parameter setting is in the form keyword = value. Spaces around - * the equal sign are optional. To write an empty value or a value - * containing spaces, surround it with single quotes, e.g., keyword = - * 'a value'. Single quotes and backslashes within the value must be - * escaped with a backslash, i.e., \' and \\. - *

- *

- * The currently recognized parameter keywords are: - * host, hostaddr, port, - * dbname, user, - * password, connect_timeout, - * options, tty (ignored), sslmode, - * requiressl (deprecated in favor of sslmode), and - * service. Which of these arguments exist depends - * on your PostgreSQL version. - *

- * @param int $connect_type [optional]

- * If PGSQL_CONNECT_FORCE_NEW is passed, then a new connection - * is created, even if the connection_string is identical to - * an existing connection. - *

- * @return resource PostgreSQL connection resource on success, FALSE on failure. - */ -function pg_pconnect ($connection_string, $connect_type = null) {} - -/** - * (PHP 4, PHP 5)
- * Closes a PostgreSQL connection - * @link http://php.net/manual/en/function.pg-close.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pg_close ($connection = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Get connection status - * @link http://php.net/manual/en/function.pg-connection-status.php - * @param resource $connection

- * PostgreSQL database connection resource. - *

- * @return int PGSQL_CONNECTION_OK or - * PGSQL_CONNECTION_BAD. - */ -function pg_connection_status ($connection) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Get connection is busy or not - * @link http://php.net/manual/en/function.pg-connection-busy.php - * @param resource $connection

- * PostgreSQL database connection resource. - *

- * @return bool TRUE if the connection is busy, FALSE otherwise. - */ -function pg_connection_busy ($connection) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Reset connection (reconnect) - * @link http://php.net/manual/en/function.pg-connection-reset.php - * @param resource $connection

- * PostgreSQL database connection resource. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pg_connection_reset ($connection) {} - -/** - * (PHP 4, PHP 5)
- * Returns the host name associated with the connection - * @link http://php.net/manual/en/function.pg-host.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @return string A string containing the name of the host the - * connection is to, or FALSE on error. - */ -function pg_host ($connection = null) {} - -/** - * (PHP 4, PHP 5)
- * Get the database name - * @link http://php.net/manual/en/function.pg-dbname.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @return string A string containing the name of the database the - * connection is to, or FALSE on error. - */ -function pg_dbname ($connection = null) {} - -/** - * (PHP 4, PHP 5)
- * Return the port number associated with the connection - * @link http://php.net/manual/en/function.pg-port.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @return int An int containing the port number of the database - * server the connection is to, - * or FALSE on error. - */ -function pg_port ($connection = null) {} - -/** - * (PHP 4, PHP 5)
- * Return the TTY name associated with the connection - * @link http://php.net/manual/en/function.pg-tty.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @return string A string containing the debug TTY of - * the connection, or FALSE on error. - */ -function pg_tty ($connection = null) {} - -/** - * (PHP 4, PHP 5)
- * Get the options associated with the connection - * @link http://php.net/manual/en/function.pg-options.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @return string A string containing the connection - * options, or FALSE on error. - */ -function pg_options ($connection = null) {} - -/** - * (PHP 5)
- * Returns an array with client, protocol and server version (when available) - * @link http://php.net/manual/en/function.pg-version.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @return array an array with client, protocol - * and server keys and values (if available). Returns - * FALSE on error or invalid connection. - */ -function pg_version ($connection = null) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Ping database connection - * @link http://php.net/manual/en/function.pg-ping.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pg_ping ($connection = null) {} - -/** - * (PHP 5)
- * Looks up a current parameter setting of the server. - * @link http://php.net/manual/en/function.pg-parameter-status.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @param string $param_name

- * Possible param_name values include server_version, - * server_encoding, client_encoding, - * is_superuser, session_authorization, - * DateStyle, TimeZone, and - * integer_datetimes. - *

- * @return string A string containing the value of the parameter, FALSE on failure or invalid - * param_name. - */ -function pg_parameter_status ($connection = null, $param_name) {} - -/** - * (PHP 5 >= 5.1.0)
- * Returns the current in-transaction status of the server. - * @link http://php.net/manual/en/function.pg-transaction-status.php - * @param resource $connection

- * PostgreSQL database connection resource. - *

- * @return int The status can be PGSQL_TRANSACTION_IDLE (currently idle), - * PGSQL_TRANSACTION_ACTIVE (a command is in progress), - * PGSQL_TRANSACTION_INTRANS (idle, in a valid transaction block), - * or PGSQL_TRANSACTION_INERROR (idle, in a failed transaction block). - * PGSQL_TRANSACTION_UNKNOWN is reported if the connection is bad. - * PGSQL_TRANSACTION_ACTIVE is reported only when a query - * has been sent to the server and not yet completed. - */ -function pg_transaction_status ($connection) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Execute a query - * @link http://php.net/manual/en/function.pg-query.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @param string $query

- * The SQL statement or statements to be executed. When multiple statements are passed to the function, - * they are automatically executed as one transaction, unless there are explicit BEGIN/COMMIT commands - * included in the query string. However, using multiple transactions in one function call is not recommended. - *

- *

- * Data inside the query should be properly escaped. - *

- * @return resource A query result resource on success or FALSE on failure. - */ -function pg_query ($connection = null, $query) {} - -/** - * (PHP 5 >= 5.1.0)
- * Submits a command to the server and waits for the result, with the ability to pass parameters separately from the SQL command text. - * @link http://php.net/manual/en/function.pg-query-params.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @param string $query

- * The parameterized SQL statement. Must contain only a single statement. - * (multiple statements separated by semi-colons are not allowed.) If any parameters - * are used, they are referred to as $1, $2, etc. - *

- * @param array $params

- * An array of parameter values to substitute for the $1, $2, etc. placeholders - * in the original prepared query string. The number of elements in the array - * must match the number of placeholders. - *

- * @return resource A query result resource on success or FALSE on failure. - */ -function pg_query_params ($connection = null, $query, array $params) {} - -/** - * (PHP 5 >= 5.1.0)
- * Submits a request to create a prepared statement with the -given parameters, and waits for completion. - * @link http://php.net/manual/en/function.pg-prepare.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @param string $stmtname

- * The name to give the prepared statement. Must be unique per-connection. If - * "" is specified, then an unnamed statement is created, overwriting any - * previously defined unnamed statement. - *

- * @param string $query

- * The parameterized SQL statement. Must contain only a single statement. - * (multiple statements separated by semi-colons are not allowed.) If any parameters - * are used, they are referred to as $1, $2, etc. - *

- * @return resource A query result resource on success or FALSE on failure. - */ -function pg_prepare ($connection = null, $stmtname, $query) {} - -/** - * (PHP 5 >= 5.1.0)
- * Sends a request to execute a prepared statement with given parameters, and waits for the result. - * @link http://php.net/manual/en/function.pg-execute.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @param string $stmtname

- * The name of the prepared statement to execute. if - * "" is specified, then the unnamed statement is executed. The name must have - * been previously prepared using pg_prepare, - * pg_send_prepare or a PREPARE SQL - * command. - *

- * @param array $params

- * An array of parameter values to substitute for the $1, $2, etc. placeholders - * in the original prepared query string. The number of elements in the array - * must match the number of placeholders. - *

- *

- * Elements are converted to strings by calling this function. - *

- * @return resource A query result resource on success or FALSE on failure. - */ -function pg_execute ($connection = null, $stmtname, array $params) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Sends asynchronous query - * @link http://php.net/manual/en/function.pg-send-query.php - * @param resource $connection

- * PostgreSQL database connection resource. - *

- * @param string $query

- * The SQL statement or statements to be executed. - *

- *

- * Data inside the query should be properly escaped. - *

- * @return bool TRUE on success or FALSE on failure.

- *

- * Use pg_get_result to determine the query result. - */ -function pg_send_query ($connection, $query) {} - -/** - * (PHP 5 >= 5.1.0)
- * Submits a command and separate parameters to the server without waiting for the result(s). - * @link http://php.net/manual/en/function.pg-send-query-params.php - * @param resource $connection

- * PostgreSQL database connection resource. - *

- * @param string $query

- * The parameterized SQL statement. Must contain only a single statement. - * (multiple statements separated by semi-colons are not allowed.) If any parameters - * are used, they are referred to as $1, $2, etc. - *

- * @param array $params

- * An array of parameter values to substitute for the $1, $2, etc. placeholders - * in the original prepared query string. The number of elements in the array - * must match the number of placeholders. - *

- * @return bool TRUE on success or FALSE on failure.

- *

- * Use pg_get_result to determine the query result. - */ -function pg_send_query_params ($connection, $query, array $params) {} - -/** - * (PHP 5 >= 5.1.0)
- * Sends a request to create a prepared statement with the given parameters, without waiting for completion. - * @link http://php.net/manual/en/function.pg-send-prepare.php - * @param resource $connection

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @param string $stmtname

- * The name to give the prepared statement. Must be unique per-connection. If - * "" is specified, then an unnamed statement is created, overwriting any - * previously defined unnamed statement. - *

- * @param string $query

- * The parameterized SQL statement. Must contain only a single statement. - * (multiple statements separated by semi-colons are not allowed.) If any parameters - * are used, they are referred to as $1, $2, etc. - *

- * @return bool TRUE on success, FALSE on failure. Use pg_get_result - * to determine the query result. - */ -function pg_send_prepare ($connection, $stmtname, $query) {} - -/** - * (PHP 5 >= 5.1.0)
- * Sends a request to execute a prepared statement with given parameters, without waiting for the result(s). - * @link http://php.net/manual/en/function.pg-send-execute.php - * @param resource $connection

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @param string $stmtname

- * The name of the prepared statement to execute. if - * "" is specified, then the unnamed statement is executed. The name must have - * been previously prepared using pg_prepare, - * pg_send_prepare or a PREPARE SQL - * command. - *

- * @param array $params

- * An array of parameter values to substitute for the $1, $2, etc. placeholders - * in the original prepared query string. The number of elements in the array - * must match the number of placeholders. - *

- * @return bool TRUE on success, FALSE on failure. Use pg_get_result - * to determine the query result. - */ -function pg_send_execute ($connection, $stmtname, array $params) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Cancel an asynchronous query - * @link http://php.net/manual/en/function.pg-cancel-query.php - * @param resource $connection

- * PostgreSQL database connection resource. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pg_cancel_query ($connection) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Returns values from a result resource - * @link http://php.net/manual/en/function.pg-fetch-result.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @param int $row

- * Row number in result to fetch. Rows are numbered from 0 upwards. If omitted, - * next row is fetched. - *

- * @param mixed $field

- * A string representing the name of the field (column) to fetch, otherwise - * an int representing the field number to fetch. Fields are - * numbered from 0 upwards. - *

- * @return string Boolean is returned as "t" or "f". All - * other types, including arrays are returned as strings formatted - * in the same default PostgreSQL manner that you would see in the - * psql program. Database NULL - * values are returned as NULL. - *

- *

- * FALSE is returned if row exceeds the number - * of rows in the set, or on any other error. - */ -function pg_fetch_result ($result, $row, $field) {} - -/** - * (PHP 4, PHP 5)
- * Get a row as an enumerated array - * @link http://php.net/manual/en/function.pg-fetch-row.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @param int $row [optional]

- * Row number in result to fetch. Rows are numbered from 0 upwards. If - * omitted or NULL, the next row is fetched. - *

- * @param int $result_type [optional] - * @return array An array, indexed from 0 upwards, with each value - * represented as a string. Database NULL - * values are returned as NULL. - *

- *

- * FALSE is returned if row exceeds the number - * of rows in the set, there are no more rows, or on any other error. - */ -function pg_fetch_row ($result, $row = null, $result_type = null) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Fetch a row as an associative array - * @link http://php.net/manual/en/function.pg-fetch-assoc.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @param int $row [optional]

- * Row number in result to fetch. Rows are numbered from 0 upwards. If - * omitted or NULL, the next row is fetched. - *

- * @return array An array indexed associatively (by field name). - * Each value in the array is represented as a - * string. Database NULL - * values are returned as NULL. - *

- *

- * FALSE is returned if row exceeds the number - * of rows in the set, there are no more rows, or on any other error. - */ -function pg_fetch_assoc ($result, $row = null) {} - -/** - * (PHP 4, PHP 5)
- * Fetch a row as an array - * @link http://php.net/manual/en/function.pg-fetch-array.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @param int $row [optional]

- * Row number in result to fetch. Rows are numbered from 0 upwards. If - * omitted or NULL, the next row is fetched. - *

- * @param int $result_type [optional]

- * An optional parameter that controls - * how the returned array is indexed. - * result_type is a constant and can take the - * following values: PGSQL_ASSOC, - * PGSQL_NUM and PGSQL_BOTH. - * Using PGSQL_NUM, pg_fetch_array - * will return an array with numerical indices, using - * PGSQL_ASSOC it will return only associative indices - * while PGSQL_BOTH, the default, will return both - * numerical and associative indices. - *

- * @return array An array indexed numerically (beginning with 0) or - * associatively (indexed by field name), or both. - * Each value in the array is represented as a - * string. Database NULL - * values are returned as NULL. - *

- *

- * FALSE is returned if row exceeds the number - * of rows in the set, there are no more rows, or on any other error. - */ -function pg_fetch_array ($result, $row = null, $result_type = 'PGSQL_BOTH') {} - -/** - * (PHP 4, PHP 5)
- * Fetch a row as an object - * @link http://php.net/manual/en/function.pg-fetch-object.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @param int $row [optional]

- * Row number in result to fetch. Rows are numbered from 0 upwards. If - * omitted or NULL, the next row is fetched. - *

- * @param int $result_type [optional]

- * Ignored and deprecated. - *

- * @return object An object with one attribute for each field - * name in the result. Database NULL - * values are returned as NULL. - *

- *

- * FALSE is returned if row exceeds the number - * of rows in the set, there are no more rows, or on any other error. - */ -function pg_fetch_object ($result, $row = null, $result_type = 'PGSQL_ASSOC') {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Fetches all rows from a result as an array - * @link http://php.net/manual/en/function.pg-fetch-all.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @return array An array with all rows in the result. Each row is an array - * of field values indexed by field name. - *

- *

- * FALSE is returned if there are no rows in the result, or on any - * other error. - */ -function pg_fetch_all ($result) {} - -/** - * (PHP 5 >= 5.1.0)
- * Fetches all rows in a particular result column as an array - * @link http://php.net/manual/en/function.pg-fetch-all-columns.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @param int $column [optional]

- * Column number, zero-based, to be retrieved from the result resource. Defaults - * to the first column if not specified. - *

- * @return array An array with all values in the result column. - *

- *

- * FALSE is returned if column is larger than the number - * of columns in the result, or on any other error. - */ -function pg_fetch_all_columns ($result, $column = 0) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Returns number of affected records (tuples) - * @link http://php.net/manual/en/function.pg-affected-rows.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @return int The number of rows affected by the query. If no tuple is - * affected, it will return 0. - */ -function pg_affected_rows ($result) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Get asynchronous query result - * @link http://php.net/manual/en/function.pg-get-result.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. - *

- * @return resource The result resource, or FALSE if no more results are available. - */ -function pg_get_result ($connection = null) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Set internal row offset in result resource - * @link http://php.net/manual/en/function.pg-result-seek.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @param int $offset

- * Row to move the internal offset to in the result resource. - * Rows are numbered starting from zero. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pg_result_seek ($result, $offset) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Get status of query result - * @link http://php.net/manual/en/function.pg-result-status.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @param int $type [optional]

- * Either PGSQL_STATUS_LONG to return the numeric status - * of the result, or PGSQL_STATUS_STRING - * to return the command tag of the result. - * If not specified, PGSQL_STATUS_LONG is the default. - *

- * @return mixed Possible return values are PGSQL_EMPTY_QUERY, - * PGSQL_COMMAND_OK, PGSQL_TUPLES_OK, PGSQL_COPY_OUT, - * PGSQL_COPY_IN, PGSQL_BAD_RESPONSE, PGSQL_NONFATAL_ERROR and - * PGSQL_FATAL_ERROR if PGSQL_STATUS_LONG is - * specified. Otherwise, a string containing the PostgreSQL command tag is returned. - */ -function pg_result_status ($result, $type = 'PGSQL_STATUS_LONG') {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Free result memory - * @link http://php.net/manual/en/function.pg-free-result.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pg_free_result ($result) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Returns the last row's OID - * @link http://php.net/manual/en/function.pg-last-oid.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @return string A string containing the OID assigned to the most recently inserted - * row in the specified connection, or FALSE on error or - * no available OID. - */ -function pg_last_oid ($result) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Returns the number of rows in a result - * @link http://php.net/manual/en/function.pg-num-rows.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @return int The number of rows in the result. On error, -1 is returned. - */ -function pg_num_rows ($result) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Returns the number of fields in a result - * @link http://php.net/manual/en/function.pg-num-fields.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @return int The number of fields (columns) in the result. On error, -1 is returned. - */ -function pg_num_fields ($result) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Returns the name of a field - * @link http://php.net/manual/en/function.pg-field-name.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @param int $field_number

- * Field number, starting from 0. - *

- * @return string The field name, or FALSE on error. - */ -function pg_field_name ($result, $field_number) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Returns the field number of the named field - * @link http://php.net/manual/en/function.pg-field-num.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @param string $field_name

- * The name of the field. - *

- * @return int The field number (numbered from 0), or -1 on error. - */ -function pg_field_num ($result, $field_name) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Returns the internal storage size of the named field - * @link http://php.net/manual/en/function.pg-field-size.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @param int $field_number

- * Field number, starting from 0. - *

- * @return int The internal field storage size (in bytes). -1 indicates a variable - * length field. FALSE is returned on error. - */ -function pg_field_size ($result, $field_number) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Returns the type name for the corresponding field number - * @link http://php.net/manual/en/function.pg-field-type.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @param int $field_number

- * Field number, starting from 0. - *

- * @return string A string containing the base name of the field's type, or FALSE - * on error. - */ -function pg_field_type ($result, $field_number) {} - -/** - * (PHP 5 >= 5.1.0)
- * Returns the type ID (OID) for the corresponding field number - * @link http://php.net/manual/en/function.pg-field-type-oid.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @param int $field_number

- * Field number, starting from 0. - *

- * @return int The OID of the field's base type. FALSE is returned on error. - */ -function pg_field_type_oid ($result, $field_number) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Returns the printed length - * @link http://php.net/manual/en/function.pg-field-prtlen.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @param int $row_number - * @param mixed $field_name_or_number - * @return int The field printed length, or FALSE on error. - */ -function pg_field_prtlen ($result, $row_number, $field_name_or_number) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Test if a field is SQL NULL - * @link http://php.net/manual/en/function.pg-field-is-null.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @param int $row

- * Row number in result to fetch. Rows are numbered from 0 upwards. If omitted, - * current row is fetched. - *

- * @param mixed $field

- * Field number (starting from 0) as an integer or - * the field name as a string. - *

- * @return int 1 if the field in the given row is SQL NULL, 0 - * if not. FALSE is returned if the row is out of range, or upon any other error. - */ -function pg_field_is_null ($result, $row, $field) {} - -/** - * (PHP 5 >= 5.2.0)
- * Returns the name or oid of the tables field - * @link http://php.net/manual/en/function.pg-field-table.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @param int $field_number

- * Field number, starting from 0. - *

- * @param bool $oid_only [optional]

- * By default the tables name that field belongs to is returned but - * if oid_only is set to TRUE, then the - * oid will instead be returned. - *

- * @return mixed On success either the fields table name or oid. Or, FALSE on failure. - */ -function pg_field_table ($result, $field_number, $oid_only = false) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Gets SQL NOTIFY message - * @link http://php.net/manual/en/function.pg-get-notify.php - * @param resource $connection

- * PostgreSQL database connection resource. - *

- * @param int $result_type [optional]

- * An optional parameter that controls - * how the returned array is indexed. - * result_type is a constant and can take the - * following values: PGSQL_ASSOC, - * PGSQL_NUM and PGSQL_BOTH. - * Using PGSQL_NUM, pg_get_notify - * will return an array with numerical indices, using - * PGSQL_ASSOC it will return only associative indices - * while PGSQL_BOTH, the default, will return both - * numerical and associative indices. - *

- * @return array An array containing the NOTIFY message name and backend PID. - * Otherwise if no NOTIFY is waiting, then FALSE is returned. - */ -function pg_get_notify ($connection, $result_type = null) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Gets the backend's process ID - * @link http://php.net/manual/en/function.pg-get-pid.php - * @param resource $connection

- * PostgreSQL database connection resource. - *

- * @return int The backend database process ID. - */ -function pg_get_pid ($connection) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Get error message associated with result - * @link http://php.net/manual/en/function.pg-result-error.php - * @param resource $result

- * PostgreSQL query result resource, returned by pg_query, - * pg_query_params or pg_execute - * (among others). - *

- * @return string a string if there is an error associated with the - * result parameter, FALSE otherwise. - */ -function pg_result_error ($result) {} - -/** - * (PHP 5 >= 5.1.0)
- * Returns an individual field of an error report. - * @link http://php.net/manual/en/function.pg-result-error-field.php - * @param resource $result

- * A PostgreSQL query result resource from a previously executed - * statement. - *

- * @param int $fieldcode

- * Possible fieldcode values are: PGSQL_DIAG_SEVERITY, - * PGSQL_DIAG_SQLSTATE, PGSQL_DIAG_MESSAGE_PRIMARY, - * PGSQL_DIAG_MESSAGE_DETAIL, - * PGSQL_DIAG_MESSAGE_HINT, PGSQL_DIAG_STATEMENT_POSITION, - * PGSQL_DIAG_INTERNAL_POSITION (PostgreSQL 8.0+ only), - * PGSQL_DIAG_INTERNAL_QUERY (PostgreSQL 8.0+ only), - * PGSQL_DIAG_CONTEXT, PGSQL_DIAG_SOURCE_FILE, - * PGSQL_DIAG_SOURCE_LINE or - * PGSQL_DIAG_SOURCE_FUNCTION. - *

- * @return string A string containing the contents of the error field, NULL if the field does not exist or FALSE - * on failure. - */ -function pg_result_error_field ($result, $fieldcode) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Get the last error message string of a connection - * @link http://php.net/manual/en/function.pg-last-error.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @return string A string containing the last error message on the - * given connection, or FALSE on error. - */ -function pg_last_error ($connection = null) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Returns the last notice message from PostgreSQL server - * @link http://php.net/manual/en/function.pg-last-notice.php - * @param resource $connection

- * PostgreSQL database connection resource. - *

- * @return string A string containing the last notice on the - * given connection, or FALSE on error. - */ -function pg_last_notice ($connection) {} - -/** - * (PHP 4 >= 4.0.3, PHP 5)
- * Send a NULL-terminated string to PostgreSQL backend - * @link http://php.net/manual/en/function.pg-put-line.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @param string $data

- * A line of text to be sent directly to the PostgreSQL backend. A NULL - * terminator is added automatically. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pg_put_line ($connection = null, $data) {} - -/** - * (PHP 4 >= 4.0.3, PHP 5)
- * Sync with PostgreSQL backend - * @link http://php.net/manual/en/function.pg-end-copy.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pg_end_copy ($connection = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Copy a table to an array - * @link http://php.net/manual/en/function.pg-copy-to.php - * @param resource $connection

- * PostgreSQL database connection resource. - *

- * @param string $table_name

- * Name of the table from which to copy the data into rows. - *

- * @param string $delimiter [optional]

- * The token that separates values for each field in each element of - * rows. Default is TAB. - *

- * @param string $null_as [optional]

- * How SQL NULL values are represented in the - * rows. Default is \N ("\\N"). - *

- * @return array An array with one element for each line of COPY data. - * It returns FALSE on failure. - */ -function pg_copy_to ($connection, $table_name, $delimiter = null, $null_as = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Insert records into a table from an array - * @link http://php.net/manual/en/function.pg-copy-from.php - * @param resource $connection

- * PostgreSQL database connection resource. - *

- * @param string $table_name

- * Name of the table into which to copy the rows. - *

- * @param array $rows

- * An array of data to be copied into table_name. - * Each value in rows becomes a row in table_name. - * Each value in rows should be a delimited string of the values - * to insert into each field. Values should be linefeed terminated. - *

- * @param string $delimiter [optional]

- * The token that separates values for each field in each element of - * rows. Default is TAB. - *

- * @param string $null_as [optional]

- * How SQL NULL values are represented in the - * rows. Default is \N ("\\N"). - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pg_copy_from ($connection, $table_name, array $rows, $delimiter = null, $null_as = null) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Enable tracing a PostgreSQL connection - * @link http://php.net/manual/en/function.pg-trace.php - * @param string $pathname

- * An optional file access mode, same as for fopen. - *

- * @param string $mode [optional] - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pg_trace ($pathname, $mode = "w", $connection = null) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Disable tracing of a PostgreSQL connection - * @link http://php.net/manual/en/function.pg-untrace.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @return bool Always returns TRUE. - */ -function pg_untrace ($connection = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Create a large object - * @link http://php.net/manual/en/function.pg-lo-create.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @param mixed $object_id [optional]

- * If an object_id is given the function - * will try to create a large object with this id, else a free - * object id is assigned by the server. The parameter - * was added in PHP 5.3 and relies on functionality that first - * appeared in PostgreSQL 8.1. - *

- * @return int A large object OID or FALSE on error. - */ -function pg_lo_create ($connection = null, $object_id = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Delete a large object - * @link http://php.net/manual/en/function.pg-lo-unlink.php - * @param resource $connection

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @param int $oid

- * The OID of the large object in the database. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pg_lo_unlink ($connection, $oid) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Open a large object - * @link http://php.net/manual/en/function.pg-lo-open.php - * @param resource $connection

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @param int $oid

- * The OID of the large object in the database. - *

- * @param string $mode

- * Can be either "r" for read-only, "w" for write only or "rw" for read and - * write. - *

- * @return resource A large object resource or FALSE on error. - */ -function pg_lo_open ($connection, $oid, $mode) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Close a large object - * @link http://php.net/manual/en/function.pg-lo-close.php - * @param resource $large_object - * @return bool TRUE on success or FALSE on failure. - */ -function pg_lo_close ($large_object) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Read a large object - * @link http://php.net/manual/en/function.pg-lo-read.php - * @param resource $large_object

- * PostgreSQL large object (LOB) resource, returned by pg_lo_open. - *

- * @param int $len [optional]

- * An optional maximum number of bytes to return. - *

- * @return string A string containing len bytes from the - * large object, or FALSE on error. - */ -function pg_lo_read ($large_object, $len = 8192) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Write to a large object - * @link http://php.net/manual/en/function.pg-lo-write.php - * @param resource $large_object

- * PostgreSQL large object (LOB) resource, returned by pg_lo_open. - *

- * @param string $data

- * The data to be written to the large object. If len is - * specified and is less than the length of data, only - * len bytes will be written. - *

- * @param int $len [optional]

- * An optional maximum number of bytes to write. Must be greater than zero - * and no greater than the length of data. Defaults to - * the length of data. - *

- * @return int The number of bytes written to the large object, or FALSE on error. - */ -function pg_lo_write ($large_object, $data, $len = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Reads an entire large object and send straight to browser - * @link http://php.net/manual/en/function.pg-lo-read-all.php - * @param resource $large_object

- * PostgreSQL large object (LOB) resource, returned by pg_lo_open. - *

- * @return int Number of bytes read or FALSE on error. - */ -function pg_lo_read_all ($large_object) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Import a large object from file - * @link http://php.net/manual/en/function.pg-lo-import.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @param string $pathname

- * The full path and file name of the file on the client - * filesystem from which to read the large object data. - *

- * @param mixed $object_id [optional]

- * If an object_id is given the function - * will try to create a large object with this id, else a free - * object id is assigned by the server. The parameter - * was added in PHP 5.3 and relies on functionality that first - * appeared in PostgreSQL 8.1. - *

- * @return int The OID of the newly created large object, or - * FALSE on failure. - */ -function pg_lo_import ($connection = null, $pathname, $object_id = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Export a large object to file - * @link http://php.net/manual/en/function.pg-lo-export.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @param int $oid

- * The OID of the large object in the database. - *

- * @param string $pathname

- * The full path and file name of the file in which to write the - * large object on the client filesystem. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pg_lo_export ($connection = null, $oid, $pathname) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Seeks position within a large object - * @link http://php.net/manual/en/function.pg-lo-seek.php - * @param resource $large_object

- * PostgreSQL large object (LOB) resource, returned by pg_lo_open. - *

- * @param int $offset

- * The number of bytes to seek. - *

- * @param int $whence [optional]

- * One of the constants PGSQL_SEEK_SET (seek from object start), - * PGSQL_SEEK_CUR (seek from current position) - * or PGSQL_SEEK_END (seek from object end) . - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pg_lo_seek ($large_object, $offset, $whence = 'PGSQL_SEEK_CUR') {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Returns current seek position a of large object - * @link http://php.net/manual/en/function.pg-lo-tell.php - * @param resource $large_object

- * PostgreSQL large object (LOB) resource, returned by pg_lo_open. - *

- * @return int The current seek offset (in number of bytes) from the beginning of the large - * object. If there is an error, the return value is negative. - */ -function pg_lo_tell ($large_object) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Escape a string for query - * @link http://php.net/manual/en/function.pg-escape-string.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @param string $data

- * A string containing text to be escaped. - *

- * @return string A string containing the escaped data. - */ -function pg_escape_string ($connection = null, $data) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Escape a string for insertion into a bytea field - * @link http://php.net/manual/en/function.pg-escape-bytea.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @param string $data

- * A string containing text or binary data to be inserted into a bytea - * column. - *

- * @return string A string containing the escaped data. - */ -function pg_escape_bytea ($connection = null, $data) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Unescape binary for bytea type - * @link http://php.net/manual/en/function.pg-unescape-bytea.php - * @param string $data

- * A string containing PostgreSQL bytea data to be converted into - * a PHP binary string. - *

- * @return string A string containing the unescaped data. - */ -function pg_unescape_bytea ($data) {} - -/** - * (PHP 5 >= 5.4.4)
- * Escape a literal for insertion into a text field - * @link http://php.net/manual/en/function.pg-escape-literal.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @param string $data

- * A string containing text to be escaped. - *

- * @return string A string containing the escaped data. - */ -function pg_escape_literal ($connection = null, $data) {} - -/** - * (PHP 5 >= 5.4.4)
- * Escape a identifier for insertion into a text field - * @link http://php.net/manual/en/function.pg-escape-identifier.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @param string $data

- * A string containing text to be escaped. - *

- * @return string A string containing the escaped data. - */ -function pg_escape_identifier ($connection = null, $data) {} - -/** - * (PHP 5 >= 5.1.0)
- * Determines the verbosity of messages returned by pg_last_error -and pg_result_error. - * @link http://php.net/manual/en/function.pg-set-error-verbosity.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @param int $verbosity

- * The required verbosity: PGSQL_ERRORS_TERSE, - * PGSQL_ERRORS_DEFAULT - * or PGSQL_ERRORS_VERBOSE. - *

- * @return int The previous verbosity level: PGSQL_ERRORS_TERSE, - * PGSQL_ERRORS_DEFAULT - * or PGSQL_ERRORS_VERBOSE. - */ -function pg_set_error_verbosity ($connection = null, $verbosity) {} - -/** - * (PHP 4 >= 4.0.3, PHP 5)
- * Gets the client encoding - * @link http://php.net/manual/en/function.pg-client-encoding.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @return string The client encoding, or FALSE on error. - */ -function pg_client_encoding ($connection = null) {} - -/** - * (PHP 4 >= 4.0.3, PHP 5)
- * Set the client encoding - * @link http://php.net/manual/en/function.pg-set-client-encoding.php - * @param resource $connection [optional]

- * PostgreSQL database connection resource. When - * connection is not present, the default connection - * is used. The default connection is the last connection made by - * pg_connect or pg_pconnect. - *

- * @param string $encoding

- * The required client encoding. One of SQL_ASCII, EUC_JP, - * EUC_CN, EUC_KR, EUC_TW, - * UNICODE, MULE_INTERNAL, LATINX (X=1...9), - * KOI8, WIN, ALT, SJIS, - * BIG5 or WIN1250. - *

- *

- * The exact list of available encodings depends on your PostgreSQL version, so check your - * PostgreSQL manual for a more specific list. - *

- * @return int 0 on success or -1 on error. - */ -function pg_set_client_encoding ($connection = null, $encoding) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Get meta data for table - * @link http://php.net/manual/en/function.pg-meta-data.php - * @param resource $connection

- * PostgreSQL database connection resource. - *

- * @param string $table_name

- * The name of the table. - *

- * @return array An array of the table definition, or FALSE on error. - */ -function pg_meta_data ($connection, $table_name) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Convert associative array values into suitable for SQL statement - * @link http://php.net/manual/en/function.pg-convert.php - * @param resource $connection

- * PostgreSQL database connection resource. - *

- * @param string $table_name

- * Name of the table against which to convert types. - *

- * @param array $assoc_array

- * Data to be converted. - *

- * @param int $options [optional]

- * Any number of PGSQL_CONV_IGNORE_DEFAULT, - * PGSQL_CONV_FORCE_NULL or - * PGSQL_CONV_IGNORE_NOT_NULL, combined. - *

- * @return array An array of converted values, or FALSE on error. - */ -function pg_convert ($connection, $table_name, array $assoc_array, $options = 0) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Insert array into table - * @link http://php.net/manual/en/function.pg-insert.php - * @param resource $connection

- * PostgreSQL database connection resource. - *

- * @param string $table_name

- * Name of the table into which to insert rows. The table table_name must at least - * have as many columns as assoc_array has elements. - *

- * @param array $assoc_array

- * An array whose keys are field names in the table table_name, - * and whose values are the values of those fields that are to be inserted. - *

- * @param int $options [optional]

- * Any number of PGSQL_CONV_OPTS, - * PGSQL_DML_NO_CONV, - * PGSQL_DML_EXEC, - * PGSQL_DML_ASYNC or - * PGSQL_DML_STRING combined. If PGSQL_DML_STRING is part of the - * options then query string is returned. - *

- * @return mixed TRUE on success or FALSE on failure. Returns string if PGSQL_DML_STRING is passed - * via options. - */ -function pg_insert ($connection, $table_name, array $assoc_array, $options = 'PGSQL_DML_EXEC') {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Update table - * @link http://php.net/manual/en/function.pg-update.php - * @param resource $connection

- * PostgreSQL database connection resource. - *

- * @param string $table_name

- * Name of the table into which to update rows. - *

- * @param array $data

- * An array whose keys are field names in the table table_name, - * and whose values are what matched rows are to be updated to. - *

- * @param array $condition

- * An array whose keys are field names in the table table_name, - * and whose values are the conditions that a row must meet to be updated. - *

- * @param int $options [optional]

- * Any number of PGSQL_CONV_OPTS, - * PGSQL_DML_NO_CONV, - * PGSQL_DML_EXEC or - * PGSQL_DML_STRING combined. If PGSQL_DML_STRING is part of the - * options then query string is returned. - *

- * @return mixed TRUE on success or FALSE on failure. Returns string if PGSQL_DML_STRING is passed - * via options. - */ -function pg_update ($connection, $table_name, array $data, array $condition, $options = 'PGSQL_DML_EXEC') {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Deletes records - * @link http://php.net/manual/en/function.pg-delete.php - * @param resource $connection

- * PostgreSQL database connection resource. - *

- * @param string $table_name

- * Name of the table from which to delete rows. - *

- * @param array $assoc_array

- * An array whose keys are field names in the table table_name, - * and whose values are the values of those fields that are to be deleted. - *

- * @param int $options [optional]

- * Any number of PGSQL_CONV_FORCE_NULL, - * PGSQL_DML_NO_CONV, - * PGSQL_DML_EXEC or - * PGSQL_DML_STRING combined. If PGSQL_DML_STRING is part of the - * options then query string is returned. - *

- * @return mixed TRUE on success or FALSE on failure. Returns string if PGSQL_DML_STRING is passed - * via options. - */ -function pg_delete ($connection, $table_name, array $assoc_array, $options = 'PGSQL_DML_EXEC') {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Select records - * @link http://php.net/manual/en/function.pg-select.php - * @param resource $connection

- * PostgreSQL database connection resource. - *

- * @param string $table_name

- * Name of the table from which to select rows. - *

- * @param array $assoc_array

- * An array whose keys are field names in the table table_name, - * and whose values are the conditions that a row must meet to be retrieved. - *

- * @param int $options [optional]

- * Any number of PGSQL_CONV_FORCE_NULL, - * PGSQL_DML_NO_CONV, - * PGSQL_DML_EXEC, - * PGSQL_DML_ASYNC or - * PGSQL_DML_STRING combined. If PGSQL_DML_STRING is part of the - * options then query string is returned. - *

- * @return mixed TRUE on success or FALSE on failure. Returns string if PGSQL_DML_STRING is passed - * via options. - */ -function pg_select ($connection, $table_name, array $assoc_array, $options = 'PGSQL_DML_EXEC') {} - -/** - * @param $connection [optional] - * @param $query [optional] - */ -function pg_exec ($connection, $query) {} - -/** - * @param $result - */ -function pg_getlastoid ($result) {} - -/** - * @param $result - */ -function pg_cmdtuples ($result) {} - -/** - * @param $connection [optional] - */ -function pg_errormessage ($connection) {} - -/** - * @param $result - */ -function pg_numrows ($result) {} - -/** - * @param $result - */ -function pg_numfields ($result) {} - -/** - * @param $result - * @param $field_number - */ -function pg_fieldname ($result, $field_number) {} - -/** - * @param $result - * @param $field_number - */ -function pg_fieldsize ($result, $field_number) {} - -/** - * @param $result - * @param $field_number - */ -function pg_fieldtype ($result, $field_number) {} - -/** - * @param $result - * @param $field_name - */ -function pg_fieldnum ($result, $field_name) {} - -/** - * @param $result - * @param $row [optional] - * @param $field_name_or_number [optional] - */ -function pg_fieldprtlen ($result, $row, $field_name_or_number) {} - -/** - * @param $result - * @param $row [optional] - * @param $field_name_or_number [optional] - */ -function pg_fieldisnull ($result, $row, $field_name_or_number) {} - -/** - * @param $result - */ -function pg_freeresult ($result) {} - -/** - * @param $connection - */ -function pg_result ($connection) {} - -/** - * @param $large_object - */ -function pg_loreadall ($large_object) {} - -/** - * @param $connection [optional] - * @param $large_object_id [optional] - */ -function pg_locreate ($connection, $large_object_id) {} - -/** - * @param $connection [optional] - * @param $large_object_oid [optional] - */ -function pg_lounlink ($connection, $large_object_oid) {} - -/** - * @param $connection [optional] - * @param $large_object_oid [optional] - * @param $mode [optional] - */ -function pg_loopen ($connection, $large_object_oid, $mode) {} - -/** - * @param $large_object - */ -function pg_loclose ($large_object) {} - -/** - * @param $large_object - * @param $len [optional] - */ -function pg_loread ($large_object, $len) {} - -/** - * @param $large_object - * @param $buf - * @param $len [optional] - */ -function pg_lowrite ($large_object, $buf, $len) {} - -/** - * @param $connection [optional] - * @param $filename [optional] - * @param $large_object_oid [optional] - */ -function pg_loimport ($connection, $filename, $large_object_oid) {} - -/** - * @param $connection [optional] - * @param $objoid [optional] - * @param $filename [optional] - */ -function pg_loexport ($connection, $objoid, $filename) {} - -/** - * @param $connection [optional] - */ -function pg_clientencoding ($connection) {} - -/** - * @param $connection [optional] - * @param $encoding [optional] - */ -function pg_setclientencoding ($connection, $encoding) {} - -define ('PGSQL_LIBPQ_VERSION', "9.1.6"); -define ('PGSQL_LIBPQ_VERSION_STR', "PostgreSQL 9.1.6 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2, 64-bit"); - -/** - * Passed to pg_connect to force the creation of a new connection, - * rather than re-using an existing identical connection. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_CONNECT_FORCE_NEW', 2); - -/** - * Passed to pg_fetch_array. Return an associative array of field - * names and values. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_ASSOC', 1); - -/** - * Passed to pg_fetch_array. Return a numerically indexed array of field - * numbers and values. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_NUM', 2); - -/** - * Passed to pg_fetch_array. Return an array of field values - * that is both numerically indexed (by field number) and associated (by field name). - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_BOTH', 3); - -/** - * Returned by pg_connection_status indicating that the database - * connection is in an invalid state. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_CONNECTION_BAD', 1); - -/** - * Returned by pg_connection_status indicating that the database - * connection is in a valid state. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_CONNECTION_OK', 0); - -/** - * Returned by pg_transaction_status. Connection is - * currently idle, not in a transaction. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_TRANSACTION_IDLE', 0); - -/** - * Returned by pg_transaction_status. A command - * is in progress on the connection. A query has been sent via the connection - * and not yet completed. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_TRANSACTION_ACTIVE', 1); - -/** - * Returned by pg_transaction_status. The connection - * is idle, in a transaction block. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_TRANSACTION_INTRANS', 2); - -/** - * Returned by pg_transaction_status. The connection - * is idle, in a failed transaction block. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_TRANSACTION_INERROR', 3); - -/** - * Returned by pg_transaction_status. The connection - * is bad. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_TRANSACTION_UNKNOWN', 4); - -/** - * Passed to pg_set_error_verbosity. - * Specified that returned messages include severity, primary text, - * and position only; this will normally fit on a single line. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_ERRORS_TERSE', 0); - -/** - * Passed to pg_set_error_verbosity. - * The default mode produces messages that include the above - * plus any detail, hint, or context fields (these may span - * multiple lines). - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_ERRORS_DEFAULT', 1); - -/** - * Passed to pg_set_error_verbosity. - * The verbose mode includes all available fields. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_ERRORS_VERBOSE', 2); - -/** - * Passed to pg_lo_seek. Seek operation is to begin - * from the start of the object. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_SEEK_SET', 0); - -/** - * Passed to pg_lo_seek. Seek operation is to begin - * from the current position. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_SEEK_CUR', 1); - -/** - * Passed to pg_lo_seek. Seek operation is to begin - * from the end of the object. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_SEEK_END', 2); - -/** - * Passed to pg_result_status. Indicates that - * numerical result code is desired. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_STATUS_LONG', 1); - -/** - * Passed to pg_result_status. Indicates that - * textual result command tag is desired. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_STATUS_STRING', 2); - -/** - * Returned by pg_result_status. The string sent to the server - * was empty. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_EMPTY_QUERY', 0); - -/** - * Returned by pg_result_status. Successful completion of a - * command returning no data. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_COMMAND_OK', 1); - -/** - * Returned by pg_result_status. Successful completion of a command - * returning data (such as a SELECT or SHOW). - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_TUPLES_OK', 2); - -/** - * Returned by pg_result_status. Copy Out (from server) data - * transfer started. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_COPY_OUT', 3); - -/** - * Returned by pg_result_status. Copy In (to server) data - * transfer started. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_COPY_IN', 4); - -/** - * Returned by pg_result_status. The server's response - * was not understood. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_BAD_RESPONSE', 5); - -/** - * Returned by pg_result_status. A nonfatal error - * (a notice or warning) occurred. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_NONFATAL_ERROR', 6); - -/** - * Returned by pg_result_status. A fatal error - * occurred. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_FATAL_ERROR', 7); - -/** - * Passed to pg_result_error_field. - * The severity; the field contents are ERROR, - * FATAL, or PANIC (in an error message), or - * WARNING, NOTICE, DEBUG, - * INFO, or LOG (in a notice message), or a localized - * translation of one of these. Always present. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_DIAG_SEVERITY', 83); - -/** - * Passed to pg_result_error_field. - * The SQLSTATE code for the error. The SQLSTATE code identifies the type of error - * that has occurred; it can be used by front-end applications to perform specific - * operations (such as error handling) in response to a particular database error. - * This field is not localizable, and is always present. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_DIAG_SQLSTATE', 67); - -/** - * Passed to pg_result_error_field. - * The primary human-readable error message (typically one line). Always present. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_DIAG_MESSAGE_PRIMARY', 77); - -/** - * Passed to pg_result_error_field. - * Detail: an optional secondary error message carrying more detail about the problem. May run to multiple lines. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_DIAG_MESSAGE_DETAIL', 68); - -/** - * Passed to pg_result_error_field. - * Hint: an optional suggestion what to do about the problem. This is intended to differ from detail in that it - * offers advice (potentially inappropriate) rather than hard facts. May run to multiple lines. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_DIAG_MESSAGE_HINT', 72); - -/** - * Passed to pg_result_error_field. - * A string containing a decimal integer indicating an error cursor position as an index into the original - * statement string. The first character has index 1, and positions are measured in characters not bytes. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_DIAG_STATEMENT_POSITION', 80); - -/** - * Passed to pg_result_error_field. - * This is defined the same as the PG_DIAG_STATEMENT_POSITION field, but - * it is used when the cursor position refers to an internally generated - * command rather than the one submitted by the client. The - * PG_DIAG_INTERNAL_QUERY field will always appear when this - * field appears. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_DIAG_INTERNAL_POSITION', 112); - -/** - * Passed to pg_result_error_field. - * The text of a failed internally-generated command. This could be, for example, a - * SQL query issued by a PL/pgSQL function. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_DIAG_INTERNAL_QUERY', 113); - -/** - * Passed to pg_result_error_field. - * An indication of the context in which the error occurred. Presently - * this includes a call stack traceback of active procedural language - * functions and internally-generated queries. The trace is one entry - * per line, most recent first. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_DIAG_CONTEXT', 87); - -/** - * Passed to pg_result_error_field. - * The file name of the PostgreSQL source-code location where the error - * was reported. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_DIAG_SOURCE_FILE', 70); - -/** - * Passed to pg_result_error_field. - * The line number of the PostgreSQL source-code location where the - * error was reported. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_DIAG_SOURCE_LINE', 76); - -/** - * Passed to pg_result_error_field. - * The name of the PostgreSQL source-code function reporting the error. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_DIAG_SOURCE_FUNCTION', 82); - -/** - * Passed to pg_convert. - * Ignore default values in the table during conversion. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_CONV_IGNORE_DEFAULT', 2); - -/** - * Passed to pg_convert. - * Use SQL NULL in place of an empty string. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_CONV_FORCE_NULL', 4); - -/** - * Passed to pg_convert. - * Ignore conversion of NULL into SQL NOT NULL columns. - * @link http://php.net/manual/en/pgsql.constants.php - */ -define ('PGSQL_CONV_IGNORE_NOT_NULL', 8); -define ('PGSQL_DML_NO_CONV', 256); -define ('PGSQL_DML_EXEC', 512); -define ('PGSQL_DML_ASYNC', 1024); -define ('PGSQL_DML_STRING', 2048); - -// End of pgsql v. -?> diff --git a/phpruntime/posix.php b/phpruntime/posix.php deleted file mode 100644 index ed263a9..0000000 --- a/phpruntime/posix.php +++ /dev/null @@ -1,762 +0,0 @@ - - * Send a signal to a process - * @link http://php.net/manual/en/function.posix-kill.php - * @param int $pid

- * The process identifier. - *

- * @param int $sig

- * One of the PCNTL signals constants. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function posix_kill ($pid, $sig) {} - -/** - * (PHP 4, PHP 5)
- * Return the current process identifier - * @link http://php.net/manual/en/function.posix-getpid.php - * @return int the identifier, as an integer. - */ -function posix_getpid () {} - -/** - * (PHP 4, PHP 5)
- * Return the parent process identifier - * @link http://php.net/manual/en/function.posix-getppid.php - * @return int the identifier, as an integer. - */ -function posix_getppid () {} - -/** - * (PHP 4, PHP 5)
- * Return the real user ID of the current process - * @link http://php.net/manual/en/function.posix-getuid.php - * @return int the user id, as an integer - */ -function posix_getuid () {} - -/** - * (PHP 4, PHP 5)
- * Set the UID of the current process - * @link http://php.net/manual/en/function.posix-setuid.php - * @param int $uid

- * The user id. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function posix_setuid ($uid) {} - -/** - * (PHP 4, PHP 5)
- * Return the effective user ID of the current process - * @link http://php.net/manual/en/function.posix-geteuid.php - * @return int the user id, as an integer - */ -function posix_geteuid () {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Set the effective UID of the current process - * @link http://php.net/manual/en/function.posix-seteuid.php - * @param int $uid

- * The user id. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function posix_seteuid ($uid) {} - -/** - * (PHP 4, PHP 5)
- * Return the real group ID of the current process - * @link http://php.net/manual/en/function.posix-getgid.php - * @return int the real group id, as an integer. - */ -function posix_getgid () {} - -/** - * (PHP 4, PHP 5)
- * Set the GID of the current process - * @link http://php.net/manual/en/function.posix-setgid.php - * @param int $gid

- * The group id. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function posix_setgid ($gid) {} - -/** - * (PHP 4, PHP 5)
- * Return the effective group ID of the current process - * @link http://php.net/manual/en/function.posix-getegid.php - * @return int an integer of the effective group ID. - */ -function posix_getegid () {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Set the effective GID of the current process - * @link http://php.net/manual/en/function.posix-setegid.php - * @param int $gid

- * The group id. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function posix_setegid ($gid) {} - -/** - * (PHP 4, PHP 5)
- * Return the group set of the current process - * @link http://php.net/manual/en/function.posix-getgroups.php - * @return array an array of integers containing the numeric group ids of the group - * set of the current process. - */ -function posix_getgroups () {} - -/** - * (PHP 4, PHP 5)
- * Return login name - * @link http://php.net/manual/en/function.posix-getlogin.php - * @return string the login name of the user, as a string. - */ -function posix_getlogin () {} - -/** - * (PHP 4, PHP 5)
- * Return the current process group identifier - * @link http://php.net/manual/en/function.posix-getpgrp.php - * @return int the identifier, as an integer. - */ -function posix_getpgrp () {} - -/** - * (PHP 4, PHP 5)
- * Make the current process a session leader - * @link http://php.net/manual/en/function.posix-setsid.php - * @return int the session id, or -1 on errors. - */ -function posix_setsid () {} - -/** - * (PHP 4, PHP 5)
- * Set process group id for job control - * @link http://php.net/manual/en/function.posix-setpgid.php - * @param int $pid

- * The process id. - *

- * @param int $pgid

- * The process group id. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function posix_setpgid ($pid, $pgid) {} - -/** - * (PHP 4, PHP 5)
- * Get process group id for job control - * @link http://php.net/manual/en/function.posix-getpgid.php - * @param int $pid

- * The process id. - *

- * @return int the identifier, as an integer. - */ -function posix_getpgid ($pid) {} - -/** - * (PHP 4, PHP 5)
- * Get the current sid of the process - * @link http://php.net/manual/en/function.posix-getsid.php - * @param int $pid

- * The process identifier. If set to 0, the current process is - * assumed. If an invalid pid is - * specified, then FALSE is returned and an error is set which - * can be checked with posix_get_last_error. - *

- * @return int the identifier, as an integer. - */ -function posix_getsid ($pid) {} - -/** - * (PHP 4, PHP 5)
- * Get system name - * @link http://php.net/manual/en/function.posix-uname.php - * @return array a hash of strings with information about the - * system. The indices of the hash are - * sysname - operating system name (e.g. Linux) - * nodename - system name (e.g. valiant) - * release - operating system release (e.g. 2.2.10) - * version - operating system version (e.g. #4 Tue Jul 20 - * 17:01:36 MEST 1999) - * machine - system architecture (e.g. i586) - * domainname - DNS domainname (e.g. example.com) - *

- *

- * domainname is a GNU extension and not part of POSIX.1, so this - * field is only available on GNU systems or when using the GNU - * libc. - */ -function posix_uname () {} - -/** - * (PHP 4, PHP 5)
- * Get process times - * @link http://php.net/manual/en/function.posix-times.php - * @return array a hash of strings with information about the current - * process CPU usage. The indices of the hash are: - * ticks - the number of clock ticks that have elapsed since - * reboot. - * utime - user time used by the current process. - * stime - system time used by the current process. - * cutime - user time used by current process and children. - * cstime - system time used by current process and children. - */ -function posix_times () {} - -/** - * (PHP 4, PHP 5)
- * Get path name of controlling terminal - * @link http://php.net/manual/en/function.posix-ctermid.php - * @return string Upon successful completion, returns string of the pathname to - * the current controlling terminal. Otherwise FALSE is returned and errno - * is set, which can be checked with posix_get_last_error. - */ -function posix_ctermid () {} - -/** - * (PHP 4, PHP 5)
- * Determine terminal device name - * @link http://php.net/manual/en/function.posix-ttyname.php - * @param int $fd

- * The file descriptor. - *

- * @return string On success, returns a string of the absolute path of the - * fd. On failure, returns FALSE - */ -function posix_ttyname ($fd) {} - -/** - * (PHP 4, PHP 5)
- * Determine if a file descriptor is an interactive terminal - * @link http://php.net/manual/en/function.posix-isatty.php - * @param int $fd

- * The file descriptor. - *

- * @return bool TRUE if fd is an open descriptor connected - * to a terminal and FALSE otherwise. - */ -function posix_isatty ($fd) {} - -/** - * (PHP 4, PHP 5)
- * Pathname of current directory - * @link http://php.net/manual/en/function.posix-getcwd.php - * @return string a string of the absolute pathname on success. - * On error, returns FALSE and sets errno which can be checked with - * posix_get_last_error. - */ -function posix_getcwd () {} - -/** - * (PHP 4, PHP 5)
- * Create a fifo special file (a named pipe) - * @link http://php.net/manual/en/function.posix-mkfifo.php - * @param string $pathname

- * Path to the FIFO file. - *

- * @param int $mode

- * The second parameter mode has to be given in - * octal notation (e.g. 0644). The permission of the newly created - * FIFO also depends on the setting of the current - * umask. The permissions of the created file are - * (mode &#38; ~umask). - *

- * @return bool TRUE on success or FALSE on failure. - */ -function posix_mkfifo ($pathname, $mode) {} - -/** - * (PHP 5 >= 5.1.0)
- * Create a special or ordinary file (POSIX.1) - * @link http://php.net/manual/en/function.posix-mknod.php - * @param string $pathname

- * The file to create - *

- * @param int $mode

- * This parameter is constructed by a bitwise OR between file type (one of - * the following constants: POSIX_S_IFREG, - * POSIX_S_IFCHR, POSIX_S_IFBLK, - * POSIX_S_IFIFO or - * POSIX_S_IFSOCK) and permissions. - *

- * @param int $major [optional]

- * The major device kernel identifier (required to pass when using - * S_IFCHR or S_IFBLK). - *

- * @param int $minor [optional]

- * The minor device kernel identifier. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function posix_mknod ($pathname, $mode, $major = 0, $minor = 0) {} - -/** - * (PHP 5 >= 5.1.0)
- * Determine accessibility of a file - * @link http://php.net/manual/en/function.posix-access.php - * @param string $file

- * The name of the file to be tested. - *

- * @param int $mode [optional]

- * A mask consisting of one or more of POSIX_F_OK, - * POSIX_R_OK, POSIX_W_OK and - * POSIX_X_OK. - *

- *

- * POSIX_R_OK, POSIX_W_OK and - * POSIX_X_OK request checking whether the file - * exists and has read, write and execute permissions, respectively. - * POSIX_F_OK just requests checking for the - * existence of the file. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function posix_access ($file, $mode = 'POSIX_F_OK') {} - -/** - * (PHP 4, PHP 5)
- * Return info about a group by name - * @link http://php.net/manual/en/function.posix-getgrnam.php - * @param string $name

The name of the group

- * @return array The array elements returned are: - * - * The group information array - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
ElementDescription
name - * The name element contains the name of the group. This is - * a short, usually less than 16 character "handle" of the - * group, not the real, full name. This should be the same as - * the name parameter used when - * calling the function, and hence redundant. - *
passwd - * The passwd element contains the group's password in an - * encrypted format. Often, for example on a system employing - * "shadow" passwords, an asterisk is returned instead. - *
gid - * Group ID of the group in numeric form. - *
members - * This consists of an array of - * string's for all the members in the group. - *
- */ -function posix_getgrnam ($name) {} - -/** - * (PHP 4, PHP 5)
- * Return info about a group by group id - * @link http://php.net/manual/en/function.posix-getgrgid.php - * @param int $gid

- * The group id. - *

- * @return array The array elements returned are: - * - * The group information array - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
ElementDescription
name - * The name element contains the name of the group. This is - * a short, usually less than 16 character "handle" of the - * group, not the real, full name. - *
passwd - * The passwd element contains the group's password in an - * encrypted format. Often, for example on a system employing - * "shadow" passwords, an asterisk is returned instead. - *
gid - * Group ID, should be the same as the - * gid parameter used when calling the - * function, and hence redundant. - *
members - * This consists of an array of - * string's for all the members in the group. - *
- */ -function posix_getgrgid ($gid) {} - -/** - * (PHP 4, PHP 5)
- * Return info about a user by username - * @link http://php.net/manual/en/function.posix-getpwnam.php - * @param string $username

- * An alphanumeric username. - *

- * @return array On success an array with the following elements is returned, else - * FALSE is returned: - * - * The user information array - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
ElementDescription
name - * The name element contains the username of the user. This is - * a short, usually less than 16 character "handle" of the - * user, not the real, full name. This should be the same as - * the username parameter used when - * calling the function, and hence redundant. - *
passwd - * The passwd element contains the user's password in an - * encrypted format. Often, for example on a system employing - * "shadow" passwords, an asterisk is returned instead. - *
uid - * User ID of the user in numeric form. - *
gid - * The group ID of the user. Use the function - * posix_getgrgid to resolve the group - * name and a list of its members. - *
gecos - * GECOS is an obsolete term that refers to the finger - * information field on a Honeywell batch processing system. - * The field, however, lives on, and its contents have been - * formalized by POSIX. The field contains a comma separated - * list containing the user's full name, office phone, office - * number, and home phone number. On most systems, only the - * user's full name is available. - *
dir - * This element contains the absolute path to the home - * directory of the user. - *
shell - * The shell element contains the absolute path to the - * executable of the user's default shell. - *
- */ -function posix_getpwnam ($username) {} - -/** - * (PHP 4, PHP 5)
- * Return info about a user by user id - * @link http://php.net/manual/en/function.posix-getpwuid.php - * @param int $uid

- * The user identifier. - *

- * @return array an associative array with the following elements: - * - * The user information array - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
ElementDescription
name - * The name element contains the username of the user. This is - * a short, usually less than 16 character "handle" of the - * user, not the real, full name. - *
passwd - * The passwd element contains the user's password in an - * encrypted format. Often, for example on a system employing - * "shadow" passwords, an asterisk is returned instead. - *
uid - * User ID, should be the same as the - * uid parameter used when calling the - * function, and hence redundant. - *
gid - * The group ID of the user. Use the function - * posix_getgrgid to resolve the group - * name and a list of its members. - *
gecos - * GECOS is an obsolete term that refers to the finger - * information field on a Honeywell batch processing system. - * The field, however, lives on, and its contents have been - * formalized by POSIX. The field contains a comma separated - * list containing the user's full name, office phone, office - * number, and home phone number. On most systems, only the - * user's full name is available. - *
dir - * This element contains the absolute path to the - * home directory of the user. - *
shell - * The shell element contains the absolute path to the - * executable of the user's default shell. - *
- */ -function posix_getpwuid ($uid) {} - -/** - * (PHP 4, PHP 5)
- * Return info about system resource limits - * @link http://php.net/manual/en/function.posix-getrlimit.php - * @return array an associative array of elements for each - * limit that is defined. Each limit has a soft and a hard limit. - * - * List of possible limits returned - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Limit nameLimit description
core - * The maximum size of the core file. When 0, not core files are - * created. When core files are larger than this size, they will - * be truncated at this size. - *
totalmem - * The maximum size of the memory of the process, in bytes. - *
virtualmem - * The maximum size of the virtual memory for the process, in bytes. - *
data - * The maximum size of the data segment for the process, in bytes. - *
stack - * The maximum size of the process stack, in bytes. - *
rss - * The maximum number of virtual pages resident in RAM - *
maxproc - * The maximum number of processes that can be created for the - * real user ID of the calling process. - *
memlock - * The maximum number of bytes of memory that may be locked into RAM. - *
cpu - * The amount of time the process is allowed to use the CPU. - *
filesize - * The maximum size of the data segment for the process, in bytes. - *
openfiles - * One more than the maximum number of open file descriptors. - *
- */ -function posix_getrlimit () {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Retrieve the error number set by the last posix function that failed - * @link http://php.net/manual/en/function.posix-get-last-error.php - * @return int the errno (error number) set by the last posix function that - * failed. If no errors exist, 0 is returned. - */ -function posix_get_last_error () {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Alias of posix_get_last_error - * @link http://php.net/manual/en/function.posix-errno.php - */ -function posix_errno () {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Retrieve the system error message associated with the given errno - * @link http://php.net/manual/en/function.posix-strerror.php - * @param int $errno

- * A POSIX error number, returned by - * posix_get_last_error. If set to 0, then the - * string "Success" is returned. - *

- * @return string the error message, as a string. - */ -function posix_strerror ($errno) {} - -/** - * (PHP 5 >= 5.2.0)
- * Calculate the group access list - * @link http://php.net/manual/en/function.posix-initgroups.php - * @param string $name

- * The user to calculate the list for. - *

- * @param int $base_group_id

- * Typically the group number from the password file. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function posix_initgroups ($name, $base_group_id) {} - - -/** - * Check whether the file exists. - * @link http://php.net/manual/en/posix.constants.php - */ -define ('POSIX_F_OK', 0); - -/** - * Check whether the file exists and has execute permissions. - * @link http://php.net/manual/en/posix.constants.php - */ -define ('POSIX_X_OK', 1); - -/** - * Check whether the file exists and has write permissions. - * @link http://php.net/manual/en/posix.constants.php - */ -define ('POSIX_W_OK', 2); - -/** - * Check whether the file exists and has read permissions. - * @link http://php.net/manual/en/posix.constants.php - */ -define ('POSIX_R_OK', 4); - -/** - * Normal file - * @link http://php.net/manual/en/posix.constants.php - */ -define ('POSIX_S_IFREG', 32768); - -/** - * Character special file - * @link http://php.net/manual/en/posix.constants.php - */ -define ('POSIX_S_IFCHR', 8192); - -/** - * Block special file - * @link http://php.net/manual/en/posix.constants.php - */ -define ('POSIX_S_IFBLK', 24576); - -/** - * FIFO (named pipe) special file - * @link http://php.net/manual/en/posix.constants.php - */ -define ('POSIX_S_IFIFO', 4096); - -/** - * Socket - * @link http://php.net/manual/en/posix.constants.php - */ -define ('POSIX_S_IFSOCK', 49152); - -// End of posix v. -?> diff --git a/phpruntime/pspell.php b/phpruntime/pspell.php deleted file mode 100644 index 9201633..0000000 --- a/phpruntime/pspell.php +++ /dev/null @@ -1,310 +0,0 @@ - - * Load a new dictionary - * @link http://php.net/manual/en/function.pspell-new.php - * @param string $language

- * The language parameter is the language code which consists of the - * two letter ISO 639 language code and an optional two letter ISO - * 3166 country code after a dash or underscore. - *

- * @param string $spelling [optional]

- * The spelling parameter is the requested spelling for languages - * with more than one spelling such as English. Known values are - * 'american', 'british', and 'canadian'. - *

- * @param string $jargon [optional]

- * The jargon parameter contains extra information to distinguish - * two different words lists that have the same language and - * spelling parameters. - *

- * @param string $encoding [optional]

- * The encoding parameter is the encoding that words are expected to - * be in. Valid values are 'utf-8', 'iso8859-*', 'koi8-r', - * 'viscii', 'cp1252', 'machine unsigned 16', 'machine unsigned - * 32'. This parameter is largely untested, so be careful when - * using. - *

- * @param int $mode [optional]

- * The mode parameter is the mode in which spellchecker will work. - * There are several modes available: - * PSPELL_FAST - Fast mode (least number of - * suggestions) - * @return int the dictionary link identifier on success or FALSE on failure. - */ -function pspell_new ($language, $spelling = null, $jargon = null, $encoding = null, $mode = 0) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Load a new dictionary with personal wordlist - * @link http://php.net/manual/en/function.pspell-new-personal.php - * @param string $personal

- * The file where words added to the personal list will be stored. - * It should be an absolute filename beginning with '/' because otherwise - * it will be relative to $HOME, which is "/root" for most systems, and - * is probably not what you want. - *

- * @param string $language

- * The language code which consists of the two letter ISO 639 language - * code and an optional two letter ISO 3166 country code after a dash - * or underscore. - *

- * @param string $spelling [optional]

- * The requested spelling for languages with more than one spelling such - * as English. Known values are 'american', 'british', and 'canadian'. - *

- * @param string $jargon [optional]

- * Extra information to distinguish two different words lists that have - * the same language and spelling parameters. - *

- * @param string $encoding [optional]

- * The encoding that words are expected to be in. Valid values are - * utf-8, iso8859-*, - * koi8-r, viscii, - * cp1252, machine unsigned 16, - * machine unsigned 32. - *

- * @param int $mode [optional]

- * The mode in which spellchecker will work. There are several modes available: - * PSPELL_FAST - Fast mode (least number of - * suggestions) - * @return int the dictionary link identifier for use in other pspell functions. - */ -function pspell_new_personal ($personal, $language, $spelling = null, $jargon = null, $encoding = null, $mode = 0) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Load a new dictionary with settings based on a given config - * @link http://php.net/manual/en/function.pspell-new-config.php - * @param int $config

- * The config parameter is the one returned by - * pspell_config_create when the config was created. - *

- * @return int a dictionary link identifier on success. - */ -function pspell_new_config ($config) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Check a word - * @link http://php.net/manual/en/function.pspell-check.php - * @param int $dictionary_link - * @param string $word

- * The tested word. - *

- * @return bool TRUE if the spelling is correct, FALSE if not. - */ -function pspell_check ($dictionary_link, $word) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Suggest spellings of a word - * @link http://php.net/manual/en/function.pspell-suggest.php - * @param int $dictionary_link - * @param string $word

- * The tested word. - *

- * @return array an array of possible spellings. - */ -function pspell_suggest ($dictionary_link, $word) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Store a replacement pair for a word - * @link http://php.net/manual/en/function.pspell-store-replacement.php - * @param int $dictionary_link

- * A dictionary link identifier, opened with - * pspell_new_personal - *

- * @param string $misspelled

- * The misspelled word. - *

- * @param string $correct

- * The fixed spelling for the misspelled word. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pspell_store_replacement ($dictionary_link, $misspelled, $correct) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Add the word to a personal wordlist - * @link http://php.net/manual/en/function.pspell-add-to-personal.php - * @param int $dictionary_link - * @param string $word

- * The added word. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pspell_add_to_personal ($dictionary_link, $word) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Add the word to the wordlist in the current session - * @link http://php.net/manual/en/function.pspell-add-to-session.php - * @param int $dictionary_link - * @param string $word

- * The added word. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pspell_add_to_session ($dictionary_link, $word) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Clear the current session - * @link http://php.net/manual/en/function.pspell-clear-session.php - * @param int $dictionary_link - * @return bool TRUE on success or FALSE on failure. - */ -function pspell_clear_session ($dictionary_link) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Save the personal wordlist to a file - * @link http://php.net/manual/en/function.pspell-save-wordlist.php - * @param int $dictionary_link

- * A dictionary link identifier opened with - * pspell_new_personal. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pspell_save_wordlist ($dictionary_link) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Create a config used to open a dictionary - * @link http://php.net/manual/en/function.pspell-config-create.php - * @param string $language

- * The language parameter is the language code which consists of the - * two letter ISO 639 language code and an optional two letter ISO - * 3166 country code after a dash or underscore. - *

- * @param string $spelling [optional]

- * The spelling parameter is the requested spelling for languages - * with more than one spelling such as English. Known values are - * 'american', 'british', and 'canadian'. - *

- * @param string $jargon [optional]

- * The jargon parameter contains extra information to distinguish - * two different words lists that have the same language and - * spelling parameters. - *

- * @param string $encoding [optional]

- * The encoding parameter is the encoding that words are expected to - * be in. Valid values are 'utf-8', 'iso8859-*', 'koi8-r', - * 'viscii', 'cp1252', 'machine unsigned 16', 'machine unsigned - * 32'. This parameter is largely untested, so be careful when - * using. - *

- * @return int Retuns a pspell config identifier, or FALSE on error. - */ -function pspell_config_create ($language, $spelling = null, $jargon = null, $encoding = null) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Consider run-together words as valid compounds - * @link http://php.net/manual/en/function.pspell-config-runtogether.php - * @param int $dictionary_link - * @param bool $flag

- * TRUE if run-together words should be treated as legal compounds, - * FALSE otherwise. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pspell_config_runtogether ($dictionary_link, $flag) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Change the mode number of suggestions returned - * @link http://php.net/manual/en/function.pspell-config-mode.php - * @param int $dictionary_link - * @param int $mode

- * The mode parameter is the mode in which spellchecker will work. - * There are several modes available: - * PSPELL_FAST - Fast mode (least number of - * suggestions) - * @return bool TRUE on success or FALSE on failure. - */ -function pspell_config_mode ($dictionary_link, $mode) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Ignore words less than N characters long - * @link http://php.net/manual/en/function.pspell-config-ignore.php - * @param int $dictionary_link - * @param int $n

- * Words less than n characters will be skipped. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pspell_config_ignore ($dictionary_link, $n) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Set a file that contains personal wordlist - * @link http://php.net/manual/en/function.pspell-config-personal.php - * @param int $dictionary_link - * @param string $file

- * The personal wordlist. If the file does not exist, it will be created. - * The file should be writable by whoever PHP runs as (e.g. nobody). - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pspell_config_personal ($dictionary_link, $file) {} - -/** - * (PHP 5)
- * Location of the main word list - * @link http://php.net/manual/en/function.pspell-config-dict-dir.php - * @param int $conf - * @param string $directory - * @return bool TRUE on success or FALSE on failure. - */ -function pspell_config_dict_dir ($conf, $directory) {} - -/** - * (PHP 5)
- * location of language data files - * @link http://php.net/manual/en/function.pspell-config-data-dir.php - * @param int $conf - * @param string $directory - * @return bool TRUE on success or FALSE on failure. - */ -function pspell_config_data_dir ($conf, $directory) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Set a file that contains replacement pairs - * @link http://php.net/manual/en/function.pspell-config-repl.php - * @param int $dictionary_link - * @param string $file

- * The file should be writable by whoever PHP runs as (e.g. nobody). - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pspell_config_repl ($dictionary_link, $file) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Determine whether to save a replacement pairs list -along with the wordlist - * @link http://php.net/manual/en/function.pspell-config-save-repl.php - * @param int $dictionary_link - * @param bool $flag

- * TRUE if replacement pairs should be saved, FALSE otherwise. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function pspell_config_save_repl ($dictionary_link, $flag) {} - -define ('PSPELL_FAST', 1); -define ('PSPELL_NORMAL', 2); -define ('PSPELL_BAD_SPELLERS', 3); -define ('PSPELL_RUN_TOGETHER', 8); - -// End of pspell v. -?> diff --git a/phpruntime/readline.php b/phpruntime/readline.php deleted file mode 100644 index ce16428..0000000 --- a/phpruntime/readline.php +++ /dev/null @@ -1,134 +0,0 @@ - - * Reads a line - * @link http://php.net/manual/en/function.readline.php - * @param string $prompt [optional]

- * You may specify a string with which to prompt the user. - *

- * @return string a single string from the user. The line returned has the ending - * newline removed. - */ -function readline ($prompt = null) {} - -/** - * (PHP 4, PHP 5)
- * Gets/sets various internal readline variables - * @link http://php.net/manual/en/function.readline-info.php - * @param string $varname [optional]

- * A variable name. - *

- * @param string $newvalue [optional]

- * If provided, this will be the new value of the setting. - *

- * @return mixed If called with no parameters, this function returns an array of - * values for all the setting readline uses. The elements will - * be indexed by the following values: done, end, erase_empty_line, - * library_version, line_buffer, mark, pending_input, point, prompt, - * readline_name, and terminal_name. - *

- *

- * If called with one or two parameters, the old value is returned. - */ -function readline_info ($varname = null, $newvalue = null) {} - -/** - * (PHP 4, PHP 5)
- * Adds a line to the history - * @link http://php.net/manual/en/function.readline-add-history.php - * @param string $line

- * The line to be added in the history. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function readline_add_history ($line) {} - -/** - * (PHP 4, PHP 5)
- * Clears the history - * @link http://php.net/manual/en/function.readline-clear-history.php - * @return bool TRUE on success or FALSE on failure. - */ -function readline_clear_history () {} - -/** - * (PHP 4, PHP 5)
- * Reads the history - * @link http://php.net/manual/en/function.readline-read-history.php - * @param string $filename [optional]

- * Path to the filename containing the command history. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function readline_read_history ($filename = null) {} - -/** - * (PHP 4, PHP 5)
- * Writes the history - * @link http://php.net/manual/en/function.readline-write-history.php - * @param string $filename [optional]

- * Path to the saved file. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function readline_write_history ($filename = null) {} - -/** - * (PHP 4, PHP 5)
- * Registers a completion function - * @link http://php.net/manual/en/function.readline-completion-function.php - * @param callable $function

- * You must supply the name of an existing function which accepts a - * partial command line and returns an array of possible matches. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function readline_completion_function (callable $function) {} - -/** - * (PHP 5 >= 5.1.0)
- * Initializes the readline callback interface and terminal, prints the prompt and returns immediately - * @link http://php.net/manual/en/function.readline-callback-handler-install.php - * @param string $prompt

- * The prompt message. - *

- * @param callable $callback

- * The callback function takes one parameter; the - * user input returned. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function readline_callback_handler_install ($prompt, callable $callback) {} - -/** - * (PHP 5 >= 5.1.0)
- * Reads a character and informs the readline callback interface when a line is received - * @link http://php.net/manual/en/function.readline-callback-read-char.php - * @return void No value is returned. - */ -function readline_callback_read_char () {} - -/** - * (PHP 5 >= 5.1.0)
- * Removes a previously installed callback handler and restores terminal settings - * @link http://php.net/manual/en/function.readline-callback-handler-remove.php - * @return bool TRUE if a previously installed callback handler was removed, or - * FALSE if one could not be found. - */ -function readline_callback_handler_remove () {} - -/** - * (PHP 5 >= 5.1.0)
- * Redraws the display - * @link http://php.net/manual/en/function.readline-redisplay.php - * @return void No value is returned. - */ -function readline_redisplay () {} - -define ('READLINE_LIB', "libedit"); - -// End of readline v.5.4.6-1ubuntu1.1 -?> diff --git a/phpruntime/recode.php b/phpruntime/recode.php deleted file mode 100644 index 13c976a..0000000 --- a/phpruntime/recode.php +++ /dev/null @@ -1,49 +0,0 @@ - - * Recode a string according to a recode request - * @link http://php.net/manual/en/function.recode-string.php - * @param string $request

- * The desired recode request type - *

- * @param string $string

- * The string to be recoded - *

- * @return string the recoded string or FALSE, if unable to - * perform the recode request. - */ -function recode_string ($request, $string) {} - -/** - * (PHP 4, PHP 5)
- * Recode from file to file according to recode request - * @link http://php.net/manual/en/function.recode-file.php - * @param string $request

- * The desired recode request type - *

- * @param resource $input

- * A local file handle resource for - * the input - *

- * @param resource $output

- * A local file handle resource for - * the output - *

- * @return bool FALSE, if unable to comply, TRUE otherwise. - */ -function recode_file ($request, $input, $output) {} - -/** - * (PHP 4, PHP 5)
- * Alias of recode_string - * @link http://php.net/manual/en/function.recode.php - * @param $request - * @param $str - */ -function recode ($request, $str) {} - -// End of recode v. -?> diff --git a/phpruntime/removed.php b/phpruntime/removed.php deleted file mode 100644 index 0a1e895..0000000 --- a/phpruntime/removed.php +++ /dev/null @@ -1,75 +0,0 @@ - - * Convert character encoding as output buffer handler - * @link http://php.net/manual/en/function.ob-iconv-handler.php - * @param string $contents - * @param int $status - * @return string See ob_start for information about this handler - * return values. - */ -function ob_iconv_handler ($contents, $status) {} - -/** - * (PHP 5)
- * ob_start callback function to repair the buffer - * @link http://php.net/manual/en/function.ob-tidyhandler.php - * @param string $input

- * The buffer. - *

- * @param int $mode [optional]

- * The buffer mode. - *

- * @return string the modified buffer. - */ -function ob_tidyhandler ($input, $mode = null) {} - -/** - * (PHP 4, PHP 5 < 5.4.0)
- * Register one or more global variables with the current session - * @link http://php.net/manual/en/function.session-register.php - * @param mixed $name

- * A string holding the name of a variable or an array consisting of - * variable names or other arrays. - *

- * @param mixed $_ [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function session_register ($name, $_ = null) {} - -/** - * (PHP 4, PHP 5 < 5.4.0)
- * Unregister a global variable from the current session - * @link http://php.net/manual/en/function.session-unregister.php - * @param string $name

- * The variable name. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function session_unregister ($name) {} - -/** - * (PHP 4, PHP 5 < 5.4.0)
- * Find out whether a global variable is registered in a session - * @link http://php.net/manual/en/function.session-is-registered.php - * @param string $name

- * The variable name. - *

- * @return bool session_is_registered returns TRUE if there is a - * global variable with the name name registered in - * the current session, FALSE otherwise. - */ -function session_is_registered ($name) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Change the root directory - * @link http://php.net/manual/en/function.chroot.php - * @param string $directory

- * The path to change the root directory to. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function chroot ($directory) {} -?> diff --git a/phpruntime/session.php b/phpruntime/session.php deleted file mode 100644 index 1921b26..0000000 --- a/phpruntime/session.php +++ /dev/null @@ -1,499 +0,0 @@ -SessionHandlerInterface is an - * interface which defines a - * prototype for creating a custom session handler. In order to pass a custom - * session handler to session_set_save_handler using its - * OOP invocation, the class must implement this interface. - * @link http://php.net/manual/en/class.sessionhandlerinterface.php - */ -interface SessionHandlerInterface { - - /** - * (PHP 5 >= 5.4.0)
- * Initialize session - * @link http://php.net/manual/en/sessionhandlerinterface.open.php - * @param string $save_path

- * The path where to store/retrieve the session. - *

- * @param string $name

- * The session name. - *

- * @return bool The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing. - */ - abstract public function open ($save_path, $name); - - /** - * (PHP 5 >= 5.4.0)
- * Close the session - * @link http://php.net/manual/en/sessionhandlerinterface.close.php - * @return bool The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing. - */ - abstract public function close (); - - /** - * (PHP 5 >= 5.4.0)
- * Read session data - * @link http://php.net/manual/en/sessionhandlerinterface.read.php - * @param string $session_id

- * The session id. - *

- * @return string an encoded string of the read data. If nothing was read, it must return an empty string. Note this value is returned internally to PHP for processing. - */ - abstract public function read ($session_id); - - /** - * (PHP 5 >= 5.4.0)
- * Write session data - * @link http://php.net/manual/en/sessionhandlerinterface.write.php - * @param string $session_id

- * The session id. - *

- * @param string $session_data

- * The encoded session data. This data is the result of the PHP internally encoding the $_SESSION superglobal to a serialized - * string and passing it as this parameter. Please note sessions use an alternative serialization method. - *

- * @return bool The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing. - */ - abstract public function write ($session_id, $session_data); - - /** - * (PHP 5 >= 5.4.0)
- * Destroy a session - * @link http://php.net/manual/en/sessionhandlerinterface.destroy.php - * @param string $session_id

- * The session ID being destroyed. - *

- * @return bool The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing. - */ - abstract public function destroy ($session_id); - - /** - * (PHP 5 >= 5.4.0)
- * Cleanup old sessions - * @link http://php.net/manual/en/sessionhandlerinterface.gc.php - * @param string $maxlifetime

- * Sessions that have not updated for the last maxlifetime seconds will be removed. - *

- * @return bool The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing. - */ - abstract public function gc ($maxlifetime); - -} - -/** - * SessionHandler a special class that can be used to expose - * the current internal PHP session save handler by inheritance. There are six methods which - * wrap the six internal session save handler callbacks (open, close, - * read, write, destroy and gc). - * By default, this class will wrap whatever internal save handler is set as as defined by the - * session.save_handler configuration directive which is usually - * files by default. - * Other internal session save handlers are provided by PHP extensions such as SQLite (as sqlite), - * Memcache (as memcache), and Memcached (as memcached). - * @link http://php.net/manual/en/class.sessionhandler.php - */ -class SessionHandler implements SessionHandlerInterface { - - /** - * (PHP 5 >= 5.4.0)
- * Initialize session - * @link http://php.net/manual/en/sessionhandler.open.php - * @param string $save_path

- * The path where to store/retrieve the session. - *

- * @param string $session_id

- * The session id. - *

- * @return bool The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing. - */ - public function open ($save_path, $session_id) {} - - /** - * (PHP 5 >= 5.4.0)
- * Close the session - * @link http://php.net/manual/en/sessionhandler.close.php - * @return bool The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing. - */ - public function close () {} - - /** - * (PHP 5 >= 5.4.0)
- * Read session data - * @link http://php.net/manual/en/sessionhandler.read.php - * @param string $session_id

- * The session id to read data for. - *

- * @return string an encoded string of the read data. If nothing was read, it must return an empty string. Note this value is returned internally to PHP for processing. - */ - public function read ($session_id) {} - - /** - * (PHP 5 >= 5.4.0)
- * Write session data - * @link http://php.net/manual/en/sessionhandler.write.php - * @param string $session_id

- * The session id. - *

- * @param string $session_data

- * The encoded session data. This data is the result of the PHP internally encoding the $_SESSION superglobal to a serialized - * string and passing it as this parameter. Please note sessions use an alternative serialization method. - *

- * @return bool The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing. - */ - public function write ($session_id, $session_data) {} - - /** - * (PHP 5 >= 5.4.0)
- * Destroy a session - * @link http://php.net/manual/en/sessionhandler.destroy.php - * @param string $session_id

- * The session ID being destroyed. - *

- * @return bool The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing. - */ - public function destroy ($session_id) {} - - /** - * (PHP 5 >= 5.4.0)
- * Cleanup old sessions - * @link http://php.net/manual/en/sessionhandler.gc.php - * @param int $maxlifetime

- * Sessions that have not updated for the last maxlifetime seconds will be removed. - *

- * @return bool The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing. - */ - public function gc ($maxlifetime) {} - -} - -/** - * (PHP 4, PHP 5)
- * Get and/or set the current session name - * @link http://php.net/manual/en/function.session-name.php - * @param string $name [optional]

- * The session name references the name of the session, which is - * used in cookies and URLs (e.g. PHPSESSID). It - * should contain only alphanumeric characters; it should be short and - * descriptive (i.e. for users with enabled cookie warnings). - * If name is specified, the name of the current - * session is changed to its value. - *

- *

- *

- * The session name can't consist of digits only, at least one letter - * must be present. Otherwise a new session id is generated every time. - *

- *

- * @return string the name of the current session. - */ -function session_name ($name = null) {} - -/** - * (PHP 4, PHP 5)
- * Get and/or set the current session module - * @link http://php.net/manual/en/function.session-module-name.php - * @param string $module [optional]

- * If module is specified, that module will be - * used instead. - *

- * @return string the name of the current session module. - */ -function session_module_name ($module = null) {} - -/** - * (PHP 4, PHP 5)
- * Get and/or set the current session save path - * @link http://php.net/manual/en/function.session-save-path.php - * @param string $path [optional]

- * Session data path. If specified, the path to which data is saved will - * be changed. session_save_path needs to be called - * before session_start for that purpose. - *

- *

- *

- * On some operating systems, you may want to specify a path on a - * filesystem that handles lots of small files efficiently. For example, - * on Linux, reiserfs may provide better performance than ext2fs. - *

- *

- * @return string the path of the current directory used for data storage. - */ -function session_save_path ($path = null) {} - -/** - * (PHP 4, PHP 5)
- * Get and/or set the current session id - * @link http://php.net/manual/en/function.session-id.php - * @param string $id [optional]

- * If id is specified, it will replace the current - * session id. session_id needs to be called before - * session_start for that purpose. Depending on the - * session handler, not all characters are allowed within the session id. - * For example, the file session handler only allows characters in the - * range a-z A-Z 0-9 , (comma) and - (minus)! - *

- * When using session cookies, specifying an id - * for session_id will always send a new cookie - * when session_start is called, regardless if the - * current session id is identical to the one being set. - * @return string session_id returns the session id for the current - * session or the empty string ("") if there is no current - * session (no current session id exists). - */ -function session_id ($id = null) {} - -/** - * (PHP 4 >= 4.3.2, PHP 5)
- * Update the current session id with a newly generated one - * @link http://php.net/manual/en/function.session-regenerate-id.php - * @param bool $delete_old_session [optional]

- * Whether to delete the old associated session file or not. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function session_regenerate_id ($delete_old_session = false) {} - -/** - * (PHP 4, PHP 5)
- * Decodes session data from a session encoded string - * @link http://php.net/manual/en/function.session-decode.php - * @param string $data

- * The encoded data to be stored. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function session_decode ($data) {} - -/** - * (PHP 4, PHP 5)
- * Encodes the current session data as a session encoded string - * @link http://php.net/manual/en/function.session-encode.php - * @return string the contents of the current session encoded. - */ -function session_encode () {} - -/** - * (PHP 4, PHP 5)
- * Start new or resume existing session - * @link http://php.net/manual/en/function.session-start.php - * @return bool This function returns TRUE if a session was successfully started, - * otherwise FALSE. - */ -function session_start () {} - -/** - * (PHP 4, PHP 5)
- * Destroys all data registered to a session - * @link http://php.net/manual/en/function.session-destroy.php - * @return bool TRUE on success or FALSE on failure. - */ -function session_destroy () {} - -/** - * (PHP 4, PHP 5)
- * Free all session variables - * @link http://php.net/manual/en/function.session-unset.php - * @return void No value is returned. - */ -function session_unset () {} - -/** - * (PHP 4, PHP 5)
- * Sets user-level session storage functions - * @link http://php.net/manual/en/function.session-set-save-handler.php - * @param callable $open - * @param callable $close - * @param callable $read - * @param callable $write - * @param callable $destroy - * @param callable $gc - * @return bool TRUE on success or FALSE on failure. - */ -function session_set_save_handler (callable $open, callable $close, callable $read, callable $write, callable $destroy, callable $gc) {} - -/** - * (PHP 4 >= 4.0.3, PHP 5)
- * Get and/or set the current cache limiter - * @link http://php.net/manual/en/function.session-cache-limiter.php - * @param string $cache_limiter [optional]

- * If cache_limiter is specified, the name of the - * current cache limiter is changed to the new value. - *

- * - * Possible values - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
ValueHeaders sent
public - *
- * Expires: (sometime in the future, according session.cache_expire)
- * Cache-Control: public, max-age=(sometime in the future, according to session.cache_expire)
- * Last-Modified: (the timestamp of when the session was last saved)
- * 
- *
private_no_expire - *
- * Cache-Control: private, max-age=(session.cache_expire in the future), pre-check=(session.cache_expire in the future)
- * Last-Modified: (the timestamp of when the session was last saved)
- * 
- *
private - *
- * Expires: Thu, 19 Nov 1981 08:52:00 GMT
- * Cache-Control: private, max-age=(session.cache_expire in the future), pre-check=(session.cache_expire in the future)
- * Last-Modified: (the timestamp of when the session was last saved)
- * 
- *
nocache - *
- * Expires: Thu, 19 Nov 1981 08:52:00 GMT
- * Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
- * Pragma: no-cache
- * 
- *
- * @return string the name of the current cache limiter. - */ -function session_cache_limiter ($cache_limiter = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Return current cache expire - * @link http://php.net/manual/en/function.session-cache-expire.php - * @param string $new_cache_expire [optional]

- * If new_cache_expire is given, the current cache - * expire is replaced with new_cache_expire. - *

- *

- * Setting new_cache_expire is of value only, if - * session.cache_limiter is set to a value - * different from nocache. - *

- * @return int the current setting of session.cache_expire. - * The value returned should be read in minutes, defaults to 180. - */ -function session_cache_expire ($new_cache_expire = null) {} - -/** - * (PHP 4, PHP 5)
- * Set the session cookie parameters - * @link http://php.net/manual/en/function.session-set-cookie-params.php - * @param int $lifetime

- * Lifetime of the - * session cookie, defined in seconds. - *

- * @param string $path [optional]

- * Path on the domain where - * the cookie will work. Use a single slash ('/') for all paths on the - * domain. - *

- * @param string $domain [optional]

- * Cookie domain, for - * example 'www.php.net'. To make cookies visible on all subdomains then - * the domain must be prefixed with a dot like '.php.net'. - *

- * @param bool $secure [optional]

- * If TRUE cookie will only be sent over - * secure connections. - *

- * @param bool $httponly [optional]

- * If set to TRUE then PHP will attempt to send the - * httponly - * flag when setting the session cookie. - *

- * @return void No value is returned. - */ -function session_set_cookie_params ($lifetime, $path = null, $domain = null, $secure = false, $httponly = false) {} - -/** - * (PHP 4, PHP 5)
- * Get the session cookie parameters - * @link http://php.net/manual/en/function.session-get-cookie-params.php - * @return array an array with the current session cookie information, the array - * contains the following items: - * "lifetime" - The - * lifetime of the cookie in seconds. - * "path" - The path where - * information is stored. - * "domain" - The domain - * of the cookie. - * "secure" - The cookie - * should only be sent over secure connections. - * "httponly" - The - * cookie can only be accessed through the HTTP protocol. - */ -function session_get_cookie_params () {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Write session data and end session - * @link http://php.net/manual/en/function.session-write-close.php - * @return void No value is returned. - */ -function session_write_close () {} - -/** - * (PHP >=5.4.0)
- * Returns the current session status - * @link http://php.net/manual/en/function.session-status.php - * @return mixed PHP_SESSION_DISABLED if sessions are disabled. - * PHP_SESSION_NONE if sessions are enabled, but none exists. - * PHP_SESSION_ACTIVE if sessions are enabled, and one exists. - */ -function session_status () {} - -/** - * (PHP >=5.4.0)
- * Session shutdown function - * @link http://php.net/manual/en/function.session-register-shutdown.php - * @return void No value is returned. - */ -function session_register_shutdown () {} - -/** - * (PHP 4 >= 4.4.0, PHP 5)
- * Alias of session_write_close - * @link http://php.net/manual/en/function.session-commit.php - */ -function session_commit () {} - - -/** - * Since PHP 5.4.0. Return value of session_status if sessions are disabled. - * @link http://php.net/manual/en/session.constants.php - */ -define ('PHP_SESSION_DISABLED', 0); - -/** - * Since PHP 5.4.0. Return value of session_status if sessions are enabled, - * but no session exists. - * @link http://php.net/manual/en/session.constants.php - */ -define ('PHP_SESSION_NONE', 1); - -/** - * Since PHP 5.4.0. Return value of session_status if sessions are enabled, - * and a session exists. - * @link http://php.net/manual/en/session.constants.php - */ -define ('PHP_SESSION_ACTIVE', 2); - -// End of session v. -?> diff --git a/phpruntime/shmop.php b/phpruntime/shmop.php deleted file mode 100644 index b9d675a..0000000 --- a/phpruntime/shmop.php +++ /dev/null @@ -1,108 +0,0 @@ - - * Create or open shared memory block - * @link http://php.net/manual/en/function.shmop-open.php - * @param int $key

- * System's id for the shared memory block. - * Can be passed as a decimal or hex. - *

- * @param string $flags

- * The flags that you can use: - * "a" for access (sets SHM_RDONLY for shmat) - * use this flag when you need to open an existing shared memory - * segment for read only - * @param int $mode

- * The permissions that you wish to assign to your memory segment, those - * are the same as permission for a file. Permissions need to be passed - * in octal form, like for example 0644 - *

- * @param int $size

- * The size of the shared memory block you wish to create in bytes - *

- * @return int On success shmop_open will return an id that you can - * use to access the shared memory segment you've created. FALSE is - * returned on failure. - */ -function shmop_open ($key, $flags, $mode, $size) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Read data from shared memory block - * @link http://php.net/manual/en/function.shmop-read.php - * @param int $shmid

- * The shared memory block identifier created by - * shmop_open - *

- * @param int $start

- * Offset from which to start reading - *

- * @param int $count

- * The number of bytes to read - *

- * @return string the data or FALSE on failure. - */ -function shmop_read ($shmid, $start, $count) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Close shared memory block - * @link http://php.net/manual/en/function.shmop-close.php - * @param int $shmid

- * The shared memory block identifier created by - * shmop_open - *

- * @return void No value is returned. - */ -function shmop_close ($shmid) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Get size of shared memory block - * @link http://php.net/manual/en/function.shmop-size.php - * @param int $shmid

- * The shared memory block identifier created by - * shmop_open - *

- * @return int an int, which represents the number of bytes the shared memory - * block occupies. - */ -function shmop_size ($shmid) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Write data into shared memory block - * @link http://php.net/manual/en/function.shmop-write.php - * @param int $shmid

- * The shared memory block identifier created by - * shmop_open - *

- * @param string $data

- * A string to write into shared memory block - *

- * @param int $offset

- * Specifies where to start writing data inside the shared memory - * segment. - *

- * @return int The size of the written data, or FALSE on - * failure. - */ -function shmop_write ($shmid, $data, $offset) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Delete shared memory block - * @link http://php.net/manual/en/function.shmop-delete.php - * @param int $shmid

- * The shared memory block identifier created by - * shmop_open - *

- * @return bool TRUE on success or FALSE on failure. - */ -function shmop_delete ($shmid) {} - -// End of shmop v. -?> diff --git a/phpruntime/snmp.php b/phpruntime/snmp.php deleted file mode 100644 index 14b13d8..0000000 --- a/phpruntime/snmp.php +++ /dev/null @@ -1,978 +0,0 @@ - - * Creates SNMP instance representing session to remote SNMP agent - * @link http://php.net/manual/en/snmp.construct.php - * @param $version - * @param $host - * @param $community - * @param $timeout [optional] - * @param $retries [optional] - */ - public function __construct ($version, $host, $community, $timeout, $retries) {} - - /** - * (PHP 5 >= 5.4.0)
- * Close SNMP session - * @link http://php.net/manual/en/snmp.close.php - * @return mixed TRUE on success or FALSE on failure. - */ - public function close () {} - - /** - * (PHP 5 >= 5.4.0)
- * Configures security-related SNMPv3 session parameters - * @link http://php.net/manual/en/snmp.setsecurity.php - * @param $session - * @param $sec_level - * @param $auth_protocol - * @param $auth_passphrase - * @param $priv_protocol - * @param $priv_passphrase - * @param $contextName - * @param $contextEngineID - * @param $var1 [optional] - * @return mixed TRUE on success or FALSE on failure. - */ - public function setSecurity ($session, $sec_level, $auth_protocol, $auth_passphrase, $priv_protocol, $priv_passphrase, $contextName, $contextEngineID, $var9) {} - - /** - * (PHP 5 >= 5.4.0)
- * Fetch an SNMP object - * @link http://php.net/manual/en/snmp.get.php - * @param $object_id - * @param $use_orignames [optional] - * @return mixed SNMP objects requested as string or array - * depending on object_id type or FALSE on error. - */ - public function get ($object_id, $use_orignames) {} - - /** - * (PHP 5 >= 5.4.0)
- * Fetch an SNMP object which -follows the given object id - * @link http://php.net/manual/en/snmp.getnext.php - * @param $object_id - * @param $use_orignames [optional] - * @return mixed SNMP objects requested as string or array - * depending on object_id type or FALSE on error. - */ - public function getnext ($object_id, $use_orignames) {} - - /** - * (PHP 5 >= 5.4.0)
- * Fetch SNMP object subtree - * @link http://php.net/manual/en/snmp.walk.php - * @param $object_id - * @param $suffix_keys - * @param $max_repetitions - * @param $non_repeaters - * @return mixed an associative array of the SNMP object ids and their values on success or FALSE on error. - * When a SNMP error occures SNMP::getErrno and - * SNMP::getError can be used for retrieving error - * number (specific to SNMP extension, see class constants) and error message - * respectively. - */ - public function walk ($object_id, $suffix_keys, $max_repetitions, $non_repeaters) {} - - /** - * (PHP 5 >= 5.4.0)
- * Set the value of an SNMP object - * @link http://php.net/manual/en/snmp.set.php - * @param $object_id - * @param $type - * @param $value - * @return mixed TRUE on success or FALSE on failure. - */ - public function set ($object_id, $type, $value) {} - - /** - * (PHP 5 >= 5.4.0)
- * Get last error code - * @link http://php.net/manual/en/snmp.geterrno.php - * @return mixed one of SNMP error code values described in constants chapter. - */ - public function getErrno () {} - - /** - * (PHP 5 >= 5.4.0)
- * Get last error message - * @link http://php.net/manual/en/snmp.geterror.php - * @return mixed String describing error from last SNMP request. - */ - public function getError () {} - -} - -/** - * Represents an error raised by SNMP. You should not throw a - * SNMPException from your own code. - * See Exceptions for more - * information about Exceptions in PHP. - * @link http://php.net/manual/en/class.snmpexception.php - */ -class SNMPException extends RuntimeException { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - - /** - * (PHP 5 >= 5.1.0)
- * String representation of the exception - * @link http://php.net/manual/en/exception.tostring.php - * @return string the string representation of the exception. - */ - public function __toString () {} - -} - -/** - * (PHP 4, PHP 5)
- * Fetch an SNMP object - * @link http://php.net/manual/en/function.snmpget.php - * @param string $hostname

- * The SNMP agent. - *

- * @param string $community

- * The read community. - *

- * @param string $object_id

- * The SNMP object. - *

- * @param int $timeout [optional]

- * The number of microseconds until the first timeout. - *

- * @param int $retries [optional]

- * The number of times to retry if timeouts occur. - *

- * @return string SNMP object value on success or FALSE on error. - */ -function snmpget ($hostname, $community, $object_id, $timeout = 1000000, $retries = 5) {} - -/** - * (PHP 5)
- * Fetch the SNMP object which follows the given object id - * @link http://php.net/manual/en/function.snmpgetnext.php - * @param string $host

The hostname of the SNMP agent (server).

- * @param string $community

The read community.

- * @param string $object_id

The SNMP object id which precedes the wanted one.

- * @param int $timeout [optional]

The number of microseconds until the first timeout.

- * @param int $retries [optional]

The number of times to retry if timeouts occur.

- * @return string SNMP object value on success or FALSE on error. - * In case of an error, an E_WARNING message is shown. - */ -function snmpgetnext ($host, $community, $object_id, $timeout = 1000000, $retries = 5) {} - -/** - * (PHP 4, PHP 5)
- * Fetch all the SNMP objects from an agent - * @link http://php.net/manual/en/function.snmpwalk.php - * @param string $hostname

- * The SNMP agent (server). - *

- * @param string $community

- * The read community. - *

- * @param string $object_id

- * If NULL, object_id is taken as the root of - * the SNMP objects tree and all objects under that tree are returned as - * an array. - *

- *

- * If object_id is specified, all the SNMP objects - * below that object_id are returned. - *

- * @param int $timeout [optional]

- * The number of microseconds until the first timeout. - *

- * @param int $retries [optional]

The number of times to retry if timeouts occur.

- * @return array an array of SNMP object values starting from the - * object_id as root or FALSE on error. - */ -function snmpwalk ($hostname, $community, $object_id, $timeout = 1000000, $retries = 5) {} - -/** - * (PHP 4, PHP 5)
- * Return all objects including their respective object ID within the specified one - * @link http://php.net/manual/en/function.snmprealwalk.php - * @param string $host

The hostname of the SNMP agent (server).

- * @param string $community

The read community.

- * @param string $object_id

The SNMP object id which precedes the wanted one.

- * @param int $timeout [optional]

The number of microseconds until the first timeout.

- * @param int $retries [optional]

The number of times to retry if timeouts occur.

- * @return array an associative array of the SNMP object ids and their values on success or FALSE on error. - * In case of an error, an E_WARNING message is shown. - */ -function snmprealwalk ($host, $community, $object_id, $timeout = 1000000, $retries = 5) {} - -/** - * (PHP 4, PHP 5)
- * Query for a tree of information about a network entity - * @link http://php.net/manual/en/function.snmpwalkoid.php - * @param string $hostname

- * The SNMP agent. - *

- * @param string $community

- * The read community. - *

- * @param string $object_id

- * If NULL, object_id is taken as the root of - * the SNMP objects tree and all objects under that tree are returned as - * an array. - *

- *

- * If object_id is specified, all the SNMP objects - * below that object_id are returned. - *

- * @param int $timeout [optional]

- * The number of microseconds until the first timeout. - *

- * @param int $retries [optional]

- * The number of times to retry if timeouts occur. - *

- * @return array an associative array with object ids and their respective - * object value starting from the object_id - * as root or FALSE on error. - */ -function snmpwalkoid ($hostname, $community, $object_id, $timeout = 1000000, $retries = 5) {} - -/** - * (PHP 4, PHP 5)
- * Set the value of an SNMP object - * @link http://php.net/manual/en/function.snmpset.php - * @param string $host

- * The hostname of the SNMP agent (server). - *

- * @param string $community

- * The write community. - *

- * @param string $object_id

- * The SNMP object id. - *

- * @param string $type The MIB defines the type of each object id. It has to be specified as a single character from the below list. - *

- * types - * =The type is taken from the MIB - * iINTEGER - * uINTEGER - * sSTRING - * xHEX STRING - * dDECIMAL STRING - * nNULLOBJ - * oOBJID - * tTIMETICKS - * aIPADDRESS - * bBITS - * - * If OPAQUE_SPECIAL_TYPES was defined while compiling the SNMP library, the following are also valid: - *

- * types - * Uunsigned int64 - * Isigned int64 - * Ffloat - * Ddouble - * - * Most of these will use the obvious corresponding ASN.1 type. 's', 'x', 'd' and 'b' are all different ways of specifying an OCTET STRING value, and - * the 'u' unsigned type is also used for handling Gauge32 values. - *

- * If the MIB-Files are loaded by into the MIB Tree with "snmp_read_mib" or by specifying it in the libsnmp config, '=' may be used as - * the type parameter for all object ids as the type can then be automatically read from the MIB. - *

- * Note that there are two ways to set a variable of the type BITS like e.g. - * "SYNTAX BITS {telnet(0), ftp(1), http(2), icmp(3), snmp(4), ssh(5), https(6)}": - *

- * Using type "b" and a list of bit numbers. This method is not recommended since GET query for the same OID would return e.g. 0xF8. - * Using type "x" and a hex number but without(!) the usual "0x" prefix. - * See examples section for more details. - *

- * @param mixed $value

- * The new value. - *

- * @param int $timeout [optional]

- * The number of microseconds until the first timeout. - *

- * @param int $retries [optional]

- * The number of times to retry if timeouts occur. - *

- * @return bool TRUE on success or FALSE on failure. - *

- *

- * If the SNMP host rejects the data type, an E_WARNING message like "Warning: Error in packet. Reason: (badValue) The value given has the wrong type or length." is shown. - * If an unknown or invalid OID is specified the warning probably reads "Could not add variable". - */ -function snmpset ($host, $community, $object_id, $type, $value, $timeout = 1000000, $retries = 5) {} - -/** - * (PHP 4, PHP 5)
- * Fetches the current value of the UCD library's quick_print setting - * @link http://php.net/manual/en/function.snmp-get-quick-print.php - * @param $d - * @return bool TRUE if quick_print is on, FALSE otherwise. - */ -function snmp_get_quick_print ($d) {} - -/** - * (PHP 4, PHP 5)
- * Set the value of quick_print within the UCD SNMP library - * @link http://php.net/manual/en/function.snmp-set-quick-print.php - * @param bool $quick_print - * @return bool No value is returned. - */ -function snmp_set_quick_print ($quick_print) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Return all values that are enums with their enum value instead of the raw integer - * @link http://php.net/manual/en/function.snmp-set-enum-print.php - * @param int $enum_print

- * As the value is interpreted as boolean by the Net-SNMP library, it can only be "0" or "1". - *

- * @return bool - */ -function snmp_set_enum_print ($enum_print) {} - -/** - * (PHP 5 >= 5.2.0)
- * Set the OID output format - * @link http://php.net/manual/en/function.snmp-set-oid-output-format.php - * @param int $oid_format [optional] - * OID .1.3.6.1.2.1.1.3.0 representation for various oid_format values - * - * - *
SNMP_OID_OUTPUT_FULL.iso.org.dod.internet.mgmt.mib-2.system.sysUpTime.sysUpTimeInstance
SNMP_OID_OUTPUT_NUMERIC.1.3.6.1.2.1.1.3.0
- *

Begining from PHP 5.4.0 four additional constants available: - * - * - * - * - * - *
SNMP_OID_OUTPUT_MODULEDISMAN-EVENT-MIB::sysUpTimeInstance
SNMP_OID_OUTPUT_SUFFIXsysUpTimeInstance
SNMP_OID_OUTPUT_UCDsystem.sysUpTime.sysUpTimeInstance
SNMP_OID_OUTPUT_NONEUndefined
- *

- * @return bool No value is returned. - */ -function snmp_set_oid_output_format ($oid_format = 'SNMP_OID_OUTPUT_MODULE') {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Return all objects including their respective object id within the specified one - * @link http://php.net/manual/en/function.snmp-set-oid-numeric-print.php - * @param int $oid_format - * @return void - */ -function snmp_set_oid_numeric_print ($oid_format) {} - -/** - * (PHP 5 >= 5.2.0)
- * Fetch an SNMP object - * @link http://php.net/manual/en/function.snmp2-get.php - * @param string $host

- * The SNMP agent. - *

- * @param string $community

- * The read community. - *

- * @param string $object_id

- * The SNMP object. - *

- * @param string $timeout [optional]

- * The number of microseconds until the first timeout. - *

- * @param string $retries [optional]

- * The number of times to retry if timeouts occur. - *

- * @return string SNMP object value on success or FALSE on error. - */ -function snmp2_get ($host, $community, $object_id, $timeout = 1000000, $retries = 5) {} - -/** - * (PHP >= 5.2.0)
- * Fetch the SNMP object which follows the given object id - * @link http://php.net/manual/en/function.snmp2-getnext.php - * @param string $host

- * The hostname of the SNMP agent (server). - *

- * @param string $community

- * The read community. - *

- * @param string $object_id

- * The SNMP object id which precedes the wanted one. - *

- * @param string $timeout [optional]

- * The number of microseconds until the first timeout. - *

- * @param string $retries [optional]

- * The number of times to retry if timeouts occur. - *

- * @return string SNMP object value on success or FALSE on error. - * In case of an error, an E_WARNING message is shown. - */ -function snmp2_getnext ($host, $community, $object_id, $timeout = 1000000, $retries = 5) {} - -/** - * (PHP >= 5.2.0)
- * Fetch all the SNMP objects from an agent - * @link http://php.net/manual/en/function.snmp2-walk.php - * @param string $host

- * The SNMP agent (server). - *

- * @param string $community

- * The read community. - *

- * @param string $object_id

- * If NULL, object_id is taken as the root of - * the SNMP objects tree and all objects under that tree are returned as - * an array. - *

- *

- * If object_id is specified, all the SNMP objects - * below that object_id are returned. - *

- * @param string $timeout [optional]

- * The number of microseconds until the first timeout. - *

- * @param string $retries [optional]

- * The number of times to retry if timeouts occur. - *

- * @return array an array of SNMP object values starting from the - * object_id as root or FALSE on error. - */ -function snmp2_walk ($host, $community, $object_id, $timeout = 1000000, $retries = 5) {} - -/** - * (PHP >= 5.2.0)
- * Return all objects including their respective object ID within the specified one - * @link http://php.net/manual/en/function.snmp2-real-walk.php - * @param string $host

- * The hostname of the SNMP agent (server). - *

- * @param string $community

- * The read community. - *

- * @param string $object_id

- * The SNMP object id which precedes the wanted one. - *

- * @param string $timeout [optional]

- * The number of microseconds until the first timeout. - *

- * @param string $retries [optional]

- * The number of times to retry if timeouts occur. - *

- * @return array an associative array of the SNMP object ids and their values on success or FALSE on error. - * In case of an error, an E_WARNING message is shown. - */ -function snmp2_real_walk ($host, $community, $object_id, $timeout = 1000000, $retries = 5) {} - -/** - * (PHP >= 5.2.0)
- * Set the value of an SNMP object - * @link http://php.net/manual/en/function.snmp2-set.php - * @param string $host

- * The hostname of the SNMP agent (server). - *

- * @param string $community

- * The write community. - *

- * @param string $object_id

- * The SNMP object id. - *

- * @param string $type The MIB defines the type of each object id. It has to be specified as a single character from the below list. - *

- * types - * =The type is taken from the MIB - * iINTEGER - * uINTEGER - * sSTRING - * xHEX STRING - * dDECIMAL STRING - * nNULLOBJ - * oOBJID - * tTIMETICKS - * aIPADDRESS - * bBITS - * - * If OPAQUE_SPECIAL_TYPES was defined while compiling the SNMP library, the following are also valid: - *

- * types - * Uunsigned int64 - * Isigned int64 - * Ffloat - * Ddouble - * - * Most of these will use the obvious corresponding ASN.1 type. 's', 'x', 'd' and 'b' are all different ways of specifying an OCTET STRING value, and - * the 'u' unsigned type is also used for handling Gauge32 values. - *

- * If the MIB-Files are loaded by into the MIB Tree with "snmp_read_mib" or by specifying it in the libsnmp config, '=' may be used as - * the type parameter for all object ids as the type can then be automatically read from the MIB. - *

- * Note that there are two ways to set a variable of the type BITS like e.g. - * "SYNTAX BITS {telnet(0), ftp(1), http(2), icmp(3), snmp(4), ssh(5), https(6)}": - *

- * Using type "b" and a list of bit numbers. This method is not recommended since GET query for the same OID would return e.g. 0xF8. - * Using type "x" and a hex number but without(!) the usual "0x" prefix. - * See examples section for more details. - *

- * @param string $value

- * The new value. - *

- * @param string $timeout [optional]

- * The number of microseconds until the first timeout. - *

- * @param string $retries [optional]

- * The number of times to retry if timeouts occur. - *

- * @return bool TRUE on success or FALSE on failure. - *

- *

- * If the SNMP host rejects the data type, an E_WARNING message like "Warning: Error in packet. Reason: (badValue) The value given has the wrong type or length." is shown. - * If an unknown or invalid OID is specified the warning probably reads "Could not add variable". - */ -function snmp2_set ($host, $community, $object_id, $type, $value, $timeout = 1000000, $retries = 5) {} - -/** - * (PHP 4, PHP 5)
- * Fetch an SNMP object - * @link http://php.net/manual/en/function.snmp3-get.php - * @param string $host

- * The hostname of the SNMP agent (server). - *

- * @param string $sec_name

- * the security name, usually some kind of username - *

- * @param string $sec_level

- * the security level (noAuthNoPriv|authNoPriv|authPriv) - *

- * @param string $auth_protocol

- * the authentication protocol (MD5 or SHA) - *

- * @param string $auth_passphrase

- * the authentication pass phrase - *

- * @param string $priv_protocol

- * the privacy protocol (DES or AES) - *

- * @param string $priv_passphrase

- * the privacy pass phrase - *

- * @param string $object_id

- * The SNMP object id. - *

- * @param string $timeout [optional]

- * The number of microseconds until the first timeout. - *

- * @param string $retries [optional]

- * The number of times to retry if timeouts occur. - *

- * @return string SNMP object value on success or FALSE on error. - */ -function snmp3_get ($host, $sec_name, $sec_level, $auth_protocol, $auth_passphrase, $priv_protocol, $priv_passphrase, $object_id, $timeout = 1000000, $retries = 5) {} - -/** - * (PHP 5)
- * Fetch the SNMP object which follows the given object id - * @link http://php.net/manual/en/function.snmp3-getnext.php - * @param string $host

- * The hostname of the - * SNMP agent (server). - *

- * @param string $sec_name

- * the security name, usually some kind of username - *

- * @param string $sec_level

- * the security level (noAuthNoPriv|authNoPriv|authPriv) - *

- * @param string $auth_protocol

- * the authentication protocol (MD5 or SHA) - *

- * @param string $auth_passphrase

- * the authentication pass phrase - *

- * @param string $priv_protocol

- * the privacy protocol (DES or AES) - *

- * @param string $priv_passphrase

- * the privacy pass phrase - *

- * @param string $object_id

- * The SNMP object id. - *

- * @param string $timeout [optional]

- * The number of microseconds until the first timeout. - *

- * @param string $retries [optional]

- * The number of times to retry if timeouts occur. - *

- * @return string SNMP object value on success or FALSE on error. - * In case of an error, an E_WARNING message is shown. - */ -function snmp3_getnext ($host, $sec_name, $sec_level, $auth_protocol, $auth_passphrase, $priv_protocol, $priv_passphrase, $object_id, $timeout = 1000000, $retries = 5) {} - -/** - * (PHP 4, PHP 5)
- * Fetch all the SNMP objects from an agent - * @link http://php.net/manual/en/function.snmp3-walk.php - * @param string $host

- * The hostname of the SNMP agent (server). - *

- * @param string $sec_name

- * the security name, usually some kind of username - *

- * @param string $sec_level

- * the security level (noAuthNoPriv|authNoPriv|authPriv) - *

- * @param string $auth_protocol

- * the authentication protocol (MD5 or SHA) - *

- * @param string $auth_passphrase

- * the authentication pass phrase - *

- * @param string $priv_protocol

- * the privacy protocol (DES or AES) - *

- * @param string $priv_passphrase

- * the privacy pass phrase - *

- * @param string $object_id

- * If NULL, object_id is taken as the root of - * the SNMP objects tree and all objects under that tree are returned as - * an array. - *

- *

- * If object_id is specified, all the SNMP objects - * below that object_id are returned. - *

- * @param string $timeout [optional]

- * The number of microseconds until the first timeout. - *

- * @param string $retries [optional]

- * The number of times to retry if timeouts occur. - *

- * @return array an array of SNMP object values starting from the - * object_id as root or FALSE on error. - */ -function snmp3_walk ($host, $sec_name, $sec_level, $auth_protocol, $auth_passphrase, $priv_protocol, $priv_passphrase, $object_id, $timeout = 1000000, $retries = 5) {} - -/** - * (PHP 4, PHP 5)
- * Return all objects including their respective object ID within the specified one - * @link http://php.net/manual/en/function.snmp3-real-walk.php - * @param string $host

- * The hostname of the - * SNMP agent (server). - *

- * @param string $sec_name

- * the security name, usually some kind of username - *

- * @param string $sec_level

- * the security level (noAuthNoPriv|authNoPriv|authPriv) - *

- * @param string $auth_protocol

- * the authentication protocol (MD5 or SHA) - *

- * @param string $auth_passphrase

- * the authentication pass phrase - *

- * @param string $priv_protocol

- * the privacy protocol (DES or AES) - *

- * @param string $priv_passphrase

- * the privacy pass phrase - *

- * @param string $object_id

- * The SNMP object id. - *

- * @param string $timeout [optional]

- * The number of microseconds until the first timeout. - *

- * @param string $retries [optional]

- * The number of times to retry if timeouts occur. - *

- * @return array an associative array of the - * SNMP object ids and their values on success or FALSE on error. - * In case of an error, an E_WARNING message is shown. - */ -function snmp3_real_walk ($host, $sec_name, $sec_level, $auth_protocol, $auth_passphrase, $priv_protocol, $priv_passphrase, $object_id, $timeout = null, $retries = null) {} - -/** - * (PHP 4, PHP 5)
- * Set the value of an SNMP object - * @link http://php.net/manual/en/function.snmp3-set.php - * @param string $host

- * The hostname of the SNMP agent (server). - *

- * @param string $sec_name

- * the security name, usually some kind of username - *

- * @param string $sec_level

- * the security level (noAuthNoPriv|authNoPriv|authPriv) - *

- * @param string $auth_protocol

- * the authentication protocol (MD5 or SHA) - *

- * @param string $auth_passphrase

- * the authentication pass phrase - *

- * @param string $priv_protocol

- * the privacy protocol (DES or AES) - *

- * @param string $priv_passphrase

- * the privacy pass phrase - *

- * @param string $object_id

- * The SNMP object id. - *

- * @param string $type The MIB defines the type of each object id. It has to be specified as a single character from the below list. - *

- * types - * =The type is taken from the MIB - * iINTEGER - * uINTEGER - * sSTRING - * xHEX STRING - * dDECIMAL STRING - * nNULLOBJ - * oOBJID - * tTIMETICKS - * aIPADDRESS - * bBITS - * - * If OPAQUE_SPECIAL_TYPES was defined while compiling the SNMP library, the following are also valid: - *

- * types - * Uunsigned int64 - * Isigned int64 - * Ffloat - * Ddouble - * - * Most of these will use the obvious corresponding ASN.1 type. 's', 'x', 'd' and 'b' are all different ways of specifying an OCTET STRING value, and - * the 'u' unsigned type is also used for handling Gauge32 values. - *

- * If the MIB-Files are loaded by into the MIB Tree with "snmp_read_mib" or by specifying it in the libsnmp config, '=' may be used as - * the type parameter for all object ids as the type can then be automatically read from the MIB. - *

- * Note that there are two ways to set a variable of the type BITS like e.g. - * "SYNTAX BITS {telnet(0), ftp(1), http(2), icmp(3), snmp(4), ssh(5), https(6)}": - *

- * Using type "b" and a list of bit numbers. This method is not recommended since GET query for the same OID would return e.g. 0xF8. - * Using type "x" and a hex number but without(!) the usual "0x" prefix. - * See examples section for more details. - *

- * @param string $value

- * The new value - *

- * @param int $timeout [optional]

- * The number of microseconds until the first timeout. - *

- * @param int $retries [optional]

- * The number of times to retry if timeouts occur. - *

- * @return bool TRUE on success or FALSE on failure. - *

- *

- * If the SNMP host rejects the data type, an E_WARNING message like "Warning: Error in packet. Reason: (badValue) The value given has the wrong type or length." is shown. - * If an unknown or invalid OID is specified the warning probably reads "Could not add variable". - */ -function snmp3_set ($host, $sec_name, $sec_level, $auth_protocol, $auth_passphrase, $priv_protocol, $priv_passphrase, $object_id, $type, $value, $timeout = 1000000, $retries = 5) {} - -/** - * (PHP 4 >= 4.3.3, PHP 5)
- * Specify the method how the SNMP values will be returned - * @link http://php.net/manual/en/function.snmp-set-valueretrieval.php - * @param int $method - * types - * - * - * - * - * - * - * - * - * - * - * - * - *
SNMP_VALUE_LIBRARYThe return values will be as returned by the Net-SNMP library.
SNMP_VALUE_PLAINThe return values will be the plain value without the SNMP type hint.
SNMP_VALUE_OBJECT - * The return values will be objects with the properties "value" and "type", where the latter - * is one of the SNMP_OCTET_STR, SNMP_COUNTER etc. constants. The - * way "value" is returned is based on which one of constants - * SNMP_VALUE_LIBRARY, SNMP_VALUE_PLAIN is set. - *
- * @return bool - */ -function snmp_set_valueretrieval ($method) {} - -/** - * (PHP 4 >= 4.3.3, PHP 5)
- * Return the method how the SNMP values will be returned - * @link http://php.net/manual/en/function.snmp-get-valueretrieval.php - * @return int OR-ed combitantion of constants ( SNMP_VALUE_LIBRARY or - * SNMP_VALUE_PLAIN ) with - * possible SNMP_VALUE_OBJECT set. - */ -function snmp_get_valueretrieval () {} - -/** - * (PHP 5)
- * Reads and parses a MIB file into the active MIB tree - * @link http://php.net/manual/en/function.snmp-read-mib.php - * @param string $filename

The filename of the MIB.

- * @return bool - */ -function snmp_read_mib ($filename) {} - - -/** - * As of 5.4.0 - * @link http://php.net/manual/en/snmp.constants.php - */ -define ('SNMP_OID_OUTPUT_SUFFIX', 1); - -/** - * As of 5.4.0 - * @link http://php.net/manual/en/snmp.constants.php - */ -define ('SNMP_OID_OUTPUT_MODULE', 2); - -/** - * As of 5.2.0 - * @link http://php.net/manual/en/snmp.constants.php - */ -define ('SNMP_OID_OUTPUT_FULL', 3); - -/** - * As of 5.2.0 - * @link http://php.net/manual/en/snmp.constants.php - */ -define ('SNMP_OID_OUTPUT_NUMERIC', 4); - -/** - * As of 5.4.0 - * @link http://php.net/manual/en/snmp.constants.php - */ -define ('SNMP_OID_OUTPUT_UCD', 5); - -/** - * As of 5.4.0 - * @link http://php.net/manual/en/snmp.constants.php - */ -define ('SNMP_OID_OUTPUT_NONE', 6); -define ('SNMP_VALUE_LIBRARY', 0); -define ('SNMP_VALUE_PLAIN', 1); -define ('SNMP_VALUE_OBJECT', 2); -define ('SNMP_BIT_STR', 3); -define ('SNMP_OCTET_STR', 4); -define ('SNMP_OPAQUE', 68); -define ('SNMP_NULL', 5); -define ('SNMP_OBJECT_ID', 6); -define ('SNMP_IPADDRESS', 64); -define ('SNMP_COUNTER', 66); -define ('SNMP_UNSIGNED', 66); -define ('SNMP_TIMETICKS', 67); -define ('SNMP_UINTEGER', 71); -define ('SNMP_INTEGER', 2); -define ('SNMP_COUNTER64', 70); - -// End of snmp v.0.1 -?> diff --git a/phpruntime/soap.php b/phpruntime/soap.php deleted file mode 100644 index c5fa067..0000000 --- a/phpruntime/soap.php +++ /dev/null @@ -1,783 +0,0 @@ - - * SoapClient constructor - * @link http://php.net/manual/en/soapclient.soapclient.php - * @param mixed $wsdl

- * URI of the WSDL file or NULL if working in - * non-WSDL mode. - *

- *

- * During development, WSDL caching may be disabled by the - * use of the soap.wsdl_cache_ttl php.ini setting - * otherwise changes made to the WSDL file will have no effect until - * soap.wsdl_cache_ttl is expired. - *

- * @param array $options [optional]

- * An array of options. If working in WSDL mode, this parameter is optional. - * If working in non-WSDL mode, the location and - * uri options must be set, where location - * is the URL of the SOAP server to send the request to, and uri - * is the target namespace of the SOAP service. - *

- *

- * The style and use options only work in - * non-WSDL mode. In WSDL mode, they come from the WSDL file. - *

- *

- * The soap_version option specifies whether to use SOAP - * 1.1 (default), or SOAP 1.2 client. - *

- *

- * For HTTP authentication, the login and - * password options can be used to supply credentials. - * For making an HTTP connection through - * a proxy server, the options proxy_host, - * proxy_port, proxy_login - * and proxy_password are also available. - * For HTTPS client certificate authentication use - * local_cert and passphrase options. An - * authentication may be supplied in the authentication - * option. The authentication method may be either - * SOAP_AUTHENTICATION_BASIC (default) or - * SOAP_AUTHENTICATION_DIGEST. - *

- *

- * The compression option allows to use compression - * of HTTP SOAP requests and responses. - *

- *

- * The encoding option defines internal character - * encoding. This option does not change the encoding of SOAP requests (it is - * always utf-8), but converts strings into it. - *

- *

- * The trace option enables tracing of request so faults - * can be backtraced. This defaults to FALSE - *

- *

- * The classmap option can be used to map some WSDL - * types to PHP classes. This option must be an array with WSDL types - * as keys and names of PHP classes as values. - *

- *

- * Setting the boolean trace option enables use of the - * methods - * SoapClient->__getLastRequest, - * SoapClient->__getLastRequestHeaders, - * SoapClient->__getLastResponse and - * SoapClient->__getLastResponseHeaders. - *

- *

- * The exceptions option is a boolean value defining whether - * soap errors throw exceptions of type - * SoapFault. - *

- *

- * The connection_timeout option defines a timeout in seconds - * for the connection to the SOAP service. This option does not define a timeout - * for services with slow responses. To limit the time to wait for calls to finish the - * default_socket_timeout setting - * is available. - *

- *

- * The typemap option is an array of type mappings. - * Type mapping is an array with keys type_name, - * type_ns (namespace URI), from_xml - * (callback accepting one string parameter) and to_xml - * (callback accepting one object parameter). - *

- *

- * The cache_wsdl option is one of - * WSDL_CACHE_NONE, - * WSDL_CACHE_DISK, - * WSDL_CACHE_MEMORY or - * WSDL_CACHE_BOTH. - *

- *

- * The user_agent option specifies string to use in - * User-Agent header. - *

- *

- * The stream_context option is a resource - * for context. - *

- *

- * The features option is a bitmask of - * SOAP_SINGLE_ELEMENT_ARRAYS, - * SOAP_USE_XSI_ARRAY_TYPE, - * SOAP_WAIT_ONE_WAY_CALLS. - *

- *

- * The keep_alive option is a boolean value defining whether - * to send the Connection: Keep-Alive header or - * Connection: close . - *

- */ - public function SoapClient ($wsdl, array $options = null) {} - - /** - * (PHP 5 >= 5.0.1)
- * Calls a SOAP function (deprecated) - * @link http://php.net/manual/en/soapclient.call.php - * @param string $function_name - * @param string $arguments - * @return mixed - */ - public function __call ($function_name, $arguments) {} - - /** - * (PHP 5 >= 5.0.1)
- * Calls a SOAP function - * @link http://php.net/manual/en/soapclient.soapcall.php - * @param string $function_name

- * The name of the SOAP function to call. - *

- * @param array $arguments

- * An array of the arguments to pass to the function. This can be either - * an ordered or an associative array. Note that most SOAP servers require - * parameter names to be provided, in which case this must be an - * associative array. - *

- * @param array $options [optional]

- * An associative array of options to pass to the client. - *

- *

- * The location option is the URL of the remote Web service. - *

- *

- * The uri option is the target namespace of the SOAP service. - *

- *

- * The soapaction option is the action to call. - *

- * @param mixed $input_headers [optional]

- * An array of headers to be sent along with the SOAP request. - *

- * @param array $output_headers [optional]

- * If supplied, this array will be filled with the headers from the SOAP response. - *

- * @return mixed SOAP functions may return one, or multiple values. If only one value is returned - * by the SOAP function, the return value of __soapCall will be - * a simple value (e.g. an integer, a string, etc). If multiple values are - * returned, __soapCall will return - * an associative array of named output parameters. - *

- *

- * On error, if the SoapClient object was constructed with the trace - * option set to FALSE, a SoapFault object will be returned. - */ - public function __soapCall ($function_name, array $arguments, array $options = null, $input_headers = null, array &$output_headers = null) {} - - /** - * (PHP 5 >= 5.0.1)
- * Returns last SOAP request - * @link http://php.net/manual/en/soapclient.getlastrequest.php - * @return string The last SOAP request, as an XML string. - */ - public function __getLastRequest () {} - - /** - * (PHP 5 >= 5.0.1)
- * Returns last SOAP response - * @link http://php.net/manual/en/soapclient.getlastresponse.php - * @return string The last SOAP response, as an XML string. - */ - public function __getLastResponse () {} - - /** - * (PHP 5 >= 5.0.1)
- * Returns the SOAP headers from the last request - * @link http://php.net/manual/en/soapclient.getlastrequestheaders.php - * @return string The last SOAP request headers. - */ - public function __getLastRequestHeaders () {} - - /** - * (PHP 5 >= 5.0.1)
- * Returns the SOAP headers from the last response - * @link http://php.net/manual/en/soapclient.getlastresponseheaders.php - * @return string The last SOAP response headers. - */ - public function __getLastResponseHeaders () {} - - /** - * (PHP 5 >= 5.0.1)
- * Returns list of available SOAP functions - * @link http://php.net/manual/en/soapclient.getfunctions.php - * @return array The array of SOAP function prototypes, detailing the return type, - * the function name and type-hinted paramaters. - */ - public function __getFunctions () {} - - /** - * (PHP 5 >= 5.0.1)
- * Returns a list of SOAP types - * @link http://php.net/manual/en/soapclient.gettypes.php - * @return array The array of SOAP types, detailing all structures and types. - */ - public function __getTypes () {} - - /** - * (PHP 5 >= 5.0.1)
- * Performs a SOAP request - * @link http://php.net/manual/en/soapclient.dorequest.php - * @param string $request

- * The XML SOAP request. - *

- * @param string $location

- * The URL to request. - *

- * @param string $action

- * The SOAP action. - *

- * @param int $version

- * The SOAP version. - *

- * @param int $one_way [optional]

- * If one_way is set to 1, this method returns nothing. - * Use this where a response is not expected. - *

- * @return string The XML SOAP response. - */ - public function __doRequest ($request, $location, $action, $version, $one_way = 0) {} - - /** - * (PHP 5 >= 5.0.4)
- * The __setCookie purpose - * @link http://php.net/manual/en/soapclient.setcookie.php - * @param string $name

- * The name of the cookie. - *

- * @param string $value [optional]

- * The value of the cookie. If not specified, the cookie will be deleted. - *

- * @return void No value is returned. - */ - public function __setCookie ($name, $value = null) {} - - /** - * (PHP 5 >= 5.0.1)
- * Sets the location of the Web service to use - * @link http://php.net/manual/en/soapclient.setlocation.php - * @param string $new_location [optional]

- * The new endpoint URL. - *

- * @return string The old endpoint URL. - */ - public function __setLocation ($new_location = null) {} - - /** - * (PHP 5 >= 5.0.5)
- * Sets SOAP headers for subsequent calls - * @link http://php.net/manual/en/soapclient.setsoapheaders.php - * @param mixed $soapheaders [optional]

- * The headers to be set. It could be SoapHeader - * object or array of SoapHeader objects. - * If not specified or set to NULL, the headers will be deleted. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function __setSoapHeaders ($soapheaders = null) {} - -} - -/** - * A class representing a variable or object for use with SOAP services. - * @link http://php.net/manual/en/class.soapvar.php - */ -class SoapVar { - - /** - * (PHP 5 >= 5.0.1)
- * SoapVar constructor - * @link http://php.net/manual/en/soapvar.soapvar.php - * @param mixed $data

- * The data to pass or return. - *

- * @param string $encoding

- * The encoding ID, one of the XSD_... constants. - *

- * @param string $type_name [optional]

- * The type name. - *

- * @param string $type_namespace [optional]

- * The type namespace. - *

- * @param string $node_name [optional]

- * The XML node name. - *

- * @param string $node_namespace [optional]

- * The XML node namespace. - *

- */ - public function SoapVar ($data, $encoding, $type_name = null, $type_namespace = null, $node_name = null, $node_namespace = null) {} - -} - -/** - * The SoapServer class provides a server for the SOAP 1.1 and SOAP 1.2 protocols. It can be used with or without a WSDL service description. - * @link http://php.net/manual/en/class.soapserver.php - */ -class SoapServer { - - /** - * (PHP 5 >= 5.0.1)
- * SoapServer constructor - * @link http://php.net/manual/en/soapserver.soapserver.php - * @param mixed $wsdl

- * To use the SoapServer in WSDL mode, pass the URI of a WSDL file. - * Otherwise, pass NULL and set the uri option to the - * target namespace for the server. - *

- * @param array $options [optional]

- * Allow setting a default SOAP version (soap_version), - * internal character encoding (encoding), - * and actor URI (actor). - *

- *

- * The classmap option can be used to map some WSDL - * types to PHP classes. This option must be an array with WSDL types - * as keys and names of PHP classes as values. - *

- *

- * The typemap option is an array of type mappings. - * Type mapping is an array with keys type_name, - * type_ns (namespace URI), from_xml - * (callback accepting one string parameter) and to_xml - * (callback accepting one object parameter). - *

- *

- * The cache_wsdl option is one of - * WSDL_CACHE_NONE, - * WSDL_CACHE_DISK, - * WSDL_CACHE_MEMORY or - * WSDL_CACHE_BOTH. - *

- *

- * There is also a features option which can be set to - * SOAP_WAIT_ONE_WAY_CALLS, - * SOAP_SINGLE_ELEMENT_ARRAYS, - * SOAP_USE_XSI_ARRAY_TYPE. - *

- */ - public function SoapServer ($wsdl, array $options = null) {} - - /** - * (PHP 5 >= 5.1.2)
- * Sets SoapServer persistence mode - * @link http://php.net/manual/en/soapserver.setpersistence.php - * @param int $mode

- * One of the SOAP_PERSISTENCE_XXX constants. - *

- *

- * SOAP_PERSISTENCE_REQUEST - SoapServer data does not persist between - * requests. This is the default behavior of any SoapServer - * object after setClass is called. - *

- *

- * SOAP_PERSISTENCE_SESSION - SoapServer data does persists between requests. - * This is accomplished by serializing the SoapServer class data into $_SESSION['_bogus_session_name'], - * because of this session_start must be called before this persistence mode is set. - *

- * @return void No value is returned. - */ - public function setPersistence ($mode) {} - - /** - * (PHP 5 >= 5.0.1)
- * Sets the class which handles SOAP requests - * @link http://php.net/manual/en/soapserver.setclass.php - * @param string $class_name

- * The name of the exported class. - *

- * @param mixed $args [optional]

- * These optional parameters will be passed to the default class constructor - * during object creation. - *

- * @param mixed $_ [optional] - * @return void No value is returned. - */ - public function setClass ($class_name, $args = null, $_ = null) {} - - /** - * (PHP 5 >= 5.2.0)
- * Sets the object which will be used to handle SOAP requests - * @link http://php.net/manual/en/soapserver.setobject.php - * @param object $object

- * The object to handle the requests. - *

- * @return void No value is returned. - */ - public function setObject ($object) {} - - /** - * (PHP 5 >= 5.0.1)
- * Adds one or more functions to handle SOAP requests - * @link http://php.net/manual/en/soapserver.addfunction.php - * @param mixed $functions

- * To export one function, pass the function name into this parameter as - * a string. - *

- *

- * To export several functions, pass an array of function names. - *

- *

- * To export all the functions, pass a special constant SOAP_FUNCTIONS_ALL. - *

- *

- * functions must receive all input arguments in the same - * order as defined in the WSDL file (They should not receive any output parameters - * as arguments) and return one or more values. To return several values they must - * return an array with named output parameters. - *

- * @return void No value is returned. - */ - public function addFunction ($functions) {} - - /** - * (PHP 5 >= 5.0.1)
- * Returns list of defined functions - * @link http://php.net/manual/en/soapserver.getfunctions.php - * @return array An array of the defined functions. - */ - public function getFunctions () {} - - /** - * (PHP 5 >= 5.0.1)
- * Handles a SOAP request - * @link http://php.net/manual/en/soapserver.handle.php - * @param string $soap_request [optional]

- * The SOAP request. If this argument is omitted, the request is assumed to be - * in the raw POST data of the HTTP request. - *

- * @return void No value is returned. - */ - public function handle ($soap_request = null) {} - - /** - * (PHP 5 >= 5.0.1)
- * Issue SoapServer fault indicating an error - * @link http://php.net/manual/en/soapserver.fault.php - * @param string $code

- * The error code to return - *

- * @param string $string

- * A brief description of the error - *

- * @param string $actor [optional]

- * A string identifying the actor that caused the fault. - *

- * @param string $details [optional]

- * More details of the fault - *

- * @param string $name [optional]

- * The name of the fault. This can be used to select a name from a WSDL file. - *

- * @return void No value is returned. - */ - public function fault ($code, $string, $actor = null, $details = null, $name = null) {} - - /** - * (PHP 5 >= 5.0.1)
- * Add a SOAP header to the response - * @link http://php.net/manual/en/soapserver.addsoapheader.php - * @param SoapHeader $object

- * The header to be returned. - *

- * @return void No value is returned. - */ - public function addSoapHeader (SoapHeader $object) {} - -} - -/** - * Represents a SOAP fault. - * @link http://php.net/manual/en/class.soapfault.php - */ -class SoapFault extends Exception { - protected $message; - protected $code; - protected $file; - protected $line; - - - /** - * (PHP 5 >= 5.0.1)
- * SoapFault constructor - * @link http://php.net/manual/en/soapfault.soapfault.php - * @param string $faultcode

- * The error code of the SoapFault. - *

- * @param string $faultstring

- * The error message of the SoapFault. - *

- * @param string $faultactor [optional]

- * A string identifying the actor that caused the error. - *

- * @param string $detail [optional]

- * More details about the cause of the error. - *

- * @param string $faultname [optional]

- * Can be used to select the proper fault encoding from WSDL. - *

- * @param string $headerfault [optional]

- * Can be used during SOAP header handling to report an error in the - * response header. - *

- */ - public function SoapFault ($faultcode, $faultstring, $faultactor = null, $detail = null, $faultname = null, $headerfault = null) {} - - /** - * (PHP 5 >= 5.0.1)
- * Obtain a string representation of a SoapFault - * @link http://php.net/manual/en/soapfault.tostring.php - * @return string A string describing the SoapFault. - */ - public function __toString () {} - - /** - * (PHP 5 >= 5.1.0)
- * Clone the exception - * @link http://php.net/manual/en/exception.clone.php - * @return void No value is returned. - */ - final private function __clone () {} - - /** - * (PHP 5 >= 5.1.0)
- * Construct the exception - * @link http://php.net/manual/en/exception.construct.php - * @param $message [optional] - * @param $code [optional] - * @param $previous [optional] - */ - public function __construct ($message, $code, $previous) {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception message - * @link http://php.net/manual/en/exception.getmessage.php - * @return string the Exception message as a string. - */ - final public function getMessage () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the Exception code - * @link http://php.net/manual/en/exception.getcode.php - * @return mixed the exception code as integer in - * Exception but possibly as other type in - * Exception descendants (for example as - * string in PDOException). - */ - final public function getCode () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the file in which the exception occurred - * @link http://php.net/manual/en/exception.getfile.php - * @return string the filename in which the exception was created. - */ - final public function getFile () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the line in which the exception occurred - * @link http://php.net/manual/en/exception.getline.php - * @return int the line number where the exception was created. - */ - final public function getLine () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace - * @link http://php.net/manual/en/exception.gettrace.php - * @return array the Exception stack trace as an array. - */ - final public function getTrace () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns previous Exception - * @link http://php.net/manual/en/exception.getprevious.php - * @return Exception the previous Exception if available - * or NULL otherwise. - */ - final public function getPrevious () {} - - /** - * (PHP 5 >= 5.1.0)
- * Gets the stack trace as a string - * @link http://php.net/manual/en/exception.gettraceasstring.php - * @return string the Exception stack trace as a string. - */ - final public function getTraceAsString () {} - -} - -/** - * Represents parameter to a SOAP call. - * @link http://php.net/manual/en/class.soapparam.php - */ -class SoapParam { - - /** - * (PHP 5 >= 5.0.1)
- * SoapParam constructor - * @link http://php.net/manual/en/soapparam.soapparam.php - * @param mixed $data

- * The data to pass or return. This parameter can be passed directly as PHP - * value, but in this case it will be named as paramN and - * the SOAP service may not understand it. - *

- * @param string $name

- * The parameter name. - *

- */ - public function SoapParam ($data, $name) {} - -} - -/** - * Represents a SOAP header. - * @link http://php.net/manual/en/class.soapheader.php - */ -class SoapHeader { - - /** - * (PHP 5 >= 5.0.1)
- * SoapHeader constructor - * @link http://php.net/manual/en/soapheader.soapheader.php - * @param string $namespace

- * The namespace of the SOAP header element. - *

- * @param string $name

- * The name of the SoapHeader object. - *

- * @param mixed $data [optional]

- * A SOAP header's content. It can be a PHP value or a - * SoapVar object. - *

- * @param bool $mustunderstand [optional] - * @param string $actor [optional]

- * Value of the actor attribute of the SOAP header - * element. - *

- */ - public function SoapHeader ($namespace, $name, $data = null, $mustunderstand = false, $actor = null) {} - -} - -/** - * (Unknown)
- * Set whether to use the SOAP error handler - * @link http://php.net/manual/en/function.use-soap-error-handler.php - * @param bool $handler [optional]

- * Set to TRUE to send error details to clients. - *

- * @return bool the original value. - */ -function use_soap_error_handler ($handler = true) {} - -/** - * (Unknown)
- * Checks if a SOAP call has failed - * @link http://php.net/manual/en/function.is-soap-fault.php - * @param mixed $object

- * The object to test. - *

- * @return bool This will return TRUE on error, and FALSE otherwise. - */ -function is_soap_fault ($object) {} - -define ('SOAP_1_1', 1); -define ('SOAP_1_2', 2); -define ('SOAP_PERSISTENCE_SESSION', 1); -define ('SOAP_PERSISTENCE_REQUEST', 2); -define ('SOAP_FUNCTIONS_ALL', 999); -define ('SOAP_ENCODED', 1); -define ('SOAP_LITERAL', 2); -define ('SOAP_RPC', 1); -define ('SOAP_DOCUMENT', 2); -define ('SOAP_ACTOR_NEXT', 1); -define ('SOAP_ACTOR_NONE', 2); -define ('SOAP_ACTOR_UNLIMATERECEIVER', 3); -define ('SOAP_COMPRESSION_ACCEPT', 32); -define ('SOAP_COMPRESSION_GZIP', 0); -define ('SOAP_COMPRESSION_DEFLATE', 16); -define ('SOAP_AUTHENTICATION_BASIC', 0); -define ('SOAP_AUTHENTICATION_DIGEST', 1); -define ('UNKNOWN_TYPE', 999998); -define ('XSD_STRING', 101); -define ('XSD_BOOLEAN', 102); -define ('XSD_DECIMAL', 103); -define ('XSD_FLOAT', 104); -define ('XSD_DOUBLE', 105); -define ('XSD_DURATION', 106); -define ('XSD_DATETIME', 107); -define ('XSD_TIME', 108); -define ('XSD_DATE', 109); -define ('XSD_GYEARMONTH', 110); -define ('XSD_GYEAR', 111); -define ('XSD_GMONTHDAY', 112); -define ('XSD_GDAY', 113); -define ('XSD_GMONTH', 114); -define ('XSD_HEXBINARY', 115); -define ('XSD_BASE64BINARY', 116); -define ('XSD_ANYURI', 117); -define ('XSD_QNAME', 118); -define ('XSD_NOTATION', 119); -define ('XSD_NORMALIZEDSTRING', 120); -define ('XSD_TOKEN', 121); -define ('XSD_LANGUAGE', 122); -define ('XSD_NMTOKEN', 123); -define ('XSD_NAME', 124); -define ('XSD_NCNAME', 125); -define ('XSD_ID', 126); -define ('XSD_IDREF', 127); -define ('XSD_IDREFS', 128); -define ('XSD_ENTITY', 129); -define ('XSD_ENTITIES', 130); -define ('XSD_INTEGER', 131); -define ('XSD_NONPOSITIVEINTEGER', 132); -define ('XSD_NEGATIVEINTEGER', 133); -define ('XSD_LONG', 134); -define ('XSD_INT', 135); -define ('XSD_SHORT', 136); -define ('XSD_BYTE', 137); -define ('XSD_NONNEGATIVEINTEGER', 138); -define ('XSD_UNSIGNEDLONG', 139); -define ('XSD_UNSIGNEDINT', 140); -define ('XSD_UNSIGNEDSHORT', 141); -define ('XSD_UNSIGNEDBYTE', 142); -define ('XSD_POSITIVEINTEGER', 143); -define ('XSD_NMTOKENS', 144); -define ('XSD_ANYTYPE', 145); -define ('XSD_ANYXML', 147); -define ('APACHE_MAP', 200); -define ('SOAP_ENC_OBJECT', 301); -define ('SOAP_ENC_ARRAY', 300); -define ('XSD_1999_TIMEINSTANT', 401); -define ('XSD_NAMESPACE', "http://www.w3.org/2001/XMLSchema"); -define ('XSD_1999_NAMESPACE', "http://www.w3.org/1999/XMLSchema"); -define ('SOAP_SINGLE_ELEMENT_ARRAYS', 1); -define ('SOAP_WAIT_ONE_WAY_CALLS', 2); -define ('SOAP_USE_XSI_ARRAY_TYPE', 4); -define ('WSDL_CACHE_NONE', 0); -define ('WSDL_CACHE_DISK', 1); -define ('WSDL_CACHE_MEMORY', 2); -define ('WSDL_CACHE_BOTH', 3); - -// End of soap v. -?> diff --git a/phpruntime/sockets.php b/phpruntime/sockets.php deleted file mode 100644 index 266b2ca..0000000 --- a/phpruntime/sockets.php +++ /dev/null @@ -1,1934 +0,0 @@ - - * Runs the select() system call on the given arrays of sockets with a specified timeout - * @link http://php.net/manual/en/function.socket-select.php - * @param array $read

- * The sockets listed in the read array will be - * watched to see if characters become available for reading (more - * precisely, to see if a read will not block - in particular, a socket - * resource is also ready on end-of-file, in which case a - * socket_read will return a zero length string). - *

- * @param array $write

- * The sockets listed in the write array will be - * watched to see if a write will not block. - *

- * @param array $except

- * The sockets listed in the except array will be - * watched for exceptions. - *

- * @param int $tv_sec

- * The tv_sec and tv_usec - * together form the timeout parameter. The - * timeout is an upper bound on the amount of time - * elapsed before socket_select return. - * tv_sec may be zero , causing - * socket_select to return immediately. This is useful - * for polling. If tv_sec is NULL (no timeout), - * socket_select can block indefinitely. - *

- * @param int $tv_usec [optional] - * @return int On success socket_select returns the number of - * socket resources contained in the modified arrays, which may be zero if - * the timeout expires before anything interesting happens. On error FALSE - * is returned. The error code can be retrieved with - * socket_last_error. - *

- *

- * Be sure to use the === operator when checking for an - * error. Since the socket_select may return 0 the - * comparison with == would evaluate to TRUE: - * Understanding socket_select's result - * - * $e = NULL; - * if (false === socket_select($r, $w, $e, 0)) { - * echo "socket_select() failed, reason: " . - * socket_strerror(socket_last_error()) . "\n"; - * } - * - */ -function socket_select (array &$read, array &$write, array &$except, $tv_sec, $tv_usec = 0) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Create a socket (endpoint for communication) - * @link http://php.net/manual/en/function.socket-create.php - * @param int $domain

- * The domain parameter specifies the protocol - * family to be used by the socket. - *

- * - * Available address/protocol families - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
DomainDescription
AF_INET - * IPv4 Internet based protocols. TCP and UDP are common protocols of - * this protocol family. - *
AF_INET6 - * IPv6 Internet based protocols. TCP and UDP are common protocols of - * this protocol family. - *
AF_UNIX - * Local communication protocol family. High efficiency and low - * overhead make it a great form of IPC (Interprocess Communication). - *
- * @param int $type

- * The type parameter selects the type of communication - * to be used by the socket. - *

- * - * Available socket types - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
TypeDescription
SOCK_STREAM - * Provides sequenced, reliable, full-duplex, connection-based byte streams. - * An out-of-band data transmission mechanism may be supported. - * The TCP protocol is based on this socket type. - *
SOCK_DGRAM - * Supports datagrams (connectionless, unreliable messages of a fixed maximum length). - * The UDP protocol is based on this socket type. - *
SOCK_SEQPACKET - * Provides a sequenced, reliable, two-way connection-based data transmission path for - * datagrams of fixed maximum length; a consumer is required to read an - * entire packet with each read call. - *
SOCK_RAW - * Provides raw network protocol access. This special type of socket - * can be used to manually construct any type of protocol. A common use - * for this socket type is to perform ICMP requests (like ping). - *
SOCK_RDM - * Provides a reliable datagram layer that does not guarantee ordering. - * This is most likely not implemented on your operating system. - *
- * @param int $protocol

- * The protocol parameter sets the specific - * protocol within the specified domain to be used - * when communicating on the returned socket. The proper value can be - * retrieved by name by using getprotobyname. If - * the desired protocol is TCP, or UDP the corresponding constants - * SOL_TCP, and SOL_UDP - * can also be used. - *

- * - * Common protocols - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
NameDescription
icmp - * The Internet Control Message Protocol is used primarily by gateways - * and hosts to report errors in datagram communication. The "ping" - * command (present in most modern operating systems) is an example - * application of ICMP. - *
udp - * The User Datagram Protocol is a connectionless, unreliable, - * protocol with fixed record lengths. Due to these aspects, UDP - * requires a minimum amount of protocol overhead. - *
tcp - * The Transmission Control Protocol is a reliable, connection based, - * stream oriented, full duplex protocol. TCP guarantees that all data packets - * will be received in the order in which they were sent. If any packet is somehow - * lost during communication, TCP will automatically retransmit the packet until - * the destination host acknowledges that packet. For reliability and performance - * reasons, the TCP implementation itself decides the appropriate octet boundaries - * of the underlying datagram communication layer. Therefore, TCP applications must - * allow for the possibility of partial record transmission. - *
- * @return resource socket_create returns a socket resource on success, - * or FALSE on error. The actual error code can be retrieved by calling - * socket_last_error. This error code may be passed to - * socket_strerror to get a textual explanation of the - * error. - */ -function socket_create ($domain, $type, $protocol) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Opens a socket on port to accept connections - * @link http://php.net/manual/en/function.socket-create-listen.php - * @param int $port

- * The port on which to listen on all interfaces. - *

- * @param int $backlog [optional]

- * The backlog parameter defines the maximum length - * the queue of pending connections may grow to. - * SOMAXCONN may be passed as - * backlog parameter, see - * socket_listen for more information. - *

- * @return resource socket_create_listen returns a new socket resource - * on success or FALSE on error. The error code can be retrieved with - * socket_last_error. This code may be passed to - * socket_strerror to get a textual explanation of the - * error. - */ -function socket_create_listen ($port, $backlog = 128) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Creates a pair of indistinguishable sockets and stores them in an array - * @link http://php.net/manual/en/function.socket-create-pair.php - * @param int $domain

- * The domain parameter specifies the protocol - * family to be used by the socket. See socket_create - * for the full list. - *

- * @param int $type

- * The type parameter selects the type of communication - * to be used by the socket. See socket_create for the - * full list. - *

- * @param int $protocol

- * The protocol parameter sets the specific - * protocol within the specified domain to be used - * when communicating on the returned socket. The proper value can be retrieved by - * name by using getprotobyname. If - * the desired protocol is TCP, or UDP the corresponding constants - * SOL_TCP, and SOL_UDP - * can also be used. - *

- *

- * See socket_create for the full list of supported - * protocols. - *

- * @param array $fd

- * Reference to an array in which the two socket resources will be inserted. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function socket_create_pair ($domain, $type, $protocol, array &$fd) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Accepts a connection on a socket - * @link http://php.net/manual/en/function.socket-accept.php - * @param resource $socket

- * A valid socket resource created with socket_create. - *

- * @return resource a new socket resource on success, or FALSE on error. The actual - * error code can be retrieved by calling - * socket_last_error. This error code may be passed to - * socket_strerror to get a textual explanation of the - * error. - */ -function socket_accept ($socket) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Sets nonblocking mode for file descriptor fd - * @link http://php.net/manual/en/function.socket-set-nonblock.php - * @param resource $socket

- * A valid socket resource created with socket_create - * or socket_accept. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function socket_set_nonblock ($socket) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Sets blocking mode on a socket resource - * @link http://php.net/manual/en/function.socket-set-block.php - * @param resource $socket

- * A valid socket resource created with socket_create - * or socket_accept. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function socket_set_block ($socket) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Listens for a connection on a socket - * @link http://php.net/manual/en/function.socket-listen.php - * @param resource $socket

- * A valid socket resource created with socket_create. - *

- * @param int $backlog [optional]

- * A maximum of backlog incoming connections will be - * queued for processing. If a connection request arrives with the queue - * full the client may receive an error with an indication of - * ECONNREFUSED, or, if the underlying protocol supports - * retransmission, the request may be ignored so that retries may succeed. - *

- *

- * The maximum number passed to the backlog - * parameter highly depends on the underlying platform. On Linux, it is - * silently truncated to SOMAXCONN. On win32, if - * passed SOMAXCONN, the underlying service provider - * responsible for the socket will set the backlog to a maximum - * reasonable value. There is no standard provision to - * find out the actual backlog value on this platform. - *

- * @return bool TRUE on success or FALSE on failure. The error code can be retrieved with - * socket_last_error. This code may be passed to - * socket_strerror to get a textual explanation of the - * error. - */ -function socket_listen ($socket, $backlog = 0) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Closes a socket resource - * @link http://php.net/manual/en/function.socket-close.php - * @param resource $socket

- * A valid socket resource created with socket_create - * or socket_accept. - *

- * @return void No value is returned. - */ -function socket_close ($socket) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Write to a socket - * @link http://php.net/manual/en/function.socket-write.php - * @param resource $socket - * @param string $buffer

- * The buffer to be written. - *

- * @param int $length [optional]

- * The optional parameter length can specify an - * alternate length of bytes written to the socket. If this length is - * greater then the buffer length, it is silently truncated to the length - * of the buffer. - *

- * @return int the number of bytes successfully written to the socket or FALSE on failure. - * The error code can be retrieved with - * socket_last_error. This code may be passed to - * socket_strerror to get a textual explanation of the - * error. - *

- *

- * It is perfectly valid for socket_write to - * return zero which means no bytes have been written. Be sure to use the - * === operator to check for FALSE in case of an - * error. - */ -function socket_write ($socket, $buffer, $length = 0) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Reads a maximum of length bytes from a socket - * @link http://php.net/manual/en/function.socket-read.php - * @param resource $socket

- * A valid socket resource created with socket_create - * or socket_accept. - *

- * @param int $length

- * The maximum number of bytes read is specified by the - * length parameter. Otherwise you can use - * \r, \n, - * or \0 to end reading (depending on the type - * parameter, see below). - *

- * @param int $type [optional]

- * Optional type parameter is a named constant: - * PHP_BINARY_READ (Default) - use the system - * recv() function. Safe for reading binary data. - * @return string socket_read returns the data as a string on success, - * or FALSE on error (including if the remote host has closed the - * connection). The error code can be retrieved with - * socket_last_error. This code may be passed to - * socket_strerror to get a textual representation of - * the error. - *

- *

- * socket_read returns a zero length string ("") - * when there is no more data to read. - */ -function socket_read ($socket, $length, $type = 'PHP_BINARY_READ') {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Queries the local side of the given socket which may either result in host/port or in a Unix filesystem path, dependent on its type - * @link http://php.net/manual/en/function.socket-getsockname.php - * @param resource $socket

- * A valid socket resource created with socket_create - * or socket_accept. - *

- * @param string $addr

- * If the given socket is of type AF_INET - * or AF_INET6, socket_getsockname - * will return the local IP address in appropriate notation (e.g. - * 127.0.0.1 or fe80::1) in the - * address parameter and, if the optional - * port parameter is present, also the associated port. - *

- *

- * If the given socket is of type AF_UNIX, - * socket_getsockname will return the Unix filesystem - * path (e.g. /var/run/daemon.sock) in the - * address parameter. - *

- * @param int $port [optional]

- * If provided, this will hold the associated port. - *

- * @return bool TRUE on success or FALSE on failure. socket_getsockname may also return - * FALSE if the socket type is not any of AF_INET, - * AF_INET6, or AF_UNIX, in which - * case the last socket error code is not updated. - */ -function socket_getsockname ($socket, &$addr, &$port = null) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Queries the remote side of the given socket which may either result in host/port or in a Unix filesystem path, dependent on its type - * @link http://php.net/manual/en/function.socket-getpeername.php - * @param resource $socket

- * A valid socket resource created with socket_create - * or socket_accept. - *

- * @param string $address

- * If the given socket is of type AF_INET or - * AF_INET6, socket_getpeername - * will return the peers (remote) IP address in - * appropriate notation (e.g. 127.0.0.1 or - * fe80::1) in the address - * parameter and, if the optional port parameter is - * present, also the associated port. - *

- *

- * If the given socket is of type AF_UNIX, - * socket_getpeername will return the Unix filesystem - * path (e.g. /var/run/daemon.sock) in the - * address parameter. - *

- * @param int $port [optional]

- * If given, this will hold the port associated to - * address. - *

- * @return bool TRUE on success or FALSE on failure. socket_getpeername may also return - * FALSE if the socket type is not any of AF_INET, - * AF_INET6, or AF_UNIX, in which - * case the last socket error code is not updated. - */ -function socket_getpeername ($socket, &$address, &$port = null) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Initiates a connection on a socket - * @link http://php.net/manual/en/function.socket-connect.php - * @param resource $socket - * @param string $address

- * The address parameter is either an IPv4 address - * in dotted-quad notation (e.g. 127.0.0.1) if - * socket is AF_INET, a valid - * IPv6 address (e.g. ::1) if IPv6 support is enabled and - * socket is AF_INET6 - * or the pathname of a Unix domain socket, if the socket family is - * AF_UNIX. - *

- * @param int $port [optional]

- * The port parameter is only used and is mandatory - * when connecting to an AF_INET or an - * AF_INET6 socket, and designates - * the port on the remote host to which a connection should be made. - *

- * @return bool TRUE on success or FALSE on failure. The error code can be retrieved with - * socket_last_error. This code may be passed to - * socket_strerror to get a textual explanation of the - * error. - *

- *

- * If the socket is non-blocking then this function returns FALSE with an - * error Operation now in progress. - */ -function socket_connect ($socket, $address, $port = 0) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Return a string describing a socket error - * @link http://php.net/manual/en/function.socket-strerror.php - * @param int $errno

- * A valid socket error number, likely produced by - * socket_last_error. - *

- * @return string the error message associated with the errno - * parameter. - */ -function socket_strerror ($errno) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Binds a name to a socket - * @link http://php.net/manual/en/function.socket-bind.php - * @param resource $socket

- * A valid socket resource created with socket_create. - *

- * @param string $address

- * If the socket is of the AF_INET family, the - * address is an IP in dotted-quad notation - * (e.g. 127.0.0.1). - *

- *

- * If the socket is of the AF_UNIX family, the - * address is the path of a - * Unix-domain socket (e.g. /tmp/my.sock). - *

- * @param int $port [optional]

- * The port parameter is only used when - * binding an AF_INET socket, and designates - * the port on which to listen for connections. - *

- * @return bool TRUE on success or FALSE on failure. - *

- *

- * The error code can be retrieved with socket_last_error. - * This code may be passed to socket_strerror to get a - * textual explanation of the error. - */ -function socket_bind ($socket, $address, $port = 0) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Receives data from a connected socket - * @link http://php.net/manual/en/function.socket-recv.php - * @param resource $socket

- * The socket must be a socket resource previously - * created by socket_create(). - *

- * @param string $buf

- * The data received will be fetched to the variable specified with - * buf. If an error occurs, if the - * connection is reset, or if no data is - * available, buf will be set to NULL. - *

- * @param int $len

- * Up to len bytes will be fetched from remote host. - *

- * @param int $flags

- * The value of flags can be any combination of - * the following flags, joined with the binary OR (|) - * operator. - *

- * - * Possible values for flags - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
FlagDescription
MSG_OOB - * Process out-of-band data. - *
MSG_PEEK - * Receive data from the beginning of the receive queue without - * removing it from the queue. - *
MSG_WAITALL - * Block until at least len are received. - * However, if a signal is caught or the remote host disconnects, the - * function may return less data. - *
MSG_DONTWAIT - * With this flag set, the function returns even if it would normally - * have blocked. - *
- * @return int socket_recv returns the number of bytes received, - * or FALSE if there was an error. The actual error code can be retrieved by - * calling socket_last_error. This error code may be - * passed to socket_strerror to get a textual explanation - * of the error. - */ -function socket_recv ($socket, &$buf, $len, $flags) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Sends data to a connected socket - * @link http://php.net/manual/en/function.socket-send.php - * @param resource $socket

- * A valid socket resource created with socket_create - * or socket_accept. - *

- * @param string $buf

- * A buffer containing the data that will be sent to the remote host. - *

- * @param int $len

- * The number of bytes that will be sent to the remote host from - * buf. - *

- * @param int $flags

- * The value of flags can be any combination of - * the following flags, joined with the binary OR (|) - * operator. - * - * Possible values for flags - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
MSG_OOB - * Send OOB (out-of-band) data. - *
MSG_EOR - * Indicate a record mark. The sent data completes the record. - *
MSG_EOF - * Close the sender side of the socket and include an appropriate - * notification of this at the end of the sent data. The sent data - * completes the transaction. - *
MSG_DONTROUTE - * Bypass routing, use direct interface. - *
- *

- * @return int socket_send returns the number of bytes sent, or FALSE on error. - */ -function socket_send ($socket, $buf, $len, $flags) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Receives data from a socket whether or not it is connection-oriented - * @link http://php.net/manual/en/function.socket-recvfrom.php - * @param resource $socket

- * The socket must be a socket resource previously - * created by socket_create(). - *

- * @param string $buf

- * The data received will be fetched to the variable specified with - * buf. - *

- * @param int $len

- * Up to len bytes will be fetched from remote host. - *

- * @param int $flags

- * The value of flags can be any combination of - * the following flags, joined with the binary OR (|) - * operator. - *

- * - * Possible values for flags - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
FlagDescription
MSG_OOB - * Process out-of-band data. - *
MSG_PEEK - * Receive data from the beginning of the receive queue without - * removing it from the queue. - *
MSG_WAITALL - * Block until at least len are received. - * However, if a signal is caught or the remote host disconnects, the - * function may return less data. - *
MSG_DONTWAIT - * With this flag set, the function returns even if it would normally - * have blocked. - *
- * @param string $name

- * If the socket is of the type AF_UNIX type, - * name is the path to the file. Else, for - * unconnected sockets, name is the IP address of, - * the remote host, or NULL if the socket is connection-oriented. - *

- * @param int $port [optional]

- * This argument only applies to AF_INET and - * AF_INET6 sockets, and specifies the remote port - * from which the data is received. If the socket is connection-oriented, - * port will be NULL. - *

- * @return int socket_recvfrom returns the number of bytes received, - * or FALSE if there was an error. The actual error code can be retrieved by - * calling socket_last_error. This error code may be - * passed to socket_strerror to get a textual explanation - * of the error. - */ -function socket_recvfrom ($socket, &$buf, $len, $flags, &$name, &$port = null) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Sends a message to a socket, whether it is connected or not - * @link http://php.net/manual/en/function.socket-sendto.php - * @param resource $socket

- * A valid socket resource created using socket_create. - *

- * @param string $buf

- * The sent data will be taken from buffer buf. - *

- * @param int $len

- * len bytes from buf will be - * sent. - *

- * @param int $flags

- * The value of flags can be any combination of - * the following flags, joined with the binary OR (|) - * operator. - * - * Possible values for flags - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
MSG_OOB - * Send OOB (out-of-band) data. - *
MSG_EOR - * Indicate a record mark. The sent data completes the record. - *
MSG_EOF - * Close the sender side of the socket and include an appropriate - * notification of this at the end of the sent data. The sent data - * completes the transaction. - *
MSG_DONTROUTE - * Bypass routing, use direct interface. - *
- *

- * @param string $addr

- * IP address of the remote host. - *

- * @param int $port [optional]

- * port is the remote port number at which the data - * will be sent. - *

- * @return int socket_sendto returns the number of bytes sent to the - * remote host, or FALSE if an error occurred. - */ -function socket_sendto ($socket, $buf, $len, $flags, $addr, $port = 0) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Gets socket options for the socket - * @link http://php.net/manual/en/function.socket-get-option.php - * @param resource $socket

- * A valid socket resource created with socket_create - * or socket_accept. - *

- * @param int $level

- * The level parameter specifies the protocol - * level at which the option resides. For example, to retrieve options at - * the socket level, a level parameter of - * SOL_SOCKET would be used. Other levels, such as - * TCP, can be used by - * specifying the protocol number of that level. Protocol numbers can be - * found by using the getprotobyname function. - *

- * @param int $optname - * Available Socket Options - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
OptionDescriptionType
SO_DEBUG - * Reports whether debugging information is being recorded. - * - * int - *
SO_BROADCAST - * Reports whether transmission of broadcast messages is supported. - * - * int - *
SO_REUSEADDR - * Reports whether local addresses can be reused. - * - * int - *
SO_KEEPALIVE - * Reports whether connections are kept active with periodic transmission - * of messages. If the connected socket fails to respond to these messages, - * the connection is broken and processes writing to that socket are notified - * with a SIGPIPE signal. - * - * int - *
SO_LINGER - *

- * Reports whether the socket lingers on - * socket_close if data is present. By default, - * when the socket is closed, it attempts to send all unsent data. - * In the case of a connection-oriented socket, - * socket_close will wait for its peer to - * acknowledge the data. - *

- *

- * If l_onoff is non-zero and - * l_linger is zero, all the - * unsent data will be discarded and RST (reset) is sent to the - * peer in the case of a connection-oriented socket. - *

- *

- * On the other hand, if l_onoff is - * non-zero and l_linger is non-zero, - * socket_close will block until all the data - * is sent or the time specified in l_linger - * elapses. If the socket is non-blocking, - * socket_close will fail and return an error. - *

- *
- * array. The array will contain two keys: - * l_onoff and - * l_linger. - *
SO_OOBINLINE - * Reports whether the socket leaves out-of-band data inline. - * - * int - *
SO_SNDBUF - * Reports the size of the send buffer. - * - * int - *
SO_RCVBUF - * Reports the size of the receive buffer. - * - * int - *
SO_ERROR - * Reports information about error status and clears it. - * - * int (cannot be set by socket_set_option) - *
SO_TYPE - * Reports the socket type (e.g. - * SOCK_STREAM). - * - * int (cannot be set by socket_set_option) - *
SO_DONTROUTE - * Reports whether outgoing messages bypass the standard routing facilities. - * - * int - *
SO_RCVLOWAT - * Reports the minimum number of bytes to process for socket - * input operations. - * - * int - *
SO_RCVTIMEO - * Reports the timeout value for input operations. - * - * array. The array will contain two keys: - * sec which is the seconds part on the timeout - * value and usec which is the microsecond part - * of the timeout value. - *
SO_SNDTIMEO - * Reports the timeout value specifying the amount of time that an output - * function blocks because flow control prevents data from being sent. - * - * array. The array will contain two keys: - * sec which is the seconds part on the timeout - * value and usec which is the microsecond part - * of the timeout value. - *
SO_SNDLOWAT - * Reports the minimum number of bytes to process for socket output operations. - * - * int - *
TCP_NODELAY - * Reports whether the Nagle TCP algorithm is disabled. - * - * int - *
MCAST_JOIN_GROUP - * Joins a multicast group. (added in PHP 5.4) - * - * array with keys "group", specifying - * a string with an IPv4 or IPv6 multicast address and - * "interface", specifying either an interface - * number (type int) or a string with - * the interface name, like "eth0". - * 0 can be specified to indicate the interface - * should be selected using routing rules. (can only be used in - * socket_set_option) - *
MCAST_LEAVE_GROUP - * Leaves a multicast group. (added in PHP 5.4) - * - * array. See MCAST_JOIN_GROUP for - * more information. (can only be used in - * socket_set_option) - *
MCAST_BLOCK_SOURCE - * Blocks packets arriving from a specific source to a specific - * multicast group, which must have been previously joined. - * (added in PHP 5.4) - * - * array with the same keys as - * MCAST_JOIN_GROUP, plus one extra key, - * source, which maps to a string - * specifying an IPv4 or IPv6 address of the source to be blocked. - * (can only be used in socket_set_option) - *
MCAST_UNBLOCK_SOURCE - * Unblocks (start receiving again) packets arriving from a specific - * source address to a specific multicast group, which must have been - * previously joined. (added in PHP 5.4) - * - * array with the same format as - * MCAST_BLOCK_SOURCE. - * (can only be used in socket_set_option) - *
MCAST_JOIN_SOURCE_GROUP - * Receive packets destined to a specific multicast group whose source - * address matches a specific value. (added in PHP 5.4) - * - * array with the same format as - * MCAST_BLOCK_SOURCE. - * (can only be used in socket_set_option) - *
MCAST_LEAVE_SOURCE_GROUP - * Stop receiving packets destined to a specific multicast group whose - * soure address matches a specific value. (added in PHP 5.4) - * - * array with the same format as - * MCAST_BLOCK_SOURCE. - * (can only be used in socket_set_option) - *
IP_MULTICAST_IF - * The outgoing interface for IPv4 multicast packets. - * (added in PHP 5.4) - * - * Either int specifying the interface number or a - * string with an interface name, like - * eth0. The value 0 can be used to - * indicate the routing table is to used in the interface selection. - * The function socket_get_option returns an - * interface index. - * Note that, unlike the C API, this option does NOT take an IP - * address. This eliminates the interface difference between - * IP_MULTICAST_IF and - * IPV6_MULTICAST_IF. - *
IPV6_MULTICAST_IF - * The outgoing interface for IPv6 multicast packets. - * (added in PHP 5.4) - * - * The same as IP_MULTICAST_IF. - *
IP_MULTICAST_LOOP - * The multicast loopback policy for IPv4 packets, which - * determines whether multicast packets sent by this socket also reach - * receivers in the same host that have joined the same multicast group - * on the outgoing interface used by this socket. This is the case by - * default. - * (added in PHP 5.4) - * - * int (either 0 or - * 1). For socket_set_option - * any value will be accepted and will be converted to a boolean - * following the usual PHP rules. - *
IPV6_MULTICAST_LOOP - * Analogous to IP_MULTICAST_LOOP, but for IPv6. - * (added in PHP 5.4) - * - * int. See IP_MULTICAST_LOOP. - *
IP_MULTICAST_TTL - * The time-to-live of outgoing IPv4 multicast packets. This should be - * a value between 0 (don't leave the interface) and 255. The default - * value is 1 (only the local network is reached). - * (added in PHP 5.4) - * - * int between 0 and 255. - *
IPV6_MULTICAST_HOPS - * Analogous to IP_MULTICAST_TTL, but for IPv6 - * packets. The value -1 is also accepted, meaning the route default - * should be used. - * (added in PHP 5.4) - * - * int between -1 and 255. - *
- * @return mixed the value of the given option, or FALSE on errors. - */ -function socket_get_option ($socket, $level, $optname) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Sets socket options for the socket - * @link http://php.net/manual/en/function.socket-set-option.php - * @param resource $socket

- * A valid socket resource created with socket_create - * or socket_accept. - *

- * @param int $level

- * The level parameter specifies the protocol - * level at which the option resides. For example, to retrieve options at - * the socket level, a level parameter of - * SOL_SOCKET would be used. Other levels, such as - * TCP, can be used by specifying the protocol number of that level. - * Protocol numbers can be found by using the - * getprotobyname function. - *

- * @param int $optname

- * The available socket options are the same as those for the - * socket_get_option function. - *

- * @param mixed $optval

- * The option value. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function socket_set_option ($socket, $level, $optname, $optval) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Shuts down a socket for receiving, sending, or both - * @link http://php.net/manual/en/function.socket-shutdown.php - * @param resource $socket

- * A valid socket resource created with socket_create. - *

- * @param int $how [optional]

- * The value of how can be one of the following: - * - * possible values for how - * - * - * - * - * - * - * - * - * - * - * - * - *
0 - * Shutdown socket reading - *
1 - * Shutdown socket writing - *
2 - * Shutdown socket reading and writing - *
- *

- * @return bool TRUE on success or FALSE on failure. - */ -function socket_shutdown ($socket, $how = 2) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Returns the last error on the socket - * @link http://php.net/manual/en/function.socket-last-error.php - * @param resource $socket [optional]

- * A valid socket resource created with socket_create. - *

- * @return int This function returns a socket error code. - */ -function socket_last_error ($socket = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Clears the error on the socket or the last error code - * @link http://php.net/manual/en/function.socket-clear-error.php - * @param resource $socket [optional]

- * A valid socket resource created with socket_create. - *

- * @return void No value is returned. - */ -function socket_clear_error ($socket = null) {} - -/** - * (PHP 4 >= 5.4.0)
- * Import a stream - * @link http://php.net/manual/en/function.socket-import-stream.php - * @param resource $stream

- * The stream resource to import. - *

- * @return resource FALSE or NULL on failure. - */ -function socket_import_stream ($stream) {} - -/** - * @param $socket - * @param $level - * @param $optname - */ -function socket_getopt ($socket, $level, $optname) {} - -/** - * @param $socket - * @param $level - * @param $optname - * @param $optval - */ -function socket_setopt ($socket, $level, $optname, $optval) {} - -define ('AF_UNIX', 1); -define ('AF_INET', 2); - -/** - * Only available if compiled with IPv6 support. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('AF_INET6', 10); -define ('SOCK_STREAM', 1); -define ('SOCK_DGRAM', 2); -define ('SOCK_RAW', 3); -define ('SOCK_SEQPACKET', 5); -define ('SOCK_RDM', 4); -define ('MSG_OOB', 1); -define ('MSG_WAITALL', 256); -define ('MSG_DONTWAIT', 64); -define ('MSG_PEEK', 2); -define ('MSG_DONTROUTE', 4); - -/** - * Not available on Windows platforms. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('MSG_EOR', 128); - -/** - * Not available on Windows platforms. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('MSG_EOF', 512); -define ('SO_DEBUG', 1); -define ('SO_REUSEADDR', 2); -define ('SO_KEEPALIVE', 9); -define ('SO_DONTROUTE', 5); -define ('SO_LINGER', 13); -define ('SO_BROADCAST', 6); -define ('SO_OOBINLINE', 10); -define ('SO_SNDBUF', 7); -define ('SO_RCVBUF', 8); -define ('SO_SNDLOWAT', 19); -define ('SO_RCVLOWAT', 18); -define ('SO_SNDTIMEO', 21); -define ('SO_RCVTIMEO', 20); -define ('SO_TYPE', 3); -define ('SO_ERROR', 4); -define ('SOL_SOCKET', 1); -define ('SOMAXCONN', 128); - -/** - * Used to disable Nagle TCP algorithm. - * Added in PHP 5.2.7. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('TCP_NODELAY', 1); -define ('PHP_NORMAL_READ', 1); -define ('PHP_BINARY_READ', 2); -define ('MCAST_JOIN_GROUP', 42); -define ('MCAST_LEAVE_GROUP', 45); -define ('MCAST_BLOCK_SOURCE', 43); -define ('MCAST_UNBLOCK_SOURCE', 44); -define ('MCAST_JOIN_SOURCE_GROUP', 46); -define ('MCAST_LEAVE_SOURCE_GROUP', 47); -define ('IP_MULTICAST_IF', 32); -define ('IP_MULTICAST_TTL', 33); -define ('IP_MULTICAST_LOOP', 34); -define ('IPV6_MULTICAST_IF', 17); -define ('IPV6_MULTICAST_HOPS', 18); -define ('IPV6_MULTICAST_LOOP', 19); - -/** - * Operation not permitted. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EPERM', 1); - -/** - * No such file or directory. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENOENT', 2); - -/** - * Interrupted system call. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EINTR', 4); - -/** - * I/O error. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EIO', 5); - -/** - * No such device or address. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENXIO', 6); - -/** - * Arg list too long. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_E2BIG', 7); - -/** - * Bad file number. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EBADF', 9); - -/** - * Try again. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EAGAIN', 11); - -/** - * Out of memory. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENOMEM', 12); - -/** - * Permission denied. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EACCES', 13); - -/** - * Bad address. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EFAULT', 14); - -/** - * Block device required. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENOTBLK', 15); - -/** - * Device or resource busy. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EBUSY', 16); - -/** - * File exists. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EEXIST', 17); - -/** - * Cross-device link. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EXDEV', 18); - -/** - * No such device. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENODEV', 19); - -/** - * Not a directory. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENOTDIR', 20); - -/** - * Is a directory. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EISDIR', 21); - -/** - * Invalid argument. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EINVAL', 22); - -/** - * File table overflow. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENFILE', 23); - -/** - * Too many open files. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EMFILE', 24); - -/** - * Not a typewriter. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENOTTY', 25); - -/** - * No space left on device. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENOSPC', 28); - -/** - * Illegal seek. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ESPIPE', 29); - -/** - * Read-only file system. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EROFS', 30); - -/** - * Too many links. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EMLINK', 31); - -/** - * Broken pipe. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EPIPE', 32); - -/** - * File name too long. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENAMETOOLONG', 36); - -/** - * No record locks available. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENOLCK', 37); - -/** - * Function not implemented. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENOSYS', 38); - -/** - * Directory not empty. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENOTEMPTY', 39); - -/** - * Too many symbolic links encountered. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ELOOP', 40); - -/** - * Operation would block. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EWOULDBLOCK', 11); - -/** - * No message of desired type. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENOMSG', 42); - -/** - * Identifier removed. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EIDRM', 43); - -/** - * Channel number out of range. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ECHRNG', 44); - -/** - * Level 2 not synchronized. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EL2NSYNC', 45); - -/** - * Level 3 halted. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EL3HLT', 46); - -/** - * Level 3 reset. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EL3RST', 47); - -/** - * Link number out of range. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ELNRNG', 48); - -/** - * Protocol driver not attached. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EUNATCH', 49); - -/** - * No CSI structure available. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENOCSI', 50); - -/** - * Level 2 halted. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EL2HLT', 51); - -/** - * Invalid exchange. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EBADE', 52); - -/** - * Invalid request descriptor. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EBADR', 53); - -/** - * Exchange full. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EXFULL', 54); - -/** - * No anode. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENOANO', 55); - -/** - * Invalid request code. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EBADRQC', 56); - -/** - * Invalid slot. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EBADSLT', 57); - -/** - * Device not a stream. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENOSTR', 60); - -/** - * No data available. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENODATA', 61); - -/** - * Timer expired. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ETIME', 62); - -/** - * Out of streams resources. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENOSR', 63); - -/** - * Machine is not on the network. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENONET', 64); - -/** - * Object is remote. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EREMOTE', 66); - -/** - * Link has been severed. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENOLINK', 67); - -/** - * Advertise error. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EADV', 68); - -/** - * Srmount error. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ESRMNT', 69); - -/** - * Communication error on send. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ECOMM', 70); - -/** - * Protocol error. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EPROTO', 71); - -/** - * Multihop attempted. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EMULTIHOP', 72); - -/** - * Not a data message. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EBADMSG', 74); - -/** - * Name not unique on network. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENOTUNIQ', 76); - -/** - * File descriptor in bad state. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EBADFD', 77); - -/** - * Remote address changed. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EREMCHG', 78); - -/** - * Interrupted system call should be restarted. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ERESTART', 85); - -/** - * Streams pipe error. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ESTRPIPE', 86); - -/** - * Too many users. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EUSERS', 87); - -/** - * Socket operation on non-socket. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENOTSOCK', 88); - -/** - * Destination address required. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EDESTADDRREQ', 89); - -/** - * Message too long. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EMSGSIZE', 90); - -/** - * Protocol wrong type for socket. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EPROTOTYPE', 91); -define ('SOCKET_ENOPROTOOPT', 92); - -/** - * Protocol not supported. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EPROTONOSUPPORT', 93); - -/** - * Socket type not supported. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ESOCKTNOSUPPORT', 94); - -/** - * Operation not supported on transport endpoint. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EOPNOTSUPP', 95); - -/** - * Protocol family not supported. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EPFNOSUPPORT', 96); - -/** - * Address family not supported by protocol. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EAFNOSUPPORT', 97); -define ('SOCKET_EADDRINUSE', 98); - -/** - * Cannot assign requested address. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EADDRNOTAVAIL', 99); - -/** - * Network is down. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENETDOWN', 100); - -/** - * Network is unreachable. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENETUNREACH', 101); - -/** - * Network dropped connection because of reset. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENETRESET', 102); - -/** - * Software caused connection abort. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ECONNABORTED', 103); - -/** - * Connection reset by peer. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ECONNRESET', 104); - -/** - * No buffer space available. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENOBUFS', 105); - -/** - * Transport endpoint is already connected. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EISCONN', 106); - -/** - * Transport endpoint is not connected. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENOTCONN', 107); - -/** - * Cannot send after transport endpoint shutdown. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ESHUTDOWN', 108); - -/** - * Too many references: cannot splice. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ETOOMANYREFS', 109); - -/** - * Connection timed out. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ETIMEDOUT', 110); - -/** - * Connection refused. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ECONNREFUSED', 111); - -/** - * Host is down. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EHOSTDOWN', 112); - -/** - * No route to host. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EHOSTUNREACH', 113); - -/** - * Operation already in progress. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EALREADY', 114); - -/** - * Operation now in progress. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EINPROGRESS', 115); - -/** - * Is a named type file. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EISNAM', 120); - -/** - * Remote I/O error. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EREMOTEIO', 121); - -/** - * Quota exceeded. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EDQUOT', 122); - -/** - * No medium found. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_ENOMEDIUM', 123); - -/** - * Wrong medium type. - * @link http://php.net/manual/en/sockets.constants.php - */ -define ('SOCKET_EMEDIUMTYPE', 124); -define ('IPPROTO_IP', 0); -define ('IPPROTO_IPV6', 41); -define ('SOL_TCP', 6); -define ('SOL_UDP', 17); - -// End of sockets v. -?> diff --git a/phpruntime/sqlite3.php b/phpruntime/sqlite3.php deleted file mode 100644 index bf885f7..0000000 --- a/phpruntime/sqlite3.php +++ /dev/null @@ -1,526 +0,0 @@ - - * Opens an SQLite database - * @link http://php.net/manual/en/sqlite3.open.php - * @param string $filename

- * Path to the SQLite database, or :memory: to use in-memory database. - *

- * @param int $flags [optional]

- * Optional flags used to determine how to open the SQLite database. By - * default, open uses SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE. - *

- * SQLITE3_OPEN_READONLY: Open the database for - * reading only. - *

- * @param string $encryption_key [optional]

- * An optional encryption key used when encrypting and decrypting an - * SQLite database. - *

- * @return void No value is returned. - */ - public function open ($filename, $flags = 'SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE', $encryption_key = null) {} - - /** - * (PHP 5 >= 5.3.0)
- * Closes the database connection - * @link http://php.net/manual/en/sqlite3.close.php - * @return bool TRUE on success, FALSE on failure. - */ - public function close () {} - - /** - * (PHP 5 >= 5.3.0)
- * Executes a result-less query against a given database - * @link http://php.net/manual/en/sqlite3.exec.php - * @param string $query

- * The SQL query to execute (typically an INSERT, UPDATE, or DELETE - * query). - *

- * @return bool TRUE if the query succeeded, FALSE on failure. - */ - public function exec ($query) {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns the SQLite3 library version as a string constant and as a number - * @link http://php.net/manual/en/sqlite3.version.php - * @return array an associative array with the keys "versionString" and - * "versionNumber". - */ - public static function version () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns the row ID of the most recent INSERT into the database - * @link http://php.net/manual/en/sqlite3.lastinsertrowid.php - * @return int the row ID of the most recent INSERT into the database - */ - public function lastInsertRowID () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns the numeric result code of the most recent failed SQLite request - * @link http://php.net/manual/en/sqlite3.lasterrorcode.php - * @return int an integer value representing the numeric result code of the most - * recent failed SQLite request. - */ - public function lastErrorCode () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns English text describing the most recent failed SQLite request - * @link http://php.net/manual/en/sqlite3.lasterrormsg.php - * @return string an English string describing the most recent failed SQLite request. - */ - public function lastErrorMsg () {} - - /** - * (PHP 5 >= 5.3.3)
- * Sets the busy connection handler - * @link http://php.net/manual/en/sqlite3.busytimeout.php - * @param int $msecs

- * The milliseconds to sleep. Setting this value to a value less than - * or equal to zero, will turn off an already set timeout handler. - *

- * @return bool TRUE on success, FALSE on failure. - */ - public function busyTimeout ($msecs) {} - - /** - * (PHP 5 >= 5.3.0)
- * Attempts to load an SQLite extension library - * @link http://php.net/manual/en/sqlite3.loadextension.php - * @param string $shared_library

- * The name of the library to load. The library must be located in the - * directory specified in the configure option sqlite3.extension_dir. - *

- * @return bool TRUE if the extension is successfully loaded, FALSE on failure. - */ - public function loadExtension ($shared_library) {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns the number of database rows that were changed (or inserted or -deleted) by the most recent SQL statement - * @link http://php.net/manual/en/sqlite3.changes.php - * @return int an integer value corresponding to the number of - * database rows changed (or inserted or deleted) by the most recent SQL - * statement. - */ - public function changes () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns a string that has been properly escaped - * @link http://php.net/manual/en/sqlite3.escapestring.php - * @param string $value

- * The string to be escaped. - *

- * @return string a properly escaped string that may be used safely in an SQL - * statement. - */ - public static function escapeString ($value) {} - - /** - * (PHP 5 >= 5.3.0)
- * Prepares an SQL statement for execution - * @link http://php.net/manual/en/sqlite3.prepare.php - * @param string $query

- * The SQL query to prepare. - *

- * @return SQLite3Stmt an SQLite3Stmt object on success or FALSE on failure. - */ - public function prepare ($query) {} - - /** - * (PHP 5 >= 5.3.0)
- * Executes an SQL query - * @link http://php.net/manual/en/sqlite3.query.php - * @param string $query

- * The SQL query to execute. - *

- * @return SQLite3Result an SQLite3Result object if the query returns results. Otherwise, - * returns TRUE if the query succeeded, FALSE on failure. - */ - public function query ($query) {} - - /** - * (PHP 5 >= 5.3.0)
- * Executes a query and returns a single result - * @link http://php.net/manual/en/sqlite3.querysingle.php - * @param string $query

- * The SQL query to execute. - *

- * @param bool $entire_row [optional]

- * By default, querySingle returns the value of the - * first column returned by the query. If - * entire_row is TRUE, then it returns an array - * of the entire first row. - *

- * @return mixed the value of the first column of results or an array of the entire - * first row (if entire_row is TRUE). - *

- *

- * If the query is valid but no results are returned, then NULL will be - * returned if entire_row is FALSE, otherwise an - * empty array is returned. - *

- *

- * Invalid or failing queries will return FALSE. - */ - public function querySingle ($query, $entire_row = false) {} - - /** - * (PHP 5 >= 5.3.0)
- * Registers a PHP function for use as an SQL scalar function - * @link http://php.net/manual/en/sqlite3.createfunction.php - * @param string $name

- * Name of the SQL function to be created or redefined. - *

- * @param mixed $callback

- * The name of a PHP function or user-defined function to apply as a - * callback, defining the behavior of the SQL function. - *

- * @param int $argument_count [optional]

- * The number of arguments that the SQL function takes. If - * this parameter is negative, then the SQL function may take - * any number of arguments. - *

- * @return bool TRUE upon successful creation of the function, FALSE on failure. - */ - public function createFunction ($name, $callback, $argument_count = -1) {} - - /** - * (PHP 5 >= 5.3.0)
- * Registers a PHP function for use as an SQL aggregate function - * @link http://php.net/manual/en/sqlite3.createaggregate.php - * @param string $name

- * Name of the SQL aggregate to be created or redefined. - *

- * @param mixed $step_callback

- * The name of a PHP function or user-defined function to apply as a - * callback for every item in the aggregate. - *

- * @param mixed $final_callback

- * The name of a PHP function or user-defined function to apply as a - * callback at the end of the aggregate data. - *

- * @param int $argument_count [optional]

- * The number of arguments that the SQL aggregate takes. If - * this parameter is negative, then the SQL aggregate may take - * any number of arguments. - *

- * @return bool TRUE upon successful creation of the aggregate, FALSE on - * failure. - */ - public function createAggregate ($name, $step_callback, $final_callback, $argument_count = -1) {} - - /** - * @param $name - * @param $callback - */ - public function createCollation ($name, $callback) {} - - /** - * @param $table - * @param $column - * @param $rowid - * @param $dbname [optional] - */ - public function openBlob ($table, $column, $rowid, $dbname) {} - - /** - * @param $enableExceptions - */ - public function enableExceptions ($enableExceptions) {} - - /** - * (PHP 5 >= 5.3.0)
- * Instantiates an SQLite3 object and opens an SQLite 3 database - * @link http://php.net/manual/en/sqlite3.construct.php - * @param string $filename

- * Path to the SQLite database, or :memory: to use in-memory database. - *

- * @param int $flags [optional]

- * Optional flags used to determine how to open the SQLite database. By - * default, open uses SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE. - *

- * SQLITE3_OPEN_READONLY: Open the database for - * reading only. - *

- * @param string $encryption_key [optional]

- * An optional encryption key used when encrypting and decrypting an - * SQLite database. - *

- */ - public function __construct ($filename, $flags = null, $encryption_key = null) {} - -} - -/** - * A class that handles prepared statements for the SQLite 3 extension. - * @link http://php.net/manual/en/class.sqlite3stmt.php - */ -class SQLite3Stmt { - - /** - * (PHP 5 >= 5.3.0)
- * Returns the number of parameters within the prepared statement - * @link http://php.net/manual/en/sqlite3stmt.paramcount.php - * @return int the number of parameters within the prepared statement. - */ - public function paramCount () {} - - /** - * (PHP 5 >= 5.3.0)
- * Closes the prepared statement - * @link http://php.net/manual/en/sqlite3stmt.close.php - * @return bool TRUE - */ - public function close () {} - - /** - * (PHP 5 >= 5.3.0)
- * Resets the prepared statement - * @link http://php.net/manual/en/sqlite3stmt.reset.php - * @return bool TRUE if the statement is successfully reset, FALSE on failure. - */ - public function reset () {} - - /** - * (PHP 5 >= 5.3.0)
- * Clears all current bound parameters - * @link http://php.net/manual/en/sqlite3stmt.clear.php - * @return bool TRUE on successful clearing of bound parameters, FALSE on - * failure. - */ - public function clear () {} - - /** - * (PHP 5 >= 5.3.0)
- * Executes a prepared statement and returns a result set object - * @link http://php.net/manual/en/sqlite3stmt.execute.php - * @return SQLite3Result an SQLite3Result object on successful execution of the prepared - * statement, FALSE on failure. - */ - public function execute () {} - - /** - * (PHP 5 >= 5.3.0)
- * Binds a parameter to a statement variable - * @link http://php.net/manual/en/sqlite3stmt.bindparam.php - * @param string $sql_param

- * An string identifying the statement variable to which the - * parameter should be bound. - *

- * @param mixed $param

- * The parameter to bind to a statement variable. - *

- * @param int $type [optional]

- * The data type of the parameter to bind. - *

- * SQLITE3_INTEGER: The value is a signed integer, - * stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of - * the value. - *

- * @return bool TRUE if the parameter is bound to the statement variable, FALSE - * on failure. - */ - public function bindParam ($sql_param, &$param, $type = null) {} - - /** - * (PHP 5 >= 5.3.0)
- * Binds the value of a parameter to a statement variable - * @link http://php.net/manual/en/sqlite3stmt.bindvalue.php - * @param string $sql_param

- * An string identifying the statement variable to which the - * value should be bound. - *

- * @param mixed $value

- * The value to bind to a statement variable. - *

- * @param int $type [optional]

- * The data type of the value to bind. - *

- * SQLITE3_INTEGER: The value is a signed integer, - * stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of - * the value. - *

- * @return bool TRUE if the value is bound to the statement variable, FALSE - * on failure. - */ - public function bindValue ($sql_param, $value, $type = null) {} - - public function readOnly () {} - - /** - * @param $sqlite3 - */ - private function __construct ($sqlite3) {} - -} - -/** - * A class that handles result sets for the SQLite 3 extension. - * @link http://php.net/manual/en/class.sqlite3result.php - */ -class SQLite3Result { - - /** - * (PHP 5 >= 5.3.0)
- * Returns the number of columns in the result set - * @link http://php.net/manual/en/sqlite3result.numcolumns.php - * @return int the number of columns in the result set. - */ - public function numColumns () {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns the name of the nth column - * @link http://php.net/manual/en/sqlite3result.columnname.php - * @param int $column_number

- * The numeric zero-based index of the column. - *

- * @return string the string name of the column identified by - * column_number. - */ - public function columnName ($column_number) {} - - /** - * (PHP 5 >= 5.3.0)
- * Returns the type of the nth column - * @link http://php.net/manual/en/sqlite3result.columntype.php - * @param int $column_number

- * The numeric zero-based index of the column. - *

- * @return int the data type index of the column identified by - * column_number (one of - * SQLITE3_INTEGER, SQLITE3_FLOAT, - * SQLITE3_TEXT, SQLITE3_BLOB, or - * SQLITE3_NULL). - */ - public function columnType ($column_number) {} - - /** - * (PHP 5 >= 5.3.0)
- * Fetches a result row as an associative or numerically indexed array or both - * @link http://php.net/manual/en/sqlite3result.fetcharray.php - * @param int $mode [optional]

- * Controls how the next row will be returned to the caller. This value - * must be one of either SQLITE3_ASSOC, - * SQLITE3_NUM, or SQLITE3_BOTH. - *

- * SQLITE3_ASSOC: returns an array indexed by column - * name as returned in the corresponding result set - *

- * @return array a result row as an associatively or numerically indexed array or - * both. Alternately will return FALSE if there are no more rows. - */ - public function fetchArray ($mode = 'SQLITE3_BOTH') {} - - /** - * (PHP 5 >= 5.3.0)
- * Resets the result set back to the first row - * @link http://php.net/manual/en/sqlite3result.reset.php - * @return bool TRUE if the result set is successfully reset - * back to the first row, FALSE on failure. - */ - public function reset () {} - - /** - * (PHP 5 >= 5.3.0)
- * Closes the result set - * @link http://php.net/manual/en/sqlite3result.finalize.php - * @return bool TRUE. - */ - public function finalize () {} - - private function __construct () {} - -} - -/** - * Specifies that the Sqlite3Result::fetchArray - * method shall return an array indexed by column name as returned in the - * corresponding result set. - * @link http://php.net/manual/en/sqlite3.constants.php - */ -define ('SQLITE3_ASSOC', 1); - -/** - * Specifies that the Sqlite3Result::fetchArray - * method shall return an array indexed by column number as returned in the - * corresponding result set, starting at column 0. - * @link http://php.net/manual/en/sqlite3.constants.php - */ -define ('SQLITE3_NUM', 2); - -/** - * Specifies that the Sqlite3Result::fetchArray - * method shall return an array indexed by both column name and number as - * returned in the corresponding result set, starting at column 0. - * @link http://php.net/manual/en/sqlite3.constants.php - */ -define ('SQLITE3_BOTH', 3); - -/** - * Represents the SQLite3 INTEGER storage class. - * @link http://php.net/manual/en/sqlite3.constants.php - */ -define ('SQLITE3_INTEGER', 1); - -/** - * Represents the SQLite3 REAL (FLOAT) storage class. - * @link http://php.net/manual/en/sqlite3.constants.php - */ -define ('SQLITE3_FLOAT', 2); - -/** - * Represents the SQLite3 TEXT storage class. - * @link http://php.net/manual/en/sqlite3.constants.php - */ -define ('SQLITE3_TEXT', 3); - -/** - * Represents the SQLite3 BLOB storage class. - * @link http://php.net/manual/en/sqlite3.constants.php - */ -define ('SQLITE3_BLOB', 4); - -/** - * Represents the SQLite3 NULL storage class. - * @link http://php.net/manual/en/sqlite3.constants.php - */ -define ('SQLITE3_NULL', 5); - -/** - * Specifies that the SQLite3 database be opened for reading only. - * @link http://php.net/manual/en/sqlite3.constants.php - */ -define ('SQLITE3_OPEN_READONLY', 1); - -/** - * Specifies that the SQLite3 database be opened for reading and writing. - * @link http://php.net/manual/en/sqlite3.constants.php - */ -define ('SQLITE3_OPEN_READWRITE', 2); - -/** - * Specifies that the SQLite3 database be created if it does not already - * exist. - * @link http://php.net/manual/en/sqlite3.constants.php - */ -define ('SQLITE3_OPEN_CREATE', 4); - -// End of sqlite3 v.0.7 -?> diff --git a/phpruntime/standard.php b/phpruntime/standard.php deleted file mode 100644 index 4b16e7d..0000000 --- a/phpruntime/standard.php +++ /dev/null @@ -1,12406 +0,0 @@ - - * The directory that was opened. - *

- * @var string - */ - public $path; - /** - *

- * Can be used with other directory functions such as - * readdir(), rewinddir() and - * closedir(). - *

- * @var resource - */ - public $handle; - - - /** - * @param $dir_handle [optional] - */ - public function close ($dir_handle) {} - - /** - * @param $dir_handle [optional] - */ - public function rewind ($dir_handle) {} - - /** - * @param $dir_handle [optional] - */ - public function read ($dir_handle) {} - -} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Returns the value of a constant - * @link http://php.net/manual/en/function.constant.php - * @param string $name

- * The constant name. - *

- * @return mixed the value of the constant, or NULL if the constant is not - * defined. - */ -function constant ($name) {} - -/** - * (PHP 4, PHP 5)
- * Convert binary data into hexadecimal representation - * @link http://php.net/manual/en/function.bin2hex.php - * @param string $str

- * A string. - *

- * @return string the hexadecimal representation of the given string. - */ -function bin2hex ($str) {} - -/** - * (PHP >= 5.4.0)
- * Decodes a hexadecimally encoded binary string - * @link http://php.net/manual/en/function.hex2bin.php - * @param string $data

- * Hexadecimal representation of data. - *

- * @return string the binary representation of the given data or FALSE on failure. - */ -function hex2bin ($data) {} - -/** - * (PHP 4, PHP 5)
- * Delay execution - * @link http://php.net/manual/en/function.sleep.php - * @param int $seconds

- * Halt time in seconds. - *

- * @return int zero on success, or FALSE on error. - *

- *

- * If the call was interrupted by a signal, sleep returns - * a non-zero value. On Windows, this value will always be - * 192 (the value of the - * WAIT_IO_COMPLETION constant within the Windows API). - * On other platforms, the return value will be the number of seconds left to - * sleep. - */ -function sleep ($seconds) {} - -/** - * (PHP 4, PHP 5)
- * Delay execution in microseconds - * @link http://php.net/manual/en/function.usleep.php - * @param int $micro_seconds

- * Halt time in micro seconds. A micro second is one millionth of a - * second. - *

- * @return void No value is returned. - */ -function usleep ($micro_seconds) {} - -/** - * (PHP 5)
- * Delay for a number of seconds and nanoseconds - * @link http://php.net/manual/en/function.time-nanosleep.php - * @param int $seconds

- * Must be a non-negative integer. - *

- * @param int $nanoseconds

- * Must be a non-negative integer less than 1 billion. - *

- * @return mixed TRUE on success or FALSE on failure. - *

- *

- * If the delay was interrupted by a signal, an associative array will be - * returned with the components: - * seconds - number of seconds remaining in - * the delay - * nanoseconds - number of nanoseconds - * remaining in the delay - */ -function time_nanosleep ($seconds, $nanoseconds) {} - -/** - * (PHP 5 >= 5.1.0)
- * Make the script sleep until the specified time - * @link http://php.net/manual/en/function.time-sleep-until.php - * @param float $timestamp

- * The timestamp when the script should wake. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function time_sleep_until ($timestamp) {} - -/** - * (PHP 5 >= 5.1.0)
- * Parse a time/date generated with strftime - * @link http://php.net/manual/en/function.strptime.php - * @param string $date

- * The string to parse (e.g. returned from strftime). - *

- * @param string $format

- * The format used in date (e.g. the same as - * used in strftime). Note that some of the format - * options available to strftime may not have any - * effect within strptime; the exact subset that are - * supported will vary based on the operating system and C library in - * use. - *

- *

- * For more information about the format options, read the - * strftime page. - *

- * @return array an array or FALSE on failure. - *

- *

- * - * The following parameters are returned in the array - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
parametersDescription
"tm_sec"Seconds after the minute (0-61)
"tm_min"Minutes after the hour (0-59)
"tm_hour"Hour since midnight (0-23)
"tm_mday"Day of the month (1-31)
"tm_mon"Months since January (0-11)
"tm_year"Years since 1900
"tm_wday"Days since Sunday (0-6)
"tm_yday"Days since January 1 (0-365)
"unparsed"the date part which was not - * recognized using the specified format
- */ -function strptime ($date, $format) {} - -/** - * (PHP 4, PHP 5)
- * Flush the output buffer - * @link http://php.net/manual/en/function.flush.php - * @return void No value is returned. - */ -function flush () {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Wraps a string to a given number of characters - * @link http://php.net/manual/en/function.wordwrap.php - * @param string $str

- * The input string. - *

- * @param int $width [optional]

- * The number of characters at which the string will be wrapped. - *

- * @param string $break [optional]

- * The line is broken using the optional - * break parameter. - *

- * @param bool $cut [optional]

- * If the cut is set to TRUE, the string is - * always wrapped at or before the specified width. So if you have - * a word that is larger than the given width, it is broken apart. - * (See second example). - *

- * @return string the given string wrapped at the specified length. - */ -function wordwrap ($str, $width = 75, $break = "\n", $cut = false) {} - -/** - * (PHP 4, PHP 5)
- * Convert special characters to HTML entities - * @link http://php.net/manual/en/function.htmlspecialchars.php - * @param string $string

- * The string being converted. - *

- * @param int $flags [optional]

- * A bitmask of one or more of the following flags, which specify how to handle quotes, - * invalid code unit sequences and the used document type. The default is - * ENT_COMPAT | ENT_HTML401. - * - * Available flags constants - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Constant NameDescription
ENT_COMPATWill convert double-quotes and leave single-quotes alone.
ENT_QUOTESWill convert both double and single quotes.
ENT_NOQUOTESWill leave both double and single quotes unconverted.
ENT_IGNORE - * Silently discard invalid code unit sequences instead of returning - * an empty string. Using this flag is discouraged as it - * may have security implications. - *
ENT_SUBSTITUTE - * Replace invalid code unit sequences with a Unicode Replacement Character - * U+FFFD (UTF-8) or &#38;#FFFD; (otherwise) instead of returning an empty string. - *
ENT_DISALLOWED - * Replace invalid code points for the given document type with a - * Unicode Replacement Character U+FFFD (UTF-8) or &#38;#FFFD; - * (otherwise) instead of leaving them as is. This may be useful, for - * instance, to ensure the well-formedness of XML documents with - * embedded external content. - *
ENT_HTML401 - * Handle code as HTML 4.01. - *
ENT_XML1 - * Handle code as XML 1. - *
ENT_XHTML - * Handle code as XHTML. - *
ENT_HTML5 - * Handle code as HTML 5. - *
- *

- * @param string $encoding [optional]

- * Defines encoding used in conversion. - * If omitted, the default value for this argument is ISO-8859-1 in - * versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards. - *

- *

- * For the purposes of this function, the encodings - * ISO-8859-1, ISO-8859-15, - * UTF-8, cp866, - * cp1251, cp1252, and - * KOI8-R are effectively equivalent, provided the - * string itself is valid for the encoding, as - * the characters affected by htmlspecialchars occupy - * the same positions in all of these encodings. - *

- * @param bool $double_encode [optional]

- * When double_encode is turned off PHP will not - * encode existing html entities, the default is to convert everything. - *

- * @return string The converted string. - *

- *

- * If the input string contains an invalid code unit - * sequence within the given encoding an empty string - * will be returned, unless either the ENT_IGNORE or - * ENT_SUBSTITUTE flags are set. - */ -function htmlspecialchars ($string, $flags = 'ENT_COMPAT | ENT_HTML401', $encoding = 'UTF-8', $double_encode = true) {} - -/** - * (PHP 4, PHP 5)
- * Convert all applicable characters to HTML entities - * @link http://php.net/manual/en/function.htmlentities.php - * @param string $string

- * The input string. - *

- * @param int $flags [optional]

- * A bitmask of one or more of the following flags, which specify how to handle quotes, - * invalid code unit sequences and the used document type. The default is - * ENT_COMPAT | ENT_HTML401. - * - * Available flags constants - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Constant NameDescription
ENT_COMPATWill convert double-quotes and leave single-quotes alone.
ENT_QUOTESWill convert both double and single quotes.
ENT_NOQUOTESWill leave both double and single quotes unconverted.
ENT_IGNORE - * Silently discard invalid code unit sequences instead of returning - * an empty string. Using this flag is discouraged as it - * may have security implications. - *
ENT_SUBSTITUTE - * Replace invalid code unit sequences with a Unicode Replacement Character - * U+FFFD (UTF-8) or &#38;#FFFD; (otherwise) instead of returning an empty string. - *
ENT_DISALLOWED - * Replace invalid code points for the given document type with a - * Unicode Replacement Character U+FFFD (UTF-8) or &#38;#FFFD; - * (otherwise) instead of leaving them as is. This may be useful, for - * instance, to ensure the well-formedness of XML documents with - * embedded external content. - *
ENT_HTML401 - * Handle code as HTML 4.01. - *
ENT_XML1 - * Handle code as XML 1. - *
ENT_XHTML - * Handle code as XHTML. - *
ENT_HTML5 - * Handle code as HTML 5. - *
- *

- * @param string $encoding [optional]

- * Like htmlspecialchars, - * htmlentities takes an optional third argument - * encoding which defines encoding used in - * conversion. - * If omitted, the default value for this argument is ISO-8859-1 in - * versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards. - * Although this argument is technically optional, you are highly - * encouraged to specify the correct value for your code. - *

- * @param bool $double_encode [optional]

- * When double_encode is turned off PHP will not - * encode existing html entities. The default is to convert everything. - *

- * @return string the encoded string. - *

- *

- * If the input string contains an invalid code unit - * sequence within the given encoding an empty string - * will be returned, unless either the ENT_IGNORE or - * ENT_SUBSTITUTE flags are set. - */ -function htmlentities ($string, $flags = 'ENT_COMPAT | ENT_HTML401', $encoding = 'UTF-8', $double_encode = true) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Convert all HTML entities to their applicable characters - * @link http://php.net/manual/en/function.html-entity-decode.php - * @param string $string

- * The input string. - *

- * @param int $flags [optional]

- * A bitmask of one or more of the following flags, which specify how to handle quotes and - * which document type to use. The default is ENT_COMPAT | ENT_HTML401. - * - * Available flags constants - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Constant NameDescription
ENT_COMPATWill convert double-quotes and leave single-quotes alone.
ENT_QUOTESWill convert both double and single quotes.
ENT_NOQUOTESWill leave both double and single quotes unconverted.
ENT_HTML401 - * Handle code as HTML 4.01. - *
ENT_XML1 - * Handle code as XML 1. - *
ENT_XHTML - * Handle code as XHTML. - *
ENT_HTML5 - * Handle code as HTML 5. - *
- *

- * @param string $encoding [optional]

- * Encoding to use. - * If omitted, the default value for this argument is ISO-8859-1 in - * versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards. - *

- * @return string the decoded string. - */ -function html_entity_decode ($string, $flags = 'ENT_COMPAT | ENT_HTML401', $encoding = 'UTF-8') {} - -/** - * (PHP 5 >= 5.1.0)
- * Convert special HTML entities back to characters - * @link http://php.net/manual/en/function.htmlspecialchars-decode.php - * @param string $string

- * The string to decode. - *

- * @param int $flags [optional]

- * A bitmask of one or more of the following flags, which specify how to handle quotes and - * which document type to use. The default is ENT_COMPAT | ENT_HTML401. - * - * Available flags constants - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Constant NameDescription
ENT_COMPATWill convert double-quotes and leave single-quotes alone.
ENT_QUOTESWill convert both double and single quotes.
ENT_NOQUOTESWill leave both double and single quotes unconverted.
ENT_HTML401 - * Handle code as HTML 4.01. - *
ENT_XML1 - * Handle code as XML 1. - *
ENT_XHTML - * Handle code as XHTML. - *
ENT_HTML5 - * Handle code as HTML 5. - *
- *

- * @return string the decoded string. - */ -function htmlspecialchars_decode ($string, $flags = 'ENT_COMPAT | ENT_HTML401') {} - -/** - * (PHP 4, PHP 5)
- * Returns the translation table used by htmlspecialchars and htmlentities - * @link http://php.net/manual/en/function.get-html-translation-table.php - * @param int $table [optional]

- * Which table to return. Either HTML_ENTITIES or - * HTML_SPECIALCHARS. - *

- * @param int $flags [optional]

- * A bitmask of one or more of the following flags, which specify which quotes the - * table will contain as well as which document type the table is for. The default is - * ENT_COMPAT | ENT_HTML401. - * - * Available flags constants - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Constant NameDescription
ENT_COMPATTable will contain entities for double-quotes, but not for single-quotes.
ENT_QUOTESTable will contain entities for both double and single quotes.
ENT_NOQUOTESTable will neither contain entities for single quotes nor for double quotes.
ENT_HTML401Table for HTML 4.01.
ENT_XML1Table for XML 1.
ENT_XHTMLTable for XHTML.
ENT_HTML5Table for HTML 5.
- *

- * @param string $encoding [optional]

- * Encoding to use. - * If omitted, the default value for this argument is ISO-8859-1 in - * versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards. - *

- * @return array the translation table as an array, with the original characters - * as keys and entities as values. - */ -function get_html_translation_table ($table = 'HTML_SPECIALCHARS', $flags = 'ENT_COMPAT | ENT_HTML401', $encoding = 'UTF-8') {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Calculate the sha1 hash of a string - * @link http://php.net/manual/en/function.sha1.php - * @param string $str

- * The input string. - *

- * @param bool $raw_output [optional]

- * If the optional raw_output is set to TRUE, - * then the sha1 digest is instead returned in raw binary format with a - * length of 20, otherwise the returned value is a 40-character - * hexadecimal number. - *

- * @return string the sha1 hash as a string. - */ -function sha1 ($str, $raw_output = false) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Calculate the sha1 hash of a file - * @link http://php.net/manual/en/function.sha1-file.php - * @param string $filename

- * The filename of the file to hash. - *

- * @param bool $raw_output [optional]

- * When TRUE, returns the digest in raw binary format with a length of - * 20. - *

- * @return string a string on success, FALSE otherwise. - */ -function sha1_file ($filename, $raw_output = false) {} - -/** - * (PHP 4, PHP 5)
- * Calculate the md5 hash of a string - * @link http://php.net/manual/en/function.md5.php - * @param string $str

- * The string. - *

- * @param bool $raw_output [optional]

- * If the optional raw_output is set to TRUE, - * then the md5 digest is instead returned in raw binary format with a - * length of 16. - *

- * @return string the hash as a 32-character hexadecimal number. - */ -function md5 ($str, $raw_output = false) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Calculates the md5 hash of a given file - * @link http://php.net/manual/en/function.md5-file.php - * @param string $filename

- * The filename - *

- * @param bool $raw_output [optional]

- * When TRUE, returns the digest in raw binary format with a length of - * 16. - *

- * @return string a string on success, FALSE otherwise. - */ -function md5_file ($filename, $raw_output = false) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Calculates the crc32 polynomial of a string - * @link http://php.net/manual/en/function.crc32.php - * @param string $str

- * The data. - *

- * @return int the crc32 checksum of str as an integer. - */ -function crc32 ($str) {} - -/** - * (PHP 4, PHP 5)
- * Parse a binary IPTC block into single tags. - * @link http://php.net/manual/en/function.iptcparse.php - * @param string $iptcblock

- * A binary IPTC block. - *

- * @return array an array using the tagmarker as an index and the value as the - * value. It returns FALSE on error or if no IPTC data was found. - */ -function iptcparse ($iptcblock) {} - -/** - * (PHP 4, PHP 5)
- * Embeds binary IPTC data into a JPEG image - * @link http://php.net/manual/en/function.iptcembed.php - * @param string $iptcdata

- * The data to be written. - *

- * @param string $jpeg_file_name

- * Path to the JPEG image. - *

- * @param int $spool [optional]

- * Spool flag. If the spool flag is over 2 then the JPEG will be - * returned as a string. - *

- * @return mixed If success and spool flag is lower than 2 then the JPEG will not be - * returned as a string, FALSE on errors. - */ -function iptcembed ($iptcdata, $jpeg_file_name, $spool = null) {} - -/** - * (PHP 4, PHP 5)
- * Get the size of an image - * @link http://php.net/manual/en/function.getimagesize.php - * @param string $filename

- * This parameter specifies the file you wish to retrieve information - * about. It can reference a local file or (configuration permitting) a - * remote file using one of the supported streams. - *

- * @param array $imageinfo [optional]

- * This optional parameter allows you to extract some extended - * information from the image file. Currently, this will return the - * different JPG APP markers as an associative array. - * Some programs use these APP markers to embed text information in - * images. A very common one is to embed - * IPTC information in the APP13 marker. - * You can use the iptcparse function to parse the - * binary APP13 marker into something readable. - *

- * @return array an array with 7 elements. - *

- *

- * Index 0 and 1 contains respectively the width and the height of the image. - *

- *

- * Some formats may contain no image or may contain multiple images. In these - * cases, getimagesize might not be able to properly - * determine the image size. getimagesize will return - * zero for width and height in these cases. - *

- *

- * Index 2 is one of the IMAGETYPE_XXX constants indicating - * the type of the image. - *

- *

- * Index 3 is a text string with the correct - * height="yyy" width="xxx" string that can be used - * directly in an IMG tag. - *

- *

- * mime is the correspondant MIME type of the image. - * This information can be used to deliver images with the correct HTTP - * Content-type header: - * getimagesize and MIME types - * - * $size = getimagesize($filename); - * $fp = fopen($filename, "rb"); - * if ($size && $fp) { - * header("Content-type: {$size['mime']}"); - * fpassthru($fp); - * exit; - * } else { - * // error - * } - * - *

- *

- * channels will be 3 for RGB pictures and 4 for CMYK - * pictures. - *

- *

- * bits is the number of bits for each color. - *

- *

- * For some image types, the presence of channels and - * bits values can be a bit - * confusing. As an example, GIF always uses 3 channels - * per pixel, but the number of bits per pixel cannot be calculated for an - * animated GIF with a global color table. - *

- *

- * On failure, FALSE is returned. - */ -function getimagesize ($filename, array &$imageinfo = null) {} - -/** - * (PHP 5 >= 5.4.0)
- * Get the size of an image from a string - * @link http://php.net/manual/en/function.getimagesizefromstring.php - * @param string $imagedata

- * The image data, as a string. - *

- * @param array $imageinfo [optional]

- * See getimagesize. - *

- * @return array See getimagesize. - */ -function getimagesizefromstring ($imagedata, array &$imageinfo = null) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Get Mime-Type for image-type returned by getimagesize, -exif_read_data, exif_thumbnail, exif_imagetype - * @link http://php.net/manual/en/function.image-type-to-mime-type.php - * @param int $imagetype

- * One of the IMAGETYPE_XXX constants. - *

- * @return string The returned values are as follows - * - * Returned values Constants - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
imagetypeReturned value
IMAGETYPE_GIFimage/gif
IMAGETYPE_JPEGimage/jpeg
IMAGETYPE_PNGimage/png
IMAGETYPE_SWFapplication/x-shockwave-flash
IMAGETYPE_PSDimage/psd
IMAGETYPE_BMPimage/bmp
IMAGETYPE_TIFF_II (intel byte order)image/tiff
- * IMAGETYPE_TIFF_MM (motorola byte order) - * image/tiff
IMAGETYPE_JPCapplication/octet-stream
IMAGETYPE_JP2image/jp2
IMAGETYPE_JPXapplication/octet-stream
IMAGETYPE_JB2application/octet-stream
IMAGETYPE_SWCapplication/x-shockwave-flash
IMAGETYPE_IFFimage/iff
IMAGETYPE_WBMPimage/vnd.wap.wbmp
IMAGETYPE_XBMimage/xbm
IMAGETYPE_ICOimage/vnd.microsoft.icon
- */ -function image_type_to_mime_type ($imagetype) {} - -/** - * (PHP 5)
- * Get file extension for image type - * @link http://php.net/manual/en/function.image-type-to-extension.php - * @param int $imagetype

- * One of the IMAGETYPE_XXX constant. - *

- * @param bool $include_dot [optional]

- * Whether to prepend a dot to the extension or not. Default to TRUE. - *

- * @return string A string with the extension corresponding to the given image type. - */ -function image_type_to_extension ($imagetype, $include_dot = '&true;') {} - -/** - * (PHP 4, PHP 5)
- * Outputs information about PHP's configuration - * @link http://php.net/manual/en/function.phpinfo.php - * @param int $what [optional]

- * The output may be customized by passing one or more of the - * following constants bitwise values summed - * together in the optional what parameter. - * One can also combine the respective constants or bitwise values - * together with the or operator. - *

- *

- * - * phpinfo options - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Name (constant)ValueDescription
INFO_GENERAL1 - * The configuration line, php.ini location, build date, Web - * Server, System and more. - *
INFO_CREDITS2 - * PHP Credits. See also phpcredits. - *
INFO_CONFIGURATION4 - * Current Local and Master values for PHP directives. See - * also ini_get. - *
INFO_MODULES8 - * Loaded modules and their respective settings. See also - * get_loaded_extensions. - *
INFO_ENVIRONMENT16 - * Environment Variable information that's also available in - * $_ENV. - *
INFO_VARIABLES32 - * Shows all - * predefined variables from EGPCS (Environment, GET, - * POST, Cookie, Server). - *
INFO_LICENSE64 - * PHP License information. See also the license FAQ. - *
INFO_ALL-1 - * Shows all of the above. - *
- *

- * @return bool TRUE on success or FALSE on failure. - */ -function phpinfo ($what = 'INFO_ALL') {} - -/** - * (PHP 4, PHP 5)
- * Gets the current PHP version - * @link http://php.net/manual/en/function.phpversion.php - * @param string $extension [optional]

- * An optional extension name. - *

- * @return string If the optional extension parameter is - * specified, phpversion returns the version of that - * extension, or FALSE if there is no version information associated or - * the extension isn't enabled. - */ -function phpversion ($extension = null) {} - -/** - * (PHP 4, PHP 5)
- * Prints out the credits for PHP - * @link http://php.net/manual/en/function.phpcredits.php - * @param int $flag [optional]

- * To generate a custom credits page, you may want to use the - * flag parameter. - *

- *

- * - * Pre-defined phpcredits flags - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
namedescription
CREDITS_ALL - * All the credits, equivalent to using: CREDITS_DOCS + - * CREDITS_GENERAL + CREDITS_GROUP + - * CREDITS_MODULES + CREDITS_FULLPAGE. - * It generates a complete stand-alone HTML page with the appropriate tags. - *
CREDITS_DOCSThe credits for the documentation team
CREDITS_FULLPAGE - * Usually used in combination with the other flags. Indicates - * that a complete stand-alone HTML page needs to be - * printed including the information indicated by the other - * flags. - *
CREDITS_GENERAL - * General credits: Language design and concept, PHP authors - * and SAPI module. - *
CREDITS_GROUPA list of the core developers
CREDITS_MODULES - * A list of the extension modules for PHP, and their authors - *
CREDITS_SAPI - * A list of the server API modules for PHP, and their authors - *
- *

- * @return bool TRUE on success or FALSE on failure. - */ -function phpcredits ($flag = 'CREDITS_ALL') {} - -/** - * (PHP 4, PHP 5)
- * Gets the logo guid - * @link http://php.net/manual/en/function.php-logo-guid.php - * @return string PHPE9568F34-D428-11d2-A769-00AA001ACF42. - */ -function php_logo_guid () {} - -function php_real_logo_guid () {} - -function php_egg_logo_guid () {} - -/** - * (PHP 4, PHP 5)
- * Gets the Zend guid - * @link http://php.net/manual/en/function.zend-logo-guid.php - * @return string PHPE9568F35-D428-11d2-A769-00AA001ACF42. - */ -function zend_logo_guid () {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Returns the type of interface between web server and PHP - * @link http://php.net/manual/en/function.php-sapi-name.php - * @return string the interface type, as a lowercase string. - *

- *

- * Although not exhaustive, the possible return values include - * aolserver, apache, - * apache2filter, apache2handler, - * caudium, cgi (until PHP 5.3), - * cgi-fcgi, cli, - * continuity, embed, - * isapi, litespeed, - * milter, nsapi, - * phttpd, pi3web, roxen, - * thttpd, tux, and webjames. - */ -function php_sapi_name () {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Returns information about the operating system PHP is running on - * @link http://php.net/manual/en/function.php-uname.php - * @param string $mode [optional]

- * mode is a single character that defines what - * information is returned: - * 'a': This is the default. Contains all modes in - * the sequence "s n r v m". - * @return string the description, as a string. - */ -function php_uname ($mode = "a") {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Return a list of .ini files parsed from the additional ini dir - * @link http://php.net/manual/en/function.php-ini-scanned-files.php - * @return string a comma-separated string of .ini files on success. Each comma is - * followed by a newline. If the directive --with-config-file-scan-dir wasn't set, - * FALSE is returned. If it was set and the directory was empty, an - * empty string is returned. If a file is unrecognizable, the file will - * still make it into the returned string but a PHP error will also result. - * This PHP error will be seen both at compile time and while using - * php_ini_scanned_files. - */ -function php_ini_scanned_files () {} - -/** - * (PHP 5 >= 5.2.4)
- * Retrieve a path to the loaded php.ini file - * @link http://php.net/manual/en/function.php-ini-loaded-file.php - * @return string The loaded php.ini path, or FALSE if one is not loaded. - */ -function php_ini_loaded_file () {} - -/** - * (PHP 4, PHP 5)
- * String comparisons using a "natural order" algorithm - * @link http://php.net/manual/en/function.strnatcmp.php - * @param string $str1

- * The first string. - *

- * @param string $str2

- * The second string. - *

- * @return int Similar to other string comparison functions, this one returns < 0 if - * str1 is less than str2; > - * 0 if str1 is greater than - * str2, and 0 if they are equal. - */ -function strnatcmp ($str1, $str2) {} - -/** - * (PHP 4, PHP 5)
- * Case insensitive string comparisons using a "natural order" algorithm - * @link http://php.net/manual/en/function.strnatcasecmp.php - * @param string $str1

- * The first string. - *

- * @param string $str2

- * The second string. - *

- * @return int Similar to other string comparison functions, this one returns < 0 if - * str1 is less than str2 > - * 0 if str1 is greater than - * str2, and 0 if they are equal. - */ -function strnatcasecmp ($str1, $str2) {} - -/** - * (PHP 4, PHP 5)
- * Count the number of substring occurrences - * @link http://php.net/manual/en/function.substr-count.php - * @param string $haystack

- * The string to search in - *

- * @param string $needle

- * The substring to search for - *

- * @param int $offset [optional]

- * The offset where to start counting - *

- * @param int $length [optional]

- * The maximum length after the specified offset to search for the - * substring. It outputs a warning if the offset plus the length is - * greater than the haystack length. - *

- * @return int This function returns an integer. - */ -function substr_count ($haystack, $needle, $offset = 0, $length = null) {} - -/** - * (PHP 4, PHP 5)
- * Finds the length of the initial segment of a string consisting -entirely of characters contained within a given mask. - * @link http://php.net/manual/en/function.strspn.php - * @param string $subject

- * The string to examine. - *

- * @param string $mask

- * The list of allowable characters. - *

- * @param int $start [optional]

- * The position in subject to - * start searching. - *

- *

- * If start is given and is non-negative, - * then strspn will begin - * examining subject at - * the start'th position. For instance, in - * the string 'abcdef', the character at - * position 0 is 'a', the - * character at position 2 is - * 'c', and so forth. - *

- *

- * If start is given and is negative, - * then strspn will begin - * examining subject at - * the start'th position from the end - * of subject. - *

- * @param int $length [optional]

- * The length of the segment from subject - * to examine. - *

- *

- * If length is given and is non-negative, - * then subject will be examined - * for length characters after the starting - * position. - *

- *

- * If lengthis given and is negative, - * then subject will be examined from the - * starting position up to length - * characters from the end of subject. - *

- * @return int the length of the initial segment of subject - * which consists entirely of characters in mask. - */ -function strspn ($subject, $mask, $start = null, $length = null) {} - -/** - * (PHP 4, PHP 5)
- * Find length of initial segment not matching mask - * @link http://php.net/manual/en/function.strcspn.php - * @param string $str1

- * The first string. - *

- * @param string $str2

- * The second string. - *

- * @param int $start [optional]

- * The start position of the string to examine. - *

- * @param int $length [optional]

- * The length of the string to examine. - *

- * @return int the length of the segment as an integer. - */ -function strcspn ($str1, $str2, $start = null, $length = null) {} - -/** - * (PHP 4, PHP 5)
- * Tokenize string - * @link http://php.net/manual/en/function.strtok.php - * @param string $str

- * The string being split up into smaller strings (tokens). - *

- * @param string $token

- * The delimiter used when splitting up str. - *

- * @return string A string token. - */ -function strtok ($str, $token) {} - -/** - * (PHP 4, PHP 5)
- * Make a string uppercase - * @link http://php.net/manual/en/function.strtoupper.php - * @param string $string

- * The input string. - *

- * @return string the uppercased string. - */ -function strtoupper ($string) {} - -/** - * (PHP 4, PHP 5)
- * Make a string lowercase - * @link http://php.net/manual/en/function.strtolower.php - * @param string $str

- * The input string. - *

- * @return string the lowercased string. - */ -function strtolower ($str) {} - -/** - * (PHP 4, PHP 5)
- * Find the position of the first occurrence of a substring in a string - * @link http://php.net/manual/en/function.strpos.php - * @param string $haystack

- * The string to search in. - *

- * @param mixed $needle

- * If needle is not a string, it is converted - * to an integer and applied as the ordinal value of a character. - *

- * @param int $offset [optional]

- * If specified, search will start this number of characters counted from - * the beginning of the string. Unlike strrpos and - * strripos, the offset cannot be negative. - *

- * @return int the position of where the needle exists relative to the beginning of - * the haystack string (independent of offset). - * Also note that string positions start at 0, and not 1. - *

- *

- * Returns FALSE if the needle was not found. - */ -function strpos ($haystack, $needle, $offset = 0) {} - -/** - * (PHP 5)
- * Find the position of the first occurrence of a case-insensitive substring in a string - * @link http://php.net/manual/en/function.stripos.php - * @param string $haystack

- * The string to search in. - *

- * @param string $needle

- * Note that the needle may be a string of one or - * more characters. - *

- *

- * If needle is not a string, it is converted to - * an integer and applied as the ordinal value of a character. - *

- * @param int $offset [optional]

- * If specified, search will start this number of characters counted from - * the beginning of the string. Unlike strrpos and - * strripos, the offset cannot be negative. - *

- * @return int the position of where the needle exists relative to the beginnning of - * the haystack string (independent of offset). - * Also note that string positions start at 0, and not 1. - *

- *

- * Returns FALSE if the needle was not found. - */ -function stripos ($haystack, $needle, $offset = 0) {} - -/** - * (PHP 4, PHP 5)
- * Find the position of the last occurrence of a substring in a string - * @link http://php.net/manual/en/function.strrpos.php - * @param string $haystack

- * The string to search in. - *

- * @param string $needle

- * If needle is not a string, it is converted - * to an integer and applied as the ordinal value of a character. - *

- * @param int $offset [optional]

- * If specified, search will start this number of characters counted from the - * beginning of the string. If the value is negative, search will instead start - * from that many characters from the end of the string, searching backwards. - *

- * @return int the position where the needle exists relative to the beginnning of - * the haystack string (independent of search direction - * or offset). - * Also note that string positions start at 0, and not 1. - *

- *

- * Returns FALSE if the needle was not found. - */ -function strrpos ($haystack, $needle, $offset = 0) {} - -/** - * (PHP 5)
- * Find the position of the last occurrence of a case-insensitive substring in a string - * @link http://php.net/manual/en/function.strripos.php - * @param string $haystack

- * The string to search in. - *

- * @param string $needle

- * If needle is not a string, it is converted - * to an integer and applied as the ordinal value of a character. - *

- * @param int $offset [optional]

- * If specified, search will start this number of characters counted from the - * beginning of the string. If the value is negative, search will instead start - * from that many characters from the end of the string, searching backwards. - *

- * @return int the position where the needle exists relative to the beginnning of - * the haystack string (independent of search direction - * or offset). - * Also note that string positions start at 0, and not 1. - *

- *

- * Returns FALSE if the needle was not found. - */ -function strripos ($haystack, $needle, $offset = 0) {} - -/** - * (PHP 4, PHP 5)
- * Reverse a string - * @link http://php.net/manual/en/function.strrev.php - * @param string $string

- * The string to be reversed. - *

- * @return string the reversed string. - */ -function strrev ($string) {} - -/** - * (PHP 4, PHP 5)
- * Convert logical Hebrew text to visual text - * @link http://php.net/manual/en/function.hebrev.php - * @param string $hebrew_text

- * A Hebrew input string. - *

- * @param int $max_chars_per_line [optional]

- * This optional parameter indicates maximum number of characters per - * line that will be returned. - *

- * @return string the visual string. - */ -function hebrev ($hebrew_text, $max_chars_per_line = 0) {} - -/** - * (PHP 4, PHP 5)
- * Convert logical Hebrew text to visual text with newline conversion - * @link http://php.net/manual/en/function.hebrevc.php - * @param string $hebrew_text

- * A Hebrew input string. - *

- * @param int $max_chars_per_line [optional]

- * This optional parameter indicates maximum number of characters per - * line that will be returned. - *

- * @return string the visual string. - */ -function hebrevc ($hebrew_text, $max_chars_per_line = 0) {} - -/** - * (PHP 4, PHP 5)
- * Inserts HTML line breaks before all newlines in a string - * @link http://php.net/manual/en/function.nl2br.php - * @param string $string

- * The input string. - *

- * @param bool $is_xhtml [optional]

- * Whether to use XHTML compatible line breaks or not. - *

- * @return string the altered string. - */ -function nl2br ($string, $is_xhtml = true) {} - -/** - * (PHP 4, PHP 5)
- * Returns trailing name component of path - * @link http://php.net/manual/en/function.basename.php - * @param string $path

- * A path. - *

- *

- * On Windows, both slash (/) and backslash - * (\) are used as directory separator character. In - * other environments, it is the forward slash (/). - *

- * @param string $suffix [optional]

- * If the name component ends in suffix this will also - * be cut off. - *

- * @return string the base name of the given path. - */ -function basename ($path, $suffix = null) {} - -/** - * (PHP 4, PHP 5)
- * Returns parent directory's path - * @link http://php.net/manual/en/function.dirname.php - * @param string $path

- * A path. - *

- *

- * On Windows, both slash (/) and backslash - * (\) are used as directory separator character. In - * other environments, it is the forward slash (/). - *

- * @return string the path of the parent directory. If there are no slashes in - * path, a dot ('.') is returned, - * indicating the current directory. Otherwise, the returned string is - * path with any trailing - * /component removed. - */ -function dirname ($path) {} - -/** - * (PHP 4 >= 4.0.3, PHP 5)
- * Returns information about a file path - * @link http://php.net/manual/en/function.pathinfo.php - * @param string $path

- * The path to be parsed. - *

- * @param int $options [optional]

- * If present, specifies a specific element to be returned; one of - * PATHINFO_DIRNAME, - * PATHINFO_BASENAME, - * PATHINFO_EXTENSION or - * PATHINFO_FILENAME. - *

- *

If options is not specified, returns all - * available elements. - *

- * @return mixed If the options parameter is not passed, an - * associative array containing the following elements is - * returned: - * dirname, basename, - * extension (if any), and filename. - *

- *

- * If the path does not have an extension, no - * extension element will be returned - * (see second example below). - *

- *

- * If options is present, returns a - * string containing the requested element. - */ -function pathinfo ($path, $options = 'PATHINFO_DIRNAME | PATHINFO_BASENAME | PATHINFO_EXTENSION | PATHINFO_FILENAME') {} - -/** - * (PHP 4, PHP 5)
- * Un-quotes a quoted string - * @link http://php.net/manual/en/function.stripslashes.php - * @param string $str

- * The input string. - *

- * @return string a string with backslashes stripped off. - * (\' becomes ' and so on.) - * Double backslashes (\\) are made into a single - * backslash (\). - */ -function stripslashes ($str) {} - -/** - * (PHP 4, PHP 5)
- * Un-quote string quoted with addcslashes - * @link http://php.net/manual/en/function.stripcslashes.php - * @param string $str

- * The string to be unescaped. - *

- * @return string the unescaped string. - */ -function stripcslashes ($str) {} - -/** - * (PHP 4, PHP 5)
- * Find the first occurrence of a string - * @link http://php.net/manual/en/function.strstr.php - * @param string $haystack

- * The input string. - *

- * @param mixed $needle

- * If needle is not a string, it is converted to - * an integer and applied as the ordinal value of a character. - *

- * @param bool $before_needle [optional]

- * If TRUE, strstr returns - * the part of the haystack before the first - * occurrence of the needle (excluding the needle). - *

- * @return string the portion of string, or FALSE if needle - * is not found. - */ -function strstr ($haystack, $needle, $before_needle = false) {} - -/** - * (PHP 4, PHP 5)
- * Case-insensitive strstr - * @link http://php.net/manual/en/function.stristr.php - * @param string $haystack

- * The string to search in - *

- * @param mixed $needle

- * If needle is not a string, it is converted to - * an integer and applied as the ordinal value of a character. - *

- * @param bool $before_needle [optional]

- * If TRUE, stristr - * returns the part of the haystack before the - * first occurrence of the needle (excluding needle). - *

- * @return string the matched substring. If needle is not - * found, returns FALSE. - */ -function stristr ($haystack, $needle, $before_needle = false) {} - -/** - * (PHP 4, PHP 5)
- * Find the last occurrence of a character in a string - * @link http://php.net/manual/en/function.strrchr.php - * @param string $haystack

- * The string to search in - *

- * @param mixed $needle

- * If needle contains more than one character, - * only the first is used. This behavior is different from that of - * strstr. - *

- *

- * If needle is not a string, it is converted to - * an integer and applied as the ordinal value of a character. - *

- * @return string This function returns the portion of string, or FALSE if - * needle is not found. - */ -function strrchr ($haystack, $needle) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Randomly shuffles a string - * @link http://php.net/manual/en/function.str-shuffle.php - * @param string $str

- * The input string. - *

- * @return string the shuffled string. - */ -function str_shuffle ($str) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Return information about words used in a string - * @link http://php.net/manual/en/function.str-word-count.php - * @param string $string

- * The string - *

- * @param int $format [optional]

- * Specify the return value of this function. The current supported values - * are: - * 0 - returns the number of words found - * @param string $charlist [optional]

- * A list of additional characters which will be considered as 'word' - *

- * @return mixed an array or an integer, depending on the - * format chosen. - */ -function str_word_count ($string, $format = 0, $charlist = null) {} - -/** - * (PHP 5)
- * Convert a string to an array - * @link http://php.net/manual/en/function.str-split.php - * @param string $string

- * The input string. - *

- * @param int $split_length [optional]

- * Maximum length of the chunk. - *

- * @return array If the optional split_length parameter is - * specified, the returned array will be broken down into chunks with each - * being split_length in length, otherwise each chunk - * will be one character in length. - *

- *

- * FALSE is returned if split_length is less than 1. - * If the split_length length exceeds the length of - * string, the entire string is returned as the first - * (and only) array element. - */ -function str_split ($string, $split_length = 1) {} - -/** - * (PHP 5)
- * Search a string for any of a set of characters - * @link http://php.net/manual/en/function.strpbrk.php - * @param string $haystack

- * The string where char_list is looked for. - *

- * @param string $char_list

- * This parameter is case sensitive. - *

- * @return string a string starting from the character found, or FALSE if it is - * not found. - */ -function strpbrk ($haystack, $char_list) {} - -/** - * (PHP 5)
- * Binary safe comparison of two strings from an offset, up to length characters - * @link http://php.net/manual/en/function.substr-compare.php - * @param string $main_str

- * The main string being compared. - *

- * @param string $str

- * The secondary string being compared. - *

- * @param int $offset

- * The start position for the comparison. If negative, it starts counting - * from the end of the string. - *

- * @param int $length [optional]

- * The length of the comparison. The default value is the largest of the - * length of the str compared to the length of - * main_str less the - * offset. - *

- * @param bool $case_insensitivity [optional]

- * If case_insensitivity is TRUE, comparison is - * case insensitive. - *

- * @return int < 0 if main_str from position - * offset is less than str, > - * 0 if it is greater than str, and 0 if they are equal. - * If offset is equal to or greater than the length of - * main_str or length is set and - * is less than 1, substr_compare prints a warning and returns - * FALSE. - */ -function substr_compare ($main_str, $str, $offset, $length = null, $case_insensitivity = false) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Locale based string comparison - * @link http://php.net/manual/en/function.strcoll.php - * @param string $str1

- * The first string. - *

- * @param string $str2

- * The second string. - *

- * @return int < 0 if str1 is less than - * str2; > 0 if - * str1 is greater than - * str2, and 0 if they are equal. - */ -function strcoll ($str1, $str2) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Formats a number as a currency string - * @link http://php.net/manual/en/function.money-format.php - * @param string $format

- * The format specification consists of the following sequence: - *

a % character

- * @param float $number

- * The number to be formatted. - *

- * @return string the formatted string. Characters before and after the formatting - * string will be returned unchanged. - * Non-numeric number causes returning NULL and - * emitting E_WARNING. - */ -function money_format ($format, $number) {} - -/** - * (PHP 4, PHP 5)
- * Return part of a string - * @link http://php.net/manual/en/function.substr.php - * @param string $string

- * The input string. Must be one character or longer. - *

- * @param int $start

- * If start is non-negative, the returned string - * will start at the start'th position in - * string, counting from zero. For instance, - * in the string 'abcdef', the character at - * position 0 is 'a', the - * character at position 2 is - * 'c', and so forth. - *

- *

- * If start is negative, the returned string - * will start at the start'th character - * from the end of string. - *

- *

- * If string is less than or equal to - * start characters long, FALSE will be returned. - *

- *

- * Using a negative start - * - * $rest = substr("abcdef", -1); // returns "f" - * $rest = substr("abcdef", -2); // returns "ef" - * $rest = substr("abcdef", -3, 1); // returns "d" - * - *

- * @param int $length [optional]

- * If length is given and is positive, the string - * returned will contain at most length characters - * beginning from start (depending on the length of - * string). - *

- *

- * If length is given and is negative, then that many - * characters will be omitted from the end of string - * (after the start position has been calculated when a - * start is negative). If - * start denotes the position of this truncation or - * beyond, false will be returned. - *

- *

- * If length is given and is 0, - * FALSE or NULL an empty string will be returned. - *

- *

- * If length is omitted, the substring starting from - * start until the end of the string will be - * returned. - *

- * Using a negative length - * - * $rest = substr("abcdef", 0, -1); // returns "abcde" - * $rest = substr("abcdef", 2, -1); // returns "cde" - * $rest = substr("abcdef", 4, -4); // returns false - * $rest = substr("abcdef", -3, -1); // returns "de" - * - * @return string the extracted part of string; or FALSE on failure, or - * an empty string. - */ -function substr ($string, $start, $length = null) {} - -/** - * (PHP 4, PHP 5)
- * Replace text within a portion of a string - * @link http://php.net/manual/en/function.substr-replace.php - * @param mixed $string

- * The input string. - *

- *

- * An array of strings can be provided, in which - * case the replacements will occur on each string in turn. In this case, - * the replacement, start - * and length parameters may be provided either as - * scalar values to be applied to each input string in turn, or as - * arrays, in which case the corresponding array element will - * be used for each input string. - *

- * @param mixed $replacement

- * The replacement string. - *

- * @param mixed $start

- * If start is positive, the replacing will - * begin at the start'th offset into - * string. - *

- *

- * If start is negative, the replacing will - * begin at the start'th character from the - * end of string. - *

- * @param mixed $length [optional]

- * If given and is positive, it represents the length of the portion of - * string which is to be replaced. If it is - * negative, it represents the number of characters from the end of - * string at which to stop replacing. If it - * is not given, then it will default to strlen( - * string ); i.e. end the replacing at the - * end of string. Of course, if - * length is zero then this function will have the - * effect of inserting replacement into - * string at the given - * start offset. - *

- * @return mixed The result string is returned. If string is an - * array then array is returned. - */ -function substr_replace ($string, $replacement, $start, $length = null) {} - -/** - * (PHP 4, PHP 5)
- * Quote meta characters - * @link http://php.net/manual/en/function.quotemeta.php - * @param string $str

- * The input string. - *

- * @return string the string with meta characters quoted, or FALSE if an empty - * string is given as str. - */ -function quotemeta ($str) {} - -/** - * (PHP 4, PHP 5)
- * Make a string's first character uppercase - * @link http://php.net/manual/en/function.ucfirst.php - * @param string $str

- * The input string. - *

- * @return string the resulting string. - */ -function ucfirst ($str) {} - -/** - * (PHP 5 >= 5.3.0)
- * Make a string's first character lowercase - * @link http://php.net/manual/en/function.lcfirst.php - * @param string $str

- * The input string. - *

- * @return string the resulting string. - */ -function lcfirst ($str) {} - -/** - * (PHP 4, PHP 5)
- * Uppercase the first character of each word in a string - * @link http://php.net/manual/en/function.ucwords.php - * @param string $str

- * The input string. - *

- * @return string the modified string. - */ -function ucwords ($str) {} - -/** - * (PHP 4, PHP 5)
- * Translate characters or replace substrings - * @link http://php.net/manual/en/function.strtr.php - * @param string $str

- * The string being translated. - *

- * @param string $from

- * The string being translated to to. - *

- * @param string $to

- * The string replacing from. - *

- * @return string the translated string. - *

- *

- * If replace_pairs contains a key which - * is an empty string (""), - * FALSE will be returned. - */ -function strtr ($str, $from, $to) {} - -/** - * (PHP 4, PHP 5)
- * Quote string with slashes - * @link http://php.net/manual/en/function.addslashes.php - * @param string $str

- * The string to be escaped. - *

- * @return string the escaped string. - */ -function addslashes ($str) {} - -/** - * (PHP 4, PHP 5)
- * Quote string with slashes in a C style - * @link http://php.net/manual/en/function.addcslashes.php - * @param string $str

- * The string to be escaped. - *

- * @param string $charlist

- * A list of characters to be escaped. If - * charlist contains characters - * \n, \r etc., they are - * converted in C-like style, while other non-alphanumeric characters - * with ASCII codes lower than 32 and higher than 126 converted to - * octal representation. - *

- *

- * When you define a sequence of characters in the charlist argument - * make sure that you know what characters come between the - * characters that you set as the start and end of the range. - * - * echo addcslashes('foo[ ]', 'A..z'); - * // output: \f\o\o\[ \] - * // All upper and lower-case letters will be escaped - * // ... but so will the [\]^_` - * - * Also, if the first character in a range has a higher ASCII value - * than the second character in the range, no range will be - * constructed. Only the start, end and period characters will be - * escaped. Use the ord function to find the - * ASCII value for a character. - * - * echo addcslashes("zoo['.']", 'z..A'); - * // output: \zoo['\.'] - * - *

- *

- * Be careful if you choose to escape characters 0, a, b, f, n, r, - * t and v. They will be converted to \0, \a, \b, \f, \n, \r, \t - * and \v. - * In PHP \0 (NULL), \r (carriage return), \n (newline), \f (form feed), - * \v (vertical tab) and \t (tab) are predefined escape sequences, - * while in C all of these are predefined escape sequences. - *

- * @return string the escaped string. - */ -function addcslashes ($str, $charlist) {} - -/** - * (PHP 4, PHP 5)
- * Strip whitespace (or other characters) from the end of a string - * @link http://php.net/manual/en/function.rtrim.php - * @param string $str

- * The input string. - *

- * @param string $charlist [optional]

- * You can also specify the characters you want to strip, by means - * of the charlist parameter. - * Simply list all characters that you want to be stripped. With - * .. you can specify a range of characters. - *

- * @return string the modified string. - */ -function rtrim ($str, $charlist = null) {} - -/** - * (PHP 4, PHP 5)
- * Replace all occurrences of the search string with the replacement string - * @link http://php.net/manual/en/function.str-replace.php - * @param mixed $search

- * The value being searched for, otherwise known as the needle. - * An array may be used to designate multiple needles. - *

- * @param mixed $replace

- * The replacement value that replaces found search - * values. An array may be used to designate multiple replacements. - *

- * @param mixed $subject

- * The string or array being searched and replaced on, - * otherwise known as the haystack. - *

- *

- * If subject is an array, then the search and - * replace is performed with every entry of - * subject, and the return value is an array as - * well. - *

- * @param int $count [optional]

- * If passed, this will be set to the number of replacements performed. - *

- * @return mixed This function returns a string or an array with the replaced values. - */ -function str_replace ($search, $replace, $subject, &$count = null) {} - -/** - * (PHP 5)
- * Case-insensitive version of str_replace. - * @link http://php.net/manual/en/function.str-ireplace.php - * @param mixed $search

- * The value being searched for, otherwise known as the - * needle. An array may be used to designate - * multiple needles. - *

- * @param mixed $replace

- * The replacement value that replaces found search - * values. An array may be used to designate multiple replacements. - *

- * @param mixed $subject

- * The string or array being searched and replaced on, - * otherwise known as the haystack. - *

- *

- * If subject is an array, then the search and - * replace is performed with every entry of - * subject, and the return value is an array as - * well. - *

- * @param int $count [optional]

- * If passed, this will be set to the number of replacements performed. - *

- * @return mixed a string or an array of replacements. - */ -function str_ireplace ($search, $replace, $subject, &$count = null) {} - -/** - * (PHP 4, PHP 5)
- * Repeat a string - * @link http://php.net/manual/en/function.str-repeat.php - * @param string $input

- * The string to be repeated. - *

- * @param int $multiplier

- * Number of time the input string should be - * repeated. - *

- *

- * multiplier has to be greater than or equal to 0. - * If the multiplier is set to 0, the function - * will return an empty string. - *

- * @return string the repeated string. - */ -function str_repeat ($input, $multiplier) {} - -/** - * (PHP 4, PHP 5)
- * Return information about characters used in a string - * @link http://php.net/manual/en/function.count-chars.php - * @param string $string

- * The examined string. - *

- * @param int $mode [optional]

- * See return values. - *

- * @return mixed Depending on mode - * count_chars returns one of the following: - * 0 - an array with the byte-value as key and the frequency of - * every byte as value. - * 1 - same as 0 but only byte-values with a frequency greater - * than zero are listed. - * 2 - same as 0 but only byte-values with a frequency equal to - * zero are listed. - * 3 - a string containing all unique characters is returned. - * 4 - a string containing all not used characters is returned. - */ -function count_chars ($string, $mode = 0) {} - -/** - * (PHP 4, PHP 5)
- * Split a string into smaller chunks - * @link http://php.net/manual/en/function.chunk-split.php - * @param string $body

- * The string to be chunked. - *

- * @param int $chunklen [optional]

- * The chunk length. - *

- * @param string $end [optional]

- * The line ending sequence. - *

- * @return string the chunked string. - */ -function chunk_split ($body, $chunklen = 76, $end = "\r\n") {} - -/** - * (PHP 4, PHP 5)
- * Strip whitespace (or other characters) from the beginning and end of a string - * @link http://php.net/manual/en/function.trim.php - * @param string $str

- * The string that will be trimmed. - *

- * @param string $charlist [optional]

- * Optionally, the stripped characters can also be specified using - * the charlist parameter. - * Simply list all characters that you want to be stripped. With - * .. you can specify a range of characters. - *

- * @return string The trimmed string. - */ -function trim ($str, $charlist = null) {} - -/** - * (PHP 4, PHP 5)
- * Strip whitespace (or other characters) from the beginning of a string - * @link http://php.net/manual/en/function.ltrim.php - * @param string $str

- * The input string. - *

- * @param string $charlist [optional]

- * You can also specify the characters you want to strip, by means of the - * charlist parameter. - * Simply list all characters that you want to be stripped. With - * .. you can specify a range of characters. - *

- * @return string This function returns a string with whitespace stripped from the - * beginning of str. - * Without the second parameter, - * ltrim will strip these characters: - * " " (ASCII 32 - * (0x20)), an ordinary space. - * "\t" (ASCII 9 - * (0x09)), a tab. - * "\n" (ASCII 10 - * (0x0A)), a new line (line feed). - * "\r" (ASCII 13 - * (0x0D)), a carriage return. - * "\0" (ASCII 0 - * (0x00)), the NUL-byte. - * "\x0B" (ASCII 11 - * (0x0B)), a vertical tab. - */ -function ltrim ($str, $charlist = null) {} - -/** - * (PHP 4, PHP 5)
- * Strip HTML and PHP tags from a string - * @link http://php.net/manual/en/function.strip-tags.php - * @param string $str

- * The input string. - *

- * @param string $allowable_tags [optional]

- * You can use the optional second parameter to specify tags which should - * not be stripped. - *

- *

- * HTML comments and PHP tags are also stripped. This is hardcoded and - * can not be changed with allowable_tags. - *

- *

- * This parameter should not contain whitespace. - * strip_tags sees a tag as a case-insensitive - * string between < and the first whitespace or - * >. It means that - * strip_tags("<br/>", "<br>") returns an - * empty string. - *

- * @return string the stripped string. - */ -function strip_tags ($str, $allowable_tags = null) {} - -/** - * (PHP 4, PHP 5)
- * Calculate the similarity between two strings - * @link http://php.net/manual/en/function.similar-text.php - * @param string $first

- * The first string. - *

- * @param string $second

- * The second string. - *

- * @param float $percent [optional]

- * By passing a reference as third argument, - * similar_text will calculate the similarity in - * percent for you. - *

- * @return int the number of matching chars in both strings. - */ -function similar_text ($first, $second, &$percent = null) {} - -/** - * (PHP 4, PHP 5)
- * Split a string by string - * @link http://php.net/manual/en/function.explode.php - * @param string $delimiter

- * The boundary string. - *

- * @param string $string

- * The input string. - *

- * @param int $limit [optional]

- * If limit is set and positive, the returned array will contain - * a maximum of limit elements with the last - * element containing the rest of string. - *

- *

- * If the limit parameter is negative, all components - * except the last -limit are returned. - *

- *

- * If the limit parameter is zero, then this is treated as 1. - *

- * @return array an array of strings - * created by splitting the string parameter on - * boundaries formed by the delimiter. - *

- *

- * If delimiter is an empty string (""), - * explode will return FALSE. - * If delimiter contains a value that is not - * contained in string and a negative - * limit is used, then an empty array will be - * returned, otherwise an array containing - * string will be returned. - */ -function explode ($delimiter, $string, $limit = null) {} - -/** - * (PHP 4, PHP 5)
- * Join array elements with a string - * @link http://php.net/manual/en/function.implode.php - * @param string $glue

- * Defaults to an empty string. This is not the preferred usage of - * implode as glue would be - * the second parameter and thus, the bad prototype would be used. - *

- * @param array $pieces

- * The array of strings to implode. - *

- * @return string a string containing a string representation of all the array - * elements in the same order, with the glue string between each element. - */ -function implode ($glue, array $pieces) {} - -/** - * (PHP 4, PHP 5)
- * Alias of implode - * @link http://php.net/manual/en/function.join.php - * @param $glue - * @param $pieces - */ -function join ($glue, $pieces) {} - -/** - * (PHP 4, PHP 5)
- * Set locale information - * @link http://php.net/manual/en/function.setlocale.php - * @param int $category

- * category is a named constant specifying the - * category of the functions affected by the locale setting: - * LC_ALL for all of the below - * @param string $locale

- * If locale is NULL or the empty string - * "", the locale names will be set from the - * values of environment variables with the same names as the above - * categories, or from "LANG". - *

- *

- * If locale is "0", - * the locale setting is not affected, only the current setting is returned. - *

- *

- * If locale is an array or followed by additional - * parameters then each array element or parameter is tried to be set as - * new locale until success. This is useful if a locale is known under - * different names on different systems or for providing a fallback - * for a possibly not available locale. - *

- * @param string $_ [optional]

- * (Optional string or array parameters to try as locale settings until - * success.) - *

- * @return string the new current locale, or FALSE if the locale functionality is - * not implemented on your platform, the specified locale does not exist or - * the category name is invalid. - *

- *

- * An invalid category name also causes a warning message. Category/locale - * names can be found in RFC 1766 - * and ISO 639. - * Different systems have different naming schemes for locales. - *

- *

- * The return value of setlocale depends - * on the system that PHP is running. It returns exactly - * what the system setlocale function returns. - */ -function setlocale ($category, $locale, $_ = null) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Get numeric formatting information - * @link http://php.net/manual/en/function.localeconv.php - * @return array localeconv returns data based upon the current locale - * as set by setlocale. The associative array that is - * returned contains the following fields: - * - * Array element - * Description - * - * - * decimal_point - * Decimal point character - * - * - * thousands_sep - * Thousands separator - * - * - * grouping - * Array containing numeric groupings - * - * - * int_curr_symbol - * International currency symbol (i.e. USD) - * - * - * currency_symbol - * Local currency symbol (i.e. $) - * - * - * mon_decimal_point - * Monetary decimal point character - * - * - * mon_thousands_sep - * Monetary thousands separator - * - * - * mon_grouping - * Array containing monetary groupings - * - * - * positive_sign - * Sign for positive values - * - * - * negative_sign - * Sign for negative values - * - * - * int_frac_digits - * International fractional digits - * - * - * frac_digits - * Local fractional digits - * - * - * p_cs_precedes - * - * TRUE if currency_symbol precedes a positive value, FALSE - * if it succeeds one - * - * - * - * p_sep_by_space - * - * TRUE if a space separates currency_symbol from a positive - * value, FALSE otherwise - * - * - * - * n_cs_precedes - * - * TRUE if currency_symbol precedes a negative value, FALSE - * if it succeeds one - * - * - * - * n_sep_by_space - * - * TRUE if a space separates currency_symbol from a negative - * value, FALSE otherwise - * - * - * p_sign_posn - * - * 0 - Parentheses surround the quantity and currency_symbol - * 1 - The sign string precedes the quantity and currency_symbol - * 2 - The sign string succeeds the quantity and currency_symbol - * 3 - The sign string immediately precedes the currency_symbol - * 4 - The sign string immediately succeeds the currency_symbol - * - * - * n_sign_posn - * - * 0 - Parentheses surround the quantity and currency_symbol - * 1 - The sign string precedes the quantity and currency_symbol - * 2 - The sign string succeeds the quantity and currency_symbol - * 3 - The sign string immediately precedes the currency_symbol - * 4 - The sign string immediately succeeds the currency_symbol - * - * - *

- *

- * The p_sign_posn, and n_sign_posn contain a string - * of formatting options. Each number representing one of the above listed conditions. - *

- *

- * The grouping fields contain arrays that define the way numbers should be - * grouped. For example, the monetary grouping field for the nl_NL locale (in - * UTF-8 mode with the euro sign), would contain a 2 item array with the - * values 3 and 3. The higher the index in the array, the farther left the - * grouping is. If an array element is equal to CHAR_MAX, - * no further grouping is done. If an array element is equal to 0, the previous - * element should be used. - */ -function localeconv () {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Query language and locale information - * @link http://php.net/manual/en/function.nl-langinfo.php - * @param int $item

- * item may be an integer value of the element or the - * constant name of the element. The following is a list of constant names - * for item that may be used and their description. - * Some of these constants may not be defined or hold no value for certain - * locales. - * - * nl_langinfo Constants - * - * - * - * - * - * LC_TIME Category Constants - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * LC_MONETARY Category Constants - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * Returns 0 if parentheses surround the quantity and CURRENCY_SYMBOL. - * @return string the element as a string, or FALSE if item - * is not valid. - */ -function nl_langinfo ($item) {} - -/** - * (PHP 4, PHP 5)
- * Calculate the soundex key of a string - * @link http://php.net/manual/en/function.soundex.php - * @param string $str

- * The input string. - *

- * @return string the soundex key as a string. - */ -function soundex ($str) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Calculate Levenshtein distance between two strings - * @link http://php.net/manual/en/function.levenshtein.php - * @param string $str1

- * One of the strings being evaluated for Levenshtein distance. - *

- * @param string $str2

- * One of the strings being evaluated for Levenshtein distance. - *

- * @return int This function returns the Levenshtein-Distance between the - * two argument strings or -1, if one of the argument strings - * is longer than the limit of 255 characters. - */ -function levenshtein ($str1, $str2) {} - -/** - * (PHP 4, PHP 5)
- * Return a specific character - * @link http://php.net/manual/en/function.chr.php - * @param int $ascii

- * The ascii code. - *

- * @return string the specified character. - */ -function chr ($ascii) {} - -/** - * (PHP 4, PHP 5)
- * Return ASCII value of character - * @link http://php.net/manual/en/function.ord.php - * @param string $string

- * A character. - *

- * @return int the ASCII value as an integer. - */ -function ord ($string) {} - -/** - * (PHP 4, PHP 5)
- * Parses the string into variables - * @link http://php.net/manual/en/function.parse-str.php - * @param string $str

- * The input string. - *

- * @param array $arr [optional]

- * If the second parameter arr is present, - * variables are stored in this variable as array elements instead. - *

- * @return void No value is returned. - */ -function parse_str ($str, array &$arr = null) {} - -/** - * (PHP 5 >= 5.3.0)
- * Parse a CSV string into an array - * @link http://php.net/manual/en/function.str-getcsv.php - * @param string $input

- * The string to parse. - *

- * @param string $delimiter [optional]

- * Set the field delimiter (one character only). - *

- * @param string $enclosure [optional]

- * Set the field enclosure character (one character only). - *

- * @param string $escape [optional]

- * Set the escape character (one character only). Defaults as a backslash - * (\) - *

- * @return array an indexed array containing the fields read. - */ -function str_getcsv ($input, $delimiter = ',', $enclosure = '"', $escape = '\\') {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Pad a string to a certain length with another string - * @link http://php.net/manual/en/function.str-pad.php - * @param string $input

- * The input string. - *

- * @param int $pad_length

- * If the value of pad_length is negative, - * less than, or equal to the length of the input string, no padding - * takes place. - *

- * @param string $pad_string [optional]

- * The pad_string may be truncated if the - * required number of padding characters can't be evenly divided by the - * pad_string's length. - *

- * @param int $pad_type [optional]

- * Optional argument pad_type can be - * STR_PAD_RIGHT, STR_PAD_LEFT, - * or STR_PAD_BOTH. If - * pad_type is not specified it is assumed to be - * STR_PAD_RIGHT. - *

- * @return string the padded string. - */ -function str_pad ($input, $pad_length, $pad_string = " ", $pad_type = 'STR_PAD_RIGHT') {} - -/** - * (PHP 4, PHP 5)
- * Alias of rtrim - * @link http://php.net/manual/en/function.chop.php - * @param $str - * @param $character_mask [optional] - */ -function chop ($str, $character_mask) {} - -/** - * (PHP 4, PHP 5)
- * Alias of strstr - * @link http://php.net/manual/en/function.strchr.php - * @param $haystack - * @param $needle - * @param $part [optional] - */ -function strchr ($haystack, $needle, $part) {} - -/** - * (PHP 4, PHP 5)
- * Return a formatted string - * @link http://php.net/manual/en/function.sprintf.php - * @param string $format

- * The format string is composed of zero or more directives: - * ordinary characters (excluding %) that are - * copied directly to the result, and conversion - * specifications, each of which results in fetching its - * own parameter. This applies to both sprintf - * and printf. - *

- *

- * Each conversion specification consists of a percent sign - * (%), followed by one or more of these - * elements, in order: - * An optional sign specifier that forces a sign - * (- or +) to be used on a number. By default, only the - sign is used - * on a number if it's negative. This specifier forces positive numbers - * to have the + sign attached as well, and was added in PHP 4.3.0. - * @param mixed $args [optional] - * @param mixed $_ [optional] - * @return string a string produced according to the formatting string - * format. - */ -function sprintf ($format, $args = null, $_ = null) {} - -/** - * (PHP 4, PHP 5)
- * Output a formatted string - * @link http://php.net/manual/en/function.printf.php - * @param string $format

- * See sprintf for a description of - * format. - *

- * @param mixed $args [optional] - * @param mixed $_ [optional] - * @return int the length of the outputted string. - */ -function printf ($format, $args = null, $_ = null) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Output a formatted string - * @link http://php.net/manual/en/function.vprintf.php - * @param string $format

- * See sprintf for a description of - * format. - *

- * @param array $args - * @return int the length of the outputted string. - */ -function vprintf ($format, array $args) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Return a formatted string - * @link http://php.net/manual/en/function.vsprintf.php - * @param string $format

- * See sprintf for a description of - * format. - *

- * @param array $args - * @return string Return array values as a formatted string according to - * format (which is described in the documentation - * for sprintf). - */ -function vsprintf ($format, array $args) {} - -/** - * (PHP 5)
- * Write a formatted string to a stream - * @link http://php.net/manual/en/function.fprintf.php - * @param resource $handle A file system pointer resource - * that is typically created using fopen.

- * @param string $format

- * See sprintf for a description of - * format. - *

- * @param mixed $args [optional] - * @param mixed $_ [optional] - * @return int the length of the string written. - */ -function fprintf ($handle, $format, $args = null, $_ = null) {} - -/** - * (PHP 5)
- * Write a formatted string to a stream - * @link http://php.net/manual/en/function.vfprintf.php - * @param resource $handle - * @param string $format

- * See sprintf for a description of - * format. - *

- * @param array $args - * @return int the length of the outputted string. - */ -function vfprintf ($handle, $format, array $args) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Parses input from a string according to a format - * @link http://php.net/manual/en/function.sscanf.php - * @param string $str

- * The input string being parsed. - *

- * @param string $format

- * The interpreted format for str, which is - * described in the documentation for sprintf with - * following differences: - * Function is not locale-aware. - * F, g, G and - * b are not supported. - * D stands for decimal number. - * i stands for integer with base detection. - * n stands for number of characters processed so far. - *

- * @param mixed $_ [optional]

- * Optionally pass in variables by reference that will contain the parsed values. - *

- * @return mixed If only two parameters were passed to this function, the values parsed will - * be returned as an array. Otherwise, if optional parameters are passed, the - * function will return the number of assigned values. The optional parameters - * must be passed by reference. - *

- *

- * If there are more substrings expected in the format - * than there are available within str, - * -1 will be returned. - */ -function sscanf ($str, $format, &$_ = null) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Parses input from a file according to a format - * @link http://php.net/manual/en/function.fscanf.php - * @param resource $handle A file system pointer resource - * that is typically created using fopen.

- * @param string $format

- * The specified format as described in the - * sprintf documentation. - *

- * @param mixed $_ [optional]

- * The optional assigned values. - *

- * @return mixed If only two parameters were passed to this function, the values parsed will be - * returned as an array. Otherwise, if optional parameters are passed, the - * function will return the number of assigned values. The optional - * parameters must be passed by reference. - */ -function fscanf ($handle, $format, &$_ = null) {} - -/** - * (PHP 4, PHP 5)
- * Parse a URL and return its components - * @link http://php.net/manual/en/function.parse-url.php - * @param string $url

- * The URL to parse. Invalid characters are replaced by - * _. - *

- * @param int $component [optional]

- * Specify one of PHP_URL_SCHEME, - * PHP_URL_HOST, PHP_URL_PORT, - * PHP_URL_USER, PHP_URL_PASS, - * PHP_URL_PATH, PHP_URL_QUERY - * or PHP_URL_FRAGMENT to retrieve just a specific - * URL component as a string (except when - * PHP_URL_PORT is given, in which case the return - * value will be an integer). - *

- * @return mixed On seriously malformed URLs, parse_url may return - * FALSE. - *

- *

- * If the component parameter is omitted, an - * associative array is returned. At least one element will be - * present within the array. Potential keys within this array are: - * scheme - e.g. http - * host - * port - * user - * pass - * path - * query - after the question mark ? - * fragment - after the hashmark # - *

- *

- * If the component parameter is specified, - * parse_url returns a string (or an - * integer, in the case of PHP_URL_PORT) - * instead of an array. If the requested component doesn't exist - * within the given URL, NULL will be returned. - */ -function parse_url ($url, $component = -1) {} - -/** - * (PHP 4, PHP 5)
- * URL-encodes string - * @link http://php.net/manual/en/function.urlencode.php - * @param string $str

- * The string to be encoded. - *

- * @return string a string in which all non-alphanumeric characters except - * -_. have been replaced with a percent - * (%) sign followed by two hex digits and spaces encoded - * as plus (+) signs. It is encoded the same way that the - * posted data from a WWW form is encoded, that is the same way as in - * application/x-www-form-urlencoded media type. This - * differs from the RFC 3986 encoding (see - * rawurlencode) in that for historical reasons, spaces - * are encoded as plus (+) signs. - */ -function urlencode ($str) {} - -/** - * (PHP 4, PHP 5)
- * Decodes URL-encoded string - * @link http://php.net/manual/en/function.urldecode.php - * @param string $str

- * The string to be decoded. - *

- * @return string the decoded string. - */ -function urldecode ($str) {} - -/** - * (PHP 4, PHP 5)
- * URL-encode according to RFC 3986 - * @link http://php.net/manual/en/function.rawurlencode.php - * @param string $str

- * The URL to be encoded. - *

- * @return string a string in which all non-alphanumeric characters except - * -_.~ have been replaced with a percent - * (%) sign followed by two hex digits. This is the - * encoding described in RFC 3986 for - * protecting literal characters from being interpreted as special URL - * delimiters, and for protecting URLs from being mangled by transmission - * media with character conversions (like some email systems). - *

- * Prior to PHP 5.3.0, rawurlencode encoded tildes (~) as per - * RFC 1738. - *

- */ -function rawurlencode ($str) {} - -/** - * (PHP 4, PHP 5)
- * Decode URL-encoded strings - * @link http://php.net/manual/en/function.rawurldecode.php - * @param string $str

- * The URL to be decoded. - *

- * @return string the decoded URL, as a string. - */ -function rawurldecode ($str) {} - -/** - * (PHP 5)
- * Generate URL-encoded query string - * @link http://php.net/manual/en/function.http-build-query.php - * @param mixed $query_data

- * May be an array or object containing properties. - *

- *

- * If query_data is an array, it may be a simple - * one-dimensional structure, or an array of arrays (which in - * turn may contain other arrays). - *

- *

- * If query_data is an object, then only public - * properties will be incorporated into the result. - *

- * @param string $numeric_prefix [optional]

- * If numeric indices are used in the base array and this parameter is - * provided, it will be prepended to the numeric index for elements in - * the base array only. - *

- *

- * This is meant to allow for legal variable names when the data is - * decoded by PHP or another CGI application later on. - *

- * @param string $arg_separator [optional]

- * arg_separator.output - * is used to separate arguments, unless this parameter is specified, - * and is then used. - *

- * @param int $enc_type [optional]

- * By default, PHP_QUERY_RFC1738. - *

- *

- * If enc_type is - * PHP_QUERY_RFC1738, then encoding is performed per - * RFC 1738 and the - * application/x-www-form-urlencoded media type, which - * implies that spaces are encoded as plus (+) signs. - *

- *

- * If enc_type is - * PHP_QUERY_RFC3986, then encoding is performed - * according to RFC 3986, and - * spaces will be percent encoded (%20). - *

- * @return string a URL-encoded string. - */ -function http_build_query ($query_data, $numeric_prefix = null, $arg_separator = null, $enc_type = 'PHP_QUERY_RFC1738') {} - -/** - * (PHP 4, PHP 5)
- * Returns the target of a symbolic link - * @link http://php.net/manual/en/function.readlink.php - * @param string $path

- * The symbolic link path. - *

- * @return string the contents of the symbolic link path or FALSE on error. - */ -function readlink ($path) {} - -/** - * (PHP 4, PHP 5)
- * Gets information about a link - * @link http://php.net/manual/en/function.linkinfo.php - * @param string $path

- * Path to the link. - *

- * @return int linkinfo returns the st_dev field - * of the Unix C stat structure returned by the lstat - * system call. Returns 0 or FALSE in case of error. - */ -function linkinfo ($path) {} - -/** - * (PHP 4, PHP 5)
- * Creates a symbolic link - * @link http://php.net/manual/en/function.symlink.php - * @param string $target

- * Target of the link. - *

- * @param string $link

- * The link name. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function symlink ($target, $link) {} - -/** - * (PHP 4, PHP 5)
- * Create a hard link - * @link http://php.net/manual/en/function.link.php - * @param string $target

- * Target of the link. - *

- * @param string $link

- * The link name. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function link ($target, $link) {} - -/** - * (PHP 4, PHP 5)
- * Deletes a file - * @link http://php.net/manual/en/function.unlink.php - * @param string $filename

- * Path to the file. - *

- * @param resource $context [optional] Context support was added - * with PHP 5.0.0. For a description of contexts, refer to - * . - * @return bool TRUE on success or FALSE on failure. - */ -function unlink ($filename, $context = null) {} - -/** - * (PHP 4, PHP 5)
- * Execute an external program - * @link http://php.net/manual/en/function.exec.php - * @param string $command

- * The command that will be executed. - *

- * @param array $output [optional]

- * If the output argument is present, then the - * specified array will be filled with every line of output from the - * command. Trailing whitespace, such as \n, is not - * included in this array. Note that if the array already contains some - * elements, exec will append to the end of the array. - * If you do not want the function to append elements, call - * unset on the array before passing it to - * exec. - *

- * @param int $return_var [optional]

- * If the return_var argument is present - * along with the output argument, then the - * return status of the executed command will be written to this - * variable. - *

- * @return string The last line from the result of the command. If you need to execute a - * command and have all the data from the command passed directly back without - * any interference, use the passthru function. - *

- *

- * To get the output of the executed command, be sure to set and use the - * output parameter. - */ -function exec ($command, array &$output = null, &$return_var = null) {} - -/** - * (PHP 4, PHP 5)
- * Execute an external program and display the output - * @link http://php.net/manual/en/function.system.php - * @param string $command

- * The command that will be executed. - *

- * @param int $return_var [optional]

- * If the return_var argument is present, then the - * return status of the executed command will be written to this - * variable. - *

- * @return string the last line of the command output on success, and FALSE - * on failure. - */ -function system ($command, &$return_var = null) {} - -/** - * (PHP 4, PHP 5)
- * Escape shell metacharacters - * @link http://php.net/manual/en/function.escapeshellcmd.php - * @param string $command

- * The command that will be escaped. - *

- * @return string The escaped string. - */ -function escapeshellcmd ($command) {} - -/** - * (PHP 4 >= 4.0.3, PHP 5)
- * Escape a string to be used as a shell argument - * @link http://php.net/manual/en/function.escapeshellarg.php - * @param string $arg

- * The argument that will be escaped. - *

- * @return string The escaped string. - */ -function escapeshellarg ($arg) {} - -/** - * (PHP 4, PHP 5)
- * Execute an external program and display raw output - * @link http://php.net/manual/en/function.passthru.php - * @param string $command

- * The command that will be executed. - *

- * @param int $return_var [optional]

- * If the return_var argument is present, the - * return status of the Unix command will be placed here. - *

- * @return void No value is returned. - */ -function passthru ($command, &$return_var = null) {} - -/** - * (PHP 4, PHP 5)
- * Execute command via shell and return the complete output as a string - * @link http://php.net/manual/en/function.shell-exec.php - * @param string $cmd

- * The command that will be executed. - *

- * @return string The output from the executed command or NULL if an error occurred. - */ -function shell_exec ($cmd) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Execute a command and open file pointers for input/output - * @link http://php.net/manual/en/function.proc-open.php - * @param string $cmd

- * The command to execute - *

- * @param array $descriptorspec

- * An indexed array where the key represents the descriptor number and the - * value represents how PHP will pass that descriptor to the child - * process. 0 is stdin, 1 is stdout, while 2 is stderr. - *

- *

- * Each element can be: - * An array describing the pipe to pass to the process. The first - * element is the descriptor type and the second element is an option for - * the given type. Valid types are pipe (the second - * element is either r to pass the read end of the pipe - * to the process, or w to pass the write end) and - * file (the second element is a filename). - * A stream resource representing a real file descriptor (e.g. opened file, - * a socket, STDIN). - *

- *

- * The file descriptor numbers are not limited to 0, 1 and 2 - you may - * specify any valid file descriptor number and it will be passed to the - * child process. This allows your script to interoperate with other - * scripts that run as "co-processes". In particular, this is useful for - * passing passphrases to programs like PGP, GPG and openssl in a more - * secure manner. It is also useful for reading status information - * provided by those programs on auxiliary file descriptors. - *

- * @param array $pipes

- * Will be set to an indexed array of file pointers that correspond to - * PHP's end of any pipes that are created. - *

- * @param string $cwd [optional]

- * The initial working dir for the command. This must be an - * absolute directory path, or NULL - * if you want to use the default value (the working dir of the current - * PHP process) - *

- * @param array $env [optional]

- * An array with the environment variables for the command that will be - * run, or NULL to use the same environment as the current PHP process - *

- * @param array $other_options [optional]

- * Allows you to specify additional options. Currently supported options - * include: - * suppress_errors (windows only): suppresses errors - * generated by this function when it's set to TRUE - * bypass_shell (windows only): bypass - * cmd.exe shell when set to TRUE - *

- * @return resource a resource representing the process, which should be freed using - * proc_close when you are finished with it. On failure - * returns FALSE. - */ -function proc_open ($cmd, array $descriptorspec, array &$pipes, $cwd = null, array $env = null, array $other_options = null) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Close a process opened by proc_open and return the exit code of that process - * @link http://php.net/manual/en/function.proc-close.php - * @param resource $process

- * The proc_open resource that will - * be closed. - *

- * @return int the termination status of the process that was run. In case of - * an error then -1 is returned. - */ -function proc_close ($process) {} - -/** - * (PHP 5)
- * Kills a process opened by proc_open - * @link http://php.net/manual/en/function.proc-terminate.php - * @param resource $process

- * The proc_open resource that will - * be closed. - *

- * @param int $signal [optional]

- * This optional parameter is only useful on POSIX - * operating systems; you may specify a signal to send to the process - * using the kill(2) system call. The default is - * SIGTERM. - *

- * @return bool the termination status of the process that was run. - */ -function proc_terminate ($process, $signal = 15) {} - -/** - * (PHP 5)
- * Get information about a process opened by proc_open - * @link http://php.net/manual/en/function.proc-get-status.php - * @param resource $process

- * The proc_open resource that will - * be evaluated. - *

- * @return array An array of collected information on success, and FALSE - * on failure. The returned array contains the following elements: - *

- *

- *

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ -function proc_get_status ($process) {} - -/** - * (PHP 5)
- * Change the priority of the current process - * @link http://php.net/manual/en/function.proc-nice.php - * @param int $increment

- * The increment value of the priority change. - *

- * @return bool TRUE on success or FALSE on failure. - * If an error occurs, like the user lacks permission to change the priority, - * an error of level E_WARNING is also generated. - */ -function proc_nice ($increment) {} - -/** - * (PHP 4, PHP 5)
- * Generate a random integer - * @link http://php.net/manual/en/function.rand.php - * @param $min [optional] - * @param $max [optional] - * @return int A pseudo random value between min - * (or 0) and max (or getrandmax, inclusive). - */ -function rand ($min, $max) {} - -/** - * (PHP 4, PHP 5)
- * Seed the random number generator - * @link http://php.net/manual/en/function.srand.php - * @param int $seed [optional]

- * Optional seed value - *

- * @return void No value is returned. - */ -function srand ($seed = null) {} - -/** - * (PHP 4, PHP 5)
- * Show largest possible random value - * @link http://php.net/manual/en/function.getrandmax.php - * @return int The largest possible random value returned by rand - */ -function getrandmax () {} - -/** - * (PHP 4, PHP 5)
- * Generate a better random value - * @link http://php.net/manual/en/function.mt-rand.php - * @param $min [optional] - * @param $max [optional] - * @return int A random integer value between min (or 0) - * and max (or mt_getrandmax, inclusive), - * or FALSE if max is less than min. - */ -function mt_rand ($min, $max) {} - -/** - * (PHP 4, PHP 5)
- * Seed the better random number generator - * @link http://php.net/manual/en/function.mt-srand.php - * @param int $seed [optional]

- * An optional seed value - *

- * @return void No value is returned. - */ -function mt_srand ($seed = null) {} - -/** - * (PHP 4, PHP 5)
- * Show largest possible random value - * @link http://php.net/manual/en/function.mt-getrandmax.php - * @return int the maximum random value returned by mt_rand - */ -function mt_getrandmax () {} - -/** - * (PHP 4, PHP 5)
- * Get port number associated with an Internet service and protocol - * @link http://php.net/manual/en/function.getservbyname.php - * @param string $service

- * The Internet service name, as a string. - *

- * @param string $protocol

- * protocol is either "tcp" - * or "udp" (in lowercase). - *

- * @return int the port number, or FALSE if service or - * protocol is not found. - */ -function getservbyname ($service, $protocol) {} - -/** - * (PHP 4, PHP 5)
- * Get Internet service which corresponds to port and protocol - * @link http://php.net/manual/en/function.getservbyport.php - * @param int $port

- * The port number. - *

- * @param string $protocol

- * protocol is either "tcp" - * or "udp" (in lowercase). - *

- * @return string the Internet service name as a string. - */ -function getservbyport ($port, $protocol) {} - -/** - * (PHP 4, PHP 5)
- * Get protocol number associated with protocol name - * @link http://php.net/manual/en/function.getprotobyname.php - * @param string $name

- * The protocol name. - *

- * @return int the protocol number, or FALSE on failure. - */ -function getprotobyname ($name) {} - -/** - * (PHP 4, PHP 5)
- * Get protocol name associated with protocol number - * @link http://php.net/manual/en/function.getprotobynumber.php - * @param int $number

- * The protocol number. - *

- * @return string the protocol name as a string, or FALSE on failure. - */ -function getprotobynumber ($number) {} - -/** - * (PHP 4, PHP 5)
- * Gets PHP script owner's UID - * @link http://php.net/manual/en/function.getmyuid.php - * @return int the user ID of the current script, or FALSE on error. - */ -function getmyuid () {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Get PHP script owner's GID - * @link http://php.net/manual/en/function.getmygid.php - * @return int the group ID of the current script, or FALSE on error. - */ -function getmygid () {} - -/** - * (PHP 4, PHP 5)
- * Gets PHP's process ID - * @link http://php.net/manual/en/function.getmypid.php - * @return int the current PHP process ID, or FALSE on error. - */ -function getmypid () {} - -/** - * (PHP 4, PHP 5)
- * Gets the inode of the current script - * @link http://php.net/manual/en/function.getmyinode.php - * @return int the current script's inode as an integer, or FALSE on error. - */ -function getmyinode () {} - -/** - * (PHP 4, PHP 5)
- * Gets time of last page modification - * @link http://php.net/manual/en/function.getlastmod.php - * @return int the time of the last modification of the current - * page. The value returned is a Unix timestamp, suitable for - * feeding to date. Returns FALSE on error. - */ -function getlastmod () {} - -/** - * (PHP 4, PHP 5)
- * Decodes data encoded with MIME base64 - * @link http://php.net/manual/en/function.base64-decode.php - * @param string $data

- * The encoded data. - *

- * @param bool $strict [optional]

- * Returns FALSE if input contains character from outside the base64 - * alphabet. - *

- * @return string the original data or FALSE on failure. The returned data may be - * binary. - */ -function base64_decode ($data, $strict = false) {} - -/** - * (PHP 4, PHP 5)
- * Encodes data with MIME base64 - * @link http://php.net/manual/en/function.base64-encode.php - * @param string $data

- * The data to encode. - *

- * @return string The encoded data, as a string or FALSE on failure. - */ -function base64_encode ($data) {} - -/** - * (PHP 5)
- * Uuencode a string - * @link http://php.net/manual/en/function.convert-uuencode.php - * @param string $data

- * The data to be encoded. - *

- * @return string the uuencoded data. - */ -function convert_uuencode ($data) {} - -/** - * (PHP 5)
- * Decode a uuencoded string - * @link http://php.net/manual/en/function.convert-uudecode.php - * @param string $data

- * The uuencoded data. - *

- * @return string the decoded data as a string. - */ -function convert_uudecode ($data) {} - -/** - * (PHP 4, PHP 5)
- * Absolute value - * @link http://php.net/manual/en/function.abs.php - * @param mixed $number

- * The numeric value to process - *

- * @return number The absolute value of number. If the - * argument number is - * of type float, the return type is also float, - * otherwise it is integer (as float usually has a - * bigger value range than integer). - */ -function abs ($number) {} - -/** - * (PHP 4, PHP 5)
- * Round fractions up - * @link http://php.net/manual/en/function.ceil.php - * @param float $value

- * The value to round - *

- * @return float value rounded up to the next highest - * integer. - * The return value of ceil is still of type - * float as the value range of float is - * usually bigger than that of integer. - */ -function ceil ($value) {} - -/** - * (PHP 4, PHP 5)
- * Round fractions down - * @link http://php.net/manual/en/function.floor.php - * @param float $value

- * The numeric value to round - *

- * @return float value rounded to the next lowest integer. - * The return value of floor is still of type - * float because the value range of float is - * usually bigger than that of integer. - */ -function floor ($value) {} - -/** - * (PHP 4, PHP 5)
- * Rounds a float - * @link http://php.net/manual/en/function.round.php - * @param float $val

- * The value to round - *

- * @param int $precision [optional]

- * The optional number of decimal digits to round to. - *

- * @param int $mode [optional]

- * Use one of the following constants to specify the mode in which rounding occurs. - *

- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *

- * @return float The rounded value - */ -function round ($val, $precision = 0, $mode = 'PHP_ROUND_HALF_UP') {} - -/** - * (PHP 4, PHP 5)
- * Sine - * @link http://php.net/manual/en/function.sin.php - * @param float $arg

- * A value in radians - *

- * @return float The sine of arg - */ -function sin ($arg) {} - -/** - * (PHP 4, PHP 5)
- * Cosine - * @link http://php.net/manual/en/function.cos.php - * @param float $arg

- * An angle in radians - *

- * @return float The cosine of arg - */ -function cos ($arg) {} - -/** - * (PHP 4, PHP 5)
- * Tangent - * @link http://php.net/manual/en/function.tan.php - * @param float $arg

- * The argument to process in radians - *

- * @return float The tangent of arg - */ -function tan ($arg) {} - -/** - * (PHP 4, PHP 5)
- * Arc sine - * @link http://php.net/manual/en/function.asin.php - * @param float $arg

- * The argument to process - *

- * @return float The arc sine of arg in radians - */ -function asin ($arg) {} - -/** - * (PHP 4, PHP 5)
- * Arc cosine - * @link http://php.net/manual/en/function.acos.php - * @param float $arg

- * The argument to process - *

- * @return float The arc cosine of arg in radians. - */ -function acos ($arg) {} - -/** - * (PHP 4, PHP 5)
- * Arc tangent - * @link http://php.net/manual/en/function.atan.php - * @param float $arg

- * The argument to process - *

- * @return float The arc tangent of arg in radians. - */ -function atan ($arg) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Inverse hyperbolic tangent - * @link http://php.net/manual/en/function.atanh.php - * @param float $arg

- * The argument to process - *

- * @return float Inverse hyperbolic tangent of arg - */ -function atanh ($arg) {} - -/** - * (PHP 4, PHP 5)
- * Arc tangent of two variables - * @link http://php.net/manual/en/function.atan2.php - * @param float $y

- * Dividend parameter - *

- * @param float $x

- * Divisor parameter - *

- * @return float The arc tangent of y/x - * in radians. - */ -function atan2 ($y, $x) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Hyperbolic sine - * @link http://php.net/manual/en/function.sinh.php - * @param float $arg

- * The argument to process - *

- * @return float The hyperbolic sine of arg - */ -function sinh ($arg) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Hyperbolic cosine - * @link http://php.net/manual/en/function.cosh.php - * @param float $arg

- * The argument to process - *

- * @return float The hyperbolic cosine of arg - */ -function cosh ($arg) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Hyperbolic tangent - * @link http://php.net/manual/en/function.tanh.php - * @param float $arg

- * The argument to process - *

- * @return float The hyperbolic tangent of arg - */ -function tanh ($arg) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Inverse hyperbolic sine - * @link http://php.net/manual/en/function.asinh.php - * @param float $arg

- * The argument to process - *

- * @return float The inverse hyperbolic sine of arg - */ -function asinh ($arg) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Inverse hyperbolic cosine - * @link http://php.net/manual/en/function.acosh.php - * @param float $arg

- * The value to process - *

- * @return float The inverse hyperbolic cosine of arg - */ -function acosh ($arg) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Returns exp(number) - 1, computed in a way that is accurate even -when the value of number is close to zero - * @link http://php.net/manual/en/function.expm1.php - * @param float $arg

- * The argument to process - *

- * @return float 'e' to the power of arg minus one - */ -function expm1 ($arg) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Returns log(1 + number), computed in a way that is accurate even when -the value of number is close to zero - * @link http://php.net/manual/en/function.log1p.php - * @param float $number

- * The argument to process - *

- * @return float log(1 + number) - */ -function log1p ($number) {} - -/** - * (PHP 4, PHP 5)
- * Get value of pi - * @link http://php.net/manual/en/function.pi.php - * @return float The value of pi as float. - */ -function pi () {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Finds whether a value is a legal finite number - * @link http://php.net/manual/en/function.is-finite.php - * @param float $val

- * The value to check - *

- * @return bool TRUE if val is a legal finite - * number within the allowed range for a PHP float on this platform, - * else FALSE. - */ -function is_finite ($val) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Finds whether a value is not a number - * @link http://php.net/manual/en/function.is-nan.php - * @param float $val

- * The value to check - *

- * @return bool TRUE if val is 'not a number', - * else FALSE. - */ -function is_nan ($val) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Finds whether a value is infinite - * @link http://php.net/manual/en/function.is-infinite.php - * @param float $val

- * The value to check - *

- * @return bool TRUE if val is infinite, else FALSE. - */ -function is_infinite ($val) {} - -/** - * (PHP 4, PHP 5)
- * Exponential expression - * @link http://php.net/manual/en/function.pow.php - * @param number $base

- * The base to use - *

- * @param number $exp

- * The exponent - *

- * @return number base raised to the power of exp. - * If both arguments are non-negative integers and the result can be represented - * as an integer, the result will be returned with integer type, - * otherwise it will be returned as a float. - */ -function pow ($base, $exp) {} - -/** - * (PHP 4, PHP 5)
- * Calculates the exponent of e - * @link http://php.net/manual/en/function.exp.php - * @param float $arg

- * The argument to process - *

- * @return float 'e' raised to the power of arg - */ -function exp ($arg) {} - -/** - * (PHP 4, PHP 5)
- * Natural logarithm - * @link http://php.net/manual/en/function.log.php - * @param float $arg

- * The value to calculate the logarithm for - *

- * @param float $base [optional]

- * The optional logarithmic base to use - * (defaults to 'e' and so to the natural logarithm). - *

- * @return float The logarithm of arg to - * base, if given, or the - * natural logarithm. - */ -function log ($arg, $base = 'M_E') {} - -/** - * (PHP 4, PHP 5)
- * Base-10 logarithm - * @link http://php.net/manual/en/function.log10.php - * @param float $arg

- * The argument to process - *

- * @return float The base-10 logarithm of arg - */ -function log10 ($arg) {} - -/** - * (PHP 4, PHP 5)
- * Square root - * @link http://php.net/manual/en/function.sqrt.php - * @param float $arg

- * The argument to process - *

- * @return float The square root of arg - * or the special value NAN for negative numbers. - */ -function sqrt ($arg) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Calculate the length of the hypotenuse of a right-angle triangle - * @link http://php.net/manual/en/function.hypot.php - * @param float $x

- * Length of first side - *

- * @param float $y

- * Length of second side - *

- * @return float Calculated length of the hypotenuse - */ -function hypot ($x, $y) {} - -/** - * (PHP 4, PHP 5)
- * Converts the number in degrees to the radian equivalent - * @link http://php.net/manual/en/function.deg2rad.php - * @param float $number

- * Angular value in degrees - *

- * @return float The radian equivalent of number - */ -function deg2rad ($number) {} - -/** - * (PHP 4, PHP 5)
- * Converts the radian number to the equivalent number in degrees - * @link http://php.net/manual/en/function.rad2deg.php - * @param float $number

- * A radian value - *

- * @return float The equivalent of number in degrees - */ -function rad2deg ($number) {} - -/** - * (PHP 4, PHP 5)
- * Binary to decimal - * @link http://php.net/manual/en/function.bindec.php - * @param string $binary_string

- * The binary string to convert - *

- * @return number The decimal value of binary_string - */ -function bindec ($binary_string) {} - -/** - * (PHP 4, PHP 5)
- * Hexadecimal to decimal - * @link http://php.net/manual/en/function.hexdec.php - * @param string $hex_string

- * The hexadecimal string to convert - *

- * @return number The decimal representation of hex_string - */ -function hexdec ($hex_string) {} - -/** - * (PHP 4, PHP 5)
- * Octal to decimal - * @link http://php.net/manual/en/function.octdec.php - * @param string $octal_string

- * The octal string to convert - *

- * @return number The decimal representation of octal_string - */ -function octdec ($octal_string) {} - -/** - * (PHP 4, PHP 5)
- * Decimal to binary - * @link http://php.net/manual/en/function.decbin.php - * @param int $number

- * Decimal value to convert - *

- *
ConstantDescription
ABDAY_(1-7)Abbreviated name of n-th day of the week.
DAY_(1-7)Name of the n-th day of the week (DAY_1 = Sunday).
ABMON_(1-12)Abbreviated name of the n-th month of the year.
MON_(1-12)Name of the n-th month of the year.
AM_STRString for Ante meridian.
PM_STRString for Post meridian.
D_T_FMTString that can be used as the format string for strftime to represent time and date.
D_FMTString that can be used as the format string for strftime to represent date.
T_FMTString that can be used as the format string for strftime to represent time.
T_FMT_AMPMString that can be used as the format string for strftime to represent time in 12-hour format with ante/post meridian.
ERAAlternate era.
ERA_YEARYear in alternate era format.
ERA_D_T_FMTDate and time in alternate era format (string can be used in strftime).
ERA_D_FMTDate in alternate era format (string can be used in strftime).
ERA_T_FMTTime in alternate era format (string can be used in strftime).
INT_CURR_SYMBOLInternational currency symbol.
CURRENCY_SYMBOLLocal currency symbol.
CRNCYSTRSame value as CURRENCY_SYMBOL.
MON_DECIMAL_POINTDecimal point character.
MON_THOUSANDS_SEPThousands separator (groups of three digits).
MON_GROUPINGLike "grouping" element.
POSITIVE_SIGNSign for positive values.
NEGATIVE_SIGNSign for negative values.
INT_FRAC_DIGITSInternational fractional digits.
FRAC_DIGITSLocal fractional digits.
P_CS_PRECEDESReturns 1 if CURRENCY_SYMBOL precedes a positive value.
P_SEP_BY_SPACEReturns 1 if a space separates CURRENCY_SYMBOL from a positive value.
N_CS_PRECEDESReturns 1 if CURRENCY_SYMBOL precedes a negative value.
N_SEP_BY_SPACEReturns 1 if a space separates CURRENCY_SYMBOL from a negative value.
P_SIGN_POSN
elementtypedescription
commandstring - * The command string that was passed to proc_open. - *
pidintprocess id
runningbool - * TRUE if the process is still running, FALSE if it has - * terminated. - *
signaledbool - * TRUE if the child process has been terminated by - * an uncaught signal. Always set to FALSE on Windows. - *
stoppedbool - * TRUE if the child process has been stopped by a - * signal. Always set to FALSE on Windows. - *
exitcodeint - * The exit code returned by the process (which is only - * meaningful if running is FALSE). - * Only first call of this function return real value, next calls return - * -1. - *
termsigint - * The number of the signal that caused the child process to terminate - * its execution (only meaningful if signaled is TRUE). - *
stopsigint - * The number of the signal that caused the child process to stop its - * execution (only meaningful if stopped is TRUE). - *
ConstantDescription
PHP_ROUND_HALF_UP - * Round val up to precision decimal places - * away from zero, when it is half way there. Making 1.5 into 2 and -1.5 into -2. - *
PHP_ROUND_HALF_DOWN - * Round val down to precision decimal places - * towards zero, when it is half way there. Making 1.5 into 1 and -1.5 into -1. - *
PHP_ROUND_HALF_EVEN - * Round val to precision decimal places - * towards the next even value. - *
PHP_ROUND_HALF_ODD - * Round val to precision decimal places - * towards the next odd value. - *
- * Range of inputs on 32-bit machines - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * ... normal progression ... - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * ... normal progression ... - * - * - * - * - * - * - * - * - * - * - * - *
positive numbernegative numberreturn value
00
11
210
21474836461111111111111111111111111111110
2147483647 (largest signed integer)1111111111111111111111111111111 (31 1's)
2147483648-214748364810000000000000000000000000000000
4294967294-211111111111111111111111111111110
4294967295 (largest unsigned integer)-111111111111111111111111111111111 (32 1's)
- * - * Range of inputs on 64-bit machines - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * ... normal progression ... - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * ... normal progression ... - * - * - * - * - * - * - * - * - * - * - * - *
positive numbernegative numberreturn value
00
11
210
9223372036854775806111111111111111111111111111111111111111111111111111111111111110
9223372036854775807 (largest signed integer)111111111111111111111111111111111111111111111111111111111111111 (63 1's)
-92233720368547758081000000000000000000000000000000000000000000000000000000000000000
-21111111111111111111111111111111111111111111111111111111111111110
-11111111111111111111111111111111111111111111111111111111111111111 (64 1's)
- * @return string Binary string representation of number - */ -function decbin ($number) {} - -/** - * (PHP 4, PHP 5)
- * Decimal to octal - * @link http://php.net/manual/en/function.decoct.php - * @param int $number

- * Decimal value to convert - *

- * @return string Octal string representation of number - */ -function decoct ($number) {} - -/** - * (PHP 4, PHP 5)
- * Decimal to hexadecimal - * @link http://php.net/manual/en/function.dechex.php - * @param int $number

- * The decimal value to convert. - *

- *

- * As PHP's integer type is signed, but - * dechex deals with unsigned integers, negative - * integers will be treated as though they were unsigned. - *

- * @return string Hexadecimal string representation of number. - */ -function dechex ($number) {} - -/** - * (PHP 4, PHP 5)
- * Convert a number between arbitrary bases - * @link http://php.net/manual/en/function.base-convert.php - * @param string $number

- * The number to convert - *

- * @param int $frombase

- * The base number is in - *

- * @param int $tobase

- * The base to convert number to - *

- * @return string number converted to base tobase - */ -function base_convert ($number, $frombase, $tobase) {} - -/** - * (PHP 4, PHP 5)
- * Format a number with grouped thousands - * @link http://php.net/manual/en/function.number-format.php - * @param float $number

- * The number being formatted. - *

- * @param int $decimals [optional]

- * Sets the number of decimal points. - *

- * @param string $dec_point [optional]

- * Sets the separator for the decimal point. - *

- * @param string $thousands_sep [optional]

- * Sets the thousands separator. - *

- * @return string A formatted version of number. - */ -function number_format ($number, $decimals = 0, $dec_point = '.', $thousands_sep = ',') {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Returns the floating point remainder (modulo) of the division -of the arguments - * @link http://php.net/manual/en/function.fmod.php - * @param float $x

- * The dividend - *

- * @param float $y

- * The divisor - *

- * @return float The floating point remainder of - * x/y - */ -function fmod ($x, $y) {} - -/** - * (PHP 5 >= 5.1.0)
- * Converts a packed internet address to a human readable representation - * @link http://php.net/manual/en/function.inet-ntop.php - * @param string $in_addr

- * A 32bit IPv4, or 128bit IPv6 address. - *

- * @return string a string representation of the address or FALSE on failure. - */ -function inet_ntop ($in_addr) {} - -/** - * (PHP 5 >= 5.1.0)
- * Converts a human readable IP address to its packed in_addr representation - * @link http://php.net/manual/en/function.inet-pton.php - * @param string $address

- * A human readable IPv4 or IPv6 address. - *

- * @return string the in_addr representation of the given - * address, or FALSE if a syntactically invalid - * address is given (for example, an IPv4 address - * without dots or an IPv6 address without colons). - */ -function inet_pton ($address) {} - -/** - * (PHP 4, PHP 5)
- * Converts a string containing an (IPv4) Internet Protocol dotted address into a proper address - * @link http://php.net/manual/en/function.ip2long.php - * @param string $ip_address

- * A standard format address. - *

- * @return int the IPv4 address or FALSE if ip_address - * is invalid. - */ -function ip2long ($ip_address) {} - -/** - * (PHP 4, PHP 5)
- * Converts an (IPv4) Internet network address into a string in Internet standard dotted format - * @link http://php.net/manual/en/function.long2ip.php - * @param string $proper_address

- * A proper address representation. - *

- * @return string the Internet IP address as a string. - */ -function long2ip ($proper_address) {} - -/** - * (PHP 4, PHP 5)
- * Gets the value of an environment variable - * @link http://php.net/manual/en/function.getenv.php - * @param string $varname

- * The variable name. - *

- * @return string the value of the environment variable - * varname, or FALSE if the environment - * variable varname does not exist. - */ -function getenv ($varname) {} - -/** - * (PHP 4, PHP 5)
- * Sets the value of an environment variable - * @link http://php.net/manual/en/function.putenv.php - * @param string $setting

- * The setting, like "FOO=BAR" - *

- * @return bool TRUE on success or FALSE on failure. - */ -function putenv ($setting) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Gets options from the command line argument list - * @link http://php.net/manual/en/function.getopt.php - * @param string $options Each character in this string will be used as option characters and - * matched against options passed to the script starting with a single - * hyphen (-). - * For example, an option string "x" recognizes an - * option -x. - * Only a-z, A-Z and 0-9 are allowed. - * @param array $longopts [optional] An array of options. Each element in this array will be used as option - * strings and matched against options passed to the script starting with - * two hyphens (--). - * For example, an longopts element "opt" recognizes an - * option --opt. - * @return array This function will return an array of option / argument pairs or FALSE on - * failure. - *

- *

- * The parsing of options will end at the first non-option found, anything - * that follows is discarded. - */ -function getopt ($options, array $longopts = null) {} - -/** - * (PHP 5 >= 5.1.3)
- * Gets system load average - * @link http://php.net/manual/en/function.sys-getloadavg.php - * @return array an array with three samples (last 1, 5 and 15 - * minutes). - */ -function sys_getloadavg () {} - -/** - * (PHP 4, PHP 5)
- * Return current Unix timestamp with microseconds - * @link http://php.net/manual/en/function.microtime.php - * @param bool $get_as_float [optional]

- * If used and set to TRUE, microtime will return a - * float instead of a string, as described in - * the return values section below. - *

- * @return mixed By default, microtime returns a string in - * the form "msec sec", where sec is the current time - * measured in the number of seconds since the Unix epoch (0:00:00 January 1, - * 1970 GMT), and msec is the number of microseconds that - * have elapsed since sec expressed in seconds. - *

- *

- * If get_as_float is set to TRUE, then - * microtime returns a float, which - * represents the current time in seconds since the Unix epoch accurate to the - * nearest microsecond. - */ -function microtime ($get_as_float = false) {} - -/** - * (PHP 4, PHP 5)
- * Get current time - * @link http://php.net/manual/en/function.gettimeofday.php - * @param bool $return_float [optional]

- * When set to TRUE, a float instead of an array is returned. - *

- * @return mixed By default an array is returned. If return_float - * is set, then a float is returned. - *

- *

- * Array keys: - * "sec" - seconds since the Unix Epoch - * "usec" - microseconds - * "minuteswest" - minutes west of Greenwich - * "dsttime" - type of dst correction - */ -function gettimeofday ($return_float = false) {} - -/** - * (PHP 4, PHP 5)
- * Gets the current resource usages - * @link http://php.net/manual/en/function.getrusage.php - * @param int $who [optional]

- * If who is 1, getrusage will be called with - * RUSAGE_CHILDREN. - *

- * @return array an associative array containing the data returned from the system - * call. All entries are accessible by using their documented field names. - */ -function getrusage ($who = 0) {} - -/** - * (PHP 4, PHP 5)
- * Generate a unique ID - * @link http://php.net/manual/en/function.uniqid.php - * @param string $prefix [optional]

- * Can be useful, for instance, if you generate identifiers - * simultaneously on several hosts that might happen to generate the - * identifier at the same microsecond. - *

- *

- * With an empty prefix, the returned string will - * be 13 characters long. If more_entropy is - * TRUE, it will be 23 characters. - *

- * @param bool $more_entropy [optional]

- * If set to TRUE, uniqid will add additional - * entropy (using the combined linear congruential generator) at the end - * of the return value, which increases the likelihood that the result - * will be unique. - *

- * @return string the unique identifier, as a string. - */ -function uniqid ($prefix = "", $more_entropy = false) {} - -/** - * (PHP 4, PHP 5)
- * Convert a quoted-printable string to an 8 bit string - * @link http://php.net/manual/en/function.quoted-printable-decode.php - * @param string $str

- * The input string. - *

- * @return string the 8-bit binary string. - */ -function quoted_printable_decode ($str) {} - -/** - * (PHP 5 >= 5.3.0)
- * Convert a 8 bit string to a quoted-printable string - * @link http://php.net/manual/en/function.quoted-printable-encode.php - * @param string $str

- * The input string. - *

- * @return string the encoded string. - */ -function quoted_printable_encode ($str) {} - -/** - * (PHP 4, PHP 5)
- * Convert from one Cyrillic character set to another - * @link http://php.net/manual/en/function.convert-cyr-string.php - * @param string $str

- * The string to be converted. - *

- * @param string $from

- * The source Cyrillic character set, as a single character. - *

- * @param string $to

- * The target Cyrillic character set, as a single character. - *

- * @return string the converted string. - */ -function convert_cyr_string ($str, $from, $to) {} - -/** - * (PHP 4, PHP 5)
- * Gets the name of the owner of the current PHP script - * @link http://php.net/manual/en/function.get-current-user.php - * @return string the username as a string. - */ -function get_current_user () {} - -/** - * (PHP 4, PHP 5)
- * Limits the maximum execution time - * @link http://php.net/manual/en/function.set-time-limit.php - * @param int $seconds

- * The maximum execution time, in seconds. If set to zero, no time limit - * is imposed. - *

- * @return void No value is returned. - */ -function set_time_limit ($seconds) {} - -/** - * (No version information available, might only be in SVN)
- * Call a header function - * @link http://php.net/manual/en/function.header-register-callback.php - * @param callable $callback

- * Function called just before the headers are sent. It gets no parameters - * and the return value is ignored. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function header_register_callback (callable $callback) {} - -/** - * (PHP 4, PHP 5)
- * Gets the value of a PHP configuration option - * @link http://php.net/manual/en/function.get-cfg-var.php - * @param string $option

- * The configuration option name. - *

- * @return string the current value of the PHP configuration variable specified by - * option, or FALSE if an error occurs. - */ -function get_cfg_var ($option) {} - -/** - * (PHP 4, PHP 5)
- * Alias of set_magic_quotes_runtime - * @link http://php.net/manual/en/function.magic-quotes-runtime.php - * @param $new_setting - */ -function magic_quotes_runtime ($new_setting) {} - -/** - * (PHP 4, PHP 5 < 5.4.0)
- * Sets the current active configuration setting of magic_quotes_runtime - * @link http://php.net/manual/en/function.set-magic-quotes-runtime.php - * @param bool $new_setting

- * FALSE for off, TRUE for on. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function set_magic_quotes_runtime ($new_setting) {} - -/** - * (PHP 4, PHP 5)
- * Gets the current configuration setting of magic_quotes_gpc - * @link http://php.net/manual/en/function.get-magic-quotes-gpc.php - * @return bool 0 if magic_quotes_gpc is off, 1 otherwise. - * Or always returns FALSE as of PHP 5.4.0. - */ -function get_magic_quotes_gpc () {} - -/** - * (PHP 4, PHP 5)
- * Gets the current active configuration setting of magic_quotes_runtime - * @link http://php.net/manual/en/function.get-magic-quotes-runtime.php - * @return bool 0 if magic_quotes_runtime is off, 1 otherwise. - * Or always returns FALSE as of PHP 5.4.0. - */ -function get_magic_quotes_runtime () {} - -/** - * (PHP 4, PHP 5)
- * Send an error message somewhere - * @link http://php.net/manual/en/function.error-log.php - * @param string $message

- * The error message that should be logged. - *

- * @param int $message_type [optional]

- * Says where the error should go. The possible message types are as - * follows: - *

- *

- * - * error_log log types - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
0 - * message is sent to PHP's system logger, using - * the Operating System's system logging mechanism or a file, depending - * on what the error_log - * configuration directive is set to. This is the default option. - *
1 - * message is sent by email to the address in - * the destination parameter. This is the only - * message type where the fourth parameter, - * extra_headers is used. - *
2 - * No longer an option. - *
3 - * message is appended to the file - * destination. A newline is not automatically - * added to the end of the message string. - *
4 - * message is sent directly to the SAPI logging - * handler. - *
- *

- * @param string $destination [optional]

- * The destination. Its meaning depends on the - * message_type parameter as described above. - *

- * @param string $extra_headers [optional]

- * The extra headers. It's used when the message_type - * parameter is set to 1. - * This message type uses the same internal function as - * mail does. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function error_log ($message, $message_type = 0, $destination = null, $extra_headers = null) {} - -/** - * (PHP 5 >= 5.2.0)
- * Get the last occurred error - * @link http://php.net/manual/en/function.error-get-last.php - * @return array an associative array describing the last error with keys "type", - * "message", "file" and "line". If the error has been caused by a PHP - * internal function then the "message" begins with its name. - * Returns NULL if there hasn't been an error yet. - */ -function error_get_last () {} - -/** - * (PHP 4, PHP 5)
- * Call the callback given by the first parameter - * @link http://php.net/manual/en/function.call-user-func.php - * @param callable $callback

- * The callable to be called. - *

- * @param mixed $parameter [optional]

- * Zero or more parameters to be passed to the callback. - *

- *

- * Note that the parameters for call_user_func are - * not passed by reference. - * call_user_func example and references - * - * error_reporting(E_ALL); - * function increment(&$var) - * { - * $var++; - * } - * $a = 0; - * call_user_func('increment', $a); - * echo $a."\n"; - * call_user_func_array('increment', array( // You can use this instead before PHP 5.3 - * echo $a."\n"; - * - * The above example will output:

- *
- * 0
- * 1
- * 
- *

- * @param mixed $_ [optional] - * @return mixed the return value of the callback, or FALSE on error. - */ -function call_user_func (callable $callback, $parameter = null, $_ = null) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Call a callback with an array of parameters - * @link http://php.net/manual/en/function.call-user-func-array.php - * @param callable $callback

- * The callable to be called. - *

- * @param array $param_arr

- * The parameters to be passed to the callback, as an indexed array. - *

- * @return mixed the return value of the callback, or FALSE on error. - */ -function call_user_func_array (callable $callback, array $param_arr) {} - -/** - * (PHP 4, PHP 5)
- * Call a user method on an specific object [deprecated] - * @link http://php.net/manual/en/function.call-user-method.php - * @param string $method_name

- * The method name being called. - *

- * @param object $obj

- * The object that method_name - * is being called on. - *

- * @param mixed $parameter [optional] - * @param mixed $_ [optional] - * @return mixed - */ -function call_user_method ($method_name, &$obj, $parameter = null, $_ = null) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Call a user method given with an array of parameters [deprecated] - * @link http://php.net/manual/en/function.call-user-method-array.php - * @param string $method_name

- * The method name being called. - *

- * @param object $obj

- * The object that method_name - * is being called on. - *

- * @param array $params

- * An array of parameters. - *

- * @return mixed - */ -function call_user_method_array ($method_name, &$obj, array $params) {} - -/** - * (PHP 5 >= 5.3.0)
- * Call a static method - * @link http://php.net/manual/en/function.forward-static-call.php - * @param callable $function

- * The function or method to be called. This parameter may be an array, - * with the name of the class, and the method, or a string, with a function - * name. - *

- * @param mixed $parameter [optional]

- * Zero or more parameters to be passed to the function. - *

- * @param mixed $_ [optional] - * @return mixed the function result, or FALSE on error. - */ -function forward_static_call (callable $function, $parameter = null, $_ = null) {} - -/** - * (PHP 5 >= 5.3.0)
- * Call a static method and pass the arguments as array - * @link http://php.net/manual/en/function.forward-static-call-array.php - * @param callable $function

- * The function or method to be called. This parameter may be an array, - * with the name of the class, and the method, or a string, with a function - * name. - *

- * @param array $parameters - * @return mixed the function result, or FALSE on error. - */ -function forward_static_call_array (callable $function, array $parameters) {} - -/** - * (PHP 4, PHP 5)
- * Generates a storable representation of a value - * @link http://php.net/manual/en/function.serialize.php - * @param mixed $value

- * The value to be serialized. serialize - * handles all types, except the resource-type. - * You can even serialize arrays that contain - * references to itself. Circular references inside the array/object you - * are serializing will also be stored. Any other - * reference will be lost. - *

- *

- * When serializing objects, PHP will attempt to call the member function - * __sleep() prior to serialization. - * This is to allow the object to do any last minute clean-up, etc. prior - * to being serialized. Likewise, when the object is restored using - * unserialize the __wakeup() member function is called. - *

- *

- * Object's private members have the class name prepended to the member - * name; protected members have a '*' prepended to the member name. - * These prepended values have null bytes on either side. - *

- * @return string a string containing a byte-stream representation of - * value that can be stored anywhere. - *

- *

- * Note that this is a binary string which may include null bytes, and needs - * to be stored and handled as such. For example, - * serialize output should generally be stored in a BLOB - * field in a database, rather than a CHAR or TEXT field. - */ -function serialize ($value) {} - -/** - * (PHP 4, PHP 5)
- * Creates a PHP value from a stored representation - * @link http://php.net/manual/en/function.unserialize.php - * @param string $str

- * The serialized string. - *

- *

- * If the variable being unserialized is an object, after successfully - * reconstructing the object PHP will automatically attempt to call the - * __wakeup() member - * function (if it exists). - *

- *

- * unserialize_callback_func directive - *

- * It's possible to set a callback-function which will be called, - * if an undefined class should be instantiated during unserializing. - * (to prevent getting an incomplete object "__PHP_Incomplete_Class".) - * Use your php.ini, ini_set or .htaccess - * to define 'unserialize_callback_func'. Everytime an undefined class - * should be instantiated, it'll be called. To disable this feature just - * empty this setting. - *

- *

- * @return mixed The converted value is returned, and can be a boolean, - * integer, float, string, - * array or object. - *

- *

- * In case the passed string is not unserializeable, FALSE is returned and - * E_NOTICE is issued. - */ -function unserialize ($str) {} - -/** - * (PHP 4, PHP 5)
- * Dumps information about a variable - * @link http://php.net/manual/en/function.var-dump.php - * @param mixed $expression

- * The variable you want to dump. - *

- * @param mixed $_ [optional] - * @return void No value is returned. - */ -function var_dump ($expression, $_ = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Outputs or returns a parsable string representation of a variable - * @link http://php.net/manual/en/function.var-export.php - * @param mixed $expression

- * The variable you want to export. - *

- * @param bool $return [optional]

- * If used and set to TRUE, var_export will return - * the variable representation instead of outputing it. - *

- * @return mixed the variable representation when the return - * parameter is used and evaluates to TRUE. Otherwise, this function will - * return NULL. - */ -function var_export ($expression, $return = false) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Dumps a string representation of an internal zend value to output - * @link http://php.net/manual/en/function.debug-zval-dump.php - * @param mixed $variable

- * The variable being evaluated. - *

- * @return void No value is returned. - */ -function debug_zval_dump ($variable) {} - -/** - * (PHP 4, PHP 5)
- * Prints human-readable information about a variable - * @link http://php.net/manual/en/function.print-r.php - * @param mixed $expression

- * The expression to be printed. - *

- * @param bool $return [optional]

- * If you would like to capture the output of print_r, - * use the return parameter. When this parameter is set - * to TRUE, print_r will return the information rather than print it. - *

- * @return mixed If given a string, integer or float, - * the value itself will be printed. If given an array, values - * will be presented in a format that shows keys and elements. Similar - * notation is used for objects. - *

- *

- * When the return parameter is TRUE, this function - * will return a string. Otherwise, the return value is TRUE. - */ -function print_r ($expression, $return = false) {} - -/** - * (PHP 4 >= 4.3.2, PHP 5)
- * Returns the amount of memory allocated to PHP - * @link http://php.net/manual/en/function.memory-get-usage.php - * @param bool $real_usage [optional]

- * Set this to TRUE to get the real size of memory allocated from - * system. If not set or FALSE only the memory used by - * emalloc() is reported. - *

- * @return int the memory amount in bytes. - */ -function memory_get_usage ($real_usage = false) {} - -/** - * (PHP 5 >= 5.2.0)
- * Returns the peak of memory allocated by PHP - * @link http://php.net/manual/en/function.memory-get-peak-usage.php - * @param bool $real_usage [optional]

- * Set this to TRUE to get the real size of memory allocated from - * system. If not set or FALSE only the memory used by - * emalloc() is reported. - *

- * @return int the memory peak in bytes. - */ -function memory_get_peak_usage ($real_usage = false) {} - -/** - * (PHP 4, PHP 5)
- * Register a function for execution on shutdown - * @link http://php.net/manual/en/function.register-shutdown-function.php - * @param callable $callback

- * The shutdown callback to register. - *

- *

- * The shutdown callbacks are executed as the part of the request, so - * it's possible to send output from them and access output buffers. - *

- * @param mixed $parameter [optional]

- * It is possible to pass parameters to the shutdown function by passing - * additional parameters. - *

- * @param mixed $_ [optional] - * @return void No value is returned. - */ -function register_shutdown_function (callable $callback, $parameter = null, $_ = null) {} - -/** - * (PHP 4 >= 4.0.3, PHP 5)
- * Register a function for execution on each tick - * @link http://php.net/manual/en/function.register-tick-function.php - * @param callable $function

- * The function name as a string, or an array consisting of an object and - * a method. - *

- * @param mixed $arg [optional] - * @param mixed $_ [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function register_tick_function (callable $function, $arg = null, $_ = null) {} - -/** - * (PHP 4 >= 4.0.3, PHP 5)
- * De-register a function for execution on each tick - * @link http://php.net/manual/en/function.unregister-tick-function.php - * @param string $function_name

- * The function name, as a string. - *

- * @return void No value is returned. - */ -function unregister_tick_function ($function_name) {} - -/** - * (PHP 4, PHP 5)
- * Syntax highlighting of a file - * @link http://php.net/manual/en/function.highlight-file.php - * @param string $filename

- * Path to the PHP file to be highlighted. - *

- * @param bool $return [optional]

- * Set this parameter to TRUE to make this function return the - * highlighted code. - *

- * @return mixed If return is set to TRUE, returns the highlighted - * code as a string instead of printing it out. Otherwise, it will return - * TRUE on success, FALSE on failure. - */ -function highlight_file ($filename, $return = false) {} - -/** - * (PHP 4, PHP 5)
- * Alias of highlight_file - * @link http://php.net/manual/en/function.show-source.php - * @param $file_name - * @param $return [optional] - */ -function show_source ($file_name, $return) {} - -/** - * (PHP 4, PHP 5)
- * Syntax highlighting of a string - * @link http://php.net/manual/en/function.highlight-string.php - * @param string $str

- * The PHP code to be highlighted. This should include the opening tag. - *

- * @param bool $return [optional]

- * Set this parameter to TRUE to make this function return the - * highlighted code. - *

- * @return mixed If return is set to TRUE, returns the highlighted - * code as a string instead of printing it out. Otherwise, it will return - * TRUE on success, FALSE on failure. - */ -function highlight_string ($str, $return = false) {} - -/** - * (PHP 5)
- * Return source with stripped comments and whitespace - * @link http://php.net/manual/en/function.php-strip-whitespace.php - * @param string $filename

- * Path to the PHP file. - *

- * @return string The stripped source code will be returned on success, or an empty string - * on failure. - *

- *

- * This function works as described as of PHP 5.0.1. Before this it would - * only return an empty string. For more information on this bug and its - * prior behavior, see bug report - * #29606. - */ -function php_strip_whitespace ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Gets the value of a configuration option - * @link http://php.net/manual/en/function.ini-get.php - * @param string $varname

- * The configuration option name. - *

- * @return string the value of the configuration option as a string on success, or an - * empty string for null values. Returns FALSE if the - * configuration option doesn't exist. - */ -function ini_get ($varname) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Gets all configuration options - * @link http://php.net/manual/en/function.ini-get-all.php - * @param string $extension [optional]

- * An optional extension name. If set, the function return only options - * specific for that extension. - *

- * @param bool $details [optional]

- * Retrieve details settings or only the current value for each setting. - * Default is TRUE (retrieve details). - *

- * @return array an associative array with directive name as the array key. - *

- *

- * When details is TRUE (default) the array will - * contain global_value (set in - * php.ini), local_value (perhaps set with - * ini_set or .htaccess), and - * access (the access level). - *

- *

- * When details is FALSE the value will be the - * current value of the option. - *

- *

- * See the manual section - * for information on what access levels mean. - *

- *

- * It's possible for a directive to have multiple access levels, which is - * why access shows the appropriate bitmask values. - */ -function ini_get_all ($extension = null, $details = true) {} - -/** - * (PHP 4, PHP 5)
- * Sets the value of a configuration option - * @link http://php.net/manual/en/function.ini-set.php - * @param string $varname

- *

- *

- * Not all the available options can be changed using - * ini_set. There is a list of all available options - * in the appendix. - *

- * @param string $newvalue

- * The new value for the option. - *

- * @return string the old value on success, FALSE on failure. - */ -function ini_set ($varname, $newvalue) {} - -/** - * (PHP 4, PHP 5)
- * Alias of ini_set - * @link http://php.net/manual/en/function.ini-alter.php - * @param $varname - * @param $newvalue - */ -function ini_alter ($varname, $newvalue) {} - -/** - * (PHP 4, PHP 5)
- * Restores the value of a configuration option - * @link http://php.net/manual/en/function.ini-restore.php - * @param string $varname

- * The configuration option name. - *

- * @return void No value is returned. - */ -function ini_restore ($varname) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Gets the current include_path configuration option - * @link http://php.net/manual/en/function.get-include-path.php - * @return string the path, as a string. - */ -function get_include_path () {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Sets the include_path configuration option - * @link http://php.net/manual/en/function.set-include-path.php - * @param string $new_include_path

- * The new value for the include_path - *

- * @return string the old include_path on - * success or FALSE on failure. - */ -function set_include_path ($new_include_path) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Restores the value of the include_path configuration option - * @link http://php.net/manual/en/function.restore-include-path.php - * @return void No value is returned. - */ -function restore_include_path () {} - -/** - * (PHP 4, PHP 5)
- * Send a cookie - * @link http://php.net/manual/en/function.setcookie.php - * @param string $name

- * The name of the cookie. - *

- * @param string $value [optional]

- * The value of the cookie. This value is stored on the clients computer; - * do not store sensitive information. Assuming the - * name is 'cookiename', this - * value is retrieved through $_COOKIE['cookiename'] - *

- * @param int $expire [optional]

- * The time the cookie expires. This is a Unix timestamp so is - * in number of seconds since the epoch. In other words, you'll - * most likely set this with the time function - * plus the number of seconds before you want it to expire. Or - * you might use mktime. - * time()+60*60*24*30 will set the cookie to - * expire in 30 days. If set to 0, or omitted, the cookie will expire at - * the end of the session (when the browser closes). - *

- *

- *

- * You may notice the expire parameter takes on a - * Unix timestamp, as opposed to the date format Wdy, DD-Mon-YYYY - * HH:MM:SS GMT, this is because PHP does this conversion - * internally. - *

- *

- * @param string $path [optional]

- * The path on the server in which the cookie will be available on. - * If set to '/', the cookie will be available - * within the entire domain. If set to - * '/foo/', the cookie will only be available - * within the /foo/ directory and all - * sub-directories such as /foo/bar/ of - * domain. The default value is the - * current directory that the cookie is being set in. - *

- * @param string $domain [optional]

- * The domain that the cookie is available to. Setting the domain to - * 'www.example.com' will make the cookie - * available in the www subdomain and higher subdomains. - * Cookies available to a lower domain, such as - * 'example.com' will be available to higher subdomains, - * such as 'www.example.com'. - * Older browsers still implementing the deprecated - * RFC 2109 may require a leading - * . to match all subdomains. - *

- * @param bool $secure [optional]

- * Indicates that the cookie should only be transmitted over a - * secure HTTPS connection from the client. When set to TRUE, the - * cookie will only be set if a secure connection exists. - * On the server-side, it's on the programmer to send this - * kind of cookie only on secure connection (e.g. with respect to - * $_SERVER["HTTPS"]). - *

- * @param bool $httponly [optional]

- * When TRUE the cookie will be made accessible only through the HTTP - * protocol. This means that the cookie won't be accessible by - * scripting languages, such as JavaScript. It has been suggested that - * this setting can effectively help to reduce identity theft through - * XSS attacks (although it is not supported by all browsers), but that - * claim is often disputed. Added in PHP 5.2.0. - * TRUE or FALSE - *

- * @return bool If output exists prior to calling this function, - * setcookie will fail and return FALSE. If - * setcookie successfully runs, it will return TRUE. - * This does not indicate whether the user accepted the cookie. - */ -function setcookie ($name, $value = null, $expire = 0, $path = null, $domain = null, $secure = false, $httponly = false) {} - -/** - * (PHP 5)
- * Send a cookie without urlencoding the cookie value - * @link http://php.net/manual/en/function.setrawcookie.php - * @param string $name - * @param string $value [optional] - * @param int $expire [optional] - * @param string $path [optional] - * @param string $domain [optional] - * @param bool $secure [optional] - * @param bool $httponly [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function setrawcookie ($name, $value = null, $expire = 0, $path = null, $domain = null, $secure = false, $httponly = false) {} - -/** - * (PHP 4, PHP 5)
- * Send a raw HTTP header - * @link http://php.net/manual/en/function.header.php - * @param string $string

- * The header string. - *

- *

- * There are two special-case header calls. The first is a header - * that starts with the string "HTTP/" (case is not - * significant), which will be used to figure out the HTTP status - * code to send. For example, if you have configured Apache to - * use a PHP script to handle requests for missing files (using - * the ErrorDocument directive), you may want to - * make sure that your script generates the proper status code. - *

- *

- * - * header("HTTP/1.0 404 Not Found"); - * - *

- *

- * For FastCGI you must use the following for a 404 response: - * - * header("Status: 404 Not Found"); - * - *

- *

- * The second special case is the "Location:" header. Not only does - * it send this header back to the browser, but it also returns a - * REDIRECT (302) status code to the browser - * unless the 201 or - * a 3xx status code has already been set. - *

- *

- * - * header("Location: http://www.example.com/"); /* Redirect browser * / - * /* Make sure that code below does not get executed when we redirect. * / - * exit; - * - *

- * @param bool $replace [optional]

- * The optional replace parameter indicates - * whether the header should replace a previous similar header, or - * add a second header of the same type. By default it will replace, - * but if you pass in FALSE as the second argument you can force - * multiple headers of the same type. For example: - *

- *

- * - * header('WWW-Authenticate: Negotiate'); - * header('WWW-Authenticate: NTLM', false); - * - *

- * @param int $http_response_code [optional]

- * Forces the HTTP response code to the specified value. Note that this - * parameter only has an effect if the string is - * not empty. - *

- * @return void No value is returned. - */ -function header ($string, $replace = true, $http_response_code = null) {} - -/** - * (PHP 5 >= 5.3.0)
- * Remove previously set headers - * @link http://php.net/manual/en/function.header-remove.php - * @param string $name [optional]

- * The header name to be removed. - *

- * This parameter is case-insensitive. - * @return void No value is returned. - */ -function header_remove ($name = null) {} - -/** - * (PHP 4, PHP 5)
- * Checks if or where headers have been sent - * @link http://php.net/manual/en/function.headers-sent.php - * @param string $file [optional]

- * If the optional file and - * line parameters are set, - * headers_sent will put the PHP source file name - * and line number where output started in the file - * and line variables. - *

- * @param int $line [optional]

- * The line number where the output started. - *

- * @return bool headers_sent will return FALSE if no HTTP headers - * have already been sent or TRUE otherwise. - */ -function headers_sent (&$file = null, &$line = null) {} - -/** - * (PHP 5)
- * Returns a list of response headers sent (or ready to send) - * @link http://php.net/manual/en/function.headers-list.php - * @return array a numerically indexed array of headers. - */ -function headers_list () {} - -/** - * (PHP 5 >= 5.4.0)
- * Get or Set the HTTP response code - * @link http://php.net/manual/en/function.http-response-code.php - * @param int $response_code [optional]

- * The optional response_code will set the response code. - *

- *

- * - * http_response_code(404); - * - *

- * @return int The current response code. By default the return value is int(200). - */ -function http_response_code ($response_code = null) {} - -/** - * (PHP 4, PHP 5)
- * Check whether client disconnected - * @link http://php.net/manual/en/function.connection-aborted.php - * @return int 1 if client disconnected, 0 otherwise. - */ -function connection_aborted () {} - -/** - * (PHP 4, PHP 5)
- * Returns connection status bitfield - * @link http://php.net/manual/en/function.connection-status.php - * @return int the connection status bitfield, which can be used against the - * CONNECTION_XXX constants to determine the connection - * status. - */ -function connection_status () {} - -/** - * (PHP 4, PHP 5)
- * Set whether a client disconnect should abort script execution - * @link http://php.net/manual/en/function.ignore-user-abort.php - * @param string $value [optional]

- * If set, this function will set the ignore_user_abort ini setting - * to the given value. If not, this function will - * only return the previous setting without changing it. - *

- * @return int the previous setting, as an integer. - */ -function ignore_user_abort ($value = null) {} - -/** - * (PHP 4, PHP 5)
- * Parse a configuration file - * @link http://php.net/manual/en/function.parse-ini-file.php - * @param string $filename

- * The filename of the ini file being parsed. - *

- * @param bool $process_sections [optional]

- * By setting the process_sections - * parameter to TRUE, you get a multidimensional array, with - * the section names and settings included. The default - * for process_sections is FALSE - *

- * @param int $scanner_mode [optional]

- * Can either be INI_SCANNER_NORMAL (default) or - * INI_SCANNER_RAW. If INI_SCANNER_RAW - * is supplied, then option values will not be parsed. - *

- * @return array The settings are returned as an associative array on success, - * and FALSE on failure. - */ -function parse_ini_file ($filename, $process_sections = false, $scanner_mode = 'INI_SCANNER_NORMAL') {} - -/** - * (PHP 5 >= 5.3.0)
- * Parse a configuration string - * @link http://php.net/manual/en/function.parse-ini-string.php - * @param string $ini

- * The contents of the ini file being parsed. - *

- * @param bool $process_sections [optional]

- * By setting the process_sections - * parameter to TRUE, you get a multidimensional array, with - * the section names and settings included. The default - * for process_sections is FALSE - *

- * @param int $scanner_mode [optional]

- * Can either be INI_SCANNER_NORMAL (default) or - * INI_SCANNER_RAW. If INI_SCANNER_RAW - * is supplied, then option values will not be parsed. - *

- * @return array The settings are returned as an associative array on success, - * and FALSE on failure. - */ -function parse_ini_string ($ini, $process_sections = false, $scanner_mode = 'INI_SCANNER_NORMAL') {} - -/** - * (PHP 4 >= 4.0.3, PHP 5)
- * Tells whether the file was uploaded via HTTP POST - * @link http://php.net/manual/en/function.is-uploaded-file.php - * @param string $filename

- * The filename being checked. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function is_uploaded_file ($filename) {} - -/** - * (PHP 4 >= 4.0.3, PHP 5)
- * Moves an uploaded file to a new location - * @link http://php.net/manual/en/function.move-uploaded-file.php - * @param string $filename

- * The filename of the uploaded file. - *

- * @param string $destination

- * The destination of the moved file. - *

- * @return bool TRUE on success. - *

- *

- * If filename is not a valid upload file, - * then no action will occur, and - * move_uploaded_file will return - * FALSE. - *

- *

- * If filename is a valid upload file, but - * cannot be moved for some reason, no action will occur, and - * move_uploaded_file will return - * FALSE. Additionally, a warning will be issued. - */ -function move_uploaded_file ($filename, $destination) {} - -/** - * (PHP 4, PHP 5)
- * Get the Internet host name corresponding to a given IP address - * @link http://php.net/manual/en/function.gethostbyaddr.php - * @param string $ip_address

- * The host IP address. - *

- * @return string the host name on success, the unmodified ip_address - * on failure, or FALSE on malformed input. - */ -function gethostbyaddr ($ip_address) {} - -/** - * (PHP 4, PHP 5)
- * Get the IPv4 address corresponding to a given Internet host name - * @link http://php.net/manual/en/function.gethostbyname.php - * @param string $hostname

- * The host name. - *

- * @return string the IPv4 address or a string containing the unmodified - * hostname on failure. - */ -function gethostbyname ($hostname) {} - -/** - * (PHP 4, PHP 5)
- * Get a list of IPv4 addresses corresponding to a given Internet host -name - * @link http://php.net/manual/en/function.gethostbynamel.php - * @param string $hostname

- * The host name. - *

- * @return array an array of IPv4 addresses or FALSE if - * hostname could not be resolved. - */ -function gethostbynamel ($hostname) {} - -/** - * (PHP >= 5.3.0)
- * Gets the host name - * @link http://php.net/manual/en/function.gethostname.php - * @return string a string with the hostname on success, otherwise FALSE is - * returned. - */ -function gethostname () {} - -/** - * (PHP 5)
- * Alias of checkdnsrr - * @link http://php.net/manual/en/function.dns-check-record.php - * @param $host - * @param $type [optional] - */ -function dns_check_record ($host, $type) {} - -/** - * (PHP 4, PHP 5)
- * Check DNS records corresponding to a given Internet host name or IP address - * @link http://php.net/manual/en/function.checkdnsrr.php - * @param string $host

- * host may either be the IP address in - * dotted-quad notation or the host name. - *

- * @param string $type [optional]

- * type may be any one of: A, MX, NS, SOA, - * PTR, CNAME, AAAA, A6, SRV, NAPTR, TXT or ANY. - *

- * @return bool TRUE if any records are found; returns FALSE if no records - * were found or if an error occurred. - */ -function checkdnsrr ($host, $type = "MX") {} - -/** - * (PHP 5)
- * Alias of getmxrr - * @link http://php.net/manual/en/function.dns-get-mx.php - * @param $hostname - * @param $mxhosts - * @param $weight [optional] - */ -function dns_get_mx ($hostname, &$mxhosts, &$weight) {} - -/** - * (PHP 4, PHP 5)
- * Get MX records corresponding to a given Internet host name - * @link http://php.net/manual/en/function.getmxrr.php - * @param string $hostname

- * The Internet host name. - *

- * @param array $mxhosts

- * A list of the MX records found is placed into the array - * mxhosts. - *

- * @param array $weight [optional]

- * If the weight array is given, it will be filled - * with the weight information gathered. - *

- * @return bool TRUE if any records are found; returns FALSE if no records - * were found or if an error occurred. - */ -function getmxrr ($hostname, array &$mxhosts, array &$weight = null) {} - -/** - * (PHP 5)
- * Fetch DNS Resource Records associated with a hostname - * @link http://php.net/manual/en/function.dns-get-record.php - * @param string $hostname

- * hostname should be a valid DNS hostname such - * as "www.example.com". Reverse lookups can be generated - * using in-addr.arpa notation, but - * gethostbyaddr is more suitable for - * the majority of reverse lookups. - *

- *

- * Per DNS standards, email addresses are given in user.host format (for - * example: hostmaster.example.com as opposed to hostmaster@example.com), - * be sure to check this value and modify if necessary before using it - * with a functions such as mail. - *

- * @param int $type [optional]

- * By default, dns_get_record will search for any - * resource records associated with hostname. - * To limit the query, specify the optional type - * parameter. May be any one of the following: - * DNS_A, DNS_CNAME, - * DNS_HINFO, DNS_MX, - * DNS_NS, DNS_PTR, - * DNS_SOA, DNS_TXT, - * DNS_AAAA, DNS_SRV, - * DNS_NAPTR, DNS_A6, - * DNS_ALL or DNS_ANY. - *

- *

- * Because of eccentricities in the performance of libresolv - * between platforms, DNS_ANY will not - * always return every record, the slower DNS_ALL - * will collect all records more reliably. - *

- * @param array $authns [optional]

- * Passed by reference and, if given, will be populated with Resource - * Records for the Authoritative Name Servers. - *

- * @param array $addtl [optional]

- * Passed by reference and, if given, will be populated with any - * Additional Records. - *

- * @return array This function returns an array of associative arrays, - * or FALSE on failure. Each associative array contains - * at minimum the following keys: - * - * Basic DNS attributes - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
AttributeMeaning
host - * The record in the DNS namespace to which the rest of the associated data refers. - *
class - * dns_get_record only returns Internet class records and as - * such this parameter will always return IN. - *
type - * String containing the record type. Additional attributes will also be contained - * in the resulting array dependant on the value of type. See table below. - *
ttl - * "Time To Live" remaining for this record. This will not equal - * the record's original ttl, but will rather equal the original ttl minus whatever - * length of time has passed since the authoritative name server was queried. - *
- *

- *

- * - * Other keys in associative arrays dependant on 'type' - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
TypeExtra Columns
A - * ip: An IPv4 addresses in dotted decimal notation. - *
MX - * pri: Priority of mail exchanger. - * Lower numbers indicate greater priority. - * target: FQDN of the mail exchanger. - * See also dns_get_mx. - *
CNAME - * target: FQDN of location in DNS namespace to which - * the record is aliased. - *
NS - * target: FQDN of the name server which is authoritative - * for this hostname. - *
PTR - * target: Location within the DNS namespace to which - * this record points. - *
TXT - * txt: Arbitrary string data associated with this record. - *
HINFO - * cpu: IANA number designating the CPU of the machine - * referenced by this record. - * os: IANA number designating the Operating System on - * the machine referenced by this record. - * See IANA's Operating System - * Names for the meaning of these values. - *
SOA - * mname: FQDN of the machine from which the resource - * records originated. - * rname: Email address of the administrative contain - * for this domain. - * serial: Serial # of this revision of the requested - * domain. - * refresh: Refresh interval (seconds) secondary name - * servers should use when updating remote copies of this domain. - * retry: Length of time (seconds) to wait after a - * failed refresh before making a second attempt. - * expire: Maximum length of time (seconds) a secondary - * DNS server should retain remote copies of the zone data without a - * successful refresh before discarding. - * minimum-ttl: Minimum length of time (seconds) a - * client can continue to use a DNS resolution before it should request - * a new resolution from the server. Can be overridden by individual - * resource records. - *
AAAA - * ipv6: IPv6 address - *
A6(PHP >= 5.1.0) - * masklen: Length (in bits) to inherit from the target - * specified by chain. - * ipv6: Address for this specific record to merge with - * chain. - * chain: Parent record to merge with - * ipv6 data. - *
SRV - * pri: (Priority) lowest priorities should be used first. - * weight: Ranking to weight which of commonly prioritized - * targets should be chosen at random. - * target and port: hostname and port - * where the requested service can be found. - * For additional information see: RFC 2782 - *
NAPTR - * order and pref: Equivalent to - * pri and weight above. - * flags, services, regex, - * and replacement: Parameters as defined by - * RFC 2915. - *
- */ -function dns_get_record ($hostname, $type = 'DNS_ANY', array &$authns = null, array &$addtl = null) {} - -/** - * (PHP 4, PHP 5)
- * Get the integer value of a variable - * @link http://php.net/manual/en/function.intval.php - * @param mixed $var

- * The scalar value being converted to an integer - *

- * @param int $base [optional]

- * The base for the conversion - *

- * @return int The integer value of var on success, or 0 on - * failure. Empty arrays return 0, non-empty arrays return 1. - *

- *

- * The maximum value depends on the system. 32 bit systems have a - * maximum signed integer range of -2147483648 to 2147483647. So for example - * on such a system, intval('1000000000000') will return - * 2147483647. The maximum signed integer value for 64 bit systems is - * 9223372036854775807. - *

- *

- * Strings will most likely return 0 although this depends on the - * leftmost characters of the string. The common rules of - * integer casting - * apply. - */ -function intval ($var, $base = 10) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Get float value of a variable - * @link http://php.net/manual/en/function.floatval.php - * @param mixed $var

- * May be any scalar type. floatval should not be used - * on objects, as doing so will emit an E_NOTICE level - * error and return 1. - *

- * @return float The float value of the given variable. Empty arrays return 0, non-empty - * arrays return 1. - *

- *

- * Strings will most likely return 0 although this depends on the - * leftmost characters of the string. The common rules of - * float casting - * apply. - */ -function floatval ($var) {} - -/** - * (PHP 4, PHP 5)
- * Alias of floatval - * @link http://php.net/manual/en/function.doubleval.php - * @param $var - */ -function doubleval ($var) {} - -/** - * (PHP 4, PHP 5)
- * Get string value of a variable - * @link http://php.net/manual/en/function.strval.php - * @param mixed $var

- * The variable that is being converted to a string. - *

- *

- * var may be any scalar type or an object that - * implements the __toString() - * method. You cannot use strval on arrays or on - * objects that do not implement the - * __toString() method. - *

- * @return string The string value of var. - */ -function strval ($var) {} - -/** - * (PHP 4, PHP 5)
- * Get the type of a variable - * @link http://php.net/manual/en/function.gettype.php - * @param mixed $var

- * The variable being type checked. - *

- * @return string Possibles values for the returned string are: - * "boolean" - * "integer" - * "double" (for historical reasons "double" is - * returned in case of a float, and not simply - * "float") - * "string" - * "array" - * "object" - * "resource" - * "NULL" - * "unknown type" - */ -function gettype ($var) {} - -/** - * (PHP 4, PHP 5)
- * Set the type of a variable - * @link http://php.net/manual/en/function.settype.php - * @param mixed $var

- * The variable being converted. - *

- * @param string $type

- * Possibles values of type are: - * "boolean" (or, since PHP 4.2.0, "bool") - * @return bool TRUE on success or FALSE on failure. - */ -function settype (&$var, $type) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Finds whether a variable is NULL - * @link http://php.net/manual/en/function.is-null.php - * @param mixed $var

- * The variable being evaluated. - *

- * @return bool TRUE if var is null, FALSE - * otherwise. - */ -function is_null ($var) {} - -/** - * (PHP 4, PHP 5)
- * Finds whether a variable is a resource - * @link http://php.net/manual/en/function.is-resource.php - * @param mixed $var

- * The variable being evaluated. - *

- * @return bool TRUE if var is a resource, - * FALSE otherwise. - */ -function is_resource ($var) {} - -/** - * (PHP 4, PHP 5)
- * Finds out whether a variable is a boolean - * @link http://php.net/manual/en/function.is-bool.php - * @param mixed $var

- * The variable being evaluated. - *

- * @return bool TRUE if var is a boolean, - * FALSE otherwise. - */ -function is_bool ($var) {} - -/** - * (PHP 4, PHP 5)
- * Alias of is_int - * @link http://php.net/manual/en/function.is-long.php - * @param $var - */ -function is_long ($var) {} - -/** - * (PHP 4, PHP 5)
- * Finds whether the type of a variable is float - * @link http://php.net/manual/en/function.is-float.php - * @param mixed $var

- * The variable being evaluated. - *

- * @return bool TRUE if var is a float, - * FALSE otherwise. - */ -function is_float ($var) {} - -/** - * (PHP 4, PHP 5)
- * Find whether the type of a variable is integer - * @link http://php.net/manual/en/function.is-int.php - * @param mixed $var

- * The variable being evaluated. - *

- * @return bool TRUE if var is an integer, - * FALSE otherwise. - */ -function is_int ($var) {} - -/** - * (PHP 4, PHP 5)
- * Alias of is_int - * @link http://php.net/manual/en/function.is-integer.php - * @param $var - */ -function is_integer ($var) {} - -/** - * (PHP 4, PHP 5)
- * Alias of is_float - * @link http://php.net/manual/en/function.is-double.php - * @param $var - */ -function is_double ($var) {} - -/** - * (PHP 4, PHP 5)
- * Alias of is_float - * @link http://php.net/manual/en/function.is-real.php - * @param $var - */ -function is_real ($var) {} - -/** - * (PHP 4, PHP 5)
- * Finds whether a variable is a number or a numeric string - * @link http://php.net/manual/en/function.is-numeric.php - * @param mixed $var

- * The variable being evaluated. - *

- * @return bool TRUE if var is a number or a numeric - * string, FALSE otherwise. - */ -function is_numeric ($var) {} - -/** - * (PHP 4, PHP 5)
- * Find whether the type of a variable is string - * @link http://php.net/manual/en/function.is-string.php - * @param mixed $var

- * The variable being evaluated. - *

- * @return bool TRUE if var is of type string, - * FALSE otherwise. - */ -function is_string ($var) {} - -/** - * (PHP 4, PHP 5)
- * Finds whether a variable is an array - * @link http://php.net/manual/en/function.is-array.php - * @param mixed $var

- * The variable being evaluated. - *

- * @return bool TRUE if var is an array, - * FALSE otherwise. - */ -function is_array ($var) {} - -/** - * (PHP 4, PHP 5)
- * Finds whether a variable is an object - * @link http://php.net/manual/en/function.is-object.php - * @param mixed $var

- * The variable being evaluated. - *

- * @return bool TRUE if var is an object, - * FALSE otherwise. - */ -function is_object ($var) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Finds whether a variable is a scalar - * @link http://php.net/manual/en/function.is-scalar.php - * @param mixed $var

- * The variable being evaluated. - *

- * @return bool TRUE if var is a scalar FALSE - * otherwise. - */ -function is_scalar ($var) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Verify that the contents of a variable can be called as a function - * @link http://php.net/manual/en/function.is-callable.php - * @param callable $name

- * The callback function to check - *

- * @param bool $syntax_only [optional]

- * If set to TRUE the function only verifies that - * name might be a function or method. It will only - * reject simple variables that are not strings, or an array that does - * not have a valid structure to be used as a callback. The valid ones - * are supposed to have only 2 entries, the first of which is an object - * or a string, and the second a string. - *

- * @param string $callable_name [optional]

- * Receives the "callable name". In the example below it is - * "someClass::someMethod". Note, however, that despite the implication - * that someClass::SomeMethod() is a callable static method, this is not - * the case. - *

- * @return bool TRUE if name is callable, FALSE - * otherwise. - */ -function is_callable (callable $name, $syntax_only = false, &$callable_name = null) {} - -/** - * (PHP 4, PHP 5)
- * Closes process file pointer - * @link http://php.net/manual/en/function.pclose.php - * @param resource $handle

- * The file pointer must be valid, and must have been returned by a - * successful call to popen. - *

- * @return int the termination status of the process that was run. In case of - * an error then -1 is returned. - */ -function pclose ($handle) {} - -/** - * (PHP 4, PHP 5)
- * Opens process file pointer - * @link http://php.net/manual/en/function.popen.php - * @param string $command

- * The command - *

- * @param string $mode

- * The mode - *

- * @return resource a file pointer identical to that returned by - * fopen, except that it is unidirectional (may - * only be used for reading or writing) and must be closed with - * pclose. This pointer may be used with - * fgets, fgetss, and - * fwrite. When the mode is 'r', the returned - * file pointer equals to the STDOUT of the command, when the mode - * is 'w', the returned file pointer equals to the STDIN of the - * command. - *

- *

- * If an error occurs, returns FALSE. - */ -function popen ($command, $mode) {} - -/** - * (PHP 4, PHP 5)
- * Outputs a file - * @link http://php.net/manual/en/function.readfile.php - * @param string $filename

- * The filename being read. - *

- * @param bool $use_include_path [optional]

- * You can use the optional second parameter and set it to TRUE, if - * you want to search for the file in the include_path, too. - *

- * @param resource $context [optional]

- * A context stream resource. - *

- * @return int the number of bytes read from the file. If an error - * occurs, FALSE is returned and unless the function was called as - * @readfile, an error message is printed. - */ -function readfile ($filename, $use_include_path = false, $context = null) {} - -/** - * (PHP 4, PHP 5)
- * Rewind the position of a file pointer - * @link http://php.net/manual/en/function.rewind.php - * @param resource $handle

- * The file pointer must be valid, and must point to a file - * successfully opened by fopen. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function rewind ($handle) {} - -/** - * (PHP 4, PHP 5)
- * Removes directory - * @link http://php.net/manual/en/function.rmdir.php - * @param string $dirname

- * Path to the directory. - *

- * @param resource $context [optional] Context support was added - * with PHP 5.0.0. For a description of contexts, refer to - * . - * @return bool TRUE on success or FALSE on failure. - */ -function rmdir ($dirname, $context = null) {} - -/** - * (PHP 4, PHP 5)
- * Changes the current umask - * @link http://php.net/manual/en/function.umask.php - * @param int $mask [optional]

- * The new umask. - *

- * @return int umask without arguments simply returns the - * current umask otherwise the old umask is returned. - */ -function umask ($mask = null) {} - -/** - * (PHP 4, PHP 5)
- * Closes an open file pointer - * @link http://php.net/manual/en/function.fclose.php - * @param resource $handle

- * The file pointer must be valid, and must point to a file successfully - * opened by fopen or fsockopen. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function fclose ($handle) {} - -/** - * (PHP 4, PHP 5)
- * Tests for end-of-file on a file pointer - * @link http://php.net/manual/en/function.feof.php - * @param resource $handle The file pointer must be valid, and must point to - * a file successfully opened by fopen or - * fsockopen (and not yet closed by - * fclose).

- * @return bool TRUE if the file pointer is at EOF or an error occurs - * (including socket timeout); otherwise returns FALSE. - */ -function feof ($handle) {} - -/** - * (PHP 4, PHP 5)
- * Gets character from file pointer - * @link http://php.net/manual/en/function.fgetc.php - * @param resource $handle The file pointer must be valid, and must point to - * a file successfully opened by fopen or - * fsockopen (and not yet closed by - * fclose).

- * @return string a string containing a single character read from the file pointed - * to by handle. Returns FALSE on EOF. - */ -function fgetc ($handle) {} - -/** - * (PHP 4, PHP 5)
- * Gets line from file pointer - * @link http://php.net/manual/en/function.fgets.php - * @param resource $handle The file pointer must be valid, and must point to - * a file successfully opened by fopen or - * fsockopen (and not yet closed by - * fclose).

- * @param int $length [optional]

- * Reading ends when length - 1 bytes have been - * read, or a newline (which is included in the return value), or an EOF - * (whichever comes first). If no length is specified, it will keep - * reading from the stream until it reaches the end of the line. - *

- *

- * Until PHP 4.3.0, omitting it would assume 1024 as the line length. - * If the majority of the lines in the file are all larger than 8KB, - * it is more resource efficient for your script to specify the maximum - * line length. - *

- * @return string a string of up to length - 1 bytes read from - * the file pointed to by handle. If there is no more data - * to read in the file pointer, then FALSE is returned. - *

- *

- * If an error occurs, FALSE is returned. - */ -function fgets ($handle, $length = null) {} - -/** - * (PHP 4, PHP 5)
- * Gets line from file pointer and strip HTML tags - * @link http://php.net/manual/en/function.fgetss.php - * @param resource $handle The file pointer must be valid, and must point to - * a file successfully opened by fopen or - * fsockopen (and not yet closed by - * fclose).

- * @param int $length [optional]

- * Length of the data to be retrieved. - *

- * @param string $allowable_tags [optional]

- * You can use the optional third parameter to specify tags which should - * not be stripped. - *

- * @return string a string of up to length - 1 bytes read from - * the file pointed to by handle, with all HTML and PHP - * code stripped. - *

- *

- * If an error occurs, returns FALSE. - */ -function fgetss ($handle, $length = null, $allowable_tags = null) {} - -/** - * (PHP 4, PHP 5)
- * Binary-safe file read - * @link http://php.net/manual/en/function.fread.php - * @param resource $handle A file system pointer resource - * that is typically created using fopen.

- * @param int $length

- * Up to length number of bytes read. - *

- * @return string the read string or FALSE on failure. - */ -function fread ($handle, $length) {} - -/** - * (PHP 4, PHP 5)
- * Opens file or URL - * @link http://php.net/manual/en/function.fopen.php - * @param string $filename

- * If filename is of the form "scheme://...", it - * is assumed to be a URL and PHP will search for a protocol handler - * (also known as a wrapper) for that scheme. If no wrappers for that - * protocol are registered, PHP will emit a notice to help you track - * potential problems in your script and then continue as though - * filename specifies a regular file. - *

- *

- * If PHP has decided that filename specifies - * a local file, then it will try to open a stream on that file. - * The file must be accessible to PHP, so you need to ensure that - * the file access permissions allow this access. - * If you have enabled safe mode, - * or open_basedir further - * restrictions may apply. - *

- *

- * If PHP has decided that filename specifies - * a registered protocol, and that protocol is registered as a - * network URL, PHP will check to make sure that - * allow_url_fopen is - * enabled. If it is switched off, PHP will emit a warning and - * the fopen call will fail. - *

- *

- * The list of supported protocols can be found in . Some protocols (also referred to as - * wrappers) support context - * and/or php.ini options. Refer to the specific page for the - * protocol in use for a list of options which can be set. (e.g. - * php.ini value user_agent used by the - * http wrapper). - *

- *

- * On the Windows platform, be careful to escape any backslashes - * used in the path to the file, or use forward slashes. - * - * $handle = fopen("c:\\folder\\resource.txt", "r"); - * - *

- * @param string $mode

- * The mode parameter specifies the type of access - * you require to the stream. It may be any of the following: - * - * A list of possible modes for fopen - * using mode - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
modeDescription
'r' - * Open for reading only; place the file pointer at the - * beginning of the file. - *
'r+' - * Open for reading and writing; place the file pointer at - * the beginning of the file. - *
'w' - * Open for writing only; place the file pointer at the - * beginning of the file and truncate the file to zero length. - * If the file does not exist, attempt to create it. - *
'w+' - * Open for reading and writing; place the file pointer at - * the beginning of the file and truncate the file to zero - * length. If the file does not exist, attempt to create it. - *
'a' - * Open for writing only; place the file pointer at the end of - * the file. If the file does not exist, attempt to create it. - *
'a+' - * Open for reading and writing; place the file pointer at - * the end of the file. If the file does not exist, attempt to - * create it. - *
'x' - * Create and open for writing only; place the file pointer at the - * beginning of the file. If the file already exists, the - * fopen call will fail by returning FALSE and - * generating an error of level E_WARNING. If - * the file does not exist, attempt to create it. This is equivalent - * to specifying O_EXCL|O_CREAT flags for the - * underlying open(2) system call. - *
'x+' - * Create and open for reading and writing; otherwise it has the - * same behavior as 'x'. - *
'c' - * Open the file for writing only. If the file does not exist, it is - * created. If it exists, it is neither truncated (as opposed to - * 'w'), nor the call to this function fails (as is - * the case with 'x'). The file pointer is - * positioned on the beginning of the file. This may be useful if it's - * desired to get an advisory lock (see flock) - * before attempting to modify the file, as using - * 'w' could truncate the file before the lock - * was obtained (if truncation is desired, - * ftruncate can be used after the lock is - * requested). - *
'c+' - * Open the file for reading and writing; otherwise it has the same - * behavior as 'c'. - *
- *

- *

- * Different operating system families have different line-ending - * conventions. When you write a text file and want to insert a line - * break, you need to use the correct line-ending character(s) for your - * operating system. Unix based systems use \n as the - * line ending character, Windows based systems use \r\n - * as the line ending characters and Macintosh based systems use - * \r as the line ending character. - *

- *

- * If you use the wrong line ending characters when writing your files, you - * might find that other applications that open those files will "look - * funny". - *

- *

- * Windows offers a text-mode translation flag ('t') - * which will transparently translate \n to - * \r\n when working with the file. In contrast, you - * can also use 'b' to force binary mode, which will not - * translate your data. To use these flags, specify either - * 'b' or 't' as the last character - * of the mode parameter. - *

- *

- * The default translation mode depends on the SAPI and version of PHP that - * you are using, so you are encouraged to always specify the appropriate - * flag for portability reasons. You should use the 't' - * mode if you are working with plain-text files and you use - * \n to delimit your line endings in your script, but - * expect your files to be readable with applications such as notepad. You - * should use the 'b' in all other cases. - *

- *

- * If you do not specify the 'b' flag when working with binary files, you - * may experience strange problems with your data, including broken image - * files and strange problems with \r\n characters. - *

- *

- * For portability, it is strongly recommended that you always - * use the 'b' flag when opening files with fopen. - *

- *

- * Again, for portability, it is also strongly recommended that - * you re-write code that uses or relies upon the 't' - * mode so that it uses the correct line endings and - * 'b' mode instead. - *

- * @param bool $use_include_path [optional]

- * The optional third use_include_path parameter - * can be set to '1' or TRUE if you want to search for the file in the - * include_path, too. - *

- * @param resource $context [optional] Context support was added - * with PHP 5.0.0. For a description of contexts, refer to - * . - * @return resource a file pointer resource on success, or FALSE on error. - */ -function fopen ($filename, $mode, $use_include_path = false, $context = null) {} - -/** - * (PHP 4, PHP 5)
- * Output all remaining data on a file pointer - * @link http://php.net/manual/en/function.fpassthru.php - * @param resource $handle The file pointer must be valid, and must point to - * a file successfully opened by fopen or - * fsockopen (and not yet closed by - * fclose).

- * @return int If an error occurs, fpassthru returns - * FALSE. Otherwise, fpassthru returns - * the number of characters read from handle - * and passed through to the output. - */ -function fpassthru ($handle) {} - -/** - * (PHP 4, PHP 5)
- * Truncates a file to a given length - * @link http://php.net/manual/en/function.ftruncate.php - * @param resource $handle

- * The file pointer. - *

- *

- * The handle must be open for writing. - *

- * @param int $size

- * The size to truncate to. - *

- *

- * If size is larger than the file then the file - * is extended with null bytes. - *

- *

- * If size is smaller than the file then the file - * is truncated to that size. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ftruncate ($handle, $size) {} - -/** - * (PHP 4, PHP 5)
- * Gets information about a file using an open file pointer - * @link http://php.net/manual/en/function.fstat.php - * @param resource $handle A file system pointer resource - * that is typically created using fopen.

- * @return array an array with the statistics of the file; the format of the array - * is described in detail on the stat manual page. - */ -function fstat ($handle) {} - -/** - * (PHP 4, PHP 5)
- * Seeks on a file pointer - * @link http://php.net/manual/en/function.fseek.php - * @param resource $handle A file system pointer resource - * that is typically created using fopen.

- * @param int $offset

- * The offset. - *

- *

- * To move to a position before the end-of-file, you need to pass - * a negative value in offset and - * set whence - * to SEEK_END. - *

- * @param int $whence [optional]

- * whence values are: - * SEEK_SET - Set position equal to offset bytes. - * SEEK_CUR - Set position to current location plus offset. - * SEEK_END - Set position to end-of-file plus offset. - *

- * @return int Upon success, returns 0; otherwise, returns -1. - */ -function fseek ($handle, $offset, $whence = 'SEEK_SET') {} - -/** - * (PHP 4, PHP 5)
- * Returns the current position of the file read/write pointer - * @link http://php.net/manual/en/function.ftell.php - * @param resource $handle

- * The file pointer must be valid, and must point to a file successfully - * opened by fopen or popen. - * ftell gives undefined results for append-only streams - * (opened with "a" flag). - *

- * @return int the position of the file pointer referenced by - * handle as an integer; i.e., its offset into the file stream. - *

- *

- * If an error occurs, returns FALSE. - */ -function ftell ($handle) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Flushes the output to a file - * @link http://php.net/manual/en/function.fflush.php - * @param resource $handle The file pointer must be valid, and must point to - * a file successfully opened by fopen or - * fsockopen (and not yet closed by - * fclose).

- * @return bool TRUE on success or FALSE on failure. - */ -function fflush ($handle) {} - -/** - * (PHP 4, PHP 5)
- * Binary-safe file write - * @link http://php.net/manual/en/function.fwrite.php - * @param resource $handle A file system pointer resource - * that is typically created using fopen.

- * @param string $string

- * The string that is to be written. - *

- * @param int $length [optional]

- * If the length argument is given, writing will - * stop after length bytes have been written or - * the end of string is reached, whichever comes - * first. - *

- *

- * Note that if the length argument is given, - * then the magic_quotes_runtime - * configuration option will be ignored and no slashes will be - * stripped from string. - *

- * @return int - */ -function fwrite ($handle, $string, $length = null) {} - -/** - * (PHP 4, PHP 5)
- * Alias of fwrite - * @link http://php.net/manual/en/function.fputs.php - * @param $fp - * @param $str - * @param $length [optional] - */ -function fputs ($fp, $str, $length) {} - -/** - * (PHP 4, PHP 5)
- * Makes directory - * @link http://php.net/manual/en/function.mkdir.php - * @param string $pathname

- * The directory path. - *

- * @param int $mode [optional]

- * The mode is 0777 by default, which means the widest possible - * access. For more information on modes, read the details - * on the chmod page. - *

- *

- * mode is ignored on Windows. - *

- *

- * Note that you probably want to specify the mode as an octal number, - * which means it should have a leading zero. The mode is also modified - * by the current umask, which you can change using - * umask. - *

- * @param bool $recursive [optional]

- * Allows the creation of nested directories specified in the - * pathname. - *

- * @param resource $context [optional] Context support was added - * with PHP 5.0.0. For a description of contexts, refer to - * . - * @return bool TRUE on success or FALSE on failure. - */ -function mkdir ($pathname, $mode = 0777, $recursive = false, $context = null) {} - -/** - * (PHP 4, PHP 5)
- * Renames a file or directory - * @link http://php.net/manual/en/function.rename.php - * @param string $oldname

- *

- *

- * The old name. The wrapper used in oldname - * must match the wrapper used in - * newname. - *

- * @param string $newname

- * The new name. - *

- * @param resource $context [optional] Context support was added - * with PHP 5.0.0. For a description of contexts, refer to - * . - * @return bool TRUE on success or FALSE on failure. - */ -function rename ($oldname, $newname, $context = null) {} - -/** - * (PHP 4, PHP 5)
- * Copies file - * @link http://php.net/manual/en/function.copy.php - * @param string $source

- * Path to the source file. - *

- * @param string $dest

- * The destination path. If dest is a URL, the - * copy operation may fail if the wrapper does not support overwriting of - * existing files. - *

- *

- * If the destination file already exists, it will be overwritten. - *

- * @param resource $context [optional]

- * A valid context resource created with - * stream_context_create. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function copy ($source, $dest, $context = null) {} - -/** - * (PHP 4, PHP 5)
- * Create file with unique file name - * @link http://php.net/manual/en/function.tempnam.php - * @param string $dir

- * The directory where the temporary filename will be created. - *

- * @param string $prefix

- * The prefix of the generated temporary filename. - *

- * Windows uses only the first three characters of prefix. - * @return string the new temporary filename, or FALSE on - * failure. - */ -function tempnam ($dir, $prefix) {} - -/** - * (PHP 4, PHP 5)
- * Creates a temporary file - * @link http://php.net/manual/en/function.tmpfile.php - * @return resource a file handle, similar to the one returned by - * fopen, for the new file or FALSE on failure. - */ -function tmpfile () {} - -/** - * (PHP 4, PHP 5)
- * Reads entire file into an array - * @link http://php.net/manual/en/function.file.php - * @param string $filename

- * Path to the file. - *

- * A URL can be used as a - * filename with this function if the fopen wrappers have been enabled. - * See fopen for more details on how to specify the - * filename. See the for links to information - * about what abilities the various wrappers have, notes on their usage, - * and information on any predefined variables they may - * provide. - * @param int $flags [optional]

- * The optional parameter flags can be one, or - * more, of the following constants: - * FILE_USE_INCLUDE_PATH - * Search for the file in the include_path. - * @param resource $context [optional]

- * A context resource created with the - * stream_context_create function. - *

- *

- * Context support was added - * with PHP 5.0.0. For a description of contexts, refer to - * . - *

- * @return array the file in an array. Each element of the array corresponds to a - * line in the file, with the newline still attached. Upon failure, - * file returns FALSE. - *

- *

- * Each line in the resulting array will include the line ending, unless - * FILE_IGNORE_NEW_LINES is used, so you still need to - * use rtrim if you do not want the line ending - * present. - */ -function file ($filename, $flags = 0, $context = null) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Reads entire file into a string - * @link http://php.net/manual/en/function.file-get-contents.php - * @param string $filename

- * Name of the file to read. - *

- * @param bool $use_include_path [optional]

- * As of PHP 5 the FILE_USE_INCLUDE_PATH can be used - * to trigger include path - * search. - *

- * @param resource $context [optional]

- * A valid context resource created with - * stream_context_create. If you don't need to use a - * custom context, you can skip this parameter by NULL. - *

- * @param int $offset [optional]

- * The offset where the reading starts on the original stream. - *

- *

- * Seeking (offset) is not supported with remote files. - * Attempting to seek on non-local files may work with small offsets, but this - * is unpredictable because it works on the buffered stream. - *

- * @param int $maxlen [optional]

- * Maximum length of data read. The default is to read until end - * of file is reached. Note that this parameter is applied to the - * stream processed by the filters. - *

- * @return string The function returns the read data or FALSE on failure. - */ -function file_get_contents ($filename, $use_include_path = false, $context = null, $offset = -1, $maxlen = null) {} - -/** - * (PHP 5)
- * Write a string to a file - * @link http://php.net/manual/en/function.file-put-contents.php - * @param string $filename

- * Path to the file where to write the data. - *

- * @param mixed $data

- * The data to write. Can be either a string, an - * array or a stream resource. - *

- *

- * If data is a stream resource, the - * remaining buffer of that stream will be copied to the specified file. - * This is similar with using stream_copy_to_stream. - *

- *

- * You can also specify the data parameter as a single - * dimension array. This is equivalent to - * file_put_contents($filename, implode('', $array)). - *

- * @param int $flags [optional]

- * The value of flags can be any combination of - * the following flags, joined with the binary OR (|) - * operator. - *

- *

- * - * Available flags - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
FlagDescription
- * FILE_USE_INCLUDE_PATH - * - * Search for filename in the include directory. - * See include_path for more - * information. - *
- * FILE_APPEND - * - * If file filename already exists, append - * the data to the file instead of overwriting it. - *
- * LOCK_EX - * - * Acquire an exclusive lock on the file while proceeding to the - * writing. - *
- *

- * @param resource $context [optional]

- * A valid context resource created with - * stream_context_create. - *

- * @return int This function returns the number of bytes that were written to the file, or - * FALSE on failure. - */ -function file_put_contents ($filename, $data, $flags = 0, $context = null) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Runs the equivalent of the select() system call on the given -arrays of streams with a timeout specified by tv_sec and tv_usec - * @link http://php.net/manual/en/function.stream-select.php - * @param array $read

- * The streams listed in the read array will be watched to - * see if characters become available for reading (more precisely, to see if - * a read will not block - in particular, a stream resource is also ready on - * end-of-file, in which case an fread will return - * a zero length string). - *

- * @param array $write

- * The streams listed in the write array will be - * watched to see if a write will not block. - *

- * @param array $except

- * The streams listed in the except array will be - * watched for high priority exceptional ("out-of-band") data arriving. - *

- *

- * When stream_select returns, the arrays - * read, write and - * except are modified to indicate which stream - * resource(s) actually changed status. - *

- * You do not need to pass every array to - * stream_select. You can leave it out and use an - * empty array or NULL instead. Also do not forget that those arrays are - * passed by reference and will be modified after - * stream_select returns. - * @param int $tv_sec

- * The tv_sec and tv_usec - * together form the timeout parameter, - * tv_sec specifies the number of seconds while - * tv_usec the number of microseconds. - * The timeout is an upper bound on the amount of time - * that stream_select will wait before it returns. - * If tv_sec and tv_usec are - * both set to 0, stream_select will - * not wait for data - instead it will return immediately, indicating the - * current status of the streams. - *

- *

- * If tv_sec is NULL stream_select - * can block indefinitely, returning only when an event on one of the - * watched streams occurs (or if a signal interrupts the system call). - *

- *

- * Using a timeout value of 0 allows you to - * instantaneously poll the status of the streams, however, it is NOT a - * good idea to use a 0 timeout value in a loop as it - * will cause your script to consume too much CPU time. - *

- *

- * It is much better to specify a timeout value of a few seconds, although - * if you need to be checking and running other code concurrently, using a - * timeout value of at least 200000 microseconds will - * help reduce the CPU usage of your script. - *

- *

- * Remember that the timeout value is the maximum time that will elapse; - * stream_select will return as soon as the - * requested streams are ready for use. - *

- * @param int $tv_usec [optional]

- * See tv_sec description. - *

- * @return int On success stream_select returns the number of - * stream resources contained in the modified arrays, which may be zero if - * the timeout expires before anything interesting happens. On error FALSE - * is returned and a warning raised (this can happen if the system call is - * interrupted by an incoming signal). - */ -function stream_select (array &$read, array &$write, array &$except, $tv_sec, $tv_usec = 0) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Creates a stream context - * @link http://php.net/manual/en/function.stream-context-create.php - * @param array $options [optional]

- * Must be an associative array of associative arrays in the format - * $arr['wrapper']['option'] = $value. - *

- *

- * Default to an empty array. - *

- * @param array $params [optional]

- * Must be an associative array in the format - * $arr['parameter'] = $value. - * Refer to context parameters for - * a listing of standard stream parameters. - *

- * @return resource A stream context resource. - */ -function stream_context_create (array $options = null, array $params = null) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Set parameters for a stream/wrapper/context - * @link http://php.net/manual/en/function.stream-context-set-params.php - * @param resource $stream_or_context

- * The stream or context to apply the parameters too. - *

- * @param array $params

- * An array of parameters to set. - *

- *

- * params should be an associative array of the structure: - * $params['paramname'] = "paramvalue";. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function stream_context_set_params ($stream_or_context, array $params) {} - -/** - * (PHP 5 >= 5.3.0)
- * Retrieves parameters from a context - * @link http://php.net/manual/en/function.stream-context-get-params.php - * @param resource $stream_or_context

- * A stream resource or a - * context resource - *

- * @return array an associate array containing all context options and parameters. - */ -function stream_context_get_params ($stream_or_context) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Sets an option for a stream/wrapper/context - * @link http://php.net/manual/en/function.stream-context-set-option.php - * @param resource $stream_or_context

- * The stream or context resource to apply the options too. - *

- * @param string $wrapper - * @param string $option - * @param mixed $value - * @return bool TRUE on success or FALSE on failure. - */ -function stream_context_set_option ($stream_or_context, $wrapper, $option, $value) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Retrieve options for a stream/wrapper/context - * @link http://php.net/manual/en/function.stream-context-get-options.php - * @param resource $stream_or_context

- * The stream or context to get options from - *

- * @return array an associative array with the options. - */ -function stream_context_get_options ($stream_or_context) {} - -/** - * (PHP 5 >= 5.1.0)
- * Retrieve the default stream context - * @link http://php.net/manual/en/function.stream-context-get-default.php - * @param array $options [optional] options must be an associative - * array of associative arrays in the format - * $arr['wrapper']['option'] = $value. - *

- * As of PHP 5.3.0, the stream_context_set_default function - * can be used to set the default context. - *

- * @return resource A stream context resource. - */ -function stream_context_get_default (array $options = null) {} - -/** - * (PHP 5 >= 5.3.0)
- * Set the default stream context - * @link http://php.net/manual/en/function.stream-context-set-default.php - * @param array $options

- * The options to set for the default context. - *

- *

- * options must be an associative - * array of associative arrays in the format - * $arr['wrapper']['option'] = $value. - *

- * @return resource the default stream context. - */ -function stream_context_set_default (array $options) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Attach a filter to a stream - * @link http://php.net/manual/en/function.stream-filter-prepend.php - * @param resource $stream

- * The target stream. - *

- * @param string $filtername

- * The filter name. - *

- * @param int $read_write [optional]

- * By default, stream_filter_prepend will - * attach the filter to the read filter chain - * if the file was opened for reading (i.e. File Mode: - * r, and/or +). The filter - * will also be attached to the write filter chain - * if the file was opened for writing (i.e. File Mode: - * w, a, and/or +). - * STREAM_FILTER_READ, - * STREAM_FILTER_WRITE, and/or - * STREAM_FILTER_ALL can also be passed to the - * read_write parameter to override this behavior. - * See stream_filter_append for an example of - * using this parameter. - *

- * @param mixed $params [optional]

- * This filter will be added with the specified params - * to the beginning of the list and will therefore be - * called first during stream operations. To add a filter to the end of the - * list, use stream_filter_append. - *

- * @return resource a resource which can be used to refer to this filter - * instance during a call to stream_filter_remove. - */ -function stream_filter_prepend ($stream, $filtername, $read_write = null, $params = null) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Attach a filter to a stream - * @link http://php.net/manual/en/function.stream-filter-append.php - * @param resource $stream

- * The target stream. - *

- * @param string $filtername

- * The filter name. - *

- * @param int $read_write [optional]

- * By default, stream_filter_append will - * attach the filter to the read filter chain - * if the file was opened for reading (i.e. File Mode: - * r, and/or +). The filter - * will also be attached to the write filter chain - * if the file was opened for writing (i.e. File Mode: - * w, a, and/or +). - * STREAM_FILTER_READ, - * STREAM_FILTER_WRITE, and/or - * STREAM_FILTER_ALL can also be passed to the - * read_write parameter to override this behavior. - *

- * @param mixed $params [optional]

- * This filter will be added with the specified - * params to the end of - * the list and will therefore be called last during stream operations. - * To add a filter to the beginning of the list, use - * stream_filter_prepend. - *

- * @return resource a resource which can be used to refer to this filter - * instance during a call to stream_filter_remove. - */ -function stream_filter_append ($stream, $filtername, $read_write = null, $params = null) {} - -/** - * (PHP 5 >= 5.1.0)
- * Remove a filter from a stream - * @link http://php.net/manual/en/function.stream-filter-remove.php - * @param resource $stream_filter

- * The stream filter to be removed. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function stream_filter_remove ($stream_filter) {} - -/** - * (PHP 5)
- * Open Internet or Unix domain socket connection - * @link http://php.net/manual/en/function.stream-socket-client.php - * @param string $remote_socket

- * Address to the socket to connect to. - *

- * @param int $errno [optional]

- * Will be set to the system level error number if connection fails. - *

- * @param string $errstr [optional]

- * Will be set to the system level error message if the connection fails. - *

- * @param float $timeout [optional]

- * Number of seconds until the connect() system call - * should timeout. - * This parameter only applies when not making asynchronous - * connection attempts. - *

- * To set a timeout for reading/writing data over the socket, use the - * stream_set_timeout, as the - * timeout only applies while making connecting - * the socket. - *

- *

- * @param int $flags [optional]

- * Bitmask field which may be set to any combination of connection flags. - * Currently the select of connection flags is limited to - * STREAM_CLIENT_CONNECT (default), - * STREAM_CLIENT_ASYNC_CONNECT and - * STREAM_CLIENT_PERSISTENT. - *

- * @param resource $context [optional]

- * A valid context resource created with stream_context_create. - *

- * @return resource On success a stream resource is returned which may - * be used together with the other file functions (such as - * fgets, fgetss, - * fwrite, fclose, and - * feof), FALSE on failure. - */ -function stream_socket_client ($remote_socket, &$errno = null, &$errstr = null, $timeout = 'ini_get("default_socket_timeout")', $flags = 'STREAM_CLIENT_CONNECT', $context = null) {} - -/** - * (PHP 5)
- * Create an Internet or Unix domain server socket - * @link http://php.net/manual/en/function.stream-socket-server.php - * @param string $local_socket

- * The type of socket created is determined by the transport specified - * using standard URL formatting: transport://target. - *

- *

- * For Internet Domain sockets (AF_INET) such as TCP and UDP, the - * target portion of the - * remote_socket parameter should consist of a - * hostname or IP address followed by a colon and a port number. For - * Unix domain sockets, the target portion should - * point to the socket file on the filesystem. - *

- *

- * Depending on the environment, Unix domain sockets may not be available. - * A list of available transports can be retrieved using - * stream_get_transports. See - * for a list of bulitin transports. - *

- * @param int $errno [optional]

- * If the optional errno and errstr - * arguments are present they will be set to indicate the actual system - * level error that occurred in the system-level socket(), - * bind(), and listen() calls. If - * the value returned in errno is - * 0 and the function returned FALSE, it is an - * indication that the error occurred before the bind() - * call. This is most likely due to a problem initializing the socket. - * Note that the errno and - * errstr arguments will always be passed by reference. - *

- * @param string $errstr [optional]

- * See errno description. - *

- * @param int $flags [optional]

- * A bitmask field which may be set to any combination of socket creation - * flags. - *

- *

- * For UDP sockets, you must use STREAM_SERVER_BIND as - * the flags parameter. - *

- * @param resource $context [optional] - * @return resource the created stream, or FALSE on error. - */ -function stream_socket_server ($local_socket, &$errno = null, &$errstr = null, $flags = 'STREAM_SERVER_BIND | STREAM_SERVER_LISTEN', $context = null) {} - -/** - * (PHP 5)
- * Accept a connection on a socket created by stream_socket_server - * @link http://php.net/manual/en/function.stream-socket-accept.php - * @param resource $server_socket

- * The server socket to accept a connection from. - *

- * @param float $timeout [optional]

- * Override the default socket accept timeout. Time should be given in - * seconds. - *

- * @param string $peername [optional]

- * Will be set to the name (address) of the client which connected, if - * included and available from the selected transport. - *

- *

- * Can also be determined later using - * stream_socket_get_name. - *

- * @return resource a stream to the accepted socket connection or FALSE on failure. - */ -function stream_socket_accept ($server_socket, $timeout = 'ini_get("default_socket_timeout")', &$peername = null) {} - -/** - * (PHP 5)
- * Retrieve the name of the local or remote sockets - * @link http://php.net/manual/en/function.stream-socket-get-name.php - * @param resource $handle

- * The socket to get the name of. - *

- * @param bool $want_peer

- * If set to TRUE the remote socket name will be returned, if set - * to FALSE the local socket name will be returned. - *

- * @return string The name of the socket. - */ -function stream_socket_get_name ($handle, $want_peer) {} - -/** - * (PHP 5)
- * Receives data from a socket, connected or not - * @link http://php.net/manual/en/function.stream-socket-recvfrom.php - * @param resource $socket

- * The remote socket. - *

- * @param int $length

- * The number of bytes to receive from the socket. - *

- * @param int $flags [optional]

- * The value of flags can be any combination - * of the following: - * - * Possible values for flags - * - * - * - * - * - * - * - * - *
STREAM_OOB - * Process OOB (out-of-band) data. - *
STREAM_PEEK - * Retrieve data from the socket, but do not consume the buffer. - * Subsequent calls to fread or - * stream_socket_recvfrom will see - * the same data. - *
- *

- * @param string $address [optional]

- * If address is provided it will be populated with - * the address of the remote socket. - *

- * @return string the read data, as a string - */ -function stream_socket_recvfrom ($socket, $length, $flags = 0, &$address = null) {} - -/** - * (PHP 5)
- * Sends a message to a socket, whether it is connected or not - * @link http://php.net/manual/en/function.stream-socket-sendto.php - * @param resource $socket

- * The socket to send data to. - *

- * @param string $data

- * The data to be sent. - *

- * @param int $flags [optional]

- * The value of flags can be any combination - * of the following: - * - * possible values for flags - * - * - * - * - *
STREAM_OOB - * Process OOB (out-of-band) data. - *
- *

- * @param string $address [optional]

- * The address specified when the socket stream was created will be used - * unless an alternate address is specified in address. - *

- *

- * If specified, it must be in dotted quad (or [ipv6]) format. - *

- * @return int a result code, as an integer. - */ -function stream_socket_sendto ($socket, $data, $flags = 0, $address = null) {} - -/** - * (PHP 5 >= 5.1.0)
- * Turns encryption on/off on an already connected socket - * @link http://php.net/manual/en/function.stream-socket-enable-crypto.php - * @param resource $stream

- * The stream resource. - *

- * @param bool $enable

- * Enable/disable cryptography on the stream. - *

- * @param int $crypto_type [optional]

- * Setup encryption on the stream. - * Valid methods are - * STREAM_CRYPTO_METHOD_SSLv2_CLIENT - * @param resource $session_stream [optional]

- * Seed the stream with settings from session_stream. - *

- * @return mixed TRUE on success, FALSE if negotiation has failed or - * 0 if there isn't enough data and you should try again - * (only for non-blocking sockets). - */ -function stream_socket_enable_crypto ($stream, $enable, $crypto_type = null, $session_stream = null) {} - -/** - * (PHP 5 >= 5.2.1)
- * Shutdown a full-duplex connection - * @link http://php.net/manual/en/function.stream-socket-shutdown.php - * @param resource $stream

- * An open stream (opened with stream_socket_client, - * for example) - *

- * @param int $how

- * One of the following constants: STREAM_SHUT_RD - * (disable further receptions), STREAM_SHUT_WR - * (disable further transmissions) or - * STREAM_SHUT_RDWR (disable further receptions and - * transmissions). - *

- * @return bool TRUE on success or FALSE on failure. - */ -function stream_socket_shutdown ($stream, $how) {} - -/** - * (PHP 5 >= 5.1.0)
- * Creates a pair of connected, indistinguishable socket streams - * @link http://php.net/manual/en/function.stream-socket-pair.php - * @param int $domain

- * The protocol family to be used: STREAM_PF_INET, - * STREAM_PF_INET6 or - * STREAM_PF_UNIX - *

- * @param int $type

- * The type of communication to be used: - * STREAM_SOCK_DGRAM, - * STREAM_SOCK_RAW, - * STREAM_SOCK_RDM, - * STREAM_SOCK_SEQPACKET or - * STREAM_SOCK_STREAM - *

- * @param int $protocol

- * The protocol to be used: STREAM_IPPROTO_ICMP, - * STREAM_IPPROTO_IP, - * STREAM_IPPROTO_RAW, - * STREAM_IPPROTO_TCP or - * STREAM_IPPROTO_UDP - *

- * @return array an array with the two socket resources on success, or - * FALSE on failure. - */ -function stream_socket_pair ($domain, $type, $protocol) {} - -/** - * (PHP 5)
- * Copies data from one stream to another - * @link http://php.net/manual/en/function.stream-copy-to-stream.php - * @param resource $source

- * The source stream - *

- * @param resource $dest

- * The destination stream - *

- * @param int $maxlength [optional]

- * Maximum bytes to copy - *

- * @param int $offset [optional]

- * The offset where to start to copy data - *

- * @return int the total count of bytes copied. - */ -function stream_copy_to_stream ($source, $dest, $maxlength = -1, $offset = 0) {} - -/** - * (PHP 5)
- * Reads remainder of a stream into a string - * @link http://php.net/manual/en/function.stream-get-contents.php - * @param resource $handle

- * A stream resource (e.g. returned from fopen) - *

- * @param int $maxlength [optional]

- * The maximum bytes to read. Defaults to -1 (read all the remaining - * buffer). - *

- * @param int $offset [optional]

- * Seek to the specified offset before reading. If this number is negative, - * no seeking will occur and reading will start from the current position. - *

- * @return string a string or FALSE on failure. - */ -function stream_get_contents ($handle, $maxlength = -1, $offset = -1) {} - -/** - * (PHP 5 >= 5.3.0)
- * Tells whether the stream supports locking. - * @link http://php.net/manual/en/function.stream-supports-lock.php - * @param resource $stream

- * The stream to check. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function stream_supports_lock ($stream) {} - -/** - * (PHP 4, PHP 5)
- * Gets line from file pointer and parse for CSV fields - * @link http://php.net/manual/en/function.fgetcsv.php - * @param resource $handle

- * A valid file pointer to a file successfully opened by - * fopen, popen, or - * fsockopen. - *

- * @param int $length [optional]

- * Must be greater than the longest line (in characters) to be found in - * the CSV file (allowing for trailing line-end characters). It became - * optional in PHP 5. Omitting this parameter (or setting it to 0 in PHP - * 5.0.4 and later) the maximum line length is not limited, which is - * slightly slower. - *

- * @param string $delimiter [optional]

- * Set the field delimiter (one character only). - *

- * @param string $enclosure [optional]

- * Set the field enclosure character (one character only). - *

- * @param string $escape [optional]

- * Set the escape character (one character only). Defaults as a backslash. - *

- * @return array an indexed array containing the fields read. - *

- *

- * A blank line in a CSV file will be returned as an array - * comprising a single null field, and will not be treated - * as an error. - *

- * If PHP is not properly recognizing - * the line endings when reading files either on or created by a Macintosh - * computer, enabling the - * auto_detect_line_endings - * run-time configuration option may help resolve the problem. - *

- * fgetcsv returns NULL if an invalid - * handle is supplied or FALSE on other errors, - * including end of file. - */ -function fgetcsv ($handle, $length = 0, $delimiter = ',', $enclosure = '"', $escape = '\\') {} - -/** - * (PHP 5 >= 5.1.0)
- * Format line as CSV and write to file pointer - * @link http://php.net/manual/en/function.fputcsv.php - * @param resource $handle The file pointer must be valid, and must point to - * a file successfully opened by fopen or - * fsockopen (and not yet closed by - * fclose).

- * @param array $fields

- * An array of values. - *

- * @param string $delimiter [optional]

- * The optional delimiter parameter sets the field - * delimiter (one character only). - *

- * @param string $enclosure [optional]

- * The optional enclosure parameter sets the field - * enclosure (one character only). - *

- * @return int the length of the written string or FALSE on failure. - */ -function fputcsv ($handle, array $fields, $delimiter = ',', $enclosure = '"') {} - -/** - * (PHP 4, PHP 5)
- * Portable advisory file locking - * @link http://php.net/manual/en/function.flock.php - * @param resource $handle A file system pointer resource - * that is typically created using fopen.

- * @param int $operation

- * operation is one of the following: - * LOCK_SH to acquire a shared lock (reader). - * @param int $wouldblock [optional]

- * The optional third argument is set to TRUE if the lock would block - * (EWOULDBLOCK errno condition). (not supported on Windows) - *

- * @return bool TRUE on success or FALSE on failure. - */ -function flock ($handle, $operation, &$wouldblock = null) {} - -/** - * (PHP 4, PHP 5)
- * Extracts all meta tag content attributes from a file and returns an array - * @link http://php.net/manual/en/function.get-meta-tags.php - * @param string $filename

- * The path to the HTML file, as a string. This can be a local file or an - * URL. - *

- *

- * What get_meta_tags parses - *

- * 
- * (pay attention to line endings - PHP uses a native function to - * parse the input, so a Mac file won't work on Unix). - *

- * @param bool $use_include_path [optional]

- * Setting use_include_path to TRUE will result - * in PHP trying to open the file along the standard include path as per - * the include_path directive. - * This is used for local files, not URLs. - *

- * @return array an array with all the parsed meta tags. - *

- *

- * The value of the name property becomes the key, the value of the content - * property becomes the value of the returned array, so you can easily use - * standard array functions to traverse it or access single values. - * Special characters in the value of the name property are substituted with - * '_', the rest is converted to lower case. If two meta tags have the same - * name, only the last one is returned. - */ -function get_meta_tags ($filename, $use_include_path = false) {} - -/** - * (PHP 5 >= 5.3.3)
- * Set read file buffering on the given stream - * @link http://php.net/manual/en/function.stream-set-read-buffer.php - * @param resource $stream

- * The file pointer. - *

- * @param int $buffer

- * The number of bytes to buffer. If buffer - * is 0 then read operations are unbuffered. This ensures that all reads - * with fread are completed before other processes are - * allowed to read from that input stream. - *

- * @return int 0 on success, or EOF if the request - * cannot be honored. - */ -function stream_set_read_buffer ($stream, $buffer) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Sets write file buffering on the given stream - * @link http://php.net/manual/en/function.stream-set-write-buffer.php - * @param resource $stream

- * The file pointer. - *

- * @param int $buffer

- * The number of bytes to buffer. If buffer - * is 0 then write operations are unbuffered. This ensures that all writes - * with fwrite are completed before other processes are - * allowed to write to that output stream. - *

- * @return int 0 on success, or EOF if the request cannot be honored. - */ -function stream_set_write_buffer ($stream, $buffer) {} - -/** - * (PHP 4, PHP 5)
- * Alias of stream_set_write_buffer - * @link http://php.net/manual/en/function.set-file-buffer.php - * @param $fp - * @param $buffer - */ -function set_file_buffer ($fp, $buffer) {} - -/** - * (PHP 5 >= 5.4.0)
- * Set the stream chunk size - * @link http://php.net/manual/en/function.stream-set-chunk-size.php - * @param resource $fp

- * The target stream. - *

- * @param int $chunk_size

- * The desired new chunk size. - *

- * @return int the previous chunk size on success. - *

- *

- * Will return FALSE if chunk_size is less than 1 or - * greater than PHP_INT_MAX. - */ -function stream_set_chunk_size ($fp, $chunk_size) {} - -/** - * (PHP 4, PHP 5)
- * Alias of stream_set_blocking - * @link http://php.net/manual/en/function.set-socket-blocking.php - * @param $socket - * @param $mode - */ -function set_socket_blocking ($socket, $mode) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Set blocking/non-blocking mode on a stream - * @link http://php.net/manual/en/function.stream-set-blocking.php - * @param resource $stream

- * The stream. - *

- * @param int $mode

- * If mode is 0, the given stream - * will be switched to non-blocking mode, and if 1, it - * will be switched to blocking mode. This affects calls like - * fgets and fread - * that read from the stream. In non-blocking mode an - * fgets call will always return right away - * while in blocking mode it will wait for data to become available - * on the stream. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function stream_set_blocking ($stream, $mode) {} - -/** - * (PHP 4, PHP 5)
- * Alias of stream_set_blocking - * @link http://php.net/manual/en/function.socket-set-blocking.php - * @param $socket - * @param $mode - */ -function socket_set_blocking ($socket, $mode) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Retrieves header/meta data from streams/file pointers - * @link http://php.net/manual/en/function.stream-get-meta-data.php - * @param resource $stream

- * The stream can be any stream created by fopen, - * fsockopen and pfsockopen. - *

- * @return array The result array contains the following items: - *

- *

- * timed_out (bool) - TRUE if the stream - * timed out while waiting for data on the last call to - * fread or fgets. - *

- *

- * blocked (bool) - TRUE if the stream is - * in blocking IO mode. See stream_set_blocking. - *

- *

- * eof (bool) - TRUE if the stream has reached - * end-of-file. Note that for socket streams this member can be TRUE - * even when unread_bytes is non-zero. To - * determine if there is more data to be read, use - * feof instead of reading this item. - *

- *

- * unread_bytes (int) - the number of bytes - * currently contained in the PHP's own internal buffer. - *

- * You shouldn't use this value in a script. - *

- * stream_type (string) - a label describing - * the underlying implementation of the stream. - *

- *

- * wrapper_type (string) - a label describing - * the protocol wrapper implementation layered over the stream. - * See for more information about wrappers. - *

- *

- * wrapper_data (mixed) - wrapper specific - * data attached to this stream. See for - * more information about wrappers and their wrapper data. - *

- *

- * filters (array) - and array containing - * the names of any filters that have been stacked onto this stream. - * Documentation on filters can be found in the - * Filters appendix. - *

- *

- * mode (string) - the type of access required for - * this stream (see Table 1 of the fopen() reference) - *

- *

- * seekable (bool) - whether the current stream can - * be seeked. - *

- *

- * uri (string) - the URI/filename associated with this - * stream. - */ -function stream_get_meta_data ($stream) {} - -/** - * (PHP 5)
- * Gets line from stream resource up to a given delimiter - * @link http://php.net/manual/en/function.stream-get-line.php - * @param resource $handle

- * A valid file handle. - *

- * @param int $length

- * The number of bytes to read from the handle. - *

- * @param string $ending [optional]

- * An optional string delimiter. - *

- * @return string a string of up to length bytes read from the file - * pointed to by handle. - *

- *

- * If an error occurs, returns FALSE. - */ -function stream_get_line ($handle, $length, $ending = null) {} - -/** - * (PHP 4 >= 4.3.2, PHP 5)
- * Register a URL wrapper implemented as a PHP class - * @link http://php.net/manual/en/function.stream-wrapper-register.php - * @param string $protocol

- * The wrapper name to be registered. - *

- * @param string $classname

- * The classname which implements the protocol. - *

- * @param int $flags [optional]

- * Should be set to STREAM_IS_URL if - * protocol is a URL protocol. Default is 0, local - * stream. - *

- * @return bool TRUE on success or FALSE on failure. - *

- *

- * stream_wrapper_register will return FALSE if the - * protocol already has a handler. - */ -function stream_wrapper_register ($protocol, $classname, $flags = null) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Alias of stream_wrapper_register - * @link http://php.net/manual/en/function.stream-register-wrapper.php - * @param $protocol - * @param $classname - * @param $flags [optional] - */ -function stream_register_wrapper ($protocol, $classname, $flags) {} - -/** - * (PHP 5 >= 5.1.0)
- * Unregister a URL wrapper - * @link http://php.net/manual/en/function.stream-wrapper-unregister.php - * @param string $protocol - * @return bool TRUE on success or FALSE on failure. - */ -function stream_wrapper_unregister ($protocol) {} - -/** - * (PHP 5 >= 5.1.0)
- * Restores a previously unregistered built-in wrapper - * @link http://php.net/manual/en/function.stream-wrapper-restore.php - * @param string $protocol - * @return bool TRUE on success or FALSE on failure. - */ -function stream_wrapper_restore ($protocol) {} - -/** - * (PHP 5)
- * Retrieve list of registered streams - * @link http://php.net/manual/en/function.stream-get-wrappers.php - * @return array an indexed array containing the name of all stream wrappers - * available on the running system. - */ -function stream_get_wrappers () {} - -/** - * (PHP 5)
- * Retrieve list of registered socket transports - * @link http://php.net/manual/en/function.stream-get-transports.php - * @return array an indexed array of socket transports names. - */ -function stream_get_transports () {} - -/** - * (PHP 5 >= 5.3.2)
- * Resolve filename against the include path - * @link http://php.net/manual/en/function.stream-resolve-include-path.php - * @param string $filename

- * The filename to resolve. - *

- * @param resource $context [optional]

- * A valid context resource created with stream_context_create. - *

- * @return string a string containing the resolved absolute filename, or FALSE on failure. - */ -function stream_resolve_include_path ($filename, $context = null) {} - -/** - * (PHP 5 >= 5.2.4)
- * Checks if a stream is a local stream - * @link http://php.net/manual/en/function.stream-is-local.php - * @param mixed $stream_or_url

- * The stream resource or URL to check. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function stream_is_local ($stream_or_url) {} - -/** - * (PHP 5)
- * Fetches all the headers sent by the server in response to a HTTP request - * @link http://php.net/manual/en/function.get-headers.php - * @param string $url

- * The target URL. - *

- * @param int $format [optional]

- * If the optional format parameter is set to non-zero, - * get_headers parses the response and sets the - * array's keys. - *

- * @return array an indexed or associative array with the headers, or FALSE on - * failure. - */ -function get_headers ($url, $format = 0) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Set timeout period on a stream - * @link http://php.net/manual/en/function.stream-set-timeout.php - * @param resource $stream

- * The target stream. - *

- * @param int $seconds

- * The seconds part of the timeout to be set. - *

- * @param int $microseconds [optional]

- * The microseconds part of the timeout to be set. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function stream_set_timeout ($stream, $seconds, $microseconds = 0) {} - -/** - * (PHP 4, PHP 5)
- * Alias of stream_set_timeout - * @link http://php.net/manual/en/function.socket-set-timeout.php - * @param $stream - * @param $seconds - * @param $microseconds - */ -function socket_set_timeout ($stream, $seconds, $microseconds) {} - -/** - * (PHP 4, PHP 5)
- * Alias of stream_get_meta_data - * @link http://php.net/manual/en/function.socket-get-status.php - * @param $fp - */ -function socket_get_status ($fp) {} - -/** - * (PHP 4, PHP 5)
- * Returns canonicalized absolute pathname - * @link http://php.net/manual/en/function.realpath.php - * @param string $path

- * The path being checked. - *

- * Whilst a path must be supplied, the value can be blank or NULL - * In these cases, the value is interpreted as the current directory. - *

- *

- * @return string the canonicalized absolute pathname on success. The resulting path - * will have no symbolic link, '/./' or '/../' components. - *

- *

- * realpath returns FALSE on failure, e.g. if - * the file does not exist. - *

- *

- * The running script must have executable permissions on all directories in - * the hierarchy, otherwise realpath will return - * FALSE. - */ -function realpath ($path) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Match filename against a pattern - * @link http://php.net/manual/en/function.fnmatch.php - * @param string $pattern

- * The shell wildcard pattern. - *

- * @param string $string

- * The tested string. This function is especially useful for filenames, - * but may also be used on regular strings. - *

- *

- * The average user may be used to shell patterns or at least in their - * simplest form to '?' and '*' - * wildcards so using fnmatch instead of - * preg_match for - * frontend search expression input may be way more convenient for - * non-programming users. - *

- * @param int $flags [optional]

- * The value of flags can be any combination of - * the following flags, joined with the - * binary OR (|) operator. - * - * A list of possible flags for fnmatch - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
FlagDescription
FNM_NOESCAPE - * Disable backslash escaping. - *
FNM_PATHNAME - * Slash in string only matches slash in the given pattern. - *
FNM_PERIOD - * Leading period in string must be exactly matched by period in the given pattern. - *
FNM_CASEFOLD - * Caseless match. Part of the GNU extension. - *
- *

- * @return bool TRUE if there is a match, FALSE otherwise. - */ -function fnmatch ($pattern, $string, $flags = 0) {} - -/** - * (PHP 4, PHP 5)
- * Open Internet or Unix domain socket connection - * @link http://php.net/manual/en/function.fsockopen.php - * @param string $hostname

- * If OpenSSL support is - * installed, you may prefix the hostname - * with either ssl:// or tls:// to - * use an SSL or TLS client connection over TCP/IP to connect to the - * remote host. - *

- * @param int $port [optional]

- * The port number. - *

- * @param int $errno [optional]

- * If provided, holds the system level error number that occurred in the - * system-level connect() call. - *

- *

- * If the value returned in errno is - * 0 and the function returned FALSE, it is an - * indication that the error occurred before the - * connect() call. This is most likely due to a - * problem initializing the socket. - *

- * @param string $errstr [optional]

- * The error message as a string. - *

- * @param float $timeout [optional]

- * The connection timeout, in seconds. - *

- *

- * If you need to set a timeout for reading/writing data over the - * socket, use stream_set_timeout, as the - * timeout parameter to - * fsockopen only applies while connecting the - * socket. - *

- * @return resource fsockopen returns a file pointer which may be used - * together with the other file functions (such as - * fgets, fgetss, - * fwrite, fclose, and - * feof). If the call fails, it will return FALSE - */ -function fsockopen ($hostname, $port = -1, &$errno = null, &$errstr = null, $timeout = 'ini_get("default_socket_timeout")') {} - -/** - * (PHP 4, PHP 5)
- * Open persistent Internet or Unix domain socket connection - * @link http://php.net/manual/en/function.pfsockopen.php - * @param string $hostname - * @param int $port [optional] - * @param int $errno [optional] - * @param string $errstr [optional] - * @param float $timeout [optional] - * @return resource - */ -function pfsockopen ($hostname, $port = -1, &$errno = null, &$errstr = null, $timeout = 'ini_get("default_socket_timeout")') {} - -/** - * (PHP 4, PHP 5)
- * Pack data into binary string - * @link http://php.net/manual/en/function.pack.php - * @param string $format

- * The format string consists of format codes - * followed by an optional repeater argument. The repeater argument can - * be either an integer value or * for repeating to - * the end of the input data. For a, A, h, H the repeat count specifies - * how many characters of one data argument are taken, for @ it is the - * absolute position where to put the next data, for everything else the - * repeat count specifies how many data arguments are consumed and packed - * into the resulting binary string. - *

- *

- * Currently implemented formats are: - * - * pack format characters - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
CodeDescription
aNUL-padded string
ASPACE-padded string
hHex string, low nibble first
HHex string, high nibble first
csigned char
Cunsigned char
ssigned short (always 16 bit, machine byte order)
Sunsigned short (always 16 bit, machine byte order)
nunsigned short (always 16 bit, big endian byte order)
vunsigned short (always 16 bit, little endian byte order)
isigned integer (machine dependent size and byte order)
Iunsigned integer (machine dependent size and byte order)
lsigned long (always 32 bit, machine byte order)
Lunsigned long (always 32 bit, machine byte order)
Nunsigned long (always 32 bit, big endian byte order)
Vunsigned long (always 32 bit, little endian byte order)
ffloat (machine dependent size and representation)
ddouble (machine dependent size and representation)
xNUL byte
XBack up one byte
@NUL-fill to absolute position
- *

- * @param mixed $args [optional] - * @param mixed $_ [optional] - * @return string a binary string containing data. - */ -function pack ($format, $args = null, $_ = null) {} - -/** - * (PHP 4, PHP 5)
- * Unpack data from binary string - * @link http://php.net/manual/en/function.unpack.php - * @param string $format

- * See pack for an explanation of the format codes. - *

- * @param string $data

- * The packed data. - *

- * @return array an associative array containing unpacked elements of binary - * string. - */ -function unpack ($format, $data) {} - -/** - * (PHP 4, PHP 5)
- * Tells what the user's browser is capable of - * @link http://php.net/manual/en/function.get-browser.php - * @param string $user_agent [optional]

- * The User Agent to be analyzed. By default, the value of HTTP - * User-Agent header is used; however, you can alter this (i.e., look up - * another browser's info) by passing this parameter. - *

- *

- * You can bypass this parameter with a NULL value. - *

- * @param bool $return_array [optional]

- * If set to TRUE, this function will return an array - * instead of an object. - *

- * @return mixed The information is returned in an object or an array which will contain - * various data elements representing, for instance, the browser's major and - * minor version numbers and ID string; TRUE/FALSE values for features - * such as frames, JavaScript, and cookies; and so forth. - *

- *

- * The cookies value simply means that the browser - * itself is capable of accepting cookies and does not mean the user has - * enabled the browser to accept cookies or not. The only way to test if - * cookies are accepted is to set one with setcookie, - * reload, and check for the value. - */ -function get_browser ($user_agent = null, $return_array = false) {} - -/** - * (PHP 4, PHP 5)
- * One-way string hashing - * @link http://php.net/manual/en/function.crypt.php - * @param string $str

- * The string to be hashed. - *

- * @param string $salt [optional]

- * An optional salt string to base the hashing on. If not provided, the - * behaviour is defined by the algorithm implementation and can lead to - * unexpected results. - *

- * @return string the hashed string or a string that is shorter than 13 characters - * and is guaranteed to differ from the salt on failure. - */ -function crypt ($str, $salt = null) {} - -/** - * (PHP 4, PHP 5)
- * Open directory handle - * @link http://php.net/manual/en/function.opendir.php - * @param string $path

- * The directory path that is to be opened - *

- * @param resource $context [optional]

- * For a description of the context parameter, - * refer to the streams section of - * the manual. - *

- * @return resource a directory handle resource on success, or - * FALSE on failure. - *

- *

- * If path is not a valid directory or the - * directory can not be opened due to permission restrictions or - * filesystem errors, opendir returns FALSE and - * generates a PHP error of level - * E_WARNING. You can suppress the error output of - * opendir by prepending - * '@' to the - * front of the function name. - */ -function opendir ($path, $context = null) {} - -/** - * (PHP 4, PHP 5)
- * Close directory handle - * @link http://php.net/manual/en/function.closedir.php - * @param resource $dir_handle [optional]

- * The directory handle resource previously opened - * with opendir. If the directory handle is - * not specified, the last link opened by opendir - * is assumed. - *

- * @return void - */ -function closedir ($dir_handle = null) {} - -/** - * (PHP 4, PHP 5)
- * Change directory - * @link http://php.net/manual/en/function.chdir.php - * @param string $directory

- * The new current directory - *

- * @return bool TRUE on success or FALSE on failure. - */ -function chdir ($directory) {} - -/** - * (PHP 4, PHP 5)
- * Gets the current working directory - * @link http://php.net/manual/en/function.getcwd.php - * @return string the current working directory on success, or FALSE on - * failure. - *

- *

- * On some Unix variants, getcwd will return - * FALSE if any one of the parent directories does not have the - * readable or search mode set, even if the current directory - * does. See chmod for more information on - * modes and permissions. - */ -function getcwd () {} - -/** - * (PHP 4, PHP 5)
- * Rewind directory handle - * @link http://php.net/manual/en/function.rewinddir.php - * @param resource $dir_handle [optional]

- * The directory handle resource previously opened - * with opendir. If the directory handle is - * not specified, the last link opened by opendir - * is assumed. - *

- * @return void - */ -function rewinddir ($dir_handle = null) {} - -/** - * (PHP 4, PHP 5)
- * Read entry from directory handle - * @link http://php.net/manual/en/function.readdir.php - * @param resource $dir_handle [optional]

- * The directory handle resource previously opened - * with opendir. If the directory handle is - * not specified, the last link opened by opendir - * is assumed. - *

- * @return string the entry name on success or FALSE on failure. - */ -function readdir ($dir_handle = null) {} - -/** - * (PHP 4, PHP 5)
- * Return an instance of the Directory class - * @link http://php.net/manual/en/function.dir.php - * @param string $directory

- * Directory to open - *

- * @param resource $context [optional]

- * Context support was added - * with PHP 5.0.0. For a description of contexts, refer to - * . - *

- * @return Directory an instance of Directory, or NULL with - * wrong parameters, or FALSE in case of another error. - */ -function dir ($directory, $context = null) {} - -/** - * (PHP 5)
- * List files and directories inside the specified path - * @link http://php.net/manual/en/function.scandir.php - * @param string $directory

- * The directory that will be scanned. - *

- * @param int $sorting_order [optional]

- * By default, the sorted order is alphabetical in ascending order. If - * the optional sorting_order is set to - * SCANDIR_SORT_DESCENDING, then the sort order is - * alphabetical in descending order. If it is set to - * SCANDIR_SORT_NONE then the result is unsorted. - *

- * @param resource $context [optional]

- * For a description of the context parameter, - * refer to the streams section of - * the manual. - *

- * @return array an array of filenames on success, or FALSE on - * failure. If directory is not a directory, then - * boolean FALSE is returned, and an error of level - * E_WARNING is generated. - */ -function scandir ($directory, $sorting_order = 'SCANDIR_SORT_ASCENDING', $context = null) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Find pathnames matching a pattern - * @link http://php.net/manual/en/function.glob.php - * @param string $pattern

- * The pattern. No tilde expansion or parameter substitution is done. - *

- * @param int $flags [optional]

- * Valid flags: - * GLOB_MARK - Adds a slash to each directory returned - * @return array an array containing the matched files/directories, an empty array - * if no file matched or FALSE on error. - *

- *

- * On some systems it is impossible to distinguish between empty match and an - * error. - */ -function glob ($pattern, $flags = 0) {} - -/** - * (PHP 4, PHP 5)
- * Gets last access time of file - * @link http://php.net/manual/en/function.fileatime.php - * @param string $filename

- * Path to the file. - *

- * @return int the time the file was last accessed, or FALSE on failure. - * The time is returned as a Unix timestamp. - */ -function fileatime ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Gets inode change time of file - * @link http://php.net/manual/en/function.filectime.php - * @param string $filename

- * Path to the file. - *

- * @return int the time the file was last changed, or FALSE on failure. - * The time is returned as a Unix timestamp. - */ -function filectime ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Gets file group - * @link http://php.net/manual/en/function.filegroup.php - * @param string $filename

- * Path to the file. - *

- * @return int the group ID of the file, or FALSE if - * an error occurs. The group ID is returned in numerical format, use - * posix_getgrgid to resolve it to a group name. - * Upon failure, FALSE is returned. - */ -function filegroup ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Gets file inode - * @link http://php.net/manual/en/function.fileinode.php - * @param string $filename

- * Path to the file. - *

- * @return int the inode number of the file, or FALSE on failure. - */ -function fileinode ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Gets file modification time - * @link http://php.net/manual/en/function.filemtime.php - * @param string $filename

- * Path to the file. - *

- * @return int the time the file was last modified, or FALSE on failure. - * The time is returned as a Unix timestamp, which is - * suitable for the date function. - */ -function filemtime ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Gets file owner - * @link http://php.net/manual/en/function.fileowner.php - * @param string $filename

- * Path to the file. - *

- * @return int the user ID of the owner of the file, or FALSE on failure. - * The user ID is returned in numerical format, use - * posix_getpwuid to resolve it to a username. - */ -function fileowner ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Gets file permissions - * @link http://php.net/manual/en/function.fileperms.php - * @param string $filename

- * Path to the file. - *

- * @return int the file's permissions as a numeric mode. Lower bits of this mode - * are the same as the permissions expected by chmod, - * however on most platforms the return value will also include information on - * the type of file given as filename. The examples - * below demonstrate how to test the return value for specific permissions and - * file types on POSIX systems, including Linux and Mac OS X. - *

- *

- * For local files, the specific return value is that of the - * st_mode member of the structure returned by the C - * library's stat function. Exactly which bits are set - * can vary from platform to platform, and looking up your specific platform's - * documentation is recommended if parsing the non-permission bits of the - * return value is required. - */ -function fileperms ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Gets file size - * @link http://php.net/manual/en/function.filesize.php - * @param string $filename

- * Path to the file. - *

- * @return int the size of the file in bytes, or FALSE (and generates an error - * of level E_WARNING) in case of an error. - */ -function filesize ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Gets file type - * @link http://php.net/manual/en/function.filetype.php - * @param string $filename

- * Path to the file. - *

- * @return string the type of the file. Possible values are fifo, char, - * dir, block, link, file, socket and unknown. - *

- *

- * Returns FALSE if an error occurs. filetype will also - * produce an E_NOTICE message if the stat call fails - * or if the file type is unknown. - */ -function filetype ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Checks whether a file or directory exists - * @link http://php.net/manual/en/function.file-exists.php - * @param string $filename

- * Path to the file or directory. - *

- *

- * On windows, use //computername/share/filename or - * \\computername\share\filename to check files on - * network shares. - *

- * @return bool TRUE if the file or directory specified by - * filename exists; FALSE otherwise. - *

- *

- * This function will return FALSE for symlinks pointing to non-existing - * files. - *

- *

- * This function returns FALSE for files inaccessible due to safe mode restrictions. However these - * files still can be included if - * they are located in safe_mode_include_dir. - *

- *

- * The check is done using the real UID/GID instead of the effective one. - */ -function file_exists ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Tells whether the filename is writable - * @link http://php.net/manual/en/function.is-writable.php - * @param string $filename

- * The filename being checked. - *

- * @return bool TRUE if the filename exists and is - * writable. - */ -function is_writable ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Alias of is_writable - * @link http://php.net/manual/en/function.is-writeable.php - * @param $filename - */ -function is_writeable ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Tells whether a file exists and is readable - * @link http://php.net/manual/en/function.is-readable.php - * @param string $filename

- * Path to the file. - *

- * @return bool TRUE if the file or directory specified by - * filename exists and is readable, FALSE otherwise. - */ -function is_readable ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Tells whether the filename is executable - * @link http://php.net/manual/en/function.is-executable.php - * @param string $filename

- * Path to the file. - *

- * @return bool TRUE if the filename exists and is executable, or FALSE on - * error. - */ -function is_executable ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Tells whether the filename is a regular file - * @link http://php.net/manual/en/function.is-file.php - * @param string $filename

- * Path to the file. - *

- * @return bool TRUE if the filename exists and is a regular file, FALSE - * otherwise. - */ -function is_file ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Tells whether the filename is a directory - * @link http://php.net/manual/en/function.is-dir.php - * @param string $filename

- * Path to the file. If filename is a relative - * filename, it will be checked relative to the current working - * directory. If filename is a symbolic or hard link - * then the link will be resolved and checked. If you have enabled safe mode, - * or open_basedir further - * restrictions may apply. - *

- * @return bool TRUE if the filename exists and is a directory, FALSE - * otherwise. - */ -function is_dir ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Tells whether the filename is a symbolic link - * @link http://php.net/manual/en/function.is-link.php - * @param string $filename

- * Path to the file. - *

- * @return bool TRUE if the filename exists and is a symbolic link, FALSE - * otherwise. - */ -function is_link ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Gives information about a file - * @link http://php.net/manual/en/function.stat.php - * @param string $filename

- * Path to the file. - *

- * @return array - * stat and fstat result - * format - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
NumericAssociative (since PHP 4.0.6)Description
0devdevice number
1inoinode number *
2modeinode protection mode
3nlinknumber of links
4uiduserid of owner *
5gidgroupid of owner *
6rdevdevice type, if inode device
7sizesize in bytes
8atimetime of last access (Unix timestamp)
9mtimetime of last modification (Unix timestamp)
10ctimetime of last inode change (Unix timestamp)
11blksizeblocksize of filesystem IO **
12blocksnumber of 512-byte blocks allocated **
- * * On Windows this will always be 0. - *

- *

- * ** Only valid on systems supporting the st_blksize type - other - * systems (e.g. Windows) return -1. - *

- *

- * In case of error, stat returns FALSE. - */ -function stat ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Gives information about a file or symbolic link - * @link http://php.net/manual/en/function.lstat.php - * @param string $filename

- * Path to a file or a symbolic link. - *

- * @return array See the manual page for stat for information on - * the structure of the array that lstat returns. - * This function is identical to the stat function - * except that if the filename parameter is a symbolic - * link, the status of the symbolic link is returned, not the status of the - * file pointed to by the symbolic link. - */ -function lstat ($filename) {} - -/** - * (PHP 4, PHP 5)
- * Changes file owner - * @link http://php.net/manual/en/function.chown.php - * @param string $filename

- * Path to the file. - *

- * @param mixed $user

- * A user name or number. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function chown ($filename, $user) {} - -/** - * (PHP 4, PHP 5)
- * Changes file group - * @link http://php.net/manual/en/function.chgrp.php - * @param string $filename

- * Path to the file. - *

- * @param mixed $group

- * A group name or number. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function chgrp ($filename, $group) {} - -/** - * (PHP 5 >= 5.1.2)
- * Changes user ownership of symlink - * @link http://php.net/manual/en/function.lchown.php - * @param string $filename

- * Path to the file. - *

- * @param mixed $user

- * User name or number. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function lchown ($filename, $user) {} - -/** - * (PHP 5 >= 5.1.2)
- * Changes group ownership of symlink - * @link http://php.net/manual/en/function.lchgrp.php - * @param string $filename

- * Path to the symlink. - *

- * @param mixed $group

- * The group specified by name or number. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function lchgrp ($filename, $group) {} - -/** - * (PHP 4, PHP 5)
- * Changes file mode - * @link http://php.net/manual/en/function.chmod.php - * @param string $filename

- * Path to the file. - *

- * @param int $mode

- * Note that mode is not automatically - * assumed to be an octal value, so strings (such as "g+w") will - * not work properly. To ensure the expected operation, - * you need to prefix mode with a zero (0): - *

- *

- * - * chmod("/somedir/somefile", 755); // decimal; probably incorrect - * chmod("/somedir/somefile", "u+rwx,go+rx"); // string; incorrect - * chmod("/somedir/somefile", 0755); // octal; correct value of mode - * - *

- *

- * The mode parameter consists of three octal - * number components specifying access restrictions for the owner, - * the user group in which the owner is in, and to everybody else in - * this order. One component can be computed by adding up the needed - * permissions for that target user base. Number 1 means that you - * grant execute rights, number 2 means that you make the file - * writeable, number 4 means that you make the file readable. Add - * up these numbers to specify needed rights. You can also read more - * about modes on Unix systems with 'man 1 chmod' - * and 'man 2 chmod'. - *

- *

- * - * // Read and write for owner, nothing for everybody else - * chmod("/somedir/somefile", 0600); - * // Read and write for owner, read for everybody else - * chmod("/somedir/somefile", 0644); - * // Everything for owner, read and execute for others - * chmod("/somedir/somefile", 0755); - * // Everything for owner, read and execute for owner's group - * chmod("/somedir/somefile", 0750); - * - *

- * @return bool TRUE on success or FALSE on failure. - */ -function chmod ($filename, $mode) {} - -/** - * (PHP 4, PHP 5)
- * Sets access and modification time of file - * @link http://php.net/manual/en/function.touch.php - * @param string $filename

- * The name of the file being touched. - *

- * @param int $time [optional]

- * The touch time. If time is not supplied, - * the current system time is used. - *

- * @param int $atime [optional]

- * If present, the access time of the given filename is set to - * the value of atime. Otherwise, it is set to - * the value passed to the time parameter. - * If neither are present, the current system time is used. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function touch ($filename, $time = 'time()', $atime = null) {} - -/** - * (PHP 4, PHP 5)
- * Clears file status cache - * @link http://php.net/manual/en/function.clearstatcache.php - * @param bool $clear_realpath_cache [optional]

- * Whether to clear the realpath cache or not. - *

- * @param string $filename [optional]

- * Clear the realpath and the stat cache for a specific filename only; only - * used if clear_realpath_cache is TRUE. - *

- * @return void No value is returned. - */ -function clearstatcache ($clear_realpath_cache = false, $filename = null) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Returns the total size of a filesystem or disk partition - * @link http://php.net/manual/en/function.disk-total-space.php - * @param string $directory

- * A directory of the filesystem or disk partition. - *

- * @return float the total number of bytes as a float - * or FALSE on failure. - */ -function disk_total_space ($directory) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Returns available space on filesystem or disk partition - * @link http://php.net/manual/en/function.disk-free-space.php - * @param string $directory

- * A directory of the filesystem or disk partition. - *

- *

- * Given a file name instead of a directory, the behaviour of the - * function is unspecified and may differ between operating systems and - * PHP versions. - *

- * @return float the number of available bytes as a float - * or FALSE on failure. - */ -function disk_free_space ($directory) {} - -/** - * (PHP 4, PHP 5)
- * Alias of disk_free_space - * @link http://php.net/manual/en/function.diskfreespace.php - * @param $path - */ -function diskfreespace ($path) {} - -/** - * (PHP 5 >= 5.3.2)
- * Get realpath cache size - * @link http://php.net/manual/en/function.realpath-cache-size.php - * @return int how much memory realpath cache is using. - */ -function realpath_cache_size () {} - -/** - * (PHP 5 >= 5.3.2)
- * Get realpath cache entries - * @link http://php.net/manual/en/function.realpath-cache-get.php - * @return array an array of realpath cache entries. The keys are original path - * entries, and the values are arrays of data items, containing the resolved - * path, expiration date, and other options kept in the cache. - */ -function realpath_cache_get () {} - -/** - * (PHP 4, PHP 5)
- * Send mail - * @link http://php.net/manual/en/function.mail.php - * @param string $to

- * Receiver, or receivers of the mail. - *

- *

- * The formatting of this string must comply with - * RFC 2822. Some examples are: - * user@example.com - * user@example.com, anotheruser@example.com - * User <user@example.com> - * User <user@example.com>, Another User <anotheruser@example.com> - *

- * @param string $subject

- * Subject of the email to be sent. - *

- *

- * Subject must satisfy RFC 2047. - *

- * @param string $message

- * Message to be sent. - *

- *

- * Each line should be separated with a LF (\n). Lines should not be larger - * than 70 characters. - *

- *

- * (Windows only) When PHP is talking to a SMTP server directly, if a full - * stop is found on the start of a line, it is removed. To counter-act this, - * replace these occurrences with a double dot. - * - * $text = str_replace("\n.", "\n..", $text); - * - *

- * @param string $additional_headers [optional]

- * String to be inserted at the end of the email header. - *

- *

- * This is typically used to add extra headers (From, Cc, and Bcc). - * Multiple extra headers should be separated with a CRLF (\r\n). - *

- *

- * When sending mail, the mail must contain - * a From header. This can be set with the - * additional_headers parameter, or a default - * can be set in php.ini. - *

- *

- * Failing to do this will result in an error - * message similar to Warning: mail(): "sendmail_from" not - * set in php.ini or custom "From:" header missing. - * The From header sets also - * Return-Path under Windows. - *

- *

- * If messages are not received, try using a LF (\n) only. - * Some Unix mail transfer agents (most notably - * qmail) replace LF by CRLF - * automatically (which leads to doubling CR if CRLF is used). - * This should be a last resort, as it does not comply with - * RFC 2822. - *

- * @param string $additional_parameters [optional]

- * The additional_parameters parameter - * can be used to pass additional flags as command line options to the - * program configured to be used when sending mail, as defined by the - * sendmail_path configuration setting. For example, - * this can be used to set the envelope sender address when using - * sendmail with the -f sendmail option. - *

- *

- * The user that the webserver runs as should be added as a trusted user to the - * sendmail configuration to prevent a 'X-Warning' header from being added - * to the message when the envelope sender (-f) is set using this method. - * For sendmail users, this file is /etc/mail/trusted-users. - *

- * @return bool TRUE if the mail was successfully accepted for delivery, FALSE otherwise. - *

- *

- * It is important to note that just because the mail was accepted for delivery, - * it does NOT mean the mail will actually reach the intended destination. - */ -function mail ($to, $subject, $message, $additional_headers = null, $additional_parameters = null) {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Calculate the hash value needed by EZMLM - * @link http://php.net/manual/en/function.ezmlm-hash.php - * @param string $addr

- * The email address that's being hashed. - *

- * @return int The hash value of addr. - */ -function ezmlm_hash ($addr) {} - -/** - * (PHP 4, PHP 5)
- * Open connection to system logger - * @link http://php.net/manual/en/function.openlog.php - * @param string $ident

- * The string ident is added to each message. - *

- * @param int $option

- * The option argument is used to indicate - * what logging options will be used when generating a log message. - * - * openlog Options - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
ConstantDescription
LOG_CONS - * if there is an error while sending data to the system logger, - * write directly to the system console - *
LOG_NDELAY - * open the connection to the logger immediately - *
LOG_ODELAY - * (default) delay opening the connection until the first - * message is logged - *
LOG_PERRORprint log message also to standard error
LOG_PIDinclude PID with each message
- * You can use one or more of this options. When using multiple options - * you need to OR them, i.e. to open the connection - * immediately, write to the console and include the PID in each message, - * you will use: LOG_CONS | LOG_NDELAY | LOG_PID - *

- * @param int $facility

- * The facility argument is used to specify what - * type of program is logging the message. This allows you to specify - * (in your machine's syslog configuration) how messages coming from - * different facilities will be handled. - * - * openlog Facilities - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
ConstantDescription
LOG_AUTH - * security/authorization messages (use - * LOG_AUTHPRIV instead - * in systems where that constant is defined) - *
LOG_AUTHPRIVsecurity/authorization messages (private)
LOG_CRONclock daemon (cron and at)
LOG_DAEMONother system daemons
LOG_KERNkernel messages
LOG_LOCAL0 ... LOG_LOCAL7reserved for local use, these are not available in Windows
LOG_LPRline printer subsystem
LOG_MAILmail subsystem
LOG_NEWSUSENET news subsystem
LOG_SYSLOGmessages generated internally by syslogd
LOG_USERgeneric user-level messages
LOG_UUCPUUCP subsystem
- *

- *

- * LOG_USER is the only valid log type under Windows - * operating systems - *

- * @return bool TRUE on success or FALSE on failure. - */ -function openlog ($ident, $option, $facility) {} - -/** - * (PHP 4, PHP 5)
- * Generate a system log message - * @link http://php.net/manual/en/function.syslog.php - * @param int $priority

- * priority is a combination of the facility and - * the level. Possible values are: - * - * syslog Priorities (in descending order) - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
ConstantDescription
LOG_EMERGsystem is unusable
LOG_ALERTaction must be taken immediately
LOG_CRITcritical conditions
LOG_ERRerror conditions
LOG_WARNINGwarning conditions
LOG_NOTICEnormal, but significant, condition
LOG_INFOinformational message
LOG_DEBUGdebug-level message
- *

- * @param string $message

- * The message to send, except that the two characters - * %m will be replaced by the error message string - * (strerror) corresponding to the present value of - * errno. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function syslog ($priority, $message) {} - -/** - * (PHP 4, PHP 5)
- * Close connection to system logger - * @link http://php.net/manual/en/function.closelog.php - * @return bool TRUE on success or FALSE on failure. - */ -function closelog () {} - -/** - * (PHP 4, PHP 5)
- * Combined linear congruential generator - * @link http://php.net/manual/en/function.lcg-value.php - * @return float A pseudo random float value in the range of (0, 1) - */ -function lcg_value () {} - -/** - * (PHP 4, PHP 5)
- * Calculate the metaphone key of a string - * @link http://php.net/manual/en/function.metaphone.php - * @param string $str

- * The input string. - *

- * @param int $phonemes [optional]

- * This parameter restricts the returned metaphone key to - * phonemes characters in length. - * The default value of 0 means no restriction. - *

- * @return string the metaphone key as a string, or FALSE on failure. - */ -function metaphone ($str, $phonemes = 0) {} - -/** - * (PHP 4, PHP 5)
- * Turn on output buffering - * @link http://php.net/manual/en/function.ob-start.php - * @param callable $output_callback [optional]

- * An optional output_callback function may be - * specified. This function takes a string as a parameter and should - * return a string. The function will be called when - * the output buffer is flushed (sent) or cleaned (with - * ob_flush, ob_clean or similar - * function) or when the output buffer - * is flushed to the browser at the end of the request. When - * output_callback is called, it will receive the - * contents of the output buffer as its parameter and is expected to - * return a new output buffer as a result, which will be sent to the - * browser. If the output_callback is not a - * callable function, this function will return FALSE. - *

- *

- * If the callback function has two parameters, the second parameter is - * filled with a bit-field consisting of - * PHP_OUTPUT_HANDLER_* constants. - *

- *

- * If output_callback returns FALSE original - * input is sent to the browser. - *

- *

- * The output_callback parameter may be bypassed - * by passing a NULL value. - *

- *

- * ob_end_clean, ob_end_flush, - * ob_clean, ob_flush and - * ob_start may not be called from a callback - * function. If you call them from callback function, the behavior is - * undefined. If you would like to delete the contents of a buffer, - * return "" (a null string) from callback function. - * You can't even call functions using the output buffering functions like - * print_r($expression, true) or - * highlight_file($filename, true) from a callback - * function. - *

- *

- * In PHP 4.0.4, ob_gzhandler was introduced to - * facilitate sending gz-encoded data to web browsers that support - * compressed web pages. ob_gzhandler determines - * what type of content encoding the browser will accept and will return - * its output accordingly. - *

- * @param int $chunk_size [optional]

- * If the optional parameter chunk_size is passed, the - * buffer will be flushed after any output call which causes the buffer's - * length to equal or exceed chunk_size. The default - * value 0 means that the output function will only be - * called when the output buffer is closed. - *

- *

- * Prior to PHP 5.4.0, the value 1 was a special case - * value that set the chunk size to 4096 bytes. - *

- * @param bool $erase [optional]

- * If the optional parameter erase is set to FALSE, - * the buffer will not be deleted until the script finishes. - * This causes that flushing and cleaning functions would issue a notice - * and return FALSE if called. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ob_start (callable $output_callback = null, $chunk_size = 0, $erase = true) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Flush (send) the output buffer - * @link http://php.net/manual/en/function.ob-flush.php - * @return void No value is returned. - */ -function ob_flush () {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Clean (erase) the output buffer - * @link http://php.net/manual/en/function.ob-clean.php - * @return void No value is returned. - */ -function ob_clean () {} - -/** - * (PHP 4, PHP 5)
- * Flush (send) the output buffer and turn off output buffering - * @link http://php.net/manual/en/function.ob-end-flush.php - * @return bool TRUE on success or FALSE on failure. Reasons for failure are first that you called the - * function without an active buffer or that for some reason a buffer could - * not be deleted (possible for special buffer). - */ -function ob_end_flush () {} - -/** - * (PHP 4, PHP 5)
- * Clean (erase) the output buffer and turn off output buffering - * @link http://php.net/manual/en/function.ob-end-clean.php - * @return bool TRUE on success or FALSE on failure. Reasons for failure are first that you called the - * function without an active buffer or that for some reason a buffer could - * not be deleted (possible for special buffer). - */ -function ob_end_clean () {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Flush the output buffer, return it as a string and turn off output buffering - * @link http://php.net/manual/en/function.ob-get-flush.php - * @return string the output buffer or FALSE if no buffering is active. - */ -function ob_get_flush () {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Get current buffer contents and delete current output buffer - * @link http://php.net/manual/en/function.ob-get-clean.php - * @return string the contents of the output buffer and end output buffering. - * If output buffering isn't active then FALSE is returned. - */ -function ob_get_clean () {} - -/** - * (PHP 4 >= 4.0.2, PHP 5)
- * Return the length of the output buffer - * @link http://php.net/manual/en/function.ob-get-length.php - * @return int the length of the output buffer contents or FALSE if no - * buffering is active. - */ -function ob_get_length () {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Return the nesting level of the output buffering mechanism - * @link http://php.net/manual/en/function.ob-get-level.php - * @return int the level of nested output buffering handlers or zero if output - * buffering is not active. - */ -function ob_get_level () {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Get status of output buffers - * @link http://php.net/manual/en/function.ob-get-status.php - * @param bool $full_status [optional]

- * TRUE to return all active output buffer levels. If FALSE or not - * set, only the top level output buffer is returned. - *

- * @return array If called without the full_status parameter - * or with full_status = FALSE a simple array - * with the following elements is returned: - *
- * Array
- * (
- * [level] => 2
- * [type] => 0
- * [status] => 0
- * [name] => URL-Rewriter
- * [del] => 1
- * )
- * 
- * Simple ob_get_status results - * KeyValue - * levelOutput nesting level - * typePHP_OUTPUT_HANDLER_INTERNAL (0) or PHP_OUTPUT_HANDLER_USER (1) - * statusOne of PHP_OUTPUT_HANDLER_START (0), PHP_OUTPUT_HANDLER_CONT (1) or PHP_OUTPUT_HANDLER_END (2) - * nameName of active output handler or ' default output handler' if none is set - * delErase-flag as set by ob_start - *

- *

- * If called with full_status = TRUE an array - * with one element for each active output buffer level is returned. - * The output level is used as key of the top level array and each array - * element itself is another array holding status information - * on one active output level. - *

- * Array
- * (
- * [0] => Array
- * (
- * [chunk_size] => 0
- * [size] => 40960
- * [block_size] => 10240
- * [type] => 1
- * [status] => 0
- * [name] => default output handler
- * [del] => 1
- * )
- * [1] => Array
- * (
- * [chunk_size] => 0
- * [size] => 40960
- * [block_size] => 10240
- * [type] => 0
- * [buffer_size] => 0
- * [status] => 0
- * [name] => URL-Rewriter
- * [del] => 1
- * )
- * )
- * 
- *

- *

- * The full output contains these additional elements: - * Full ob_get_status results - * KeyValue - * chunk_sizeChunk size as set by ob_start - * size... - * blocksize... - */ -function ob_get_status ($full_status = null) {} - -/** - * (PHP 4, PHP 5)
- * Return the contents of the output buffer - * @link http://php.net/manual/en/function.ob-get-contents.php - * @return string This will return the contents of the output buffer or FALSE, if output - * buffering isn't active. - */ -function ob_get_contents () {} - -/** - * (PHP 4, PHP 5)
- * Turn implicit flush on/off - * @link http://php.net/manual/en/function.ob-implicit-flush.php - * @param int $flag [optional]

- * TRUE to turn implicit flushing on, FALSE otherwise. - *

- * @return void No value is returned. - */ -function ob_implicit_flush ($flag = true) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * List all output handlers in use - * @link http://php.net/manual/en/function.ob-list-handlers.php - * @return array This will return an array with the output handlers in use (if any). If - * output_buffering is enabled or - * an anonymous function was used with ob_start, - * ob_list_handlers will return "default output - * handler". - */ -function ob_list_handlers () {} - -/** - * (PHP 4, PHP 5)
- * Sort an array by key - * @link http://php.net/manual/en/function.ksort.php - * @param array $array

- * The input array. - *

- * @param int $sort_flags [optional]

- * You may modify the behavior of the sort using the optional - * parameter sort_flags, for details - * see sort. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function ksort (array &$array, $sort_flags = 'SORT_REGULAR') {} - -/** - * (PHP 4, PHP 5)
- * Sort an array by key in reverse order - * @link http://php.net/manual/en/function.krsort.php - * @param array $array

- * The input array. - *

- * @param int $sort_flags [optional]

- * You may modify the behavior of the sort using the optional parameter - * sort_flags, for details see - * sort. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function krsort (array &$array, $sort_flags = 'SORT_REGULAR') {} - -/** - * (PHP 4, PHP 5)
- * Sort an array using a "natural order" algorithm - * @link http://php.net/manual/en/function.natsort.php - * @param array $array

- * The input array. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function natsort (array &$array) {} - -/** - * (PHP 4, PHP 5)
- * Sort an array using a case insensitive "natural order" algorithm - * @link http://php.net/manual/en/function.natcasesort.php - * @param array $array

- * The input array. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function natcasesort (array &$array) {} - -/** - * (PHP 4, PHP 5)
- * Sort an array and maintain index association - * @link http://php.net/manual/en/function.asort.php - * @param array $array

- * The input array. - *

- * @param int $sort_flags [optional]

- * You may modify the behavior of the sort using the optional - * parameter sort_flags, for details - * see sort. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function asort (array &$array, $sort_flags = 'SORT_REGULAR') {} - -/** - * (PHP 4, PHP 5)
- * Sort an array in reverse order and maintain index association - * @link http://php.net/manual/en/function.arsort.php - * @param array $array

- * The input array. - *

- * @param int $sort_flags [optional]

- * You may modify the behavior of the sort using the optional parameter - * sort_flags, for details see - * sort. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function arsort (array &$array, $sort_flags = 'SORT_REGULAR') {} - -/** - * (PHP 4, PHP 5)
- * Sort an array - * @link http://php.net/manual/en/function.sort.php - * @param array $array

- * The input array. - *

- * @param int $sort_flags [optional]

- * The optional second parameter sort_flags - * may be used to modify the sorting behavior using these values: - *

- *

- * Sorting type flags: - * SORT_REGULAR - compare items normally - * (don't change types) - * @return bool TRUE on success or FALSE on failure. - */ -function sort (array &$array, $sort_flags = 'SORT_REGULAR') {} - -/** - * (PHP 4, PHP 5)
- * Sort an array in reverse order - * @link http://php.net/manual/en/function.rsort.php - * @param array $array

- * The input array. - *

- * @param int $sort_flags [optional]

- * You may modify the behavior of the sort using the optional - * parameter sort_flags, for details see - * sort. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function rsort (array &$array, $sort_flags = 'SORT_REGULAR') {} - -/** - * (PHP 4, PHP 5)
- * Sort an array by values using a user-defined comparison function - * @link http://php.net/manual/en/function.usort.php - * @param array $array

- * The input array. - *

- * @param callable $cmp_function

- * The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. - *

- * intcallbackmixedamixedb - *

- * Returning non-integer values from the comparison - * function, such as float, will result in an internal cast to - * integer of the callback's return value. So values such as - * 0.99 and 0.1 will both be cast to an integer value of 0, which will - * compare such values as equal. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function usort (array &$array, callable $cmp_function) {} - -/** - * (PHP 4, PHP 5)
- * Sort an array with a user-defined comparison function and maintain index association - * @link http://php.net/manual/en/function.uasort.php - * @param array $array

- * The input array. - *

- * @param callable $cmp_function

- * See usort and uksort for - * examples of user-defined comparison functions. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function uasort (array &$array, callable $cmp_function) {} - -/** - * (PHP 4, PHP 5)
- * Sort an array by keys using a user-defined comparison function - * @link http://php.net/manual/en/function.uksort.php - * @param array $array

- * The input array. - *

- * @param callable $cmp_function

- * The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. - *

- * intcallbackmixedamixedb - * @return bool TRUE on success or FALSE on failure. - */ -function uksort (array &$array, callable $cmp_function) {} - -/** - * (PHP 4, PHP 5)
- * Shuffle an array - * @link http://php.net/manual/en/function.shuffle.php - * @param array $array

- * The array. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function shuffle (array &$array) {} - -/** - * (PHP 4, PHP 5)
- * Apply a user function to every member of an array - * @link http://php.net/manual/en/function.array-walk.php - * @param array $array

- * The input array. - *

- * @param callable $funcname

- * Typically, funcname takes on two parameters. - * The array parameter's value being the first, and - * the key/index second. - *

- *

- * If funcname needs to be working with the - * actual values of the array, specify the first parameter of - * funcname as a - * reference. Then, - * any changes made to those elements will be made in the - * original array itself. - *

- *

- * Many internal functions (for example strtolower) - * will throw a warning if more than the expected number of argument - * are passed in and are not usable directly as - * funcname. - *

- *

- * Only the values of the array may potentially be - * changed; its structure cannot be altered, i.e., the programmer cannot - * add, unset or reorder elements. If the callback does not respect this - * requirement, the behavior of this function is undefined, and - * unpredictable. - *

- * @param mixed $userdata [optional]

- * If the optional userdata parameter is supplied, - * it will be passed as the third parameter to the callback - * funcname. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function array_walk (array &$array, callable $funcname, $userdata = null) {} - -/** - * (PHP 5)
- * Apply a user function recursively to every member of an array - * @link http://php.net/manual/en/function.array-walk-recursive.php - * @param array $input

- * The input array. - *

- * @param callable $funcname

- * Typically, funcname takes on two parameters. - * The input parameter's value being the first, and - * the key/index second. - *

- *

- * If funcname needs to be working with the - * actual values of the array, specify the first parameter of - * funcname as a - * reference. Then, - * any changes made to those elements will be made in the - * original array itself. - *

- * @param mixed $userdata [optional]

- * If the optional userdata parameter is supplied, - * it will be passed as the third parameter to the callback - * funcname. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function array_walk_recursive (array &$input, callable $funcname, $userdata = null) {} - -/** - * (PHP 4, PHP 5)
- * Count all elements in an array, or something in an object - * @link http://php.net/manual/en/function.count.php - * @param mixed $var

- * The array or the object. - *

- * @param int $mode [optional]

- * If the optional mode parameter is set to - * COUNT_RECURSIVE (or 1), count - * will recursively count the array. This is particularly useful for - * counting all the elements of a multidimensional array. - *

- *

- * count can detect recursion to avoid an infinite - * loop, but will emit an E_WARNING every time it - * does (in case the array contains itself more than once) and return a - * count higher than may be expected. - *

- * @return int the number of elements in var. - * If var is not an array or an object with - * implemented Countable interface, - * 1 will be returned. - * There is one exception, if var is NULL, - * 0 will be returned. - *

- *

- * count may return 0 for a variable that isn't set, - * but it may also return 0 for a variable that has been initialized with an - * empty array. Use isset to test if a variable is set. - */ -function count ($var, $mode = 'COUNT_NORMAL') {} - -/** - * (PHP 4, PHP 5)
- * Set the internal pointer of an array to its last element - * @link http://php.net/manual/en/function.end.php - * @param array $array

- * The array. This array is passed by reference because it is modified by - * the function. This means you must pass it a real variable and not - * a function returning an array because only actual variables may be - * passed by reference. - *

- * @return mixed the value of the last element or FALSE for empty array. - */ -function end (array &$array) {} - -/** - * (PHP 4, PHP 5)
- * Rewind the internal array pointer - * @link http://php.net/manual/en/function.prev.php - * @param array $array

- * The input array. - *

- * @return mixed the array value in the previous place that's pointed to by - * the internal array pointer, or FALSE if there are no more - * elements. - */ -function prev (array &$array) {} - -/** - * (PHP 4, PHP 5)
- * Advance the internal array pointer of an array - * @link http://php.net/manual/en/function.next.php - * @param array $array

- * The array being affected. - *

- * @return mixed the array value in the next place that's pointed to by the - * internal array pointer, or FALSE if there are no more elements. - */ -function next (array &$array) {} - -/** - * (PHP 4, PHP 5)
- * Set the internal pointer of an array to its first element - * @link http://php.net/manual/en/function.reset.php - * @param array $array

- * The input array. - *

- * @return mixed the value of the first array element, or FALSE if the array is - * empty. - */ -function reset (array &$array) {} - -/** - * (PHP 4, PHP 5)
- * Return the current element in an array - * @link http://php.net/manual/en/function.current.php - * @param array $array

- * The array. - *

- * @return mixed The current function simply returns the - * value of the array element that's currently being pointed to by the - * internal pointer. It does not move the pointer in any way. If the - * internal pointer points beyond the end of the elements list or the array is - * empty, current returns FALSE. - */ -function current (array &$array) {} - -/** - * (PHP 4, PHP 5)
- * Fetch a key from an array - * @link http://php.net/manual/en/function.key.php - * @param array $array

- * The array. - *

- * @return mixed The key function simply returns the - * key of the array element that's currently being pointed to by the - * internal pointer. It does not move the pointer in any way. If the - * internal pointer points beyond the end of the elements list or the array is - * empty, key returns NULL. - */ -function key (array &$array) {} - -/** - * (PHP 4, PHP 5)
- * Find lowest value - * @link http://php.net/manual/en/function.min.php - * @param array $values

- * An array containing the values. - *

- * @return mixed min returns the numerically lowest of the - * parameter values. - */ -function min (array $values) {} - -/** - * (PHP 4, PHP 5)
- * Find highest value - * @link http://php.net/manual/en/function.max.php - * @param array $values

- * An array containing the values. - *

- * @return mixed max returns the numerically highest of the - * parameter values. If multiple values can be considered of the same size, - * the one that is listed first will be returned. - *

- *

- * When max is given multiple arrays, the - * longest array is returned. If all the arrays have the same length, - * max will use lexicographic ordering to find the return - * value. - *

- *

- * When given a string it will be cast as an integer - * when comparing. - */ -function max (array $values) {} - -/** - * (PHP 4, PHP 5)
- * Checks if a value exists in an array - * @link http://php.net/manual/en/function.in-array.php - * @param mixed $needle

- * The searched value. - *

- *

- * If needle is a string, the comparison is done - * in a case-sensitive manner. - *

- * @param array $haystack

- * The array. - *

- * @param bool $strict [optional]

- * If the third parameter strict is set to TRUE - * then the in_array function will also check the - * types of the - * needle in the haystack. - *

- * @return bool TRUE if needle is found in the array, - * FALSE otherwise. - */ -function in_array ($needle, array $haystack, $strict = '&false;') {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Searches the array for a given value and returns the corresponding key if successful - * @link http://php.net/manual/en/function.array-search.php - * @param mixed $needle

- * The searched value. - *

- *

- * If needle is a string, the comparison is done - * in a case-sensitive manner. - *

- * @param array $haystack

- * The array. - *

- * @param bool $strict [optional]

- * If the third parameter strict is set to TRUE - * then the array_search function will search for - * identical elements in the - * haystack. This means it will also check the - * types of the - * needle in the haystack, - * and objects must be the same instance. - *

- * @return mixed the key for needle if it is found in the - * array, FALSE otherwise. - *

- *

- * If needle is found in haystack - * more than once, the first matching key is returned. To return the keys for - * all matching values, use array_keys with the optional - * search_value parameter instead. - */ -function array_search ($needle, array $haystack, $strict = false) {} - -/** - * (PHP 4, PHP 5)
- * Import variables into the current symbol table from an array - * @link http://php.net/manual/en/function.extract.php - * @param array $var_array

- * Note that prefix is only required if - * extract_type is EXTR_PREFIX_SAME, - * EXTR_PREFIX_ALL, EXTR_PREFIX_INVALID - * or EXTR_PREFIX_IF_EXISTS. If - * the prefixed result is not a valid variable name, it is not - * imported into the symbol table. Prefixes are automatically separated from - * the array key by an underscore character. - *

- * @param int $extract_type [optional]

- * The way invalid/numeric keys and collisions are treated is determined - * by the extract_type. It can be one of the - * following values: - * EXTR_OVERWRITE - * If there is a collision, overwrite the existing variable. - * @param string $prefix [optional] Only overwrite the variable if it already exists in the - * current symbol table, otherwise do nothing. This is useful - * for defining a list of valid variables and then extracting - * only those variables you have defined out of - * $_REQUEST, for example. - * @return int the number of variables successfully imported into the symbol - * table. - */ -function extract (array &$var_array, $extract_type = 'EXTR_OVERWRITE', $prefix = null) {} - -/** - * (PHP 4, PHP 5)
- * Create array containing variables and their values - * @link http://php.net/manual/en/function.compact.php - * @param mixed $varname

- * compact takes a variable number of parameters. - * Each parameter can be either a string containing the name of the - * variable, or an array of variable names. The array can contain other - * arrays of variable names inside it; compact - * handles it recursively. - *

- * @param mixed $_ [optional] - * @return array the output array with all the variables added to it. - */ -function compact ($varname, $_ = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Fill an array with values - * @link http://php.net/manual/en/function.array-fill.php - * @param int $start_index

- * The first index of the returned array. - *

- *

- * If start_index is negative, - * the first index of the returned array will be - * start_index and the following - * indices will start from zero - * (see example). - *

- * @param int $num

- * Number of elements to insert. - * Must be greater than zero. - *

- * @param mixed $value

- * Value to use for filling - *

- * @return array the filled array - */ -function array_fill ($start_index, $num, $value) {} - -/** - * (PHP 5 >= 5.2.0)
- * Fill an array with values, specifying keys - * @link http://php.net/manual/en/function.array-fill-keys.php - * @param array $keys

- * Array of values that will be used as keys. Illegal values - * for key will be converted to string. - *

- * @param mixed $value

- * Value to use for filling - *

- * @return array the filled array - */ -function array_fill_keys (array $keys, $value) {} - -/** - * (PHP 4, PHP 5)
- * Create an array containing a range of elements - * @link http://php.net/manual/en/function.range.php - * @param mixed $start

- * First value of the sequence. - *

- * @param mixed $end

- * The sequence is ended upon reaching the - * end value. - *

- * @param number $step [optional]

- * If a step value is given, it will be used as the - * increment between elements in the sequence. step - * should be given as a positive number. If not specified, - * step will default to 1. - *

- * @return array an array of elements from start to - * end, inclusive. - */ -function range ($start, $end, $step = 1) {} - -/** - * (PHP 4, PHP 5)
- * Sort multiple or multi-dimensional arrays - * @link http://php.net/manual/en/function.array-multisort.php - * @param array $arr

- * An array being sorted. - *

- * @param mixed $arg [optional]

- * Optionally another array, or sort options for the - * previous array argument: - * SORT_ASC, - * SORT_DESC, - * SORT_REGULAR, - * SORT_NUMERIC, - * SORT_STRING. - *

- * @param mixed $arg [optional] - * @param mixed $_ [optional]

- * Additional arg's. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function array_multisort (array &$arr, $arg = 'SORT_ASC', $arg = 'SORT_REGULAR', $_ = null) {} - -/** - * (PHP 4, PHP 5)
- * Push one or more elements onto the end of array - * @link http://php.net/manual/en/function.array-push.php - * @param array $array

- * The input array. - *

- * @param mixed $var

- * The pushed value. - *

- * @param mixed $_ [optional] - * @return int the new number of elements in the array. - */ -function array_push (array &$array, $var, $_ = null) {} - -/** - * (PHP 4, PHP 5)
- * Pop the element off the end of array - * @link http://php.net/manual/en/function.array-pop.php - * @param array $array

- * The array to get the value from. - *

- * @return mixed the last value of array. - * If array is empty (or is not an array), - * NULL will be returned. - */ -function array_pop (array &$array) {} - -/** - * (PHP 4, PHP 5)
- * Shift an element off the beginning of array - * @link http://php.net/manual/en/function.array-shift.php - * @param array $array

- * The input array. - *

- * @return mixed the shifted value, or NULL if array is - * empty or is not an array. - */ -function array_shift (array &$array) {} - -/** - * (PHP 4, PHP 5)
- * Prepend one or more elements to the beginning of an array - * @link http://php.net/manual/en/function.array-unshift.php - * @param array $array

- * The input array. - *

- * @param mixed $var

- * The prepended variable. - *

- * @param mixed $_ [optional] - * @return int the new number of elements in the array. - */ -function array_unshift (array &$array, $var, $_ = null) {} - -/** - * (PHP 4, PHP 5)
- * Remove a portion of the array and replace it with something else - * @link http://php.net/manual/en/function.array-splice.php - * @param array $input

- * The input array. - *

- * @param int $offset

- * If offset is positive then the start of removed - * portion is at that offset from the beginning of the - * input array. If offset - * is negative then it starts that far from the end of the - * input array. - *

- * @param int $length [optional]

- * If length is omitted, removes everything - * from offset to the end of the array. If - * length is specified and is positive, then - * that many elements will be removed. If - * length is specified and is negative then - * the end of the removed portion will be that many elements from - * the end of the array. Tip: to remove everything from - * offset to the end of the array when - * replacement is also specified, use - * count($input) for - * length. - *

- * @param mixed $replacement [optional]

- * If replacement array is specified, then the - * removed elements are replaced with elements from this array. - *

- *

- * If offset and length - * are such that nothing is removed, then the elements from the - * replacement array are inserted in the place - * specified by the offset. Note that keys in - * replacement array are not preserved. - *

- *

- * If replacement is just one element it is - * not necessary to put array() - * around it, unless the element is an array itself, an object or NULL. - *

- * @return array the array consisting of the extracted elements. - */ -function array_splice (array &$input, $offset, $length = 0, $replacement = null) {} - -/** - * (PHP 4, PHP 5)
- * Extract a slice of the array - * @link http://php.net/manual/en/function.array-slice.php - * @param array $array

- * The input array. - *

- * @param int $offset

- * If offset is non-negative, the sequence will - * start at that offset in the array. If - * offset is negative, the sequence will - * start that far from the end of the array. - *

- * @param int $length [optional]

- * If length is given and is positive, then - * the sequence will have up to that many elements in it. If the array - * is shorter than the length, then only the - * available array elements will be present. If - * length is given and is negative then the - * sequence will stop that many elements from the end of the - * array. If it is omitted, then the sequence will have everything - * from offset up until the end of the - * array. - *

- * @param bool $preserve_keys [optional]

- * Note that array_slice will reorder and reset the - * numeric array indices by default. You can change this behaviour by setting - * preserve_keys to TRUE. - *

- * @return array the slice. - */ -function array_slice (array $array, $offset, $length = null, $preserve_keys = false) {} - -/** - * (PHP 4, PHP 5)
- * Merge one or more arrays - * @link http://php.net/manual/en/function.array-merge.php - * @param array $array1

- * Initial array to merge. - *

- * @param array $_ [optional]

- * Variable list of arrays to merge. - *

- * @return array the resulting array. - */ -function array_merge (array $array1, array $_ = null) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Merge two or more arrays recursively - * @link http://php.net/manual/en/function.array-merge-recursive.php - * @param array $array1

- * Initial array to merge. - *

- * @param array $_ [optional]

- * Variable list of arrays to recursively merge. - *

- * @return array An array of values resulted from merging the arguments together. - */ -function array_merge_recursive (array $array1, array $_ = null) {} - -/** - * (PHP 5 >= 5.3.0)
- * Replaces elements from passed arrays into the first array - * @link http://php.net/manual/en/function.array-replace.php - * @param array $array

- * The array in which elements are replaced. - *

- * @param array $array1

- * The array from which elements will be extracted. - *

- * @param array $_ [optional]

- * More arrays from which elements will be extracted. - * Values from later arrays overwrite the previous values. - *

- * @return array an array, or NULL if an error occurs. - */ -function array_replace (array $array, array $array1, array $_ = null) {} - -/** - * (PHP 5 >= 5.3.0)
- * Replaces elements from passed arrays into the first array recursively - * @link http://php.net/manual/en/function.array-replace-recursive.php - * @param array $array

- * The array in which elements are replaced. - *

- * @param array $array1

- * The array from which elements will be extracted. - *

- * @param array $_ [optional]

- * Optional. More arrays from which elements will be extracted. - *

- * @return array an array, or NULL if an error occurs. - */ -function array_replace_recursive (array $array, array $array1, array $_ = null) {} - -/** - * (PHP 4, PHP 5)
- * Return all the keys or a subset of the keys of an array - * @link http://php.net/manual/en/function.array-keys.php - * @param array $input

- * An array containing keys to return. - *

- * @param mixed $search_value [optional]

- * If specified, then only keys containing these values are returned. - *

- * @param bool $strict [optional]

- * Determines if strict comparison (===) should be used during the search. - *

- * @return array an array of all the keys in input. - */ -function array_keys (array $input, $search_value = null, $strict = false) {} - -/** - * (PHP 4, PHP 5)
- * Return all the values of an array - * @link http://php.net/manual/en/function.array-values.php - * @param array $input

- * The array. - *

- * @return array an indexed array of values. - */ -function array_values (array $input) {} - -/** - * (PHP 4, PHP 5)
- * Counts all the values of an array - * @link http://php.net/manual/en/function.array-count-values.php - * @param array $input

- * The array of values to count - *

- * @return array an associative array of values from input as - * keys and their count as value. - */ -function array_count_values (array $input) {} - -/** - * (PHP 4, PHP 5)
- * Return an array with elements in reverse order - * @link http://php.net/manual/en/function.array-reverse.php - * @param array $array

- * The input array. - *

- * @param bool $preserve_keys [optional]

- * If set to TRUE numeric keys are preserved. - * Non-numeric keys are not affected by this setting and will always be preserved. - *

- * @return array the reversed array. - */ -function array_reverse (array $array, $preserve_keys = false) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Iteratively reduce the array to a single value using a callback function - * @link http://php.net/manual/en/function.array-reduce.php - * @param array $input

- * The input array. - *

- * @param callable $function

- * The callback function. - *

- * mixedcallback - * mixedresult - * mixeditem - * @param mixed $initial [optional]

- * If the optional initial is available, it will - * be used at the beginning of the process, or as a final result in case - * the array is empty. - *

- * @return mixed the resulting value. - *

- *

- * If the array is empty and initial is not passed, - * array_reduce returns NULL. - */ -function array_reduce (array $input, callable $function, $initial = null) {} - -/** - * (PHP 4, PHP 5)
- * Pad array to the specified length with a value - * @link http://php.net/manual/en/function.array-pad.php - * @param array $input

- * Initial array of values to pad. - *

- * @param int $pad_size

- * New size of the array. - *

- * @param mixed $pad_value

- * Value to pad if input is less than - * pad_size. - *

- * @return array a copy of the input padded to size specified - * by pad_size with value - * pad_value. If pad_size is - * positive then the array is padded on the right, if it's negative then - * on the left. If the absolute value of pad_size is less - * than or equal to the length of the input then no - * padding takes place. - */ -function array_pad (array $input, $pad_size, $pad_value) {} - -/** - * (PHP 4, PHP 5)
- * Exchanges all keys with their associated values in an array - * @link http://php.net/manual/en/function.array-flip.php - * @param array $trans

- * An array of key/value pairs to be flipped. - *

- * @return array the flipped array on success and NULL on failure. - */ -function array_flip (array $trans) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Changes all keys in an array - * @link http://php.net/manual/en/function.array-change-key-case.php - * @param array $input

- * The array to work on - *

- * @param int $case [optional]

- * Either CASE_UPPER or - * CASE_LOWER (default) - *

- * @return array an array with its keys lower or uppercased, or FALSE if - * input is not an array. - */ -function array_change_key_case (array $input, $case = 'CASE_LOWER') {} - -/** - * (PHP 4, PHP 5)
- * Pick one or more random entries out of an array - * @link http://php.net/manual/en/function.array-rand.php - * @param array $input

- * The input array. - *

- * @param int $num_req [optional]

- * Specifies how many entries you want to pick. Trying to pick more - * elements than there are in the array will result in an - * E_WARNING level error. - *

- * @return mixed If you are picking only one entry, array_rand - * returns the key for a random entry. Otherwise, it returns an array - * of keys for the random entries. This is done so that you can pick - * random keys as well as values out of the array. - */ -function array_rand (array $input, $num_req = 1) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Removes duplicate values from an array - * @link http://php.net/manual/en/function.array-unique.php - * @param array $array

- * The input array. - *

- * @param int $sort_flags [optional]

- * The optional second parameter sort_flags - * may be used to modify the sorting behavior using these values: - *

- *

- * Sorting type flags: - * SORT_REGULAR - compare items normally - * (don't change types) - * @return array the filtered array. - */ -function array_unique (array $array, $sort_flags = 'SORT_STRING') {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Computes the intersection of arrays - * @link http://php.net/manual/en/function.array-intersect.php - * @param array $array1

- * The array with master values to check. - *

- * @param array $array2

- * An array to compare values against. - *

- * @param array $_ [optional] - * @return array an array containing all of the values in - * array1 whose values exist in all of the parameters. - */ -function array_intersect (array $array1, array $array2, array $_ = null) {} - -/** - * (PHP 5 >= 5.1.0)
- * Computes the intersection of arrays using keys for comparison - * @link http://php.net/manual/en/function.array-intersect-key.php - * @param array $array1

- * The array with master keys to check. - *

- * @param array $array2

- * An array to compare keys against. - *

- * @param array $_ [optional] - * @return array an associative array containing all the entries of - * array1 which have keys that are present in all - * arguments. - */ -function array_intersect_key (array $array1, array $array2, array $_ = null) {} - -/** - * (PHP 5 >= 5.1.0)
- * Computes the intersection of arrays using a callback function on the keys for comparison - * @link http://php.net/manual/en/function.array-intersect-ukey.php - * @param array $array1

- * Initial array for comparison of the arrays. - *

- * @param array $array2

- * First array to compare keys against. - *

- * @param array $_ [optional] - * @param callable $key_compare_func

- * The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. - *

- * intcallbackmixedamixedb - * @return array the values of array1 whose keys exist - * in all the arguments. - */ -function array_intersect_ukey (array $array1, array $array2, array $_ = null, callable $key_compare_func) {} - -/** - * (PHP 5)
- * Computes the intersection of arrays, compares data by a callback function - * @link http://php.net/manual/en/function.array-uintersect.php - * @param array $array1

- * The first array. - *

- * @param array $array2

- * The second array. - *

- * @param array $_ [optional] - * @param callable $data_compare_func

- * The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. - *

- * intcallbackmixedamixedb - * @return array an array containing all the values of array1 - * that are present in all the arguments. - */ -function array_uintersect (array $array1, array $array2, array $_ = null, callable $data_compare_func) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Computes the intersection of arrays with additional index check - * @link http://php.net/manual/en/function.array-intersect-assoc.php - * @param array $array1

- * The array with master values to check. - *

- * @param array $array2

- * An array to compare values against. - *

- * @param array $_ [optional] - * @return array an associative array containing all the values in - * array1 that are present in all of the arguments. - */ -function array_intersect_assoc (array $array1, array $array2, array $_ = null) {} - -/** - * (PHP 5)
- * Computes the intersection of arrays with additional index check, compares data by a callback function - * @link http://php.net/manual/en/function.array-uintersect-assoc.php - * @param array $array1

- * The first array. - *

- * @param array $array2

- * The second array. - *

- * @param array $_ [optional] - * @param callable $data_compare_func

- * The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. - *

- * intcallbackmixedamixedb - * @return array an array containing all the values of - * array1 that are present in all the arguments. - */ -function array_uintersect_assoc (array $array1, array $array2, array $_ = null, callable $data_compare_func) {} - -/** - * (PHP 5)
- * Computes the intersection of arrays with additional index check, compares indexes by a callback function - * @link http://php.net/manual/en/function.array-intersect-uassoc.php - * @param array $array1

- * Initial array for comparison of the arrays. - *

- * @param array $array2

- * First array to compare keys against. - *

- * @param array $_ [optional] - * @param callable $key_compare_func

- * The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. - *

- * intcallbackmixedamixedb - * @return array the values of array1 whose values exist - * in all of the arguments. - */ -function array_intersect_uassoc (array $array1, array $array2, array $_ = null, callable $key_compare_func) {} - -/** - * (PHP 5)
- * Computes the intersection of arrays with additional index check, compares data and indexes by a callback functions - * @link http://php.net/manual/en/function.array-uintersect-uassoc.php - * @param array $array1

- * The first array. - *

- * @param array $array2

- * The second array. - *

- * @param array $_ [optional] - * @param callable $data_compare_func

- * The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. - *

- * intcallbackmixedamixedb - * @param callable $key_compare_func

- * Key comparison callback function. - *

- * @return array an array containing all the values of - * array1 that are present in all the arguments. - */ -function array_uintersect_uassoc (array $array1, array $array2, array $_ = null, callable $data_compare_func, callable $key_compare_func) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Computes the difference of arrays - * @link http://php.net/manual/en/function.array-diff.php - * @param array $array1

- * The array to compare from - *

- * @param array $array2

- * An array to compare against - *

- * @param array $_ [optional]

- * More arrays to compare against - *

- * @return array an array containing all the entries from - * array1 that are not present in any of the other arrays. - */ -function array_diff (array $array1, array $array2, array $_ = null) {} - -/** - * (PHP 5 >= 5.1.0)
- * Computes the difference of arrays using keys for comparison - * @link http://php.net/manual/en/function.array-diff-key.php - * @param array $array1

- * The array to compare from - *

- * @param array $array2

- * An array to compare against - *

- * @param array $_ [optional]

- * More arrays to compare against - *

- * @return array an array containing all the entries from - * array1 whose keys are not present in any of the - * other arrays. - */ -function array_diff_key (array $array1, array $array2, array $_ = null) {} - -/** - * (PHP 5 >= 5.1.0)
- * Computes the difference of arrays using a callback function on the keys for comparison - * @link http://php.net/manual/en/function.array-diff-ukey.php - * @param array $array1

- * The array to compare from - *

- * @param array $array2

- * An array to compare against - *

- * @param array $_ [optional]

- * More arrays to compare against - *

- * @param callable $key_compare_func

- * The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. - *

- * intcallbackmixedamixedb - * @return array an array containing all the entries from - * array1 that are not present in any of the other arrays. - */ -function array_diff_ukey (array $array1, array $array2, array $_ = null, callable $key_compare_func) {} - -/** - * (PHP 5)
- * Computes the difference of arrays by using a callback function for data comparison - * @link http://php.net/manual/en/function.array-udiff.php - * @param array $array1

- * The first array. - *

- * @param array $array2

- * The second array. - *

- * @param array $_ [optional] - * @param callable $data_compare_func

- * The callback comparison function. - *

- *

- * The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. - *

- * intcallbackmixedamixedb - * @return array an array containing all the values of array1 - * that are not present in any of the other arguments. - */ -function array_udiff (array $array1, array $array2, array $_ = null, callable $data_compare_func) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Computes the difference of arrays with additional index check - * @link http://php.net/manual/en/function.array-diff-assoc.php - * @param array $array1

- * The array to compare from - *

- * @param array $array2

- * An array to compare against - *

- * @param array $_ [optional]

- * More arrays to compare against - *

- * @return array an array containing all the values from - * array1 that are not present in any of the other arrays. - */ -function array_diff_assoc (array $array1, array $array2, array $_ = null) {} - -/** - * (PHP 5)
- * Computes the difference of arrays with additional index check, compares data by a callback function - * @link http://php.net/manual/en/function.array-udiff-assoc.php - * @param array $array1

- * The first array. - *

- * @param array $array2

- * The second array. - *

- * @param array $_ [optional] - * @param callable $data_compare_func

- * The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. - *

- * intcallbackmixedamixedb - * @return array array_udiff_assoc returns an array - * containing all the values from array1 - * that are not present in any of the other arguments. - * Note that the keys are used in the comparison unlike - * array_diff and array_udiff. - * The comparison of arrays' data is performed by using an user-supplied - * callback. In this aspect the behaviour is opposite to the behaviour of - * array_diff_assoc which uses internal function for - * comparison. - */ -function array_udiff_assoc (array $array1, array $array2, array $_ = null, callable $data_compare_func) {} - -/** - * (PHP 5)
- * Computes the difference of arrays with additional index check which is performed by a user supplied callback function - * @link http://php.net/manual/en/function.array-diff-uassoc.php - * @param array $array1

- * The array to compare from - *

- * @param array $array2

- * An array to compare against - *

- * @param array $_ [optional]

- * More arrays to compare against - *

- * @param callable $key_compare_func

- * The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. - *

- * intcallbackmixedamixedb - * @return array an array containing all the entries from - * array1 that are not present in any of the other arrays. - */ -function array_diff_uassoc (array $array1, array $array2, array $_ = null, callable $key_compare_func) {} - -/** - * (PHP 5)
- * Computes the difference of arrays with additional index check, compares data and indexes by a callback function - * @link http://php.net/manual/en/function.array-udiff-uassoc.php - * @param array $array1

- * The first array. - *

- * @param array $array2

- * The second array. - *

- * @param array $_ [optional] - * @param callable $data_compare_func

- * The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. - *

- * intcallbackmixedamixedb - * @param callable $key_compare_func

- * The comparison of keys (indices) is done also by the callback function - * key_compare_func. This behaviour is unlike what - * array_udiff_assoc does, since the latter compares - * the indices by using an internal function. - *

- * @return array an array containing all the values from - * array1 that are not present in any of the other - * arguments. - */ -function array_udiff_uassoc (array $array1, array $array2, array $_ = null, callable $data_compare_func, callable $key_compare_func) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Calculate the sum of values in an array - * @link http://php.net/manual/en/function.array-sum.php - * @param array $array

- * The input array. - *

- * @return number the sum of values as an integer or float. - */ -function array_sum (array $array) {} - -/** - * (PHP 5 >= 5.1.0)
- * Calculate the product of values in an array - * @link http://php.net/manual/en/function.array-product.php - * @param array $array

- * The array. - *

- * @return number the product as an integer or float. - */ -function array_product (array $array) {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Filters elements of an array using a callback function - * @link http://php.net/manual/en/function.array-filter.php - * @param array $input

- * The array to iterate over - *

- * @param callable $callback [optional]

- * The callback function to use - *

- *

- * If no callback is supplied, all entries of - * input equal to FALSE (see - * converting to - * boolean) will be removed. - *

- * @return array the filtered array. - */ -function array_filter (array $input, callable $callback = "") {} - -/** - * (PHP 4 >= 4.0.6, PHP 5)
- * Applies the callback to the elements of the given arrays - * @link http://php.net/manual/en/function.array-map.php - * @param callable $callback

- * Callback function to run for each element in each array. - *

- * @param array $arr1

- * An array to run through the callback function. - *

- * @param array $_ [optional] - * @return array an array containing all the elements of arr1 - * after applying the callback function to each one. - */ -function array_map (callable $callback, array $arr1, array $_ = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Split an array into chunks - * @link http://php.net/manual/en/function.array-chunk.php - * @param array $input

- * The array to work on - *

- * @param int $size

- * The size of each chunk - *

- * @param bool $preserve_keys [optional]

- * When set to TRUE keys will be preserved. - * Default is FALSE which will reindex the chunk numerically - *

- * @return array a multidimensional numerically indexed array, starting with zero, - * with each dimension containing size elements. - */ -function array_chunk (array $input, $size, $preserve_keys = false) {} - -/** - * (PHP 5)
- * Creates an array by using one array for keys and another for its values - * @link http://php.net/manual/en/function.array-combine.php - * @param array $keys

- * Array of keys to be used. Illegal values for key will be - * converted to string. - *

- * @param array $values

- * Array of values to be used - *

- * @return array the combined array, FALSE if the number of elements - * for each array isn't equal. - */ -function array_combine (array $keys, array $values) {} - -/** - * (PHP 4 >= 4.0.7, PHP 5)
- * Checks if the given key or index exists in the array - * @link http://php.net/manual/en/function.array-key-exists.php - * @param mixed $key

- * Value to check. - *

- * @param array $search

- * An array with keys to check. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function array_key_exists ($key, array $search) {} - -/** - * (PHP 4, PHP 5)
- * Alias of current - * @link http://php.net/manual/en/function.pos.php - * @param $arg - */ -function pos (&$arg) {} - -/** - * (PHP 4, PHP 5)
- * Alias of count - * @link http://php.net/manual/en/function.sizeof.php - * @param $var - * @param $mode [optional] - */ -function sizeof ($var, $mode) {} - -/** - * @param $key - * @param $search - */ -function key_exists ($key, $search) {} - -/** - * (PHP 4, PHP 5)
- * Checks if assertion is FALSE - * @link http://php.net/manual/en/function.assert.php - * @param mixed $assertion

- * The assertion. - *

- * @param string $description [optional]

- * An optional description that will be included in the failure message if - * the assertion fails. - *

- * @return bool FALSE if the assertion is false, TRUE otherwise. - */ -function assert ($assertion, $description = null) {} - -/** - * (PHP 4, PHP 5)
- * Set/get the various assert flags - * @link http://php.net/manual/en/function.assert-options.php - * @param int $what

- * - * Assert Options - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * NULL) - * - * - *
OptionINI SettingDefault valueDescription
ASSERT_ACTIVEassert.active1enable assert evaluation
ASSERT_WARNINGassert.warning1issue a PHP warning for each failed assertion
ASSERT_BAILassert.bail0terminate execution on failed assertions
ASSERT_QUIET_EVALassert.quiet_eval0 - * disable error_reporting during assertion expression - * evaluation - *
ASSERT_CALLBACKassert.callbackCallback to call on failed assertions
- *

- * @param mixed $value [optional]

- * An optional new value for the option. - *

- * @return mixed the original setting of any option or FALSE on errors. - */ -function assert_options ($what, $value = null) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Compares two "PHP-standardized" version number strings - * @link http://php.net/manual/en/function.version-compare.php - * @param string $version1

- * First version number. - *

- * @param string $version2

- * Second version number. - *

- * @param string $operator [optional]

- * If you specify the third optional operator - * argument, you can test for a particular relationship. The - * possible operators are: <, - * lt, <=, - * le, >, - * gt, >=, - * ge, ==, - * =, eq, - * !=, <>, - * ne respectively. - *

- *

- * This parameter is case-sensitive, so values should be lowercase. - *

- * @return mixed By default, version_compare returns - * -1 if the first version is lower than the second, - * 0 if they are equal, and - * 1 if the second is lower. - *

- *

- * When using the optional operator argument, the - * function will return TRUE if the relationship is the one specified - * by the operator, FALSE otherwise. - */ -function version_compare ($version1, $version2, $operator = null) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Convert a pathname and a project identifier to a System V IPC key - * @link http://php.net/manual/en/function.ftok.php - * @param string $pathname

- * Path to an accessible file. - *

- * @param string $proj

- * Project identifier. This must be a one character string. - *

- * @return int On success the return value will be the created key value, otherwise - * -1 is returned. - */ -function ftok ($pathname, $proj) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Perform the rot13 transform on a string - * @link http://php.net/manual/en/function.str-rot13.php - * @param string $str

- * The input string. - *

- * @return string the ROT13 version of the given string. - */ -function str_rot13 ($str) {} - -/** - * (PHP 5)
- * Retrieve list of registered filters - * @link http://php.net/manual/en/function.stream-get-filters.php - * @return array an indexed array containing the name of all stream filters - * available. - */ -function stream_get_filters () {} - -/** - * (PHP 5)
- * Register a user defined stream filter - * @link http://php.net/manual/en/function.stream-filter-register.php - * @param string $filtername

- * The filter name to be registered. - *

- * @param string $classname

- * To implement a filter, you need to define a class as an extension of - * php_user_filter with a number of member - * functions. When performing read/write operations on the stream - * to which your filter is attached, PHP will pass the data through your - * filter (and any other filters attached to that stream) so that the - * data may be modified as desired. You must implement the methods - * exactly as described in php_user_filter - doing - * otherwise will lead to undefined behaviour. - *

- * @return bool TRUE on success or FALSE on failure. - *

- *

- * stream_filter_register will return FALSE if the - * filtername is already defined. - */ -function stream_filter_register ($filtername, $classname) {} - -/** - * (PHP 5)
- * Return a bucket object from the brigade for operating on - * @link http://php.net/manual/en/function.stream-bucket-make-writeable.php - * @param resource $brigade - * @return object - */ -function stream_bucket_make_writeable ($brigade) {} - -/** - * (PHP 5)
- * Prepend bucket to brigade - * @link http://php.net/manual/en/function.stream-bucket-prepend.php - * @param resource $brigade

- * brigade is a resource pointing to a bucket brigade - * which contains one or more bucket objects. - *

- * @param resource $bucket

- * A bucket object. - *

- * @return void No value is returned. - */ -function stream_bucket_prepend ($brigade, $bucket) {} - -/** - * (PHP 5)
- * Append bucket to brigade - * @link http://php.net/manual/en/function.stream-bucket-append.php - * @param resource $brigade - * @param resource $bucket - * @return void - */ -function stream_bucket_append ($brigade, $bucket) {} - -/** - * (PHP 5)
- * Create a new bucket for use on the current stream - * @link http://php.net/manual/en/function.stream-bucket-new.php - * @param resource $stream - * @param string $buffer - * @return object - */ -function stream_bucket_new ($stream, $buffer) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Add URL rewriter values - * @link http://php.net/manual/en/function.output-add-rewrite-var.php - * @param string $name

- * The variable name. - *

- * @param string $value

- * The variable value. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function output_add_rewrite_var ($name, $value) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Reset URL rewriter values - * @link http://php.net/manual/en/function.output-reset-rewrite-vars.php - * @return bool TRUE on success or FALSE on failure. - */ -function output_reset_rewrite_vars () {} - -/** - * (PHP 5 >= 5.2.1)
- * Returns directory path used for temporary files - * @link http://php.net/manual/en/function.sys-get-temp-dir.php - * @return string the path of the temporary directory. - */ -function sys_get_temp_dir () {} - -define ('CONNECTION_ABORTED', 1); -define ('CONNECTION_NORMAL', 0); -define ('CONNECTION_TIMEOUT', 2); -define ('INI_USER', 1); -define ('INI_PERDIR', 2); -define ('INI_SYSTEM', 4); -define ('INI_ALL', 7); - -/** - * Normal INI scanner mode (since PHP 5.3). - * @link http://php.net/manual/en/filesystem.constants.php - */ -define ('INI_SCANNER_NORMAL', 0); - -/** - * Raw INI scanner mode (since PHP 5.3). - * @link http://php.net/manual/en/filesystem.constants.php - */ -define ('INI_SCANNER_RAW', 1); -define ('PHP_URL_SCHEME', 0); -define ('PHP_URL_HOST', 1); -define ('PHP_URL_PORT', 2); -define ('PHP_URL_USER', 3); -define ('PHP_URL_PASS', 4); -define ('PHP_URL_PATH', 5); -define ('PHP_URL_QUERY', 6); -define ('PHP_URL_FRAGMENT', 7); -define ('PHP_QUERY_RFC1738', 1); -define ('PHP_QUERY_RFC3986', 2); -define ('M_E', 2.718281828459); -define ('M_LOG2E', 1.442695040889); -define ('M_LOG10E', 0.43429448190325); -define ('M_LN2', 0.69314718055995); -define ('M_LN10', 2.302585092994); - -/** - * Round halves up - * @link http://php.net/manual/en/math.constants.php - */ -define ('M_PI', 3.1415926535898); -define ('M_PI_2', 1.5707963267949); -define ('M_PI_4', 0.78539816339745); -define ('M_1_PI', 0.31830988618379); -define ('M_2_PI', 0.63661977236758); -define ('M_SQRTPI', 1.7724538509055); -define ('M_2_SQRTPI', 1.1283791670955); -define ('M_LNPI', 1.1447298858494); -define ('M_EULER', 0.57721566490153); -define ('M_SQRT2', 1.4142135623731); -define ('M_SQRT1_2', 0.70710678118655); -define ('M_SQRT3', 1.7320508075689); -define ('INF', INF); -define ('NAN', NAN); -define ('PHP_ROUND_HALF_UP', 1); - -/** - * Round halves down - * @link http://php.net/manual/en/math.constants.php - */ -define ('PHP_ROUND_HALF_DOWN', 2); - -/** - * Round halves to even numbers - * @link http://php.net/manual/en/math.constants.php - */ -define ('PHP_ROUND_HALF_EVEN', 3); - -/** - * Round halves to odd numbers - * @link http://php.net/manual/en/math.constants.php - */ -define ('PHP_ROUND_HALF_ODD', 4); -define ('INFO_GENERAL', 1); - -/** - * PHP Credits. See also phpcredits. - * @link http://php.net/manual/en/info.constants.php - */ -define ('INFO_CREDITS', 2); - -/** - * Current Local and Master values for PHP directives. See - * also ini_get. - * @link http://php.net/manual/en/info.constants.php - */ -define ('INFO_CONFIGURATION', 4); - -/** - * Loaded modules and their respective settings. - * @link http://php.net/manual/en/info.constants.php - */ -define ('INFO_MODULES', 8); - -/** - * Environment Variable information that's also available in - * $_ENV. - * @link http://php.net/manual/en/info.constants.php - */ -define ('INFO_ENVIRONMENT', 16); - -/** - * Shows all - * predefined variables from EGPCS (Environment, GET, - * POST, Cookie, Server). - * @link http://php.net/manual/en/info.constants.php - */ -define ('INFO_VARIABLES', 32); - -/** - * PHP License information. See also the license faq. - * @link http://php.net/manual/en/info.constants.php - */ -define ('INFO_LICENSE', 64); - -/** - * Unused - * @link http://php.net/manual/en/info.constants.php - */ -define ('INFO_ALL', 4294967295); - -/** - * A list of the core developers - * @link http://php.net/manual/en/info.constants.php - */ -define ('CREDITS_GROUP', 1); - -/** - * General credits: Language design and concept, PHP - * authors and SAPI module. - * @link http://php.net/manual/en/info.constants.php - */ -define ('CREDITS_GENERAL', 2); - -/** - * A list of the server API modules for PHP, and their authors. - * @link http://php.net/manual/en/info.constants.php - */ -define ('CREDITS_SAPI', 4); - -/** - * A list of the extension modules for PHP, and their authors. - * @link http://php.net/manual/en/info.constants.php - */ -define ('CREDITS_MODULES', 8); - -/** - * The credits for the documentation team. - * @link http://php.net/manual/en/info.constants.php - */ -define ('CREDITS_DOCS', 16); - -/** - * Usually used in combination with the other flags. Indicates - * that a complete stand-alone HTML page needs to be - * printed including the information indicated by the other - * flags. - * @link http://php.net/manual/en/info.constants.php - */ -define ('CREDITS_FULLPAGE', 32); - -/** - * The credits for the quality assurance team. - * @link http://php.net/manual/en/info.constants.php - */ -define ('CREDITS_QA', 64); - -/** - * The configuration line, php.ini location, build date, Web - * Server, System and more. - * @link http://php.net/manual/en/info.constants.php - */ -define ('CREDITS_ALL', 4294967295); -define ('HTML_SPECIALCHARS', 0); -define ('HTML_ENTITIES', 1); -define ('ENT_COMPAT', 2); -define ('ENT_QUOTES', 3); -define ('ENT_NOQUOTES', 0); -define ('ENT_IGNORE', 4); -define ('ENT_SUBSTITUTE', 8); -define ('ENT_DISALLOWED', 128); -define ('ENT_HTML401', 0); -define ('ENT_XML1', 16); -define ('ENT_XHTML', 32); -define ('ENT_HTML5', 48); -define ('STR_PAD_LEFT', 0); -define ('STR_PAD_RIGHT', 1); -define ('STR_PAD_BOTH', 2); -define ('PATHINFO_DIRNAME', 1); -define ('PATHINFO_BASENAME', 2); -define ('PATHINFO_EXTENSION', 4); - -/** - * Since PHP 5.2.0. - * @link http://php.net/manual/en/filesystem.constants.php - */ -define ('PATHINFO_FILENAME', 8); -define ('CHAR_MAX', 127); -define ('LC_CTYPE', 0); -define ('LC_NUMERIC', 1); -define ('LC_TIME', 2); -define ('LC_COLLATE', 3); -define ('LC_MONETARY', 4); -define ('LC_ALL', 6); -define ('LC_MESSAGES', 5); -define ('SEEK_SET', 0); -define ('SEEK_CUR', 1); -define ('SEEK_END', 2); -define ('LOCK_SH', 1); -define ('LOCK_EX', 2); -define ('LOCK_UN', 3); -define ('LOCK_NB', 4); - -/** - * A connection with an external resource has been established. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_NOTIFY_CONNECT', 2); - -/** - * Additional authorization is required to access the specified resource. - * Typical issued with severity level of - * STREAM_NOTIFY_SEVERITY_ERR. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_NOTIFY_AUTH_REQUIRED', 3); - -/** - * Authorization has been completed (with or without success). - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_NOTIFY_AUTH_RESULT', 10); - -/** - * The mime-type of resource has been identified, - * refer to message for a description of the - * discovered type. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_NOTIFY_MIME_TYPE_IS', 4); - -/** - * The size of the resource has been discovered. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_NOTIFY_FILE_SIZE_IS', 5); - -/** - * The external resource has redirected the stream to an alternate - * location. Refer to message. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_NOTIFY_REDIRECTED', 6); - -/** - * Indicates current progress of the stream transfer in - * bytes_transferred and possibly - * bytes_max as well. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_NOTIFY_PROGRESS', 7); - -/** - * A generic error occurred on the stream, consult - * message and message_code - * for details. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_NOTIFY_FAILURE', 9); - -/** - * There is no more data available on the stream. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_NOTIFY_COMPLETED', 8); - -/** - * A remote address required for this stream has been resolved, or the resolution - * failed. See severity for an indication of which happened. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_NOTIFY_RESOLVE', 1); - -/** - * Normal, non-error related, notification. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_NOTIFY_SEVERITY_INFO', 0); - -/** - * Non critical error condition. Processing may continue. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_NOTIFY_SEVERITY_WARN', 1); - -/** - * A critical error occurred. Processing cannot continue. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_NOTIFY_SEVERITY_ERR', 2); - -/** - * Used with stream_filter_append and - * stream_filter_prepend to indicate - * that the specified filter should only be applied when - * reading - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_FILTER_READ', 1); - -/** - * Used with stream_filter_append and - * stream_filter_prepend to indicate - * that the specified filter should only be applied when - * writing - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_FILTER_WRITE', 2); - -/** - * This constant is equivalent to - * STREAM_FILTER_READ | STREAM_FILTER_WRITE - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_FILTER_ALL', 3); - -/** - * Client socket opened with stream_socket_client - * should remain persistent between page loads. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_CLIENT_PERSISTENT', 1); - -/** - * Open client socket asynchronously. This option must be used - * together with the STREAM_CLIENT_CONNECT flag. - * Used with stream_socket_client. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_CLIENT_ASYNC_CONNECT', 2); - -/** - * Open client socket connection. Client sockets should always - * include this flag. Used with stream_socket_client. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_CLIENT_CONNECT', 4); -define ('STREAM_CRYPTO_METHOD_SSLv2_CLIENT', 0); -define ('STREAM_CRYPTO_METHOD_SSLv3_CLIENT', 1); -define ('STREAM_CRYPTO_METHOD_SSLv23_CLIENT', 2); -define ('STREAM_CRYPTO_METHOD_TLS_CLIENT', 3); -define ('STREAM_CRYPTO_METHOD_SSLv2_SERVER', 4); -define ('STREAM_CRYPTO_METHOD_SSLv3_SERVER', 5); -define ('STREAM_CRYPTO_METHOD_SSLv23_SERVER', 6); -define ('STREAM_CRYPTO_METHOD_TLS_SERVER', 7); - -/** - * Used with stream_socket_shutdown to disable - * further receptions. Added in PHP 5.2.1. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_SHUT_RD', 0); - -/** - * Used with stream_socket_shutdown to disable - * further transmissions. Added in PHP 5.2.1. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_SHUT_WR', 1); - -/** - * Used with stream_socket_shutdown to disable - * further receptions and transmissions. Added in PHP 5.2.1. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_SHUT_RDWR', 2); - -/** - * Internet Protocol Version 4 (IPv4). - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_PF_INET', 2); - -/** - * Internet Protocol Version 6 (IPv6). - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_PF_INET6', 10); - -/** - * Unix system internal protocols. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_PF_UNIX', 1); - -/** - * Provides a IP socket. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_IPPROTO_IP', 0); - -/** - * Provides a TCP socket. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_IPPROTO_TCP', 6); - -/** - * Provides a UDP socket. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_IPPROTO_UDP', 17); - -/** - * Provides a ICMP socket. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_IPPROTO_ICMP', 1); - -/** - * Provides a RAW socket. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_IPPROTO_RAW', 255); - -/** - * Provides sequenced, two-way byte streams with a transmission mechanism - * for out-of-band data (TCP, for example). - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_SOCK_STREAM', 1); - -/** - * Provides datagrams, which are connectionless messages (UDP, for - * example). - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_SOCK_DGRAM', 2); - -/** - * Provides a raw socket, which provides access to internal network - * protocols and interfaces. Usually this type of socket is just available - * to the root user. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_SOCK_RAW', 3); - -/** - * Provides a sequenced packet stream socket. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_SOCK_SEQPACKET', 5); - -/** - * Provides a RDM (Reliably-delivered messages) socket. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_SOCK_RDM', 4); -define ('STREAM_PEEK', 2); -define ('STREAM_OOB', 1); - -/** - * Tells a stream created with stream_socket_server - * to bind to the specified target. Server sockets should always include this flag. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_SERVER_BIND', 4); - -/** - * Tells a stream created with stream_socket_server - * and bound using the STREAM_SERVER_BIND flag to start - * listening on the socket. Connection-orientated transports (such as TCP) - * must use this flag, otherwise the server socket will not be enabled. - * Using this flag for connect-less transports (such as UDP) is an error. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_SERVER_LISTEN', 8); - -/** - * Search for filename in - * include_path (since PHP 5). - * @link http://php.net/manual/en/filesystem.constants.php - */ -define ('FILE_USE_INCLUDE_PATH', 1); - -/** - * Strip EOL characters (since PHP 5). - * @link http://php.net/manual/en/filesystem.constants.php - */ -define ('FILE_IGNORE_NEW_LINES', 2); - -/** - * Skip empty lines (since PHP 5). - * @link http://php.net/manual/en/filesystem.constants.php - */ -define ('FILE_SKIP_EMPTY_LINES', 4); - -/** - * Append content to existing file. - * @link http://php.net/manual/en/filesystem.constants.php - */ -define ('FILE_APPEND', 8); -define ('FILE_NO_DEFAULT_CONTEXT', 16); - -/** - *

- * Text mode (since PHP 5.2.7). - *

- * This constant has no effect, and is only available for - * forward compatibility. - *

- *

- * @link http://php.net/manual/en/filesystem.constants.php - */ -define ('FILE_TEXT', 0); - -/** - *

- * Binary mode (since PHP 5.2.7). - *

- * This constant has no effect, and is only available for - * forward compatibility. - *

- *

- * @link http://php.net/manual/en/filesystem.constants.php - */ -define ('FILE_BINARY', 0); - -/** - * Disable backslash escaping. - * @link http://php.net/manual/en/filesystem.constants.php - */ -define ('FNM_NOESCAPE', 2); - -/** - * Slash in string only matches slash in the given pattern. - * @link http://php.net/manual/en/filesystem.constants.php - */ -define ('FNM_PATHNAME', 1); - -/** - * Leading period in string must be exactly matched by period in the given pattern. - * @link http://php.net/manual/en/filesystem.constants.php - */ -define ('FNM_PERIOD', 4); - -/** - * Caseless match. Part of the GNU extension. - * @link http://php.net/manual/en/filesystem.constants.php - */ -define ('FNM_CASEFOLD', 16); - -/** - * Return Code indicating that the - * userspace filter returned buckets in $out. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('PSFS_PASS_ON', 2); - -/** - * Return Code indicating that the - * userspace filter did not return buckets in $out - * (i.e. No data available). - * @link http://php.net/manual/en/stream.constants.php - */ -define ('PSFS_FEED_ME', 1); - -/** - * Return Code indicating that the - * userspace filter encountered an unrecoverable error - * (i.e. Invalid data received). - * @link http://php.net/manual/en/stream.constants.php - */ -define ('PSFS_ERR_FATAL', 0); - -/** - * Regular read/write. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('PSFS_FLAG_NORMAL', 0); - -/** - * An incremental flush. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('PSFS_FLAG_FLUSH_INC', 1); - -/** - * Final flush prior to closing. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('PSFS_FLAG_FLUSH_CLOSE', 2); -define ('ABDAY_1', 131072); -define ('ABDAY_2', 131073); -define ('ABDAY_3', 131074); -define ('ABDAY_4', 131075); -define ('ABDAY_5', 131076); -define ('ABDAY_6', 131077); -define ('ABDAY_7', 131078); -define ('DAY_1', 131079); -define ('DAY_2', 131080); -define ('DAY_3', 131081); -define ('DAY_4', 131082); -define ('DAY_5', 131083); -define ('DAY_6', 131084); -define ('DAY_7', 131085); -define ('ABMON_1', 131086); -define ('ABMON_2', 131087); -define ('ABMON_3', 131088); -define ('ABMON_4', 131089); -define ('ABMON_5', 131090); -define ('ABMON_6', 131091); -define ('ABMON_7', 131092); -define ('ABMON_8', 131093); -define ('ABMON_9', 131094); -define ('ABMON_10', 131095); -define ('ABMON_11', 131096); -define ('ABMON_12', 131097); -define ('MON_1', 131098); -define ('MON_2', 131099); -define ('MON_3', 131100); -define ('MON_4', 131101); -define ('MON_5', 131102); -define ('MON_6', 131103); -define ('MON_7', 131104); -define ('MON_8', 131105); -define ('MON_9', 131106); -define ('MON_10', 131107); -define ('MON_11', 131108); -define ('MON_12', 131109); -define ('AM_STR', 131110); -define ('PM_STR', 131111); -define ('D_T_FMT', 131112); -define ('D_FMT', 131113); -define ('T_FMT', 131114); -define ('T_FMT_AMPM', 131115); -define ('ERA', 131116); -define ('ERA_D_T_FMT', 131120); -define ('ERA_D_FMT', 131118); -define ('ERA_T_FMT', 131121); -define ('ALT_DIGITS', 131119); -define ('CRNCYSTR', 262159); -define ('RADIXCHAR', 65536); -define ('THOUSEP', 65537); -define ('YESEXPR', 327680); -define ('NOEXPR', 327681); -define ('CODESET', 14); -define ('CRYPT_SALT_LENGTH', 37); -define ('CRYPT_STD_DES', 1); -define ('CRYPT_EXT_DES', 1); -define ('CRYPT_MD5', 1); -define ('CRYPT_BLOWFISH', 1); -define ('CRYPT_SHA256', 1); -define ('CRYPT_SHA512', 1); -define ('DIRECTORY_SEPARATOR', "/"); - -/** - * Available since PHP 4.3.0. Semicolon on Windows, colon otherwise. - * @link http://php.net/manual/en/dir.constants.php - */ -define ('PATH_SEPARATOR', ":"); - -/** - * Available since PHP 5.4.0. - * @link http://php.net/manual/en/dir.constants.php - */ -define ('SCANDIR_SORT_ASCENDING', 0); - -/** - * Available since PHP 5.4.0. - * @link http://php.net/manual/en/dir.constants.php - */ -define ('SCANDIR_SORT_DESCENDING', 1); - -/** - * Available since PHP 5.4.0. - * @link http://php.net/manual/en/dir.constants.php - */ -define ('SCANDIR_SORT_NONE', 2); -define ('GLOB_BRACE', 1024); -define ('GLOB_MARK', 2); -define ('GLOB_NOSORT', 4); -define ('GLOB_NOCHECK', 16); -define ('GLOB_NOESCAPE', 64); -define ('GLOB_ERR', 1); -define ('GLOB_ONLYDIR', 8192); -define ('GLOB_AVAILABLE_FLAGS', 9303); - -/** - * system is unusable - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_EMERG', 0); - -/** - * action must be taken immediately - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_ALERT', 1); - -/** - * critical conditions - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_CRIT', 2); - -/** - * error conditions - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_ERR', 3); - -/** - * warning conditions - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_WARNING', 4); - -/** - * normal, but significant, condition - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_NOTICE', 5); - -/** - * informational message - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_INFO', 6); - -/** - * debug-level message - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_DEBUG', 7); - -/** - * kernel messages - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_KERN', 0); - -/** - * generic user-level messages - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_USER', 8); - -/** - * mail subsystem - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_MAIL', 16); - -/** - * other system daemons - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_DAEMON', 24); - -/** - * security/authorization messages (use LOG_AUTHPRIV instead - * in systems where that constant is defined) - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_AUTH', 32); - -/** - * messages generated internally by syslogd - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_SYSLOG', 40); - -/** - * line printer subsystem - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_LPR', 48); - -/** - * USENET news subsystem - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_NEWS', 56); - -/** - * UUCP subsystem - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_UUCP', 64); - -/** - * clock daemon (cron and at) - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_CRON', 72); - -/** - * security/authorization messages (private) - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_AUTHPRIV', 80); -define ('LOG_LOCAL0', 128); -define ('LOG_LOCAL1', 136); -define ('LOG_LOCAL2', 144); -define ('LOG_LOCAL3', 152); -define ('LOG_LOCAL4', 160); -define ('LOG_LOCAL5', 168); -define ('LOG_LOCAL6', 176); -define ('LOG_LOCAL7', 184); - -/** - * include PID with each message - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_PID', 1); - -/** - * if there is an error while sending data to the system logger, - * write directly to the system console - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_CONS', 2); - -/** - * (default) delay opening the connection until the first - * message is logged - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_ODELAY', 4); - -/** - * open the connection to the logger immediately - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_NDELAY', 8); -define ('LOG_NOWAIT', 16); - -/** - * print log message also to standard error - * @link http://php.net/manual/en/network.constants.php - */ -define ('LOG_PERROR', 32); -define ('EXTR_OVERWRITE', 0); -define ('EXTR_SKIP', 1); -define ('EXTR_PREFIX_SAME', 2); -define ('EXTR_PREFIX_ALL', 3); -define ('EXTR_PREFIX_INVALID', 4); -define ('EXTR_PREFIX_IF_EXISTS', 5); -define ('EXTR_IF_EXISTS', 6); -define ('EXTR_REFS', 256); - -/** - * SORT_ASC is used with - * array_multisort to sort in ascending order. - * @link http://php.net/manual/en/array.constants.php - */ -define ('SORT_ASC', 4); - -/** - * SORT_DESC is used with - * array_multisort to sort in descending order. - * @link http://php.net/manual/en/array.constants.php - */ -define ('SORT_DESC', 3); - -/** - * SORT_REGULAR is used to compare items normally. - * @link http://php.net/manual/en/array.constants.php - */ -define ('SORT_REGULAR', 0); - -/** - * SORT_NUMERIC is used to compare items numerically. - * @link http://php.net/manual/en/array.constants.php - */ -define ('SORT_NUMERIC', 1); - -/** - * SORT_STRING is used to compare items as strings. - * @link http://php.net/manual/en/array.constants.php - */ -define ('SORT_STRING', 2); - -/** - * SORT_LOCALE_STRING is used to compare items as - * strings, based on the current locale. Added in PHP 4.4.0 and 5.0.2. - * @link http://php.net/manual/en/array.constants.php - */ -define ('SORT_LOCALE_STRING', 5); - -/** - * SORT_NATURAL is used to compare items as - * strings using "natural ordering" like natsort. Added in PHP 5.4.0. - * @link http://php.net/manual/en/array.constants.php - */ -define ('SORT_NATURAL', 6); - -/** - * SORT_FLAG_CASE can be combined - * (bitwise OR) with - * SORT_STRING or - * SORT_NATURAL to sort strings case-insensitively. Added in PHP 5.4.0. - * @link http://php.net/manual/en/array.constants.php - */ -define ('SORT_FLAG_CASE', 8); - -/** - * CASE_LOWER is used with - * array_change_key_case and is used to convert array - * keys to lower case. This is also the default case for - * array_change_key_case. - * @link http://php.net/manual/en/array.constants.php - */ -define ('CASE_LOWER', 0); - -/** - * CASE_UPPER is used with - * array_change_key_case and is used to convert array - * keys to upper case. - * @link http://php.net/manual/en/array.constants.php - */ -define ('CASE_UPPER', 1); -define ('COUNT_NORMAL', 0); -define ('COUNT_RECURSIVE', 1); -define ('ASSERT_ACTIVE', 1); -define ('ASSERT_CALLBACK', 2); -define ('ASSERT_BAIL', 3); -define ('ASSERT_WARNING', 4); -define ('ASSERT_QUIET_EVAL', 5); - -/** - * Flag indicating if the stream - * used the include path. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_USE_PATH', 1); -define ('STREAM_IGNORE_URL', 2); - -/** - * Flag indicating if the wrapper - * is responsible for raising errors using trigger_error - * during opening of the stream. If this flag is not set, you - * should not raise any errors. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_REPORT_ERRORS', 8); - -/** - * This flag is useful when your extension really must be able to randomly - * seek around in a stream. Some streams may not be seekable in their - * native form, so this flag asks the streams API to check to see if the - * stream does support seeking. If it does not, it will copy the stream - * into temporary storage (which may be a temporary file or a memory - * stream) which does support seeking. - * Please note that this flag is not useful when you want to seek the - * stream and write to it, because the stream you are accessing might - * not be bound to the actual resource you requested. - * If the requested resource is network based, this flag will cause the - * opener to block until the whole contents have been downloaded. - * @link http://php.net/manual/en/internals2.ze1.streams.constants.php - */ -define ('STREAM_MUST_SEEK', 16); -define ('STREAM_URL_STAT_LINK', 1); -define ('STREAM_URL_STAT_QUIET', 2); -define ('STREAM_MKDIR_RECURSIVE', 1); -define ('STREAM_IS_URL', 1); -define ('STREAM_OPTION_BLOCKING', 1); -define ('STREAM_OPTION_READ_TIMEOUT', 4); -define ('STREAM_OPTION_READ_BUFFER', 2); -define ('STREAM_OPTION_WRITE_BUFFER', 3); -define ('STREAM_BUFFER_NONE', 0); -define ('STREAM_BUFFER_LINE', 1); -define ('STREAM_BUFFER_FULL', 2); - -/** - * Stream casting, when stream_cast is called - * otherwise (see above). - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_CAST_AS_STREAM', 0); - -/** - * Stream casting, for when stream_select is - * calling stream_cast. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_CAST_FOR_SELECT', 3); - -/** - * Used with stream_metadata, to specify touch call. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_META_TOUCH', 1); - -/** - * Used with stream_metadata, to specify chown call. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_META_OWNER', 3); - -/** - * Used with stream_metadata, to specify chown call. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_META_OWNER_NAME', 2); - -/** - * Used with stream_metadata, to specify chgrp call. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_META_GROUP', 5); - -/** - * Used with stream_metadata, to specify chgrp call. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_META_GROUP_NAME', 4); - -/** - * Used with stream_metadata, to specify chmod call. - * @link http://php.net/manual/en/stream.constants.php - */ -define ('STREAM_META_ACCESS', 6); - -/** - * Image type constant used by the - * image_type_to_mime_type and - * image_type_to_extension functions. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMAGETYPE_GIF', 1); - -/** - * Image type constant used by the - * image_type_to_mime_type and - * image_type_to_extension functions. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMAGETYPE_JPEG', 2); - -/** - * Image type constant used by the - * image_type_to_mime_type and - * image_type_to_extension functions. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMAGETYPE_PNG', 3); - -/** - * Image type constant used by the - * image_type_to_mime_type and - * image_type_to_extension functions. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMAGETYPE_SWF', 4); - -/** - * Image type constant used by the - * image_type_to_mime_type and - * image_type_to_extension functions. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMAGETYPE_PSD', 5); - -/** - * Image type constant used by the - * image_type_to_mime_type and - * image_type_to_extension functions. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMAGETYPE_BMP', 6); - -/** - * Image type constant used by the - * image_type_to_mime_type and - * image_type_to_extension functions. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMAGETYPE_TIFF_II', 7); - -/** - * Image type constant used by the - * image_type_to_mime_type and - * image_type_to_extension functions. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMAGETYPE_TIFF_MM', 8); - -/** - * Image type constant used by the - * image_type_to_mime_type and - * image_type_to_extension functions. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMAGETYPE_JPC', 9); - -/** - * Image type constant used by the - * image_type_to_mime_type and - * image_type_to_extension functions. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMAGETYPE_JP2', 10); - -/** - * Image type constant used by the - * image_type_to_mime_type and - * image_type_to_extension functions. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMAGETYPE_JPX', 11); - -/** - * Image type constant used by the - * image_type_to_mime_type and - * image_type_to_extension functions. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMAGETYPE_JB2', 12); - -/** - * Image type constant used by the - * image_type_to_mime_type and - * image_type_to_extension functions. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMAGETYPE_SWC', 13); - -/** - * Image type constant used by the - * image_type_to_mime_type and - * image_type_to_extension functions. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMAGETYPE_IFF', 14); - -/** - * Image type constant used by the - * image_type_to_mime_type and - * image_type_to_extension functions. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMAGETYPE_WBMP', 15); - -/** - * Image type constant used by the - * image_type_to_mime_type and - * image_type_to_extension functions. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMAGETYPE_JPEG2000', 9); - -/** - * Image type constant used by the - * image_type_to_mime_type and - * image_type_to_extension functions. - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMAGETYPE_XBM', 16); - -/** - * Image type constant used by the - * image_type_to_mime_type and - * image_type_to_extension functions. - * (Available as of PHP 5.3.0) - * @link http://php.net/manual/en/image.constants.php - */ -define ('IMAGETYPE_ICO', 17); -define ('IMAGETYPE_UNKNOWN', 0); -define ('IMAGETYPE_COUNT', 18); - -/** - * IPv4 Address Resource - * @link http://php.net/manual/en/network.constants.php - */ -define ('DNS_A', 1); - -/** - * Authoritative Name Server Resource - * @link http://php.net/manual/en/network.constants.php - */ -define ('DNS_NS', 2); - -/** - * Alias (Canonical Name) Resource - * @link http://php.net/manual/en/network.constants.php - */ -define ('DNS_CNAME', 16); - -/** - * Start of Authority Resource - * @link http://php.net/manual/en/network.constants.php - */ -define ('DNS_SOA', 32); - -/** - * Pointer Resource - * @link http://php.net/manual/en/network.constants.php - */ -define ('DNS_PTR', 2048); - -/** - * Host Info Resource (See IANA's - * Operating System Names - * for the meaning of these values) - * @link http://php.net/manual/en/network.constants.php - */ -define ('DNS_HINFO', 4096); - -/** - * Mail Exchanger Resource - * @link http://php.net/manual/en/network.constants.php - */ -define ('DNS_MX', 16384); - -/** - * Text Resource - * @link http://php.net/manual/en/network.constants.php - */ -define ('DNS_TXT', 32768); -define ('DNS_SRV', 33554432); -define ('DNS_NAPTR', 67108864); - -/** - * IPv6 Address Resource - * @link http://php.net/manual/en/network.constants.php - */ -define ('DNS_AAAA', 134217728); -define ('DNS_A6', 16777216); - -/** - * Any Resource Record. On most systems - * this returns all resource records, however - * it should not be counted upon for critical - * uses. Try DNS_ALL instead. - * @link http://php.net/manual/en/network.constants.php - */ -define ('DNS_ANY', 268435456); - -/** - * Iteratively query the name server for - * each available record type. - * @link http://php.net/manual/en/network.constants.php - */ -define ('DNS_ALL', 251713587); - -// End of standard v.5.4.6-1ubuntu1.1 -?> diff --git a/phpruntime/svn.php b/phpruntime/svn.php deleted file mode 100644 index 51b0c53..0000000 --- a/phpruntime/svn.php +++ /dev/null @@ -1,1243 +0,0 @@ - - * Checks out a working copy from the repository - * @link http://php.net/manual/en/function.svn-checkout.php - * @param string $repos

- * String URL path to directory in repository to check out. - *

- * @param string $targetpath

- * String local path to directory to check out in to - *

- * Relative paths will be resolved as if the current working directory was the one that contains the PHP binary. To use the calling script's working directory, use realpath or dirname(__FILE__). - * @param int $revision [optional]

- * Integer revision number of repository to check out. Default is - * HEAD, the most recent revision. - *

- * @param int $flags [optional]

- * Any combination of SVN_NON_RECURSIVE and - * SVN_IGNORE_EXTERNALS. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function svn_checkout ($repos, $targetpath, $revision = null, $flags = 0) {} - -/** - * (PECL svn >= 0.1.0)
- * Returns the contents of a file in a repository - * @link http://php.net/manual/en/function.svn-cat.php - * @param string $repos_url

- * String URL path to item in a repository. - *

- * @param int $revision_no [optional]

- * Integer revision number of item to retrieve, default is the HEAD - * revision. - *

- * @return string the string contents of the item from the repository on - * success, and FALSE on failure. - */ -function svn_cat ($repos_url, $revision_no = null) {} - -/** - * (PECL svn >= 0.1.0)
- * Returns list of directory contents in repository URL, optionally at revision number - * @link http://php.net/manual/en/function.svn-ls.php - * @param string $repos_url - * @param int $revision_no [optional] - * @param bool $recurse [optional]

- * Enables recursion. - *

- * @param bool $peg [optional] - * @return array On success, this function returns an array file listing in the format - * of: - *
- * [0] => Array
- * (
- * [created_rev] => integer revision number of last edit
- * [last_author] => string author name of last edit
- * [size] => integer byte file size of file
- * [time] => string date of last edit in form 'M d H:i'
- * or 'M d Y', depending on how old the file is
- * [time_t] => integer unix timestamp of last edit
- * [name] => name of file/directory
- * [type] => type, can be 'file' or 'dir'
- * )
- * [1] => ...
- * 
- */ -function svn_ls ($repos_url, $revision_no = 'SVN_REVISION_HEAD', $recurse = false, $peg = false) {} - -/** - * (PECL svn >= 0.1.0)
- * Returns the commit log messages of a repository URL - * @link http://php.net/manual/en/function.svn-log.php - * @param string $repos_url

- * Repository URL of the item to retrieve log history from. - *

- * @param int $start_revision [optional]

- * Revision number of the first log to retrieve. Use - * SVN_REVISION_HEAD to retrieve the log from - * the most recent revision. - *

- * @param int $end_revision [optional]

- * Revision number of the last log to retrieve. Defaults to - * start_revision if specified or to - * SVN_REVISION_INITIAL otherwise. - *

- * @param int $limit [optional]

- * Number of logs to retrieve. - *

- * @param int $flags [optional]

- * Any combination of SVN_OMIT_MESSAGES, - * SVN_DISCOVER_CHANGED_PATHS and - * SVN_STOP_ON_COPY. - *

- * @return array On success, this function returns an array file listing in the format - * of: - *
- * [0] => Array, ordered most recent (highest) revision first
- * (
- * [rev] => integer revision number
- * [author] => string author name
- * [msg] => string log message
- * [date] => string date formatted per ISO 8601, i.e. date('c')
- * [paths] => Array, describing changed files
- * (
- * [0] => Array
- * (
- * [action] => string letter signifying change
- * [path] => absolute repository path of changed file
- * )
- * [1] => ...
- * )
- * )
- * [1] => ...
- * 
- *

- *

- * The output will always be a numerically indexed array of arrays, - * even when there are none or only one log message(s). - *

- *

- * The value of action is a subset of the - * status output - * in the first column, where possible values are: - *

- * - * Actions - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
LetterDescription
MItem/props was modified
AItem was added
DItem was deleted
RItem was replaced
- *

- * If no changes were made to the item, an empty array is returned. - */ -function svn_log ($repos_url, $start_revision = null, $end_revision = null, $limit = 0, $flags = 'SVN_DISCOVER_CHANGED_PATHS | SVN_STOP_ON_COPY') {} - -/** - * (PECL svn >= 0.1.0)
- * Sets an authentication parameter - * @link http://php.net/manual/en/function.svn-auth-set-parameter.php - * @param string $key

- * String key name. Use the authentication constants - * defined by this extension to specify a key. - *

- * @param string $value

- * String value to set to parameter at key. Format of value varies - * with the parameter. - *

- * @return void No value is returned. - */ -function svn_auth_set_parameter ($key, $value) {} - -/** - * (PECL svn >= 0.1.0)
- * Retrieves authentication parameter - * @link http://php.net/manual/en/function.svn-auth-get-parameter.php - * @param string $key

- * String key name. Use the authentication constants - * defined by this extension to specify a key. - *

- * @return string the string value of the parameter at key; - * returns NULL if parameter does not exist. - */ -function svn_auth_get_parameter ($key) {} - -/** - * (PECL svn >= 0.1.0)
- * Returns the version of the SVN client libraries - * @link http://php.net/manual/en/function.svn-client-version.php - * @return string String version number, usually in form of x.y.z. - */ -function svn_client_version () {} - -function svn_config_ensure () {} - -/** - * (PECL svn >= 0.1.0)
- * Recursively diffs two paths - * @link http://php.net/manual/en/function.svn-diff.php - * @param string $path1

- * First path to diff. This can be a URL to a file/directory in an SVN - * repository or a local file/directory path. - *

- * Relative paths will be resolved as if the current working directory was the one that contains the PHP binary. To use the calling script's working directory, use realpath or dirname(__FILE__). - * If a local file path has only backslashes and no forward slashes, - * this extension will fail to find the path. Always - * replace all backslashes with forward slashes when using this - * function. - * @param int $rev1

- * First path's revision number. Use SVN_REVISION_HEAD - * to specify the most recent revision. - *

- * @param string $path2

- * Second path to diff. See path1 for description. - *

- * @param int $rev2

- * Second path's revision number. See rev1 - * for description. - *

- * @return array an array-list consisting of two streams: the first is the diff output - * and the second contains error stream output. The streams can be - * read using fread. Returns FALSE or NULL on - * error. - *

- *

- * The diff output will, by default, be in the form of Subversion's - * custom unified diff format, but an - * external - * diff engine may be - * used depending on Subversion's configuration. - */ -function svn_diff ($path1, $rev1, $path2, $rev2) {} - -/** - * (PECL svn >= 0.1.0)
- * Recursively cleanup a working copy directory, finishing incomplete operations and removing locks - * @link http://php.net/manual/en/function.svn-cleanup.php - * @param string $workingdir

- * String path to local working directory to cleanup - *

- * Relative paths will be resolved as if the current working directory was the one that contains the PHP binary. To use the calling script's working directory, use realpath or dirname(__FILE__). - * @return bool TRUE on success or FALSE on failure. - */ -function svn_cleanup ($workingdir) {} - -/** - * (PECL svn >= 0.3.0)
- * Revert changes to the working copy - * @link http://php.net/manual/en/function.svn-revert.php - * @param string $path

- * The path to the working repository. - *

- * @param bool $recursive [optional]

- * Optionally make recursive changes. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function svn_revert ($path, $recursive = false) {} - -function svn_resolved () {} - -/** - * (PECL svn >= 0.1.0)
- * Sends changes from the local working copy to the repository - * @link http://php.net/manual/en/function.svn-commit.php - * @param string $log

- * String log text to commit - *

- * @param array $targets

- * Array of local paths of files to be committed - *

- * This parameter must be an array, a string for a single - * target is not acceptable. - * Relative paths will be resolved as if the current working directory was the one that contains the PHP binary. To use the calling script's working directory, use realpath or dirname(__FILE__). - * @param bool $recursive [optional]

- * Boolean flag to disable recursive committing of - * directories in the targets array. - * Default is TRUE. - *

- * @return array array in form of: - *

- *
- * array(
- * 0 => integer revision number of commit
- * 1 => string ISO 8601 date and time of commit
- * 2 => name of committer
- * )
- * 
- *

- * Returns FALSE on failure. - */ -function svn_commit ($log, array $targets, $recursive = true) {} - -function svn_lock () {} - -function svn_unlock () {} - -/** - * (PECL svn >= 0.1.0)
- * Schedules the addition of an item in a working directory - * @link http://php.net/manual/en/function.svn-add.php - * @param string $path

- * Path of item to add. - *

- * Relative paths will be resolved as if the current working directory was the one that contains the PHP binary. To use the calling script's working directory, use realpath or dirname(__FILE__). - * @param bool $recursive [optional]

- * If item is directory, whether or not to recursively add - * all of its contents. Default is TRUE - *

- * @param bool $force [optional]

- * If true, Subversion will recurse into already versioned directories - * in order to add unversioned files that may be hiding in those - * directories. Default is FALSE - *

- * @return bool TRUE on success or FALSE on failure. - */ -function svn_add ($path, $recursive = true, $force = false) {} - -/** - * (PECL svn >= 0.1.0)
- * Returns the status of working copy files and directories - * @link http://php.net/manual/en/function.svn-status.php - * @param string $path

- * Local path to file or directory to retrieve status of. - *

- * Relative paths will be resolved as if the current working directory was the one that contains the PHP binary. To use the calling script's working directory, use realpath or dirname(__FILE__). - * @param int $flags [optional]

- * Any combination of SVN_NON_RECURSIVE, - * SVN_ALL (regardless of modification status), - * SVN_SHOW_UPDATES (entries will be added for items - * that are out-of-date), SVN_NO_IGNORE (disregard - * svn:ignore properties when scanning for new files) - * and SVN_IGNORE_EXTERNALS. - *

- * @return array a numerically indexed array of associative arrays detailing - * the status of items in the repository: - *

- *
- * Array (
- * [0] => Array (
- * // information on item
- * )
- * [1] => ...
- * )
- * 
- *

- * The information on the item is an associative array that can contain - * the following keys: - *

- * path - * String path to file/directory of this entry on local filesystem. - * text_status - * Status of item's text. Refer to status constants for possible values. - * repos_text_status - * Status of item's text in repository. Only accurate if - * update was set to TRUE. - * Refer to status constants for possible values. - * prop_status - * Status of item's properties. Refer to status constants for possible values. - * repos_prop_status - * Status of item's property in repository. Only accurate if - * update was set to TRUE. Refer to status constants for possible values. - * locked - * Whether or not the item is locked. (Only set if TRUE.) - * copied - * Whether or not the item was copied (scheduled for addition with - * history). (Only set if TRUE.) - * switched - * Whether or not the item was switched using the switch command. - * (Only set if TRUE) - *

- * These keys are only set if the item is versioned: - *

- * name - * Base name of item in repository. - * url - * URL of item in repository. - * repos - * Base URL of repository. - * revision - * Integer revision of item in working copy. - * kind - * Type of item, i.e. file or directory. Refer to type constants for possible values. - * schedule - * Scheduled action for item, i.e. addition or deletion. Constants - * for these magic numbers are not available, they can - * be emulated by using: - * - * if (!defined('svn_wc_schedule_normal')) { - * define('svn_wc_schedule_normal', 0); // nothing special - * define('svn_wc_schedule_add', 1); // item will be added - * define('svn_wc_schedule_delete', 2); // item will be deleted - * define('svn_wc_schedule_replace', 3); // item will be added and deleted - * } - * - * deleted - * Whether or not the item was deleted, but parent revision lags - * behind. (Only set if TRUE.) - * absent - * Whether or not the item is absent, that is, Subversion knows that - * there should be something there but there isn't. (Only set if - * TRUE.) - * incomplete - * Whether or not the entries file for a directory is incomplete. - * (Only set if TRUE.) - * cmt_date - * Integer Unix timestamp of last commit date. (Unaffected by update.) - * cmt_rev - * Integer revision of last commit. (Unaffected by update.) - * cmt_author - * String author of last commit. (Unaffected by update - */ -function svn_status ($path, $flags = 0) {} - -/** - * (PECL svn >= 0.1.0)
- * Update working copy - * @link http://php.net/manual/en/function.svn-update.php - * @param string $path

- * Path to local working copy. - *

- * Relative paths will be resolved as if the current working directory was the one that contains the PHP binary. To use the calling script's working directory, use realpath or dirname(__FILE__). - * @param int $revno [optional]

- * Revision number to update to, default is SVN_REVISION_HEAD. - *

- * @param bool $recurse [optional]

- * Whether or not to recursively update directories. - *

- * @return int new revision number on success, returns FALSE on failure. - */ -function svn_update ($path, $revno = 'SVN_REVISION_HEAD', $recurse = true) {} - -/** - * (PECL svn >= 0.2.0)
- * Imports an unversioned path into a repository - * @link http://php.net/manual/en/function.svn-import.php - * @param string $path

- * Path of file or directory to import. - *

- * Relative paths will be resolved as if the current working directory was the one that contains the PHP binary. To use the calling script's working directory, use realpath or dirname(__FILE__). - * @param string $url

- * Repository URL to import into. - *

- * @param bool $nonrecursive

- * Whether or not to refrain from recursively processing directories. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function svn_import ($path, $url, $nonrecursive) {} - -function svn_info () {} - -/** - * (PECL svn >= 0.3.0)
- * Export the contents of a SVN directory - * @link http://php.net/manual/en/function.svn-export.php - * @param string $frompath

- * The path to the current repository. - *

- * @param string $topath

- * The path to the new repository. - *

- * @param bool $working_copy [optional]

- * If TRUE, it will export uncommitted files from the working copy. - *

- * @param int $revision_no [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function svn_export ($frompath, $topath, $working_copy = true, $revision_no = -1) {} - -function svn_copy () {} - -function svn_switch () {} - -/** - * (PECL svn >= 0.3.0)
- * Get the SVN blame for a file - * @link http://php.net/manual/en/function.svn-blame.php - * @param string $repository_url

- * The repository URL. - *

- * @param int $revision_no [optional]

- * The revision number. - *

- * @return array An array of SVN blame information separated by line - * which includes the revision number, line number, line of code, - * author, and date. - */ -function svn_blame ($repository_url, $revision_no = 'SVN_REVISION_HEAD') {} - -/** - * (PECL svn >= 0.4.0)
- * Delete items from a working copy or repository. - * @link http://php.net/manual/en/function.svn-delete.php - * @param string $path

- * Path of item to delete. - *

- * Relative paths will be resolved as if the current working directory was the one that contains the PHP binary. To use the calling script's working directory, use realpath or dirname(__FILE__). - * @param bool $force [optional]

- * If TRUE, the file will be deleted even if it has local modifications. - * Otherwise, local modifications will result in a failure. Default is - * FALSE - *

- * @return bool TRUE on success or FALSE on failure. - */ -function svn_delete ($path, $force = false) {} - -/** - * (PECL svn >= 0.4.0)
- * Creates a directory in a working copy or repository - * @link http://php.net/manual/en/function.svn-mkdir.php - * @param string $path

- * The path to the working copy or repository. - *

- * @param string $log_message [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function svn_mkdir ($path, $log_message = null) {} - -function svn_move () {} - -function svn_proplist () {} - -function svn_propget () {} - -/** - * (PECL svn >= 0.1.0)
- * Create a new subversion repository at path - * @link http://php.net/manual/en/function.svn-repos-create.php - * @param string $path

- * Its description - *

- * @param array $config [optional]

- * Its description - *

- * @param array $fsconfig [optional]

- * Its description - *

- * @return resource What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_repos_create ($path, array $config = null, array $fsconfig = null) {} - -/** - * (PECL svn >= 0.1.0)
- * Run recovery procedures on the repository located at path. - * @link http://php.net/manual/en/function.svn-repos-recover.php - * @param string $path

- * Its description - *

- * @return bool What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_repos_recover ($path) {} - -/** - * (PECL svn >= 0.1.0)
- * Make a hot-copy of the repos at repospath; copy it to destpath - * @link http://php.net/manual/en/function.svn-repos-hotcopy.php - * @param string $repospath

- * Its description - *

- * @param string $destpath

- * Its description - *

- * @param bool $cleanlogs

- * Its description - *

- * @return bool What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_repos_hotcopy ($repospath, $destpath, $cleanlogs) {} - -/** - * (PECL svn >= 0.1.0)
- * Open a shared lock on a repository. - * @link http://php.net/manual/en/function.svn-repos-open.php - * @param string $path

- * Its description - *

- * @return resource What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_repos_open ($path) {} - -/** - * (PECL svn >= 0.1.0)
- * Gets a handle on the filesystem for a repository - * @link http://php.net/manual/en/function.svn-repos-fs.php - * @param resource $repos

- * Its description - *

- * @return resource What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_repos_fs ($repos) {} - -/** - * (PECL svn >= 0.2.0)
- * Create a new transaction - * @link http://php.net/manual/en/function.svn-repos-fs-begin-txn-for-commit.php - * @param resource $repos

- * Its description - *

- * @param int $rev

- * Its description - *

- * @param string $author

- * Its description - *

- * @param string $log_msg

- * Its description - *

- * @return resource What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_repos_fs_begin_txn_for_commit ($repos, $rev, $author, $log_msg) {} - -/** - * (PECL svn >= 0.2.0)
- * Commits a transaction and returns the new revision - * @link http://php.net/manual/en/function.svn-repos-fs-commit-txn.php - * @param resource $txn

- * Its description - *

- * @return int What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_repos_fs_commit_txn ($txn) {} - -/** - * (PECL svn >= 0.1.0)
- * Get a handle on a specific version of the repository root - * @link http://php.net/manual/en/function.svn-fs-revision-root.php - * @param resource $fs

- * Its description - *

- * @param int $revnum

- * Its description - *

- * @return resource What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_revision_root ($fs, $revnum) {} - -/** - * (PECL svn >= 0.1.0)
- * Determines what kind of item lives at path in a given repository fsroot - * @link http://php.net/manual/en/function.svn-fs-check-path.php - * @param resource $fsroot

- * Its description - *

- * @param string $path

- * Its description - *

- * @return int What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_check_path ($fsroot, $path) {} - -/** - * (PECL svn >= 0.1.0)
- * Fetches the value of a named property - * @link http://php.net/manual/en/function.svn-fs-revision-prop.php - * @param resource $fs

- * Its description - *

- * @param int $revnum

- * Its description - *

- * @param string $propname

- * Its description - *

- * @return string What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_revision_prop ($fs, $revnum, $propname) {} - -/** - * (PECL svn >= 0.1.0)
- * Enumerates the directory entries under path; returns a hash of dir names to file type - * @link http://php.net/manual/en/function.svn-fs-dir-entries.php - * @param resource $fsroot

- * Its description - *

- * @param string $path

- * Its description - *

- * @return array What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_dir_entries ($fsroot, $path) {} - -/** - * (PECL svn >= 0.1.0)
- * Returns the revision in which path under fsroot was created - * @link http://php.net/manual/en/function.svn-fs-node-created-rev.php - * @param resource $fsroot

- * Its description - *

- * @param string $path

- * Its description - *

- * @return int What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_node_created_rev ($fsroot, $path) {} - -/** - * (PECL svn >= 0.1.0)
- * Returns the number of the youngest revision in the filesystem - * @link http://php.net/manual/en/function.svn-fs-youngest-rev.php - * @param resource $fs

- * Its description - *

- * @return int What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_youngest_rev ($fs) {} - -/** - * (PECL svn >= 0.1.0)
- * Returns a stream to access the contents of a file from a given version of the fs - * @link http://php.net/manual/en/function.svn-fs-file-contents.php - * @param resource $fsroot

- * Its description - *

- * @param string $path

- * Its description - *

- * @return resource What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_file_contents ($fsroot, $path) {} - -/** - * (PECL svn >= 0.1.0)
- * Returns the length of a file from a given version of the fs - * @link http://php.net/manual/en/function.svn-fs-file-length.php - * @param resource $fsroot

- * Its description - *

- * @param string $path

- * Its description - *

- * @return int What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_file_length ($fsroot, $path) {} - -/** - * (PECL svn >= 0.2.0)
- * Creates and returns a transaction root - * @link http://php.net/manual/en/function.svn-fs-txn-root.php - * @param resource $txn

- * Its description - *

- * @return resource What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_txn_root ($txn) {} - -/** - * (PECL svn >= 0.2.0)
- * Creates a new empty file, returns true if all is ok, false otherwise - * @link http://php.net/manual/en/function.svn-fs-make-file.php - * @param resource $root

- * Its description - *

- * @param string $path

- * Its description - *

- * @return bool What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_make_file ($root, $path) {} - -/** - * (PECL svn >= 0.2.0)
- * Creates a new empty directory, returns true if all is ok, false otherwise - * @link http://php.net/manual/en/function.svn-fs-make-dir.php - * @param resource $root

- * Its description - *

- * @param string $path

- * Its description - *

- * @return bool What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_make_dir ($root, $path) {} - -/** - * (PECL svn >= 0.2.0)
- * Creates and returns a stream that will be used to replace - * @link http://php.net/manual/en/function.svn-fs-apply-text.php - * @param resource $root

- * Its description - *

- * @param string $path

- * Its description - *

- * @return resource What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_apply_text ($root, $path) {} - -/** - * (PECL svn >= 0.2.0)
- * Copies a file or a directory, returns true if all is ok, false otherwise - * @link http://php.net/manual/en/function.svn-fs-copy.php - * @param resource $from_root

- * Its description - *

- * @param string $from_path

- * Its description - *

- * @param resource $to_root

- * Its description - *

- * @param string $to_path

- * Its description - *

- * @return bool What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_copy ($from_root, $from_path, $to_root, $to_path) {} - -/** - * (PECL svn >= 0.2.0)
- * Deletes a file or a directory, return true if all is ok, false otherwise - * @link http://php.net/manual/en/function.svn-fs-delete.php - * @param resource $root

- * Its description - *

- * @param string $path

- * Its description - *

- * @return bool What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_delete ($root, $path) {} - -/** - * (PECL svn >= 0.2.0)
- * Create a new transaction - * @link http://php.net/manual/en/function.svn-fs-begin-txn2.php - * @param resource $repos

- * Its description - *

- * @param int $rev

- * Its description - *

- * @return resource What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_begin_txn2 ($repos, $rev) {} - -/** - * (PECL svn >= 0.2.0)
- * Return true if the path points to a directory, false otherwise - * @link http://php.net/manual/en/function.svn-fs-is-dir.php - * @param resource $root

- * Its description - *

- * @param string $path

- * Its description - *

- * @return bool What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_is_dir ($root, $path) {} - -/** - * (PECL svn >= 0.2.0)
- * Return true if the path points to a file, false otherwise - * @link http://php.net/manual/en/function.svn-fs-is-file.php - * @param resource $root

- * Its description - *

- * @param string $path

- * Its description - *

- * @return bool What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_is_file ($root, $path) {} - -/** - * (PECL svn >= 0.1.0)
- * Returns the value of a property for a node - * @link http://php.net/manual/en/function.svn-fs-node-prop.php - * @param resource $fsroot

- * Its description - *

- * @param string $path

- * Its description - *

- * @param string $propname

- * Its description - *

- * @return string What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_node_prop ($fsroot, $path, $propname) {} - -/** - * (PECL svn >= 0.2.0)
- * Return true if everything is ok, false otherwise - * @link http://php.net/manual/en/function.svn-fs-change-node-prop.php - * @param resource $root

- * Its description - *

- * @param string $path

- * Its description - *

- * @param string $name

- * Its description - *

- * @param string $value

- * Its description - *

- * @return bool What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_change_node_prop ($root, $path, $name, $value) {} - -/** - * (PECL svn >= 0.2.0)
- * Return true if content is different, false otherwise - * @link http://php.net/manual/en/function.svn-fs-contents-changed.php - * @param resource $root1

- * Its description - *

- * @param string $path1

- * Its description - *

- * @param resource $root2

- * Its description - *

- * @param string $path2

- * Its description - *

- * @return bool What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_contents_changed ($root1, $path1, $root2, $path2) {} - -/** - * (PECL svn >= 0.2.0)
- * Return true if props are different, false otherwise - * @link http://php.net/manual/en/function.svn-fs-props-changed.php - * @param resource $root1

- * Its description - *

- * @param string $path1

- * Its description - *

- * @param resource $root2

- * Its description - *

- * @param string $path2

- * Its description - *

- * @return bool What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_props_changed ($root1, $path1, $root2, $path2) {} - -/** - * (PECL svn >= 0.2.0)
- * Abort a transaction, returns true if everything is okay, false otherwise - * @link http://php.net/manual/en/function.svn-fs-abort-txn.php - * @param resource $txn

- * Its description - *

- * @return bool What the function returns, first on success, then on failure. See - * also the &#38;return.success; entity - */ -function svn_fs_abort_txn ($txn) {} - - -/** - * Property for default username to use when performing basic authentication - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_AUTH_PARAM_DEFAULT_USERNAME', "svn:auth:username"); - -/** - * Property for default password to use when performing basic authentication - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_AUTH_PARAM_DEFAULT_PASSWORD', "svn:auth:password"); -define ('SVN_AUTH_PARAM_NON_INTERACTIVE', "svn:auth:non-interactive"); -define ('SVN_AUTH_PARAM_DONT_STORE_PASSWORDS', "svn:auth:dont-store-passwords"); -define ('SVN_AUTH_PARAM_NO_AUTH_CACHE', "svn:auth:no-auth-cache"); -define ('SVN_AUTH_PARAM_SSL_SERVER_FAILURES', "svn:auth:ssl:failures"); -define ('SVN_AUTH_PARAM_SSL_SERVER_CERT_INFO', "svn:auth:ssl:cert-info"); -define ('SVN_AUTH_PARAM_CONFIG', "svn:auth:config-category-servers"); -define ('SVN_AUTH_PARAM_SERVER_GROUP', "svn:auth:server-group"); -define ('SVN_AUTH_PARAM_CONFIG_DIR', "svn:auth:config-dir"); - -/** - * Custom property for ignoring SSL cert verification errors - * @link http://php.net/manual/en/svn.constants.php - */ -define ('PHP_SVN_AUTH_PARAM_IGNORE_SSL_VERIFY_ERRORS', "php:svn:auth:ignore-ssl-verify-errors"); - -/** - * Configuration key that determines filesystem type - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_FS_CONFIG_FS_TYPE', "fs-type"); - -/** - * Filesystem is Berkeley-DB implementation - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_FS_TYPE_BDB', "bdb"); - -/** - * Filesystem is native-filesystem implementation - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_FS_TYPE_FSFS', "fsfs"); - -/** - * svn:date - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_PROP_REVISION_DATE', "svn:date"); - -/** - * svn:original-date - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_PROP_REVISION_ORIG_DATE', "svn:original-date"); - -/** - * svn:author - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_PROP_REVISION_AUTHOR', "svn:author"); - -/** - * svn:log - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_PROP_REVISION_LOG', "svn:log"); -define ('SVN_REVISION_INITIAL', 1); - -/** - * Magic number (-1) specifying the HEAD revision - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_REVISION_HEAD', -1); -define ('SVN_REVISION_BASE', -2); -define ('SVN_REVISION_COMMITTED', -3); -define ('SVN_REVISION_PREV', -4); -define ('SVN_REVISION_UNSPECIFIED', -5); -define ('SVN_NON_RECURSIVE', 1); -define ('SVN_DISCOVER_CHANGED_PATHS', 2); -define ('SVN_OMIT_MESSAGES', 4); -define ('SVN_STOP_ON_COPY', 8); -define ('SVN_ALL', 16); -define ('SVN_SHOW_UPDATES', 32); -define ('SVN_NO_IGNORE', 64); - -/** - * Status does not exist - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_WC_STATUS_NONE', 1); - -/** - * Item is not versioned in working copy - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_WC_STATUS_UNVERSIONED', 2); - -/** - * Item exists, nothing else is happening - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_WC_STATUS_NORMAL', 3); - -/** - * Item is scheduled for addition - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_WC_STATUS_ADDED', 4); - -/** - * Item is versioned but missing from the working copy - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_WC_STATUS_MISSING', 5); - -/** - * Item is scheduled for deletion - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_WC_STATUS_DELETED', 6); - -/** - * Item was deleted and then re-added - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_WC_STATUS_REPLACED', 7); - -/** - * Item (text or properties) was modified - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_WC_STATUS_MODIFIED', 8); - -/** - * Item's local modifications were merged with repository modifications - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_WC_STATUS_MERGED', 9); - -/** - * Item's local modifications conflicted with repository modifications - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_WC_STATUS_CONFLICTED', 10); - -/** - * Item is unversioned but configured to be ignored - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_WC_STATUS_IGNORED', 11); - -/** - * Unversioned item is in the way of a versioned resource - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_WC_STATUS_OBSTRUCTED', 12); - -/** - * Unversioned path that is populated using svn:externals - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_WC_STATUS_EXTERNAL', 13); - -/** - * Directory does not contain complete entries list - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_WC_STATUS_INCOMPLETE', 14); - -/** - * Absent - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_NODE_NONE', 0); - -/** - * File - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_NODE_FILE', 1); - -/** - * Directory - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_NODE_DIR', 2); - -/** - * Something Subversion cannot identify - * @link http://php.net/manual/en/svn.constants.php - */ -define ('SVN_NODE_UNKNOWN', 3); -define ('SVN_WC_SCHEDULE_NORMAL', 0); -define ('SVN_WC_SCHEDULE_ADD', 1); -define ('SVN_WC_SCHEDULE_DELETE', 2); -define ('SVN_WC_SCHEDULE_REPLACE', 3); - -// End of svn v.1.0.1 -?> diff --git a/phpruntime/sysvmsg.php b/phpruntime/sysvmsg.php deleted file mode 100644 index e441045..0000000 --- a/phpruntime/sysvmsg.php +++ /dev/null @@ -1,268 +0,0 @@ - - * Create or attach to a message queue - * @link http://php.net/manual/en/function.msg-get-queue.php - * @param int $key

- * Message queue numeric ID - *

- * @param int $perms [optional]

- * Queue permissions. Default to 0666. If the message queue already - * exists, the perms will be ignored. - *

- * @return resource a resource handle that can be used to access the System V message queue. - */ -function msg_get_queue ($key, $perms = 0666) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Send a message to a message queue - * @link http://php.net/manual/en/function.msg-send.php - * @param resource $queue - * @param int $msgtype - * @param mixed $message - * @param bool $serialize [optional]

- * The optional serialize controls how the - * message is sent. serialize - * defaults to TRUE which means that the message is - * serialized using the same mechanism as the session module before being - * sent to the queue. This allows complex arrays and objects to be sent to - * other PHP scripts, or if you are using the WDDX serializer, to any WDDX - * compatible client. - *

- * @param bool $blocking [optional]

- * If the message is too large to fit in the queue, your script will wait - * until another process reads messages from the queue and frees enough - * space for your message to be sent. - * This is called blocking; you can prevent blocking by setting the - * optional blocking parameter to FALSE, in which - * case msg_send will immediately return FALSE if the - * message is too big for the queue, and set the optional - * errorcode to MSG_EAGAIN, - * indicating that you should try to send your message again a little - * later on. - *

- * @param int $errorcode [optional] - * @return bool TRUE on success or FALSE on failure. - *

- *

- * Upon successful completion the message queue data structure is updated as - * follows: msg_lspid is set to the process-ID of the - * calling process, msg_qnum is incremented by 1 and - * msg_stime is set to the current time. - */ -function msg_send ($queue, $msgtype, $message, $serialize = true, $blocking = true, &$errorcode = null) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Receive a message from a message queue - * @link http://php.net/manual/en/function.msg-receive.php - * @param resource $queue - * @param int $desiredmsgtype

- * If desiredmsgtype is 0, the message from the front - * of the queue is returned. If desiredmsgtype is - * greater than 0, then the first message of that type is returned. - * If desiredmsgtype is less than 0, the first - * message on the queue with the lowest type less than or equal to the - * absolute value of desiredmsgtype will be read. - * If no messages match the criteria, your script will wait until a suitable - * message arrives on the queue. You can prevent the script from blocking - * by specifying MSG_IPC_NOWAIT in the - * flags parameter. - *

- * @param int $msgtype

- * The type of the message that was received will be stored in this - * parameter. - *

- * @param int $maxsize

- * The maximum size of message to be accepted is specified by the - * maxsize; if the message in the queue is larger - * than this size the function will fail (unless you set - * flags as described below). - *

- * @param mixed $message

- * The received message will be stored in message, - * unless there were errors receiving the message. - *

- * @param bool $unserialize [optional]

- * If set to - * TRUE, the message is treated as though it was serialized using the - * same mechanism as the session module. The message will be unserialized - * and then returned to your script. This allows you to easily receive - * arrays or complex object structures from other PHP scripts, or if you - * are using the WDDX serializer, from any WDDX compatible source. - *

- *

- * If unserialize is FALSE, the message will be - * returned as a binary-safe string. - *

- * @param int $flags [optional]

- * The optional flags allows you to pass flags to the - * low-level msgrcv system call. It defaults to 0, but you may specify one - * or more of the following values (by adding or ORing them together). - * - * Flag values for msg_receive - * - * - * - * - * - * - * - * - * - * - * - * - *
MSG_IPC_NOWAITIf there are no messages of the - * desiredmsgtype, return immediately and do not - * wait. The function will fail and return an integer value - * corresponding to MSG_ENOMSG. - *
MSG_EXCEPTUsing this flag in combination with a - * desiredmsgtype greater than 0 will cause the - * function to receive the first message that is not equal to - * desiredmsgtype.
MSG_NOERROR - * If the message is longer than maxsize, - * setting this flag will truncate the message to - * maxsize and will not signal an error. - *
- *

- * @param int $errorcode [optional]

- * If the function fails, the optional errorcode - * will be set to the value of the system errno variable. - *

- * @return bool TRUE on success or FALSE on failure. - *

- *

- * Upon successful completion the message queue data structure is updated as - * follows: msg_lrpid is set to the process-ID of the - * calling process, msg_qnum is decremented by 1 and - * msg_rtime is set to the current time. - */ -function msg_receive ($queue, $desiredmsgtype, &$msgtype, $maxsize, &$message, $unserialize = true, $flags = 0, &$errorcode = null) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Destroy a message queue - * @link http://php.net/manual/en/function.msg-remove-queue.php - * @param resource $queue

- * Message queue resource handle - *

- * @return bool TRUE on success or FALSE on failure. - */ -function msg_remove_queue ($queue) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Returns information from the message queue data structure - * @link http://php.net/manual/en/function.msg-stat-queue.php - * @param resource $queue

- * Message queue resource handle - *

- * @return array The return value is an array whose keys and values have the following - * meanings: - * - * Array structure for msg_stat_queue - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
msg_perm.uid - * The uid of the owner of the queue. - *
msg_perm.gid - * The gid of the owner of the queue. - *
msg_perm.mode - * The file access mode of the queue. - *
msg_stime - * The time that the last message was sent to the queue. - *
msg_rtime - * The time that the last message was received from the queue. - *
msg_ctime - * The time that the queue was last changed. - *
msg_qnum - * The number of messages waiting to be read from the queue. - *
msg_qbytes - * The maximum number of bytes allowed in one message queue. On - * Linux, this value may be read and modified via - * /proc/sys/kernel/msgmnb. - *
msg_lspid - * The pid of the process that sent the last message to the queue. - *
msg_lrpid - * The pid of the process that received the last message from the queue. - *
- */ -function msg_stat_queue ($queue) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Set information in the message queue data structure - * @link http://php.net/manual/en/function.msg-set-queue.php - * @param resource $queue

- * Message queue resource handle - *

- * @param array $data

- * You specify the values you require by setting the value of the keys - * that you require in the data array. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function msg_set_queue ($queue, array $data) {} - -/** - * (PHP 5 >= 5.3.0)
- * Check whether a message queue exists - * @link http://php.net/manual/en/function.msg-queue-exists.php - * @param int $key

- * Queue key. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function msg_queue_exists ($key) {} - -define ('MSG_IPC_NOWAIT', 1); -define ('MSG_EAGAIN', 11); -define ('MSG_ENOMSG', 42); -define ('MSG_NOERROR', 2); -define ('MSG_EXCEPT', 4); - -// End of sysvmsg v. -?> diff --git a/phpruntime/sysvsem.php b/phpruntime/sysvsem.php deleted file mode 100644 index 85dcc48..0000000 --- a/phpruntime/sysvsem.php +++ /dev/null @@ -1,65 +0,0 @@ - - * Get a semaphore id - * @link http://php.net/manual/en/function.sem-get.php - * @param int $key - * @param int $max_acquire [optional]

- * The number of processes that can acquire the semaphore simultaneously - * is set to max_acquire. - *

- * @param int $perm [optional]

- * The semaphore permissions. Actually this value is - * set only if the process finds it is the only process currently - * attached to the semaphore. - *

- * @param int $auto_release [optional]

- * Specifies if the semaphore should be automatically released on request - * shutdown. - *

- * @return resource a positive semaphore identifier on success, or FALSE on - * error. - */ -function sem_get ($key, $max_acquire = 1, $perm = 0666, $auto_release = 1) {} - -/** - * (PHP 4, PHP 5)
- * Acquire a semaphore - * @link http://php.net/manual/en/function.sem-acquire.php - * @param resource $sem_identifier

- * sem_identifier is a semaphore resource, - * obtained from sem_get. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function sem_acquire ($sem_identifier) {} - -/** - * (PHP 4, PHP 5)
- * Release a semaphore - * @link http://php.net/manual/en/function.sem-release.php - * @param resource $sem_identifier

- * A Semaphore resource handle as returned by - * sem_get. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function sem_release ($sem_identifier) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Remove a semaphore - * @link http://php.net/manual/en/function.sem-remove.php - * @param resource $sem_identifier

- * A semaphore resource identifier as returned - * by sem_get. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function sem_remove ($sem_identifier) {} - -// End of sysvsem v. -?> diff --git a/phpruntime/sysvshm.php b/phpruntime/sysvshm.php deleted file mode 100644 index 4367fed..0000000 --- a/phpruntime/sysvshm.php +++ /dev/null @@ -1,113 +0,0 @@ - - * Creates or open a shared memory segment - * @link http://php.net/manual/en/function.shm-attach.php - * @param int $key

- * A numeric shared memory segment ID - *

- * @param int $memsize [optional]

- * The memory size. If not provided, default to the - * sysvshm.init_mem in the php.ini, otherwise 10000 - * bytes. - *

- * @param int $perm [optional]

- * The optional permission bits. Default to 0666. - *

- * @return resource a shared memory segment identifier. - */ -function shm_attach ($key, $memsize = null, $perm = 0666) {} - -/** - * (PHP 4, PHP 5)
- * Removes shared memory from Unix systems - * @link http://php.net/manual/en/function.shm-remove.php - * @param resource $shm_identifier

- * The shared memory identifier as returned by - * shm_attach - *

- * @return bool TRUE on success or FALSE on failure. - */ -function shm_remove ($shm_identifier) {} - -/** - * (PHP 4, PHP 5)
- * Disconnects from shared memory segment - * @link http://php.net/manual/en/function.shm-detach.php - * @param resource $shm_identifier

- * A shared memory resource handle as returned by - * shm_attach - *

- * @return bool shm_detach always returns TRUE. - */ -function shm_detach ($shm_identifier) {} - -/** - * (PHP 4, PHP 5)
- * Inserts or updates a variable in shared memory - * @link http://php.net/manual/en/function.shm-put-var.php - * @param resource $shm_identifier

- * A shared memory resource handle as returned by - * shm_attach - *

- * @param int $variable_key

- * The variable key. - *

- * @param mixed $variable

- * The variable. All variable types - * that serialize supports may be used: generally - * this means all types except for resources and some internal objects - * that cannot be serialized. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function shm_put_var ($shm_identifier, $variable_key, $variable) {} - -/** - * (PHP 5 >= 5.3.0)
- * Check whether a specific entry exists - * @link http://php.net/manual/en/function.shm-has-var.php - * @param resource $shm_identifier

- * Shared memory segment, obtained from shm_attach. - *

- * @param int $variable_key

- * The variable key. - *

- * @return bool TRUE if the entry exists, otherwise FALSE - */ -function shm_has_var ($shm_identifier, $variable_key) {} - -/** - * (PHP 4, PHP 5)
- * Returns a variable from shared memory - * @link http://php.net/manual/en/function.shm-get-var.php - * @param resource $shm_identifier

- * Shared memory segment, obtained from shm_attach. - *

- * @param int $variable_key

- * The variable key. - *

- * @return mixed the variable with the given key. - */ -function shm_get_var ($shm_identifier, $variable_key) {} - -/** - * (PHP 4, PHP 5)
- * Removes a variable from shared memory - * @link http://php.net/manual/en/function.shm-remove-var.php - * @param resource $shm_identifier

- * The shared memory identifier as returned by - * shm_attach - *

- * @param int $variable_key

- * The variable key. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function shm_remove_var ($shm_identifier, $variable_key) {} - -// End of sysvshm v. -?> diff --git a/phpruntime/tidy.php b/phpruntime/tidy.php deleted file mode 100644 index 47c0273..0000000 --- a/phpruntime/tidy.php +++ /dev/null @@ -1,735 +0,0 @@ - - * Returns the value of the specified configuration option for the tidy document - * @link http://php.net/manual/en/tidy.getopt.php - * @param string $option

- * You will find a list with each configuration option and their types - * at: http://tidy.sourceforge.net/docs/quickref.html. - *

- * @return mixed the value of the specified option. - * The return type depends on the type of the specified one. - */ - public function getOpt ($option) {} - - /** - * (PHP 5, PECL tidy >= 0.5.2)
- * Execute configured cleanup and repair operations on parsed markup - * @link http://php.net/manual/en/tidy.cleanrepair.php - * @return bool TRUE on success or FALSE on failure. - */ - public function cleanRepair () {} - - /** - * (PHP 5, PECL tidy >= 0.5.2)
- * Parse markup in file or URI - * @link http://php.net/manual/en/tidy.parsefile.php - * @param string $filename

- * If the filename parameter is given, this function - * will also read that file and initialize the object with the file, - * acting like tidy_parse_file. - *

- * @param mixed $config [optional]

- * The config config can be passed either as an - * array or as a string. If a string is passed, it is interpreted as the - * name of the configuration file, otherwise, it is interpreted as the - * options themselves. - *

- *

- * For an explanation about each option, see - * http://tidy.sourceforge.net/docs/quickref.html. - *

- * @param string $encoding [optional]

- * The encoding parameter sets the encoding for - * input/output documents. The possible values for encoding are: - * ascii, latin0, latin1, - * raw, utf8, iso2022, - * mac, win1252, ibm858, - * utf16, utf16le, utf16be, - * big5, and shiftjis. - *

- * @param bool $use_include_path [optional]

- * Search for the file in the include_path. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function parseFile ($filename, $config = null, $encoding = null, $use_include_path = false) {} - - /** - * (PHP 5, PECL tidy >= 0.5.2)
- * Parse a document stored in a string - * @link http://php.net/manual/en/tidy.parsestring.php - * @param string $input

- * The data to be parsed. - *

- * @param mixed $config [optional]

- * The config config can be passed either as an - * array or as a string. If a string is passed, it is interpreted as the - * name of the configuration file, otherwise, it is interpreted as the - * options themselves. - *

- *

- * For an explanation about each option, visit http://tidy.sourceforge.net/docs/quickref.html. - *

- * @param string $encoding [optional]

- * The encoding parameter sets the encoding for - * input/output documents. The possible values for encoding are: - * ascii, latin0, latin1, - * raw, utf8, iso2022, - * mac, win1252, ibm858, - * utf16, utf16le, utf16be, - * big5, and shiftjis. - *

- * @return bool a new tidy instance. - */ - public function parseString ($input, $config = null, $encoding = null) {} - - /** - * (PHP 5, PECL tidy >= 0.7.0)
- * Repair a string using an optionally provided configuration file - * @link http://php.net/manual/en/tidy.repairstring.php - * @param string $data

- * The data to be repaired. - *

- * @param mixed $config [optional]

- * The config config can be passed either as an - * array or as a string. If a string is passed, it is interpreted as the - * name of the configuration file, otherwise, it is interpreted as the - * options themselves. - *

- *

- * Check http://tidy.sourceforge.net/docs/quickref.html for - * an explanation about each option. - *

- * @param string $encoding [optional]

- * The encoding parameter sets the encoding for - * input/output documents. The possible values for encoding are: - * ascii, latin0, latin1, - * raw, utf8, iso2022, - * mac, win1252, ibm858, - * utf16, utf16le, utf16be, - * big5, and shiftjis. - *

- * @return string the repaired string. - */ - public function repairString ($data, $config = null, $encoding = null) {} - - /** - * (PHP 5, PECL tidy >= 0.7.0)
- * Repair a file and return it as a string - * @link http://php.net/manual/en/tidy.repairfile.php - * @param string $filename

- * The file to be repaired. - *

- * @param mixed $config [optional]

- * The config config can be passed either as an - * array or as a string. If a string is passed, it is interpreted as the - * name of the configuration file, otherwise, it is interpreted as the - * options themselves. - *

- *

- * Check http://tidy.sourceforge.net/docs/quickref.html for an - * explanation about each option. - *

- * @param string $encoding [optional]

- * The encoding parameter sets the encoding for - * input/output documents. The possible values for encoding are: - * ascii, latin0, latin1, - * raw, utf8, iso2022, - * mac, win1252, ibm858, - * utf16, utf16le, utf16be, - * big5, and shiftjis. - *

- * @param bool $use_include_path [optional]

- * Search for the file in the include_path. - *

- * @return string the repaired contents as a string. - */ - public function repairFile ($filename, $config = null, $encoding = null, $use_include_path = false) {} - - /** - * (PHP 5, PECL tidy >= 0.5.2)
- * Run configured diagnostics on parsed and repaired markup - * @link http://php.net/manual/en/tidy.diagnose.php - * @return bool TRUE on success or FALSE on failure. - */ - public function diagnose () {} - - /** - * (PHP 5, PECL tidy >= 0.5.2)
- * Get release date (version) for Tidy library - * @link http://php.net/manual/en/tidy.getrelease.php - * @return string a string with the release date of the Tidy library. - */ - public function getRelease () {} - - /** - * (PHP 5, PECL tidy >= 0.7.0)
- * Get current Tidy configuration - * @link http://php.net/manual/en/tidy.getconfig.php - * @return array an array of configuration options. - *

- *

- * For an explanation about each option, visit http://tidy.sourceforge.net/docs/quickref.html. - */ - public function getConfig () {} - - /** - * (PHP 5, PECL tidy >= 0.5.2)
- * Get status of specified document - * @link http://php.net/manual/en/tidy.getstatus.php - * @return int 0 if no error/warning was raised, 1 for warnings or accessibility - * errors, or 2 for errors. - */ - public function getStatus () {} - - /** - * (PHP 5, PECL tidy >= 0.5.2)
- * Get the Detected HTML version for the specified document - * @link http://php.net/manual/en/tidy.gethtmlver.php - * @return int the detected HTML version. - *

- *

- * This function is not yet implemented in the Tidylib itself, so it always - * return 0. - */ - public function getHtmlVer () {} - - /** - * (PHP 5 >= 5.1.0)
- * Returns the documentation for the given option name - * @link http://php.net/manual/en/tidy.getoptdoc.php - * @param string $optname

- * The option name - *

- * @return string a string if the option exists and has documentation available, or - * FALSE otherwise. - */ - public function getOptDoc ($optname) {} - - /** - * (PHP 5, PECL tidy >= 0.5.2)
- * Indicates if the document is a XHTML document - * @link http://php.net/manual/en/tidy.isxhtml.php - * @return bool This function returns TRUE if the specified tidy - * object is a XHTML document, or FALSE otherwise. - *

- *

- * This function is not yet implemented in the Tidylib itself, so it always - * return FALSE. - */ - public function isXhtml () {} - - /** - * (PHP 5, PECL tidy >= 0.5.2)
- * Indicates if the document is a generic (non HTML/XHTML) XML document - * @link http://php.net/manual/en/tidy.isxml.php - * @return bool This function returns TRUE if the specified tidy - * object is a generic XML document (non HTML/XHTML), - * or FALSE otherwise. - *

- *

- * This function is not yet implemented in the Tidylib itself, so it always - * return FALSE. - */ - public function isXml () {} - - /** - * (PHP 5, PECL tidy 0.5.2-1.0.0)
- * Returns a tidyNode object representing the root of the tidy parse tree - * @link http://php.net/manual/en/tidy.root.php - * @return tidyNode the tidyNode object. - */ - public function root () {} - - /** - * (PHP 5, PECL tidy 0.5.2-1.0.0)
- * Returns a tidyNode object starting from the <head> tag of the tidy parse tree - * @link http://php.net/manual/en/tidy.head.php - * @return tidyNode the tidyNode object. - */ - public function head () {} - - /** - * (PHP 5, PECL tidy 0.5.2-1.0.0)
- * Returns a tidyNode object starting from the <html> tag of the tidy parse tree - * @link http://php.net/manual/en/tidy.html.php - * @return tidyNode the tidyNode object. - */ - public function html () {} - - /** - * (PHP 5, PECL tidy 0.5.2-1.0)
- * Returns a tidyNode object starting from the <body> tag of the tidy parse tree - * @link http://php.net/manual/en/tidy.body.php - * @return tidyNode the detected HTML version. - *

- *

- * This function is not yet implemented in the Tidylib itself, so it always - * return 0. - */ - public function body () {} - - /** - * (PHP 5, PECL tidy >= 0.5.2)
- * Constructs a new tidy object - * @link http://php.net/manual/en/tidy.construct.php - * @param string $filename [optional]

- * If the filename parameter is given, this function - * will also read that file and initialize the object with the file, - * acting like tidy_parse_file. - *

- * @param mixed $config [optional]

- * The config config can be passed either as an - * array or as a string. If a string is passed, it is interpreted as the - * name of the configuration file, otherwise, it is interpreted as the - * options themselves. - *

- *

- * For an explanation about each option, visit http://tidy.sourceforge.net/docs/quickref.html. - *

- * @param string $encoding [optional]

- * The encoding parameter sets the encoding for - * input/output documents. The possible values for encoding are: - * ascii, latin0, latin1, - * raw, utf8, iso2022, - * mac, win1252, ibm858, - * utf16, utf16le, utf16be, - * big5, and shiftjis. - *

- * @param bool $use_include_path [optional]

- * Search for the file in the include_path. - *

- */ - public function __construct ($filename = null, $config = null, $encoding = null, $use_include_path = null) {} - -} - -/** - * An HTML node in an HTML file, as detected by tidy. - * @link http://php.net/manual/en/class.tidynode.php - */ -final class tidyNode { - - /** - * (PHP 5 >= 5.0.1)
- * Checks if a node has children - * @link http://php.net/manual/en/tidynode.haschildren.php - * @return bool TRUE if the node has children, FALSE otherwise. - */ - public function hasChildren () {} - - /** - * (PHP 5 >= 5.0.1)
- * Checks if a node has siblings - * @link http://php.net/manual/en/tidynode.hassiblings.php - * @return bool TRUE if the node has siblings, FALSE otherwise. - */ - public function hasSiblings () {} - - /** - * (PHP 5 >= 5.0.1)
- * Checks if a node represents a comment - * @link http://php.net/manual/en/tidynode.iscomment.php - * @return bool TRUE if the node is a comment, FALSE otherwise. - */ - public function isComment () {} - - /** - * (PHP 5 >= 5.0.1)
- * Checks if a node is part of a HTML document - * @link http://php.net/manual/en/tidynode.ishtml.php - * @return bool TRUE if the node is part of a HTML document, FALSE otherwise. - */ - public function isHtml () {} - - /** - * (PHP 5 >= 5.0.1)
- * Checks if a node represents text (no markup) - * @link http://php.net/manual/en/tidynode.istext.php - * @return bool TRUE if the node represent a text, FALSE otherwise. - */ - public function isText () {} - - /** - * (PHP 5 >= 5.0.1)
- * Checks if this node is JSTE - * @link http://php.net/manual/en/tidynode.isjste.php - * @return bool TRUE if the node is JSTE, FALSE otherwise. - */ - public function isJste () {} - - /** - * (PHP 5 >= 5.0.1)
- * Checks if this node is ASP - * @link http://php.net/manual/en/tidynode.isasp.php - * @return bool TRUE if the node is ASP, FALSE otherwise. - */ - public function isAsp () {} - - /** - * (PHP 5 >= 5.0.1)
- * Checks if a node is PHP - * @link http://php.net/manual/en/tidynode.isphp.php - * @return bool TRUE if the current node is PHP code, FALSE otherwise. - */ - public function isPhp () {} - - /** - * (PHP 5 >= 5.2.2)
- * Returns the parent node of the current node - * @link http://php.net/manual/en/tidynode.getparent.php - * @return tidyNode a tidyNode if the node has a parent, or NULL - * otherwise. - */ - public function getParent () {} - - private function __construct () {} - -} - -/** - * @param $option - */ -function tidy_getopt ($option) {} - -/** - * @param $input - * @param $config_options [optional] - * @param $encoding [optional] - */ -function tidy_parse_string ($input, $config_options, $encoding) {} - -/** - * @param $file - * @param $config_options [optional] - * @param $encoding [optional] - * @param $use_include_path [optional] - */ -function tidy_parse_file ($file, $config_options, $encoding, $use_include_path) {} - -/** - * (PHP 5, PECL tidy >= 0.5.2)
- * Return a string representing the parsed tidy markup - * @link http://php.net/manual/en/function.tidy-get-output.php - * @param tidy $object

- * The Tidy object. - *

- * @return string the parsed tidy markup. - */ -function tidy_get_output (tidy $object) {} - -function tidy_get_error_buffer () {} - -function tidy_clean_repair () {} - -/** - * @param $data - * @param $config_file [optional] - * @param $encoding [optional] - */ -function tidy_repair_string ($data, $config_file, $encoding) {} - -/** - * @param $filename - * @param $config_file [optional] - * @param $encoding [optional] - * @param $use_include_path [optional] - */ -function tidy_repair_file ($filename, $config_file, $encoding, $use_include_path) {} - -function tidy_diagnose () {} - -function tidy_get_release () {} - -function tidy_get_config () {} - -function tidy_get_status () {} - -function tidy_get_html_ver () {} - -function tidy_is_xhtml () {} - -function tidy_is_xml () {} - -/** - * (PHP 5, PECL tidy >= 0.5.2)
- * Returns the Number of Tidy errors encountered for specified document - * @link http://php.net/manual/en/function.tidy-error-count.php - * @param tidy $object

- * The Tidy object. - *

- * @return int the number of errors. - */ -function tidy_error_count (tidy $object) {} - -/** - * (PHP 5, PECL tidy >= 0.5.2)
- * Returns the Number of Tidy warnings encountered for specified document - * @link http://php.net/manual/en/function.tidy-warning-count.php - * @param tidy $object

- * The Tidy object. - *

- * @return int the number of warnings. - */ -function tidy_warning_count (tidy $object) {} - -/** - * (PHP 5, PECL tidy >= 0.5.2)
- * Returns the Number of Tidy accessibility warnings encountered for specified document - * @link http://php.net/manual/en/function.tidy-access-count.php - * @param tidy $object

- * The Tidy object. - *

- * @return int the number of warnings. - */ -function tidy_access_count (tidy $object) {} - -/** - * (PHP 5, PECL tidy >= 0.5.2)
- * Returns the Number of Tidy configuration errors encountered for specified document - * @link http://php.net/manual/en/function.tidy-config-count.php - * @param tidy $object

- * The Tidy object. - *

- * @return int the number of errors. - */ -function tidy_config_count (tidy $object) {} - -/** - * @param $resource - * @param $optname - */ -function tidy_get_opt_doc ($resource, $optname) {} - -function tidy_get_root () {} - -function tidy_get_head () {} - -function tidy_get_html () {} - -/** - * @param $tidy - */ -function tidy_get_body ($tidy) {} - - -/** - * description - * @link http://php.net/manual/en/tidy.constants.php - */ -define ('TIDY_TAG_UNKNOWN', 0); -define ('TIDY_TAG_A', 1); -define ('TIDY_TAG_ABBR', 2); -define ('TIDY_TAG_ACRONYM', 3); -define ('TIDY_TAG_ADDRESS', 4); -define ('TIDY_TAG_ALIGN', 5); -define ('TIDY_TAG_APPLET', 6); -define ('TIDY_TAG_AREA', 7); -define ('TIDY_TAG_B', 8); -define ('TIDY_TAG_BASE', 9); -define ('TIDY_TAG_BASEFONT', 10); -define ('TIDY_TAG_BDO', 11); -define ('TIDY_TAG_BGSOUND', 12); -define ('TIDY_TAG_BIG', 13); -define ('TIDY_TAG_BLINK', 14); -define ('TIDY_TAG_BLOCKQUOTE', 15); -define ('TIDY_TAG_BODY', 16); -define ('TIDY_TAG_BR', 17); -define ('TIDY_TAG_BUTTON', 18); -define ('TIDY_TAG_CAPTION', 19); -define ('TIDY_TAG_CENTER', 20); -define ('TIDY_TAG_CITE', 21); -define ('TIDY_TAG_CODE', 22); -define ('TIDY_TAG_COL', 23); -define ('TIDY_TAG_COLGROUP', 24); -define ('TIDY_TAG_COMMENT', 25); -define ('TIDY_TAG_DD', 26); -define ('TIDY_TAG_DEL', 27); -define ('TIDY_TAG_DFN', 28); -define ('TIDY_TAG_DIR', 29); -define ('TIDY_TAG_DIV', 30); -define ('TIDY_TAG_DL', 31); -define ('TIDY_TAG_DT', 32); -define ('TIDY_TAG_EM', 33); -define ('TIDY_TAG_EMBED', 34); -define ('TIDY_TAG_FIELDSET', 35); -define ('TIDY_TAG_FONT', 36); -define ('TIDY_TAG_FORM', 37); -define ('TIDY_TAG_FRAME', 38); -define ('TIDY_TAG_FRAMESET', 39); -define ('TIDY_TAG_H1', 40); -define ('TIDY_TAG_H2', 41); -define ('TIDY_TAG_H3', 42); -define ('TIDY_TAG_H4', 43); -define ('TIDY_TAG_H5', 44); -define ('TIDY_TAG_H6', 45); -define ('TIDY_TAG_HEAD', 46); -define ('TIDY_TAG_HR', 47); -define ('TIDY_TAG_HTML', 48); -define ('TIDY_TAG_I', 49); -define ('TIDY_TAG_IFRAME', 50); -define ('TIDY_TAG_ILAYER', 51); -define ('TIDY_TAG_IMG', 52); -define ('TIDY_TAG_INPUT', 53); -define ('TIDY_TAG_INS', 54); -define ('TIDY_TAG_ISINDEX', 55); -define ('TIDY_TAG_KBD', 56); -define ('TIDY_TAG_KEYGEN', 57); -define ('TIDY_TAG_LABEL', 58); -define ('TIDY_TAG_LAYER', 59); -define ('TIDY_TAG_LEGEND', 60); -define ('TIDY_TAG_LI', 61); -define ('TIDY_TAG_LINK', 62); -define ('TIDY_TAG_LISTING', 63); -define ('TIDY_TAG_MAP', 64); -define ('TIDY_TAG_MARQUEE', 65); -define ('TIDY_TAG_MENU', 66); -define ('TIDY_TAG_META', 67); -define ('TIDY_TAG_MULTICOL', 68); -define ('TIDY_TAG_NOBR', 69); -define ('TIDY_TAG_NOEMBED', 70); -define ('TIDY_TAG_NOFRAMES', 71); -define ('TIDY_TAG_NOLAYER', 72); -define ('TIDY_TAG_NOSAVE', 73); -define ('TIDY_TAG_NOSCRIPT', 74); -define ('TIDY_TAG_OBJECT', 75); -define ('TIDY_TAG_OL', 76); -define ('TIDY_TAG_OPTGROUP', 77); -define ('TIDY_TAG_OPTION', 78); -define ('TIDY_TAG_P', 79); -define ('TIDY_TAG_PARAM', 80); -define ('TIDY_TAG_PLAINTEXT', 81); -define ('TIDY_TAG_PRE', 82); -define ('TIDY_TAG_Q', 83); -define ('TIDY_TAG_RB', 84); -define ('TIDY_TAG_RBC', 85); -define ('TIDY_TAG_RP', 86); -define ('TIDY_TAG_RT', 87); -define ('TIDY_TAG_RTC', 88); -define ('TIDY_TAG_RUBY', 89); -define ('TIDY_TAG_S', 90); -define ('TIDY_TAG_SAMP', 91); -define ('TIDY_TAG_SCRIPT', 92); -define ('TIDY_TAG_SELECT', 93); -define ('TIDY_TAG_SERVER', 94); -define ('TIDY_TAG_SERVLET', 95); -define ('TIDY_TAG_SMALL', 96); -define ('TIDY_TAG_SPACER', 97); -define ('TIDY_TAG_SPAN', 98); -define ('TIDY_TAG_STRIKE', 99); -define ('TIDY_TAG_STRONG', 100); -define ('TIDY_TAG_STYLE', 101); -define ('TIDY_TAG_SUB', 102); -define ('TIDY_TAG_SUP', 103); -define ('TIDY_TAG_TABLE', 104); -define ('TIDY_TAG_TBODY', 105); -define ('TIDY_TAG_TD', 106); -define ('TIDY_TAG_TEXTAREA', 107); -define ('TIDY_TAG_TFOOT', 108); -define ('TIDY_TAG_TH', 109); -define ('TIDY_TAG_THEAD', 110); -define ('TIDY_TAG_TITLE', 111); -define ('TIDY_TAG_TR', 112); -define ('TIDY_TAG_TT', 113); -define ('TIDY_TAG_U', 114); -define ('TIDY_TAG_UL', 115); -define ('TIDY_TAG_VAR', 116); -define ('TIDY_TAG_WBR', 117); -define ('TIDY_TAG_XMP', 118); - -/** - * root node - * @link http://php.net/manual/en/tidy.constants.php - */ -define ('TIDY_NODETYPE_ROOT', 0); - -/** - * doctype - * @link http://php.net/manual/en/tidy.constants.php - */ -define ('TIDY_NODETYPE_DOCTYPE', 1); - -/** - * HTML comment - * @link http://php.net/manual/en/tidy.constants.php - */ -define ('TIDY_NODETYPE_COMMENT', 2); - -/** - * Processing Instruction - * @link http://php.net/manual/en/tidy.constants.php - */ -define ('TIDY_NODETYPE_PROCINS', 3); - -/** - * Text - * @link http://php.net/manual/en/tidy.constants.php - */ -define ('TIDY_NODETYPE_TEXT', 4); - -/** - * start tag - * @link http://php.net/manual/en/tidy.constants.php - */ -define ('TIDY_NODETYPE_START', 5); - -/** - * end tag - * @link http://php.net/manual/en/tidy.constants.php - */ -define ('TIDY_NODETYPE_END', 6); - -/** - * empty tag - * @link http://php.net/manual/en/tidy.constants.php - */ -define ('TIDY_NODETYPE_STARTEND', 7); - -/** - * CDATA - * @link http://php.net/manual/en/tidy.constants.php - */ -define ('TIDY_NODETYPE_CDATA', 8); - -/** - * XML section - * @link http://php.net/manual/en/tidy.constants.php - */ -define ('TIDY_NODETYPE_SECTION', 9); - -/** - * ASP code - * @link http://php.net/manual/en/tidy.constants.php - */ -define ('TIDY_NODETYPE_ASP', 10); - -/** - * JSTE code - * @link http://php.net/manual/en/tidy.constants.php - */ -define ('TIDY_NODETYPE_JSTE', 11); - -/** - * PHP code - * @link http://php.net/manual/en/tidy.constants.php - */ -define ('TIDY_NODETYPE_PHP', 12); - -/** - * XML declaration - * @link http://php.net/manual/en/tidy.constants.php - */ -define ('TIDY_NODETYPE_XMLDECL', 13); - -// End of tidy v.2.0 -?> diff --git a/phpruntime/tokenizer.php b/phpruntime/tokenizer.php deleted file mode 100644 index 0e02fd6..0000000 --- a/phpruntime/tokenizer.php +++ /dev/null @@ -1,161 +0,0 @@ - - * Split given source into PHP tokens - * @link http://php.net/manual/en/function.token-get-all.php - * @param string $source

- * The PHP source to parse. - *

- * @return array An array of token identifiers. Each individual token identifier is either - * a single character (i.e.: ;, ., - * >, !, etc...), - * or a three element array containing the token index in element 0, the string - * content of the original token in element 1 and the line number in element 2. - */ -function token_get_all ($source) {} - -/** - * (PHP 4 >= 4.2.0, PHP 5)
- * Get the symbolic name of a given PHP token - * @link http://php.net/manual/en/function.token-name.php - * @param int $token

- * The token value. - *

- * @return string The symbolic name of the given token. - */ -function token_name ($token) {} - -define ('T_REQUIRE_ONCE', 258); -define ('T_REQUIRE', 259); -define ('T_EVAL', 260); -define ('T_INCLUDE_ONCE', 261); -define ('T_INCLUDE', 262); -define ('T_LOGICAL_OR', 263); -define ('T_LOGICAL_XOR', 264); -define ('T_LOGICAL_AND', 265); -define ('T_PRINT', 266); -define ('T_SR_EQUAL', 267); -define ('T_SL_EQUAL', 268); -define ('T_XOR_EQUAL', 269); -define ('T_OR_EQUAL', 270); -define ('T_AND_EQUAL', 271); -define ('T_MOD_EQUAL', 272); -define ('T_CONCAT_EQUAL', 273); -define ('T_DIV_EQUAL', 274); -define ('T_MUL_EQUAL', 275); -define ('T_MINUS_EQUAL', 276); -define ('T_PLUS_EQUAL', 277); -define ('T_BOOLEAN_OR', 278); -define ('T_BOOLEAN_AND', 279); -define ('T_IS_NOT_IDENTICAL', 280); -define ('T_IS_IDENTICAL', 281); -define ('T_IS_NOT_EQUAL', 282); -define ('T_IS_EQUAL', 283); -define ('T_IS_GREATER_OR_EQUAL', 284); -define ('T_IS_SMALLER_OR_EQUAL', 285); -define ('T_SR', 286); -define ('T_SL', 287); -define ('T_INSTANCEOF', 288); -define ('T_UNSET_CAST', 289); -define ('T_BOOL_CAST', 290); -define ('T_OBJECT_CAST', 291); -define ('T_ARRAY_CAST', 292); -define ('T_STRING_CAST', 293); -define ('T_DOUBLE_CAST', 294); -define ('T_INT_CAST', 295); -define ('T_DEC', 296); -define ('T_INC', 297); -define ('T_CLONE', 298); -define ('T_NEW', 299); -define ('T_EXIT', 300); -define ('T_IF', 301); -define ('T_ELSEIF', 302); -define ('T_ELSE', 303); -define ('T_ENDIF', 304); -define ('T_LNUMBER', 305); -define ('T_DNUMBER', 306); -define ('T_STRING', 307); -define ('T_STRING_VARNAME', 308); -define ('T_VARIABLE', 309); -define ('T_NUM_STRING', 310); -define ('T_INLINE_HTML', 311); -define ('T_CHARACTER', 312); -define ('T_BAD_CHARACTER', 313); -define ('T_ENCAPSED_AND_WHITESPACE', 314); -define ('T_CONSTANT_ENCAPSED_STRING', 315); -define ('T_ECHO', 316); -define ('T_DO', 317); -define ('T_WHILE', 318); -define ('T_ENDWHILE', 319); -define ('T_FOR', 320); -define ('T_ENDFOR', 321); -define ('T_FOREACH', 322); -define ('T_ENDFOREACH', 323); -define ('T_DECLARE', 324); -define ('T_ENDDECLARE', 325); -define ('T_AS', 326); -define ('T_SWITCH', 327); -define ('T_ENDSWITCH', 328); -define ('T_CASE', 329); -define ('T_DEFAULT', 330); -define ('T_BREAK', 331); -define ('T_CONTINUE', 332); -define ('T_GOTO', 333); -define ('T_FUNCTION', 334); -define ('T_CONST', 335); -define ('T_RETURN', 336); -define ('T_TRY', 337); -define ('T_CATCH', 338); -define ('T_THROW', 339); -define ('T_USE', 340); -define ('T_INSTEADOF', 341); -define ('T_GLOBAL', 342); -define ('T_PUBLIC', 343); -define ('T_PROTECTED', 344); -define ('T_PRIVATE', 345); -define ('T_FINAL', 346); -define ('T_ABSTRACT', 347); -define ('T_STATIC', 348); -define ('T_VAR', 349); -define ('T_UNSET', 350); -define ('T_ISSET', 351); -define ('T_EMPTY', 352); -define ('T_HALT_COMPILER', 353); -define ('T_CLASS', 354); -define ('T_TRAIT', 355); -define ('T_INTERFACE', 356); -define ('T_EXTENDS', 357); -define ('T_IMPLEMENTS', 358); -define ('T_OBJECT_OPERATOR', 359); -define ('T_DOUBLE_ARROW', 360); -define ('T_LIST', 361); -define ('T_ARRAY', 362); -define ('T_CALLABLE', 363); -define ('T_CLASS_C', 364); -define ('T_TRAIT_C', 365); -define ('T_METHOD_C', 366); -define ('T_FUNC_C', 367); -define ('T_LINE', 368); -define ('T_FILE', 369); -define ('T_COMMENT', 370); -define ('T_DOC_COMMENT', 371); -define ('T_OPEN_TAG', 372); -define ('T_OPEN_TAG_WITH_ECHO', 373); -define ('T_CLOSE_TAG', 374); -define ('T_WHITESPACE', 375); -define ('T_START_HEREDOC', 376); -define ('T_END_HEREDOC', 377); -define ('T_DOLLAR_OPEN_CURLY_BRACES', 378); -define ('T_CURLY_OPEN', 379); -define ('T_PAAMAYIM_NEKUDOTAYIM', 380); -define ('T_NAMESPACE', 381); -define ('T_NS_C', 382); -define ('T_DIR', 383); -define ('T_NS_SEPARATOR', 384); -define ('T_DOUBLE_COLON', 380); - -// End of tokenizer v.0.1 -?> diff --git a/phpruntime/wddx.php b/phpruntime/wddx.php deleted file mode 100644 index 21615cc..0000000 --- a/phpruntime/wddx.php +++ /dev/null @@ -1,83 +0,0 @@ - - * Serialize a single value into a WDDX packet - * @link http://php.net/manual/en/function.wddx-serialize-value.php - * @param mixed $var

- * The value to be serialized - *

- * @param string $comment [optional]

- * An optional comment string that appears in the packet header. - *

- * @return string the WDDX packet, or FALSE on error. - */ -function wddx_serialize_value ($var, $comment = null) {} - -/** - * (PHP 4, PHP 5)
- * Serialize variables into a WDDX packet - * @link http://php.net/manual/en/function.wddx-serialize-vars.php - * @param mixed $var_name

- * Can be either a string naming a variable or an array containing - * strings naming the variables or another array, etc. - *

- * @param mixed $_ [optional] - * @return string the WDDX packet, or FALSE on error. - */ -function wddx_serialize_vars ($var_name, $_ = null) {} - -/** - * (PHP 4, PHP 5)
- * Starts a new WDDX packet with structure inside it - * @link http://php.net/manual/en/function.wddx-packet-start.php - * @param string $comment [optional]

- * An optional comment string. - *

- * @return resource a packet ID for use in later functions, or FALSE on error. - */ -function wddx_packet_start ($comment = null) {} - -/** - * (PHP 4, PHP 5)
- * Ends a WDDX packet with the specified ID - * @link http://php.net/manual/en/function.wddx-packet-end.php - * @param resource $packet_id

- * A WDDX packet, returned by wddx_packet_start. - *

- * @return string the string containing the WDDX packet. - */ -function wddx_packet_end ($packet_id) {} - -/** - * (PHP 4, PHP 5)
- * Add variables to a WDDX packet with the specified ID - * @link http://php.net/manual/en/function.wddx-add-vars.php - * @param resource $packet_id

- * A WDDX packet, returned by wddx_packet_start. - *

- * @param mixed $var_name

- * Can be either a string naming a variable or an array containing - * strings naming the variables or another array, etc. - *

- * @param mixed $_ [optional] - * @return bool TRUE on success or FALSE on failure. - */ -function wddx_add_vars ($packet_id, $var_name, $_ = null) {} - -/** - * (PHP 4, PHP 5)
- * Unserializes a WDDX packet - * @link http://php.net/manual/en/function.wddx-deserialize.php - * @param string $packet

- * A WDDX packet, as a string or stream. - *

- * @return mixed the deserialized value which can be a string, a number or an - * array. Note that structures are deserialized into associative arrays. - */ -function wddx_deserialize ($packet) {} - -// End of wddx v. -?> diff --git a/phpruntime/xdebug.php b/phpruntime/xdebug.php deleted file mode 100644 index a73523b..0000000 --- a/phpruntime/xdebug.php +++ /dev/null @@ -1,80 +0,0 @@ - diff --git a/phpruntime/xml.php b/phpruntime/xml.php deleted file mode 100644 index 7531d38..0000000 --- a/phpruntime/xml.php +++ /dev/null @@ -1,588 +0,0 @@ - - * Create an XML parser - * @link http://php.net/manual/en/function.xml-parser-create.php - * @param string $encoding [optional]

- * The optional encoding specifies the character - * encoding for the input/output in PHP 4. Starting from PHP 5, the input - * encoding is automatically detected, so that the - * encoding parameter specifies only the output - * encoding. In PHP 4, the default output encoding is the same as the - * input charset. If empty string is passed, the parser attempts to identify - * which encoding the document is encoded in by looking at the heading 3 or - * 4 bytes. In PHP 5.0.0 and 5.0.1, the default output charset is - * ISO-8859-1, while in PHP 5.0.2 and upper is UTF-8. The supported - * encodings are ISO-8859-1, UTF-8 and - * US-ASCII. - *

- * @return resource a resource handle for the new XML parser. - */ -function xml_parser_create ($encoding = null) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Create an XML parser with namespace support - * @link http://php.net/manual/en/function.xml-parser-create-ns.php - * @param string $encoding [optional]

- * The optional encoding specifies the character - * encoding for the input/output in PHP 4. Starting from PHP 5, the input - * encoding is automatically detected, so that the - * encoding parameter specifies only the output - * encoding. In PHP 4, the default output encoding is the same as the - * input charset. In PHP 5.0.0 and 5.0.1, the default output charset is - * ISO-8859-1, while in PHP 5.0.2 and upper is UTF-8. The supported - * encodings are ISO-8859-1, UTF-8 and - * US-ASCII. - *

- * @param string $separator [optional]

- * With a namespace aware parser tag parameters passed to the various - * handler functions will consist of namespace and tag name separated by - * the string specified in separator. - *

- * @return resource a resource handle for the new XML parser. - */ -function xml_parser_create_ns ($encoding = null, $separator = ':') {} - -/** - * (PHP 4, PHP 5)
- * Use XML Parser within an object - * @link http://php.net/manual/en/function.xml-set-object.php - * @param resource $parser

- * A reference to the XML parser to use inside the object. - *

- * @param object $object

- * The object where to use the XML parser. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xml_set_object ($parser, &$object) {} - -/** - * (PHP 4, PHP 5)
- * Set up start and end element handlers - * @link http://php.net/manual/en/function.xml-set-element-handler.php - * @param resource $parser

- * A reference to the XML parser to set up start and end element handler functions. - *

- * @param callable $start_element_handler

- * The function named by start_element_handler - * must accept three parameters: - * start_element_handler - * resourceparser - * stringname - * arrayattribs - * parser - * The first parameter, parser, is a - * reference to the XML parser calling the handler. - * @param callable $end_element_handler

- * The function named by end_element_handler - * must accept two parameters: - * end_element_handler - * resourceparser - * stringname - * parser - * The first parameter, parser, is a - * reference to the XML parser calling the handler. - * @return bool TRUE on success or FALSE on failure. - */ -function xml_set_element_handler ($parser, callable $start_element_handler, callable $end_element_handler) {} - -/** - * (PHP 4, PHP 5)
- * Set up character data handler - * @link http://php.net/manual/en/function.xml-set-character-data-handler.php - * @param resource $parser

- * A reference to the XML parser to set up character data handler function. - *

- * @param callable $handler

- * handler is a string containing the name of a - * function that must exist when xml_parse is called - * for parser. - *

- *

- * The function named by handler must accept - * two parameters: - * handler - * resourceparser - * stringdata - * parser - * The first parameter, parser, is a - * reference to the XML parser calling the handler. - * @return bool TRUE on success or FALSE on failure. - */ -function xml_set_character_data_handler ($parser, callable $handler) {} - -/** - * (PHP 4, PHP 5)
- * Set up processing instruction (PI) handler - * @link http://php.net/manual/en/function.xml-set-processing-instruction-handler.php - * @param resource $parser

- * A reference to the XML parser to set up processing instruction (PI) handler function. - *

- * @param callable $handler

- * handler is a string containing the name of a - * function that must exist when xml_parse is called - * for parser. - *

- *

- * The function named by handler must accept - * three parameters: - * handler - * resourceparser - * stringtarget - * stringdata - * parser - * The first parameter, parser, is a - * reference to the XML parser calling the handler. - * @return bool TRUE on success or FALSE on failure. - */ -function xml_set_processing_instruction_handler ($parser, callable $handler) {} - -/** - * (PHP 4, PHP 5)
- * Set up default handler - * @link http://php.net/manual/en/function.xml-set-default-handler.php - * @param resource $parser

- * A reference to the XML parser to set up default handler function. - *

- * @param callable $handler

- * handler is a string containing the name of a - * function that must exist when xml_parse is called - * for parser. - *

- *

- * The function named by handler must accept - * two parameters: - * handler - * resourceparser - * stringdata - * parser - * The first parameter, parser, is a - * reference to the XML parser calling the handler. - * @return bool TRUE on success or FALSE on failure. - */ -function xml_set_default_handler ($parser, callable $handler) {} - -/** - * (PHP 4, PHP 5)
- * Set up unparsed entity declaration handler - * @link http://php.net/manual/en/function.xml-set-unparsed-entity-decl-handler.php - * @param resource $parser

- * A reference to the XML parser to set up unparsed entity declaration handler function. - *

- * @param callable $handler

- * handler is a string containing the name of a - * function that must exist when xml_parse is called - * for parser. - *

- *

- * The function named by handler must accept six - * parameters: - * handler - * resourceparser - * stringentity_name - * stringbase - * stringsystem_id - * stringpublic_id - * stringnotation_name - * parser - * The first parameter, parser, is a - * reference to the XML parser calling the - * handler. - * @return bool TRUE on success or FALSE on failure. - */ -function xml_set_unparsed_entity_decl_handler ($parser, callable $handler) {} - -/** - * (PHP 4, PHP 5)
- * Set up notation declaration handler - * @link http://php.net/manual/en/function.xml-set-notation-decl-handler.php - * @param resource $parser

- * A reference to the XML parser to set up notation declaration handler function. - *

- * @param callable $handler

- * handler is a string containing the name of a - * function that must exist when xml_parse is called - * for parser. - *

- *

- * The function named by handler must accept - * five parameters: - * handler - * resourceparser - * stringnotation_name - * stringbase - * stringsystem_id - * stringpublic_id - * parser - * The first parameter, parser, is a - * reference to the XML parser calling the handler. - * @return bool TRUE on success or FALSE on failure. - */ -function xml_set_notation_decl_handler ($parser, callable $handler) {} - -/** - * (PHP 4, PHP 5)
- * Set up external entity reference handler - * @link http://php.net/manual/en/function.xml-set-external-entity-ref-handler.php - * @param resource $parser

- * A reference to the XML parser to set up external entity reference handler function. - *

- * @param callable $handler

- * handler is a string containing the name of a - * function that must exist when xml_parse is called - * for parser. - *

- *

- * The function named by handler must accept - * five parameters, and should return an integer value.If the - * value returned from the handler is FALSE (which it will be if no - * value is returned), the XML parser will stop parsing and - * xml_get_error_code will return - * XML_ERROR_EXTERNAL_ENTITY_HANDLING. - * handler - * resourceparser - * stringopen_entity_names - * stringbase - * stringsystem_id - * stringpublic_id - * parser - * The first parameter, parser, is a - * reference to the XML parser calling the handler. - * @return bool TRUE on success or FALSE on failure. - */ -function xml_set_external_entity_ref_handler ($parser, callable $handler) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Set up start namespace declaration handler - * @link http://php.net/manual/en/function.xml-set-start-namespace-decl-handler.php - * @param resource $parser

- * A reference to the XML parser. - *

- * @param callable $handler

- * handler is a string containing the name of a - * function that must exist when xml_parse is called - * for parser. - *

- *

- * The function named by handler must accept - * three parameters, and should return an integer value. If the - * value returned from the handler is FALSE (which it will be if no - * value is returned), the XML parser will stop parsing and - * xml_get_error_code will return - * XML_ERROR_EXTERNAL_ENTITY_HANDLING. - * handler - * resourceparser - * stringprefix - * stringuri - * parser - * The first parameter, parser, is a - * reference to the XML parser calling the handler. - * @return bool TRUE on success or FALSE on failure. - */ -function xml_set_start_namespace_decl_handler ($parser, callable $handler) {} - -/** - * (PHP 4 >= 4.0.5, PHP 5)
- * Set up end namespace declaration handler - * @link http://php.net/manual/en/function.xml-set-end-namespace-decl-handler.php - * @param resource $parser

- * A reference to the XML parser. - *

- * @param callable $handler

- * handler is a string containing the name of a - * function that must exist when xml_parse is called - * for parser. - *

- *

- * The function named by handler must accept - * two parameters, and should return an integer value. If the - * value returned from the handler is FALSE (which it will be if no - * value is returned), the XML parser will stop parsing and - * xml_get_error_code will return - * XML_ERROR_EXTERNAL_ENTITY_HANDLING. - * handler - * resourceparser - * stringprefix - * parser - * The first parameter, parser, is a - * reference to the XML parser calling the handler. - * @return bool TRUE on success or FALSE on failure. - */ -function xml_set_end_namespace_decl_handler ($parser, callable $handler) {} - -/** - * (PHP 4, PHP 5)
- * Start parsing an XML document - * @link http://php.net/manual/en/function.xml-parse.php - * @param resource $parser

- * A reference to the XML parser to use. - *

- * @param string $data

- * Chunk of data to parse. A document may be parsed piece-wise by - * calling xml_parse several times with new data, - * as long as the is_final parameter is set and - * TRUE when the last data is parsed. - *

- * @param bool $is_final [optional]

- * If set and TRUE, data is the last piece of - * data sent in this parse. - *

- * @return int 1 on success or 0 on failure. - *

- *

- * For unsuccessful parses, error information can be retrieved with - * xml_get_error_code, - * xml_error_string, - * xml_get_current_line_number, - * xml_get_current_column_number and - * xml_get_current_byte_index. - *

- *

- * Entity errors are reported at the end of the data thus only if - * is_final is set and TRUE. - */ -function xml_parse ($parser, $data, $is_final = false) {} - -/** - * (PHP 4, PHP 5)
- * Parse XML data into an array structure - * @link http://php.net/manual/en/function.xml-parse-into-struct.php - * @param resource $parser

- * A reference to the XML parser. - *

- * @param string $data

- * A string containing the XML data. - *

- * @param array $values

- * An array containing the values of the XML data - *

- * @param array $index [optional]

- * An array containing pointers to the location of the appropriate values in the $values. - *

- * @return int xml_parse_into_struct returns 0 for failure and 1 for - * success. This is not the same as FALSE and TRUE, be careful with - * operators such as ===. - */ -function xml_parse_into_struct ($parser, $data, array &$values, array &$index = null) {} - -/** - * (PHP 4, PHP 5)
- * Get XML parser error code - * @link http://php.net/manual/en/function.xml-get-error-code.php - * @param resource $parser

- * A reference to the XML parser to get error code from. - *

- * @return int This function returns FALSE if parser does - * not refer to a valid parser, or else it returns one of the error - * codes listed in the error codes - * section. - */ -function xml_get_error_code ($parser) {} - -/** - * (PHP 4, PHP 5)
- * Get XML parser error string - * @link http://php.net/manual/en/function.xml-error-string.php - * @param int $code

- * An error code from xml_get_error_code. - *

- * @return string a string with a textual description of the error - * code, or FALSE if no description was found. - */ -function xml_error_string ($code) {} - -/** - * (PHP 4, PHP 5)
- * Get current line number for an XML parser - * @link http://php.net/manual/en/function.xml-get-current-line-number.php - * @param resource $parser

- * A reference to the XML parser to get line number from. - *

- * @return int This function returns FALSE if parser does - * not refer to a valid parser, or else it returns which line the - * parser is currently at in its data buffer. - */ -function xml_get_current_line_number ($parser) {} - -/** - * (PHP 4, PHP 5)
- * Get current column number for an XML parser - * @link http://php.net/manual/en/function.xml-get-current-column-number.php - * @param resource $parser

- * A reference to the XML parser to get column number from. - *

- * @return int This function returns FALSE if parser does - * not refer to a valid parser, or else it returns which column on - * the current line (as given by - * xml_get_current_line_number) the parser is - * currently at. - */ -function xml_get_current_column_number ($parser) {} - -/** - * (PHP 4, PHP 5)
- * Get current byte index for an XML parser - * @link http://php.net/manual/en/function.xml-get-current-byte-index.php - * @param resource $parser

- * A reference to the XML parser to get byte index from. - *

- * @return int This function returns FALSE if parser does - * not refer to a valid parser, or else it returns which byte index - * the parser is currently at in its data buffer (starting at 0). - */ -function xml_get_current_byte_index ($parser) {} - -/** - * (PHP 4, PHP 5)
- * Free an XML parser - * @link http://php.net/manual/en/function.xml-parser-free.php - * @param resource $parser A reference to the XML parser to free. - * @return bool This function returns FALSE if parser does not - * refer to a valid parser, or else it frees the parser and returns TRUE. - */ -function xml_parser_free ($parser) {} - -/** - * (PHP 4, PHP 5)
- * Set options in an XML parser - * @link http://php.net/manual/en/function.xml-parser-set-option.php - * @param resource $parser

- * A reference to the XML parser to set an option in. - *

- * @param int $option

- * Which option to set. See below. - *

- *

- * The following options are available: - * - * XML parser options - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Option constantData typeDescription
XML_OPTION_CASE_FOLDINGinteger - * Controls whether case-folding is enabled for this - * XML parser. Enabled by default. - *
XML_OPTION_SKIP_TAGSTARTinteger - * Specify how many characters should be skipped in the beginning of a - * tag name. - *
XML_OPTION_SKIP_WHITEinteger - * Whether to skip values consisting of whitespace characters. - *
XML_OPTION_TARGET_ENCODINGstring - * Sets which target encoding to - * use in this XML parser.By default, it is set to the same as the - * source encoding used by xml_parser_create. - * Supported target encodings are ISO-8859-1, - * US-ASCII and UTF-8. - *
- *

- * @param mixed $value

- * The option's new value. - *

- * @return bool This function returns FALSE if parser does not - * refer to a valid parser, or if the option could not be set. Else the - * option is set and TRUE is returned. - */ -function xml_parser_set_option ($parser, $option, $value) {} - -/** - * (PHP 4, PHP 5)
- * Get options from an XML parser - * @link http://php.net/manual/en/function.xml-parser-get-option.php - * @param resource $parser A reference to the XML parser to get an option from. - * @param int $option Which option to fetch. XML_OPTION_CASE_FOLDING - * and XML_OPTION_TARGET_ENCODING are available. - * See xml_parser_set_option for their description. - * @return mixed This function returns FALSE if parser does - * not refer to a valid parser or if option isn't - * valid (generates also a E_WARNING). - * Else the option's value is returned. - */ -function xml_parser_get_option ($parser, $option) {} - -/** - * (PHP 4, PHP 5)
- * Encodes an ISO-8859-1 string to UTF-8 - * @link http://php.net/manual/en/function.utf8-encode.php - * @param string $data

- * An ISO-8859-1 string. - *

- * @return string the UTF-8 translation of data. - */ -function utf8_encode ($data) {} - -/** - * (PHP 4, PHP 5)
- * Converts a string with ISO-8859-1 characters encoded with UTF-8 -to single-byte ISO-8859-1 - * @link http://php.net/manual/en/function.utf8-decode.php - * @param string $data

- * An UTF-8 encoded string. - *

- * @return string the ISO-8859-1 translation of data. - */ -function utf8_decode ($data) {} - -define ('XML_ERROR_NONE', 0); -define ('XML_ERROR_NO_MEMORY', 1); -define ('XML_ERROR_SYNTAX', 2); -define ('XML_ERROR_NO_ELEMENTS', 3); -define ('XML_ERROR_INVALID_TOKEN', 4); -define ('XML_ERROR_UNCLOSED_TOKEN', 5); -define ('XML_ERROR_PARTIAL_CHAR', 6); -define ('XML_ERROR_TAG_MISMATCH', 7); -define ('XML_ERROR_DUPLICATE_ATTRIBUTE', 8); -define ('XML_ERROR_JUNK_AFTER_DOC_ELEMENT', 9); -define ('XML_ERROR_PARAM_ENTITY_REF', 10); -define ('XML_ERROR_UNDEFINED_ENTITY', 11); -define ('XML_ERROR_RECURSIVE_ENTITY_REF', 12); -define ('XML_ERROR_ASYNC_ENTITY', 13); -define ('XML_ERROR_BAD_CHAR_REF', 14); -define ('XML_ERROR_BINARY_ENTITY_REF', 15); -define ('XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF', 16); -define ('XML_ERROR_MISPLACED_XML_PI', 17); -define ('XML_ERROR_UNKNOWN_ENCODING', 18); -define ('XML_ERROR_INCORRECT_ENCODING', 19); -define ('XML_ERROR_UNCLOSED_CDATA_SECTION', 20); -define ('XML_ERROR_EXTERNAL_ENTITY_HANDLING', 21); -define ('XML_OPTION_CASE_FOLDING', 1); -define ('XML_OPTION_TARGET_ENCODING', 2); -define ('XML_OPTION_SKIP_TAGSTART', 3); -define ('XML_OPTION_SKIP_WHITE', 4); - -/** - * Holds the SAX implementation method. - * Can be libxml or expat. - * @link http://php.net/manual/en/xml.constants.php - */ -define ('XML_SAX_IMPL', "libxml"); - -// End of xml v. -?> diff --git a/phpruntime/xmlreader.php b/phpruntime/xmlreader.php deleted file mode 100644 index 865346e..0000000 --- a/phpruntime/xmlreader.php +++ /dev/null @@ -1,318 +0,0 @@ - - * Close the XMLReader input - * @link http://php.net/manual/en/xmlreader.close.php - * @return bool TRUE on success or FALSE on failure. - */ - public function close () {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the value of a named attribute - * @link http://php.net/manual/en/xmlreader.getattribute.php - * @param string $name

- * The name of the attribute. - *

- * @return string The value of the attribute, or NULL if no attribute with the given - * name is found or not positioned on an element node. - */ - public function getAttribute ($name) {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the value of an attribute by index - * @link http://php.net/manual/en/xmlreader.getattributeno.php - * @param int $index

- * The position of the attribute. - *

- * @return string The value of the attribute, or an empty string if no attribute exists - * at index or not positioned of element. - */ - public function getAttributeNo ($index) {} - - /** - * (PHP 5 >= 5.1.0)
- * Get the value of an attribute by localname and URI - * @link http://php.net/manual/en/xmlreader.getattributens.php - * @param string $localName

- * The local name. - *

- * @param string $namespaceURI

- * The namespace URI. - *

- * @return string The value of the attribute, or an empty string if no attribute with the - * given localName and - * namespaceURI is found or not positioned of element. - */ - public function getAttributeNs ($localName, $namespaceURI) {} - - /** - * (PHP 5 >= 5.1.0)
- * Indicates if specified property has been set - * @link http://php.net/manual/en/xmlreader.getparserproperty.php - * @param int $property

- * One of the parser option - * constants. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function getParserProperty ($property) {} - - /** - * (PHP 5 >= 5.1.0)
- * Indicates if the parsed document is valid - * @link http://php.net/manual/en/xmlreader.isvalid.php - * @return bool TRUE on success or FALSE on failure. - */ - public function isValid () {} - - /** - * (PHP 5 >= 5.1.0)
- * Lookup namespace for a prefix - * @link http://php.net/manual/en/xmlreader.lookupnamespace.php - * @param string $prefix

- * String containing the prefix. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function lookupNamespace ($prefix) {} - - /** - * (PHP 5 >= 5.1.0)
- * Move cursor to an attribute by index - * @link http://php.net/manual/en/xmlreader.movetoattributeno.php - * @param int $index

- * The position of the attribute. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function moveToAttributeNo ($index) {} - - /** - * (PHP 5 >= 5.1.0)
- * Move cursor to a named attribute - * @link http://php.net/manual/en/xmlreader.movetoattribute.php - * @param string $name

- * The name of the attribute. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function moveToAttribute ($name) {} - - /** - * (PHP 5 >= 5.1.0)
- * Move cursor to a named attribute - * @link http://php.net/manual/en/xmlreader.movetoattributens.php - * @param string $localName

- * The local name. - *

- * @param string $namespaceURI

- * The namespace URI. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function moveToAttributeNs ($localName, $namespaceURI) {} - - /** - * (PHP 5 >= 5.1.0)
- * Position cursor on the parent Element of current Attribute - * @link http://php.net/manual/en/xmlreader.movetoelement.php - * @return bool TRUE if successful and FALSE if it fails or not positioned on - * Attribute when this method is called. - */ - public function moveToElement () {} - - /** - * (PHP 5 >= 5.1.0)
- * Position cursor on the first Attribute - * @link http://php.net/manual/en/xmlreader.movetofirstattribute.php - * @return bool TRUE on success or FALSE on failure. - */ - public function moveToFirstAttribute () {} - - /** - * (PHP 5 >= 5.1.0)
- * Position cursor on the next Attribute - * @link http://php.net/manual/en/xmlreader.movetonextattribute.php - * @return bool TRUE on success or FALSE on failure. - */ - public function moveToNextAttribute () {} - - /** - * (PHP 5 >= 5.1.0)
- * Set the URI containing the XML to parse - * @link http://php.net/manual/en/xmlreader.open.php - * @param string $URI

- * URI pointing to the document. - *

- * @param string $encoding [optional]

- * The document encoding or NULL. - *

- * @param int $options [optional]

- * A bitmask of the LIBXML_* - * constants. - *

- * @return bool TRUE on success or FALSE on failure. If called statically, returns an - * XMLReader or FALSE on failure. - */ - public function open ($URI, $encoding = null, $options = 0) {} - - /** - * (PHP 5 >= 5.1.0)
- * Move to next node in document - * @link http://php.net/manual/en/xmlreader.read.php - * @return bool TRUE on success or FALSE on failure. - */ - public function read () {} - - /** - * (PHP 5 >= 5.1.0)
- * Move cursor to next node skipping all subtrees - * @link http://php.net/manual/en/xmlreader.next.php - * @param string $localname [optional]

- * The name of the next node to move to. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function next ($localname = null) {} - - /** - * (PHP 5 >= 5.2.0)
- * Retrieve XML from current node - * @link http://php.net/manual/en/xmlreader.readinnerxml.php - * @return string the contents of the current node as a string. Empty string on failure. - */ - public function readInnerXml () {} - - /** - * (PHP 5 >= 5.2.0)
- * Retrieve XML from current node, including it self - * @link http://php.net/manual/en/xmlreader.readouterxml.php - * @return string the contents of current node, including itself, as a string. Empty string on failure. - */ - public function readOuterXml () {} - - /** - * (PHP 5 >= 5.2.0)
- * Reads the contents of the current node as a string - * @link http://php.net/manual/en/xmlreader.readstring.php - * @return string the content of the current node as a string. Empty string on - * failure. - */ - public function readString () {} - - /** - * (PHP 5 >= 5.2.0)
- * Validate document against XSD - * @link http://php.net/manual/en/xmlreader.setschema.php - * @param string $filename

- * The filename of the XSD schema. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setSchema ($filename) {} - - /** - * (PHP 5 >= 5.1.0)
- * Set parser options - * @link http://php.net/manual/en/xmlreader.setparserproperty.php - * @param int $property

- * One of the parser option - * constants. - *

- * @param bool $value

- * If set to TRUE the option will be enabled otherwise will - * be disabled. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setParserProperty ($property, $value) {} - - /** - * (PHP 5 >= 5.2.0)
- * Set the filename or URI for a RelaxNG Schema - * @link http://php.net/manual/en/xmlreader.setrelaxngschema.php - * @param string $filename

- * filename or URI pointing to a RelaxNG Schema. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setRelaxNGSchema ($filename) {} - - /** - * (PHP 5 >= 5.1.0)
- * Set the data containing a RelaxNG Schema - * @link http://php.net/manual/en/xmlreader.setrelaxngschemasource.php - * @param string $source

- * String containing the RelaxNG Schema. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setRelaxNGSchemaSource ($source) {} - - /** - * (PHP 5 >= 5.1.0)
- * Set the data containing the XML to parse - * @link http://php.net/manual/en/xmlreader.xml.php - * @param string $source

- * String containing the XML to be parsed. - *

- * @param string $encoding [optional]

- * The document encoding or NULL. - *

- * @param int $options [optional]

- * A bitmask of the LIBXML_* - * constants. - *

- * @return bool TRUE on success or FALSE on failure. If called statically, returns an - * XMLReader or FALSE on failure. - */ - public function XML ($source, $encoding = null, $options = 0) {} - - /** - * (PHP 5 >= 5.1.0)
- * Returns a copy of the current node as a DOM object - * @link http://php.net/manual/en/xmlreader.expand.php - * @param DOMNode $basenode [optional] - * @return DOMNode The resulting DOMNode or FALSE on error. - */ - public function expand (DOMNode $basenode = null) {} - -} -// End of xmlreader v.0.1 -?> diff --git a/phpruntime/xmlrpc.php b/phpruntime/xmlrpc.php deleted file mode 100644 index 784e3a1..0000000 --- a/phpruntime/xmlrpc.php +++ /dev/null @@ -1,167 +0,0 @@ - - * Generates XML for a PHP value - * @link http://php.net/manual/en/function.xmlrpc-encode.php - * @param mixed $value - * @return string - */ -function xmlrpc_encode ($value) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Decodes XML into native PHP types - * @link http://php.net/manual/en/function.xmlrpc-decode.php - * @param string $xml

- * XML response returned by XMLRPC method. - *

- * @param string $encoding [optional]

- * Input encoding supported by iconv. - *

- * @return mixed either an array, or an integer, or a string, or a boolean according - * to the response returned by the XMLRPC method. - */ -function xmlrpc_decode ($xml, $encoding = "iso-8859-1") {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Decodes XML into native PHP types - * @link http://php.net/manual/en/function.xmlrpc-decode-request.php - * @param string $xml - * @param string $method - * @param string $encoding [optional] - * @return mixed - */ -function xmlrpc_decode_request ($xml, &$method, $encoding = null) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Generates XML for a method request - * @link http://php.net/manual/en/function.xmlrpc-encode-request.php - * @param string $method

- * Name of the method to call. - *

- * @param mixed $params

- * Method parameters compatible with method signature. - *

- * @param array $output_options [optional]

- * Array specifying output options may contain (default values are - * emphasised): - *

output_type: php, xml

- * @return string a string containing the XML representation of the request. - */ -function xmlrpc_encode_request ($method, $params, array $output_options = null) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Gets xmlrpc type for a PHP value - * @link http://php.net/manual/en/function.xmlrpc-get-type.php - * @param mixed $value

- * PHP value - *

- * @return string the XML-RPC type. - */ -function xmlrpc_get_type ($value) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Sets xmlrpc type, base64 or datetime, for a PHP string value - * @link http://php.net/manual/en/function.xmlrpc-set-type.php - * @param string $value

- * Value to set the type - *

- * @param string $type

- * 'base64' or 'datetime' - *

- * @return bool TRUE on success or FALSE on failure. - * If successful, value is converted to an object. - */ -function xmlrpc_set_type (&$value, $type) {} - -/** - * (PHP 4 >= 4.3.0, PHP 5)
- * Determines if an array value represents an XMLRPC fault - * @link http://php.net/manual/en/function.xmlrpc-is-fault.php - * @param array $arg

- * Array returned by xmlrpc_decode. - *

- * @return bool TRUE if the argument means fault, FALSE otherwise. Fault - * description is available in $arg["faultString"], fault - * code is in $arg["faultCode"]. - */ -function xmlrpc_is_fault (array $arg) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Creates an xmlrpc server - * @link http://php.net/manual/en/function.xmlrpc-server-create.php - * @return resource - */ -function xmlrpc_server_create () {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Destroys server resources - * @link http://php.net/manual/en/function.xmlrpc-server-destroy.php - * @param resource $server - * @return int - */ -function xmlrpc_server_destroy ($server) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Register a PHP function to resource method matching method_name - * @link http://php.net/manual/en/function.xmlrpc-server-register-method.php - * @param resource $server - * @param string $method_name - * @param string $function - * @return bool - */ -function xmlrpc_server_register_method ($server, $method_name, $function) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Parses XML requests and call methods - * @link http://php.net/manual/en/function.xmlrpc-server-call-method.php - * @param resource $server - * @param string $xml - * @param mixed $user_data - * @param array $output_options [optional] - * @return string - */ -function xmlrpc_server_call_method ($server, $xml, $user_data, array $output_options = null) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Decodes XML into a list of method descriptions - * @link http://php.net/manual/en/function.xmlrpc-parse-method-descriptions.php - * @param string $xml - * @return array - */ -function xmlrpc_parse_method_descriptions ($xml) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Adds introspection documentation - * @link http://php.net/manual/en/function.xmlrpc-server-add-introspection-data.php - * @param resource $server - * @param array $desc - * @return int - */ -function xmlrpc_server_add_introspection_data ($server, array $desc) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5)
- * Register a PHP function to generate documentation - * @link http://php.net/manual/en/function.xmlrpc-server-register-introspection-callback.php - * @param resource $server - * @param string $function - * @return bool - */ -function xmlrpc_server_register_introspection_callback ($server, $function) {} - -// End of xmlrpc v.0.51 -?> diff --git a/phpruntime/xmlwriter.php b/phpruntime/xmlwriter.php deleted file mode 100644 index 4309480..0000000 --- a/phpruntime/xmlwriter.php +++ /dev/null @@ -1,1031 +0,0 @@ - - * Create new xmlwriter using source uri for output - * @link http://php.net/manual/en/function.xmlwriter-open-uri.php - * @param string $uri

- * The URI of the resource for the output. - *

- * @return bool Object oriented style: Returns TRUE on success or FALSE on failure. - *

- *

- * Procedural style: Returns a new xmlwriter resource for later use with the - * xmlwriter functions on success, FALSE on error. - */ - public function openUri ($uri) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create new xmlwriter using memory for string output - * @link http://php.net/manual/en/function.xmlwriter-open-memory.php - * @return bool Object oriented style: Returns TRUE on success or FALSE on failure. - *

- *

- * Procedural style: Returns a new xmlwriter resource for later use with the - * xmlwriter functions on success, FALSE on error. - */ - public function openMemory () {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Toggle indentation on/off - * @link http://php.net/manual/en/function.xmlwriter-set-indent.php - * @param bool $indent

- * Whether indentation is enabled. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setIndent ($indent) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Set string used for indenting - * @link http://php.net/manual/en/function.xmlwriter-set-indent-string.php - * @param string $indentString

- * The indentation string. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setIndentString ($indentString) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 1.0.0)
- * Create start comment - * @link http://php.net/manual/en/function.xmlwriter-start-comment.php - * @return bool TRUE on success or FALSE on failure. - */ - public function startComment () {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 1.0.0)
- * Create end comment - * @link http://php.net/manual/en/function.xmlwriter-end-comment.php - * @return bool TRUE on success or FALSE on failure. - */ - public function endComment () {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create start attribute - * @link http://php.net/manual/en/function.xmlwriter-start-attribute.php - * @param string $name

- * The attribute name. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function startAttribute ($name) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * End attribute - * @link http://php.net/manual/en/function.xmlwriter-end-attribute.php - * @return bool TRUE on success or FALSE on failure. - */ - public function endAttribute () {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write full attribute - * @link http://php.net/manual/en/function.xmlwriter-write-attribute.php - * @param string $name

- * The name of the attribute. - *

- * @param string $value

- * The value of the attribute. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function writeAttribute ($name, $value) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create start namespaced attribute - * @link http://php.net/manual/en/function.xmlwriter-start-attribute-ns.php - * @param string $prefix

- * The namespace prefix. - *

- * @param string $name

- * The attribute name. - *

- * @param string $uri

- * The namespace URI. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function startAttributeNs ($prefix, $name, $uri) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write full namespaced attribute - * @link http://php.net/manual/en/function.xmlwriter-write-attribute-ns.php - * @param string $prefix

- * The namespace prefix. - *

- * @param string $name

- * The attribute name. - *

- * @param string $uri

- * The namespace URI. - *

- * @param string $content

- * The attribute value. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function writeAttributeNs ($prefix, $name, $uri, $content) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create start element tag - * @link http://php.net/manual/en/function.xmlwriter-start-element.php - * @param string $name

- * The element name. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function startElement ($name) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * End current element - * @link http://php.net/manual/en/function.xmlwriter-end-element.php - * @return bool TRUE on success or FALSE on failure. - */ - public function endElement () {} - - /** - * (PHP 5 >= 5.2.0, PECL xmlwriter >= 2.0.4)
- * End current element - * @link http://php.net/manual/en/function.xmlwriter-full-end-element.php - * @return bool TRUE on success or FALSE on failure. - */ - public function fullEndElement () {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create start namespaced element tag - * @link http://php.net/manual/en/function.xmlwriter-start-element-ns.php - * @param string $prefix

- * The namespace prefix. - *

- * @param string $name

- * The element name. - *

- * @param string $uri

- * The namespace URI. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function startElementNs ($prefix, $name, $uri) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write full element tag - * @link http://php.net/manual/en/function.xmlwriter-write-element.php - * @param string $name

- * The element name. - *

- * @param string $content [optional]

- * The element contents. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function writeElement ($name, $content = null) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write full namespaced element tag - * @link http://php.net/manual/en/function.xmlwriter-write-element-ns.php - * @param string $prefix

- * The namespace prefix. - *

- * @param string $name

- * The element name. - *

- * @param string $uri

- * The namespace URI. - *

- * @param string $content [optional]

- * The element contents. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function writeElementNs ($prefix, $name, $uri, $content = null) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create start PI tag - * @link http://php.net/manual/en/function.xmlwriter-start-pi.php - * @param string $target

- * The target of the processing instruction. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function startPi ($target) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * End current PI - * @link http://php.net/manual/en/function.xmlwriter-end-pi.php - * @return bool TRUE on success or FALSE on failure. - */ - public function endPi () {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Writes a PI - * @link http://php.net/manual/en/function.xmlwriter-write-pi.php - * @param string $target

- * The target of the processing instruction. - *

- * @param string $content

- * The content of the processing instruction. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function writePi ($target, $content) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create start CDATA tag - * @link http://php.net/manual/en/function.xmlwriter-start-cdata.php - * @return bool TRUE on success or FALSE on failure. - */ - public function startCdata () {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * End current CDATA - * @link http://php.net/manual/en/function.xmlwriter-end-cdata.php - * @return bool TRUE on success or FALSE on failure. - */ - public function endCdata () {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write full CDATA tag - * @link http://php.net/manual/en/function.xmlwriter-write-cdata.php - * @param string $content

- * The contents of the CDATA. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function writeCdata ($content) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write text - * @link http://php.net/manual/en/function.xmlwriter-text.php - * @param string $content

- * The contents of the text. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function text ($content) {} - - /** - * (PHP 5 >= 5.2.0, PECL xmlwriter >= 2.0.4)
- * Write a raw XML text - * @link http://php.net/manual/en/function.xmlwriter-write-raw.php - * @param string $content

- * The text string to write. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function writeRaw ($content) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create document tag - * @link http://php.net/manual/en/function.xmlwriter-start-document.php - * @param string $version [optional]

- * The version number of the document as part of the XML declaration. - *

- * @param string $encoding [optional]

- * The encoding of the document as part of the XML declaration. - *

- * @param string $standalone [optional]

- * yes or no. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function startDocument ($version = 1.0, $encoding = null, $standalone = null) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * End current document - * @link http://php.net/manual/en/function.xmlwriter-end-document.php - * @return bool TRUE on success or FALSE on failure. - */ - public function endDocument () {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write full comment tag - * @link http://php.net/manual/en/function.xmlwriter-write-comment.php - * @param string $content

- * The contents of the comment. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function writeComment ($content) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create start DTD tag - * @link http://php.net/manual/en/function.xmlwriter-start-dtd.php - * @param string $qualifiedName

- * The qualified name of the document type to create. - *

- * @param string $publicId [optional]

- * The external subset public identifier. - *

- * @param string $systemId [optional]

- * The external subset system identifier. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function startDtd ($qualifiedName, $publicId = null, $systemId = null) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * End current DTD - * @link http://php.net/manual/en/function.xmlwriter-end-dtd.php - * @return bool TRUE on success or FALSE on failure. - */ - public function endDtd () {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write full DTD tag - * @link http://php.net/manual/en/function.xmlwriter-write-dtd.php - * @param string $name

- * The DTD name. - *

- * @param string $publicId [optional]

- * The external subset public identifier. - *

- * @param string $systemId [optional]

- * The external subset system identifier. - *

- * @param string $subset [optional]

- * The content of the DTD. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function writeDtd ($name, $publicId = null, $systemId = null, $subset = null) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create start DTD element - * @link http://php.net/manual/en/function.xmlwriter-start-dtd-element.php - * @param string $qualifiedName

- * The qualified name of the document type to create. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function startDtdElement ($qualifiedName) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * End current DTD element - * @link http://php.net/manual/en/function.xmlwriter-end-dtd-element.php - * @return bool TRUE on success or FALSE on failure. - */ - public function endDtdElement () {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write full DTD element tag - * @link http://php.net/manual/en/function.xmlwriter-write-dtd-element.php - * @param string $name

- * The name of the DTD element. - *

- * @param string $content

- * The content of the element. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function writeDtdElement ($name, $content) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create start DTD AttList - * @link http://php.net/manual/en/function.xmlwriter-start-dtd-attlist.php - * @param string $name

- * The attribute list name. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function startDtdAttlist ($name) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * End current DTD AttList - * @link http://php.net/manual/en/function.xmlwriter-end-dtd-attlist.php - * @return bool TRUE on success or FALSE on failure. - */ - public function endDtdAttlist () {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write full DTD AttList tag - * @link http://php.net/manual/en/function.xmlwriter-write-dtd-attlist.php - * @param string $name

- * The name of the DTD attribute list. - *

- * @param string $content

- * The content of the DTD attribute list. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function writeDtdAttlist ($name, $content) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create start DTD Entity - * @link http://php.net/manual/en/function.xmlwriter-start-dtd-entity.php - * @param string $name

- * The name of the entity. - *

- * @param bool $isparam - * @return bool TRUE on success or FALSE on failure. - */ - public function startDtdEntity ($name, $isparam) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * End current DTD Entity - * @link http://php.net/manual/en/function.xmlwriter-end-dtd-entity.php - * @return bool TRUE on success or FALSE on failure. - */ - public function endDtdEntity () {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write full DTD Entity tag - * @link http://php.net/manual/en/function.xmlwriter-write-dtd-entity.php - * @param string $name

- * The name of the entity. - *

- * @param string $content

- * The content of the entity. - *

- * @param bool $pe - * @param string $pubid - * @param string $sysid - * @param string $ndataid - * @return bool TRUE on success or FALSE on failure. - */ - public function writeDtdEntity ($name, $content, $pe, $pubid, $sysid, $ndataid) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Returns current buffer - * @link http://php.net/manual/en/function.xmlwriter-output-memory.php - * @param bool $flush [optional]

- * Whether to flush the output buffer or not. Default is TRUE. - *

- * @return string the current buffer as a string. - */ - public function outputMemory ($flush = true) {} - - /** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 1.0.0)
- * Flush current buffer - * @link http://php.net/manual/en/function.xmlwriter-flush.php - * @param bool $empty [optional]

- * Whether to empty the buffer or not. Default is TRUE. - *

- * @return mixed If you opened the writer in memory, this function returns the generated XML buffer, - * Else, if using URI, this function will write the buffer and return the number of - * written bytes. - */ - public function flush ($empty = true) {} - -} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create new xmlwriter using source uri for output - * @link http://php.net/manual/en/function.xmlwriter-open-uri.php - * @param string $uri

- * The URI of the resource for the output. - *

- * @return bool Object oriented style: Returns TRUE on success or FALSE on failure. - *

- *

- * Procedural style: Returns a new xmlwriter resource for later use with the - * xmlwriter functions on success, FALSE on error. - */ -function xmlwriter_open_uri ($uri) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create new xmlwriter using memory for string output - * @link http://php.net/manual/en/function.xmlwriter-open-memory.php - * @return bool Object oriented style: Returns TRUE on success or FALSE on failure. - *

- *

- * Procedural style: Returns a new xmlwriter resource for later use with the - * xmlwriter functions on success, FALSE on error. - */ -function xmlwriter_open_memory () {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Toggle indentation on/off - * @link http://php.net/manual/en/function.xmlwriter-set-indent.php - * @param bool $indent

- * Whether indentation is enabled. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_set_indent ($indent) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Set string used for indenting - * @link http://php.net/manual/en/function.xmlwriter-set-indent-string.php - * @param string $indentString

- * The indentation string. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_set_indent_string ($indentString) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 1.0.0)
- * Create start comment - * @link http://php.net/manual/en/function.xmlwriter-start-comment.php - * @param $xmlwriter - * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_start_comment ($xmlwriter) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 1.0.0)
- * Create end comment - * @link http://php.net/manual/en/function.xmlwriter-end-comment.php - * @param $xmlwriter - * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_end_comment ($xmlwriter) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create start attribute - * @link http://php.net/manual/en/function.xmlwriter-start-attribute.php - * @param string $name

- * The attribute name. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_start_attribute ($name) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * End attribute - * @link http://php.net/manual/en/function.xmlwriter-end-attribute.php - * @param $xmlwriter - * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_end_attribute ($xmlwriter) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write full attribute - * @link http://php.net/manual/en/function.xmlwriter-write-attribute.php - * @param string $name

- * The name of the attribute. - *

- * @param string $value

- * The value of the attribute. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_write_attribute ($name, $value) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create start namespaced attribute - * @link http://php.net/manual/en/function.xmlwriter-start-attribute-ns.php - * @param string $prefix

- * The namespace prefix. - *

- * @param string $name

- * The attribute name. - *

- * @param string $uri

- * The namespace URI. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_start_attribute_ns ($prefix, $name, $uri) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write full namespaced attribute - * @link http://php.net/manual/en/function.xmlwriter-write-attribute-ns.php - * @param string $prefix

- * The namespace prefix. - *

- * @param string $name

- * The attribute name. - *

- * @param string $uri

- * The namespace URI. - *

- * @param string $content

- * The attribute value. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_write_attribute_ns ($prefix, $name, $uri, $content) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create start element tag - * @link http://php.net/manual/en/function.xmlwriter-start-element.php - * @param string $name

- * The element name. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_start_element ($name) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * End current element - * @link http://php.net/manual/en/function.xmlwriter-end-element.php - * @param $xmlwriter - * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_end_element ($xmlwriter) {} - -/** - * (PHP 5 >= 5.2.0, PECL xmlwriter >= 2.0.4)
- * End current element - * @link http://php.net/manual/en/function.xmlwriter-full-end-element.php - * @param $xmlwriter - * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_full_end_element ($xmlwriter) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create start namespaced element tag - * @link http://php.net/manual/en/function.xmlwriter-start-element-ns.php - * @param string $prefix

- * The namespace prefix. - *

- * @param string $name

- * The element name. - *

- * @param string $uri

- * The namespace URI. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_start_element_ns ($prefix, $name, $uri) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write full element tag - * @link http://php.net/manual/en/function.xmlwriter-write-element.php - * @param string $name

- * The element name. - *

- * @param string $content [optional]

- * The element contents. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_write_element ($name, $content = null) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write full namespaced element tag - * @link http://php.net/manual/en/function.xmlwriter-write-element-ns.php - * @param string $prefix

- * The namespace prefix. - *

- * @param string $name

- * The element name. - *

- * @param string $uri

- * The namespace URI. - *

- * @param string $content [optional]

- * The element contents. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_write_element_ns ($prefix, $name, $uri, $content = null) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create start PI tag - * @link http://php.net/manual/en/function.xmlwriter-start-pi.php - * @param string $target

- * The target of the processing instruction. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_start_pi ($target) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * End current PI - * @link http://php.net/manual/en/function.xmlwriter-end-pi.php - * @param $xmlwriter - * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_end_pi ($xmlwriter) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Writes a PI - * @link http://php.net/manual/en/function.xmlwriter-write-pi.php - * @param string $target

- * The target of the processing instruction. - *

- * @param string $content

- * The content of the processing instruction. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_write_pi ($target, $content) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create start CDATA tag - * @link http://php.net/manual/en/function.xmlwriter-start-cdata.php - * @param $xmlwriter - * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_start_cdata ($xmlwriter) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * End current CDATA - * @link http://php.net/manual/en/function.xmlwriter-end-cdata.php - * @param $xmlwriter - * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_end_cdata ($xmlwriter) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write full CDATA tag - * @link http://php.net/manual/en/function.xmlwriter-write-cdata.php - * @param string $content

- * The contents of the CDATA. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_write_cdata ($content) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write text - * @link http://php.net/manual/en/function.xmlwriter-text.php - * @param string $content

- * The contents of the text. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_text ($content) {} - -/** - * (PHP 5 >= 5.2.0, PECL xmlwriter >= 2.0.4)
- * Write a raw XML text - * @link http://php.net/manual/en/function.xmlwriter-write-raw.php - * @param string $content

- * The text string to write. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_write_raw ($content) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create document tag - * @link http://php.net/manual/en/function.xmlwriter-start-document.php - * @param string $version [optional]

- * The version number of the document as part of the XML declaration. - *

- * @param string $encoding [optional]

- * The encoding of the document as part of the XML declaration. - *

- * @param string $standalone [optional]

- * yes or no. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_start_document ($version = 1.0, $encoding = null, $standalone = null) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * End current document - * @link http://php.net/manual/en/function.xmlwriter-end-document.php - * @param $xmlwriter - * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_end_document ($xmlwriter) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write full comment tag - * @link http://php.net/manual/en/function.xmlwriter-write-comment.php - * @param string $content

- * The contents of the comment. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_write_comment ($content) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create start DTD tag - * @link http://php.net/manual/en/function.xmlwriter-start-dtd.php - * @param string $qualifiedName

- * The qualified name of the document type to create. - *

- * @param string $publicId [optional]

- * The external subset public identifier. - *

- * @param string $systemId [optional]

- * The external subset system identifier. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_start_dtd ($qualifiedName, $publicId = null, $systemId = null) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * End current DTD - * @link http://php.net/manual/en/function.xmlwriter-end-dtd.php - * @param $xmlwriter - * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_end_dtd ($xmlwriter) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write full DTD tag - * @link http://php.net/manual/en/function.xmlwriter-write-dtd.php - * @param string $name

- * The DTD name. - *

- * @param string $publicId [optional]

- * The external subset public identifier. - *

- * @param string $systemId [optional]

- * The external subset system identifier. - *

- * @param string $subset [optional]

- * The content of the DTD. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_write_dtd ($name, $publicId = null, $systemId = null, $subset = null) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create start DTD element - * @link http://php.net/manual/en/function.xmlwriter-start-dtd-element.php - * @param string $qualifiedName

- * The qualified name of the document type to create. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_start_dtd_element ($qualifiedName) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * End current DTD element - * @link http://php.net/manual/en/function.xmlwriter-end-dtd-element.php - * @param $xmlwriter - * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_end_dtd_element ($xmlwriter) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write full DTD element tag - * @link http://php.net/manual/en/function.xmlwriter-write-dtd-element.php - * @param string $name

- * The name of the DTD element. - *

- * @param string $content

- * The content of the element. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_write_dtd_element ($name, $content) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create start DTD AttList - * @link http://php.net/manual/en/function.xmlwriter-start-dtd-attlist.php - * @param string $name

- * The attribute list name. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_start_dtd_attlist ($name) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * End current DTD AttList - * @link http://php.net/manual/en/function.xmlwriter-end-dtd-attlist.php - * @param $xmlwriter - * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_end_dtd_attlist ($xmlwriter) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write full DTD AttList tag - * @link http://php.net/manual/en/function.xmlwriter-write-dtd-attlist.php - * @param string $name

- * The name of the DTD attribute list. - *

- * @param string $content

- * The content of the DTD attribute list. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_write_dtd_attlist ($name, $content) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Create start DTD Entity - * @link http://php.net/manual/en/function.xmlwriter-start-dtd-entity.php - * @param string $name

- * The name of the entity. - *

- * @param bool $isparam - * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_start_dtd_entity ($name, $isparam) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * End current DTD Entity - * @link http://php.net/manual/en/function.xmlwriter-end-dtd-entity.php - * @param $xmlwriter - * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_end_dtd_entity ($xmlwriter) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Write full DTD Entity tag - * @link http://php.net/manual/en/function.xmlwriter-write-dtd-entity.php - * @param string $name

- * The name of the entity. - *

- * @param string $content

- * The content of the entity. - *

- * @param bool $pe - * @param string $pubid - * @param string $sysid - * @param string $ndataid - * @return bool TRUE on success or FALSE on failure. - */ -function xmlwriter_write_dtd_entity ($name, $content, $pe, $pubid, $sysid, $ndataid) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 0.1.0)
- * Returns current buffer - * @link http://php.net/manual/en/function.xmlwriter-output-memory.php - * @param bool $flush [optional]

- * Whether to flush the output buffer or not. Default is TRUE. - *

- * @return string the current buffer as a string. - */ -function xmlwriter_output_memory ($flush = true) {} - -/** - * (PHP 5 >= 5.1.2, PECL xmlwriter >= 1.0.0)
- * Flush current buffer - * @link http://php.net/manual/en/function.xmlwriter-flush.php - * @param bool $empty [optional]

- * Whether to empty the buffer or not. Default is TRUE. - *

- * @return mixed If you opened the writer in memory, this function returns the generated XML buffer, - * Else, if using URI, this function will write the buffer and return the number of - * written bytes. - */ -function xmlwriter_flush ($empty = true) {} - -// End of xmlwriter v.0.1 -?> diff --git a/phpruntime/xsl.php b/phpruntime/xsl.php deleted file mode 100644 index 782d566..0000000 --- a/phpruntime/xsl.php +++ /dev/null @@ -1,192 +0,0 @@ - - * Import stylesheet - * @link http://php.net/manual/en/xsltprocessor.importstylesheet.php - * @param object $stylesheet

- * The imported style sheet as a DOMDocument or - * SimpleXMLElement object. - *

- * @return void No value is returned. - */ - public function importStylesheet ($stylesheet) {} - - /** - * (PHP 5)
- * Transform to a DOMDocument - * @link http://php.net/manual/en/xsltprocessor.transformtodoc.php - * @param DOMNode $doc

- * The node to be transformed. - *

- * @return DOMDocument The resulting DOMDocument or FALSE on error. - */ - public function transformToDoc (DOMNode $doc) {} - - /** - * (PHP 5)
- * Transform to URI - * @link http://php.net/manual/en/xsltprocessor.transformtouri.php - * @param DOMDocument $doc

- * The document to transform. - *

- * @param string $uri

- * The target URI for the transformation. - *

- * @return int the number of bytes written or FALSE if an error occurred. - */ - public function transformToUri (DOMDocument $doc, $uri) {} - - /** - * (PHP 5)
- * Transform to XML - * @link http://php.net/manual/en/xsltprocessor.transformtoxml.php - * @param DOMDocument $doc

- * The transformed document. - *

- * @return string The result of the transformation as a string or FALSE on error. - */ - public function transformToXml (DOMDocument $doc) {} - - /** - * (PHP 5)
- * Set value for a parameter - * @link http://php.net/manual/en/xsltprocessor.setparameter.php - * @param string $namespace

- * The namespace URI of the XSLT parameter. - *

- * @param string $name

- * The local name of the XSLT parameter. - *

- * @param string $value

- * The new value of the XSLT parameter. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setParameter ($namespace, $name, $value) {} - - /** - * (PHP 5)
- * Get value of a parameter - * @link http://php.net/manual/en/xsltprocessor.getparameter.php - * @param string $namespaceURI

- * The namespace URI of the XSLT parameter. - *

- * @param string $localName

- * The local name of the XSLT parameter. - *

- * @return string The value of the parameter or NULL if it's not set. - */ - public function getParameter ($namespaceURI, $localName) {} - - /** - * (PHP 5)
- * Remove parameter - * @link http://php.net/manual/en/xsltprocessor.removeparameter.php - * @param string $namespaceURI

- * The namespace URI of the XSLT parameter. - *

- * @param string $localName

- * The local name of the XSLT parameter. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function removeParameter ($namespaceURI, $localName) {} - - /** - * (PHP 5 >= 5.0.4)
- * Determine if PHP has EXSLT support - * @link http://php.net/manual/en/xsltprocessor.hasexsltsupport.php - * @return bool TRUE on success or FALSE on failure. - */ - public function hasExsltSupport () {} - - /** - * (PHP 5 >= 5.0.4)
- * Enables the ability to use PHP functions as XSLT functions - * @link http://php.net/manual/en/xsltprocessor.registerphpfunctions.php - * @param mixed $restrict [optional]

- * Use this parameter to only allow certain functions to be called from - * XSLT. - *

- *

- * This parameter can be either a string (a function name) or an array of - * functions. - *

- * @return void No value is returned. - */ - public function registerPHPFunctions ($restrict = null) {} - - /** - * (PHP >= 5.3.0)
- * Sets profiling output file - * @link http://php.net/manual/en/xsltprocessor.setprofiling.php - * @param string $filename

- * Path to the file to dump profiling information. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function setProfiling ($filename) {} - - /** - * (PHP >= 5.4.0)
- * Set security preferences - * @link http://php.net/manual/en/xsltprocessor.setsecurityprefs.php - * @param int $securityPrefs - * @return int - */ - public function setSecurityPrefs ($securityPrefs) {} - - /** - * (PHP >= 5.4.0)
- * Get security preferences - * @link http://php.net/manual/en/xsltprocessor.getsecurityprefs.php - * @return int - */ - public function getSecurityPrefs () {} - -} -define ('XSL_CLONE_AUTO', 0); -define ('XSL_CLONE_NEVER', -1); -define ('XSL_CLONE_ALWAYS', 1); -define ('XSL_SECPREF_NONE', 0); -define ('XSL_SECPREF_READ_FILE', 2); -define ('XSL_SECPREF_WRITE_FILE', 4); -define ('XSL_SECPREF_CREATE_DIRECTORY', 8); -define ('XSL_SECPREF_READ_NETWORK', 16); -define ('XSL_SECPREF_WRITE_NETWORK', 32); -define ('XSL_SECPREF_DEFAULT', 44); - -/** - * libxslt version like 10117. Available as of PHP 5.1.2. - * @link http://php.net/manual/en/xsl.constants.php - */ -define ('LIBXSLT_VERSION', 10126); - -/** - * libxslt version like 1.1.17. Available as of PHP 5.1.2. - * @link http://php.net/manual/en/xsl.constants.php - */ -define ('LIBXSLT_DOTTED_VERSION', "1.1.26"); - -/** - * libexslt version like 813. Available as of PHP 5.1.2. - * @link http://php.net/manual/en/xsl.constants.php - */ -define ('LIBEXSLT_VERSION', 815); - -/** - * libexslt version like 1.1.17. Available as of PHP 5.1.2. - * @link http://php.net/manual/en/xsl.constants.php - */ -define ('LIBEXSLT_DOTTED_VERSION', "1.1.26"); - -// End of xsl v.0.1 -?> diff --git a/phpruntime/zip.php b/phpruntime/zip.php deleted file mode 100644 index fff2c5c..0000000 --- a/phpruntime/zip.php +++ /dev/null @@ -1,659 +0,0 @@ - - * Open a ZIP file archive - * @link http://php.net/manual/en/ziparchive.open.php - * @param string $filename

- * The file name of the ZIP archive to open. - *

- * @param int $flags [optional]

- * The mode to use to open the archive. - *

- * ZIPARCHIVE::OVERWRITE - *

- * @return mixed Error codes - *

- * Returns TRUE on success or the error code. - *

- * ZIPARCHIVE::ER_EXISTS - *

- *

- * File already exists. - *

- *

- * ZIPARCHIVE::ER_INCONS - *

- *

- * Zip archive inconsistent. - *

- *

- * ZIPARCHIVE::ER_INVAL - *

- *

- * Invalid argument. - *

- *

- * ZIPARCHIVE::ER_MEMORY - *

- *

- * Malloc failure. - *

- *

- * ZIPARCHIVE::ER_NOENT - *

- *

- * No such file. - *

- *

- * ZIPARCHIVE::ER_NOZIP - *

- *

- * Not a zip archive. - *

- *

- * ZIPARCHIVE::ER_OPEN - *

- *

- * Can't open file. - *

- *

- * ZIPARCHIVE::ER_READ - *

- *

- * Read error. - *

- *

- * ZIPARCHIVE::ER_SEEK - *

- *

- * Seek error. - *

- *

- */ - public function open ($filename, $flags = null) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
- * Close the active archive (opened or newly created) - * @link http://php.net/manual/en/ziparchive.close.php - * @return bool TRUE on success or FALSE on failure. - */ - public function close () {} - - /** - * (PHP 5 >= 5.2.7)
- * Returns the status error message, system and/or zip messages - * @link http://php.net/manual/en/ziparchive.getstatusstring.php - * @return string a string with the status message on success or FALSE on failure. - */ - public function getStatusString () {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.8.0)
- * Add a new directory - * @link http://php.net/manual/en/ziparchive.addemptydir.php - * @param string $dirname

- * The directory to add. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function addEmptyDir ($dirname) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
- * Add a file to a ZIP archive using its contents - * @link http://php.net/manual/en/ziparchive.addfromstring.php - * @param string $localname

- * The name of the entry to create. - *

- * @param string $contents

- * The contents to use to create the entry. It is used in a binary - * safe mode. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function addFromString ($localname, $contents) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
- * Adds a file to a ZIP archive from the given path - * @link http://php.net/manual/en/ziparchive.addfile.php - * @param string $filename

- * The path to the file to add. - *

- * @param string $localname [optional]

- * If supplied, this is the local name inside the ZIP archive that will override the filename. - *

- * @param int $start [optional]

- * This parameter is not used but is required to extend ZipArchive. - *

- * @param int $length [optional]

- * This parameter is not used but is required to extend ZipArchive. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function addFile ($filename, $localname = null, $start = 0, $length = 0) {} - - /** - * @param $pattern - * @param $flags [optional] - * @param $options [optional] - */ - public function addGlob ($pattern, $flags, $options) {} - - /** - * @param $pattern - * @param $path [optional] - * @param $options [optional] - */ - public function addPattern ($pattern, $path, $options) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.5.0)
- * Renames an entry defined by its index - * @link http://php.net/manual/en/ziparchive.renameindex.php - * @param int $index

- * Index of the entry to rename. - *

- * @param string $newname

- * New name. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function renameIndex ($index, $newname) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.5.0)
- * Renames an entry defined by its name - * @link http://php.net/manual/en/ziparchive.renamename.php - * @param string $name

- * Name of the entry to rename. - *

- * @param string $newname

- * New name. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function renameName ($name, $newname) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.4.0)
- * Set the comment of a ZIP archive - * @link http://php.net/manual/en/ziparchive.setarchivecomment.php - * @param string $comment

- * The contents of the comment. - *

- * @return mixed TRUE on success or FALSE on failure. - */ - public function setArchiveComment ($comment) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
- * Returns the Zip archive comment - * @link http://php.net/manual/en/ziparchive.getarchivecomment.php - * @param int $flags [optional]

- * If flags is set to ZIPARCHIVE::FL_UNCHANGED, the original unchanged - * comment is returned. - *

- * @return string the Zip archive comment or FALSE on failure. - */ - public function getArchiveComment ($flags = null) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.4.0)
- * Set the comment of an entry defined by its index - * @link http://php.net/manual/en/ziparchive.setcommentindex.php - * @param int $index

- * Index of the entry. - *

- * @param string $comment

- * The contents of the comment. - *

- * @return mixed TRUE on success or FALSE on failure. - */ - public function setCommentIndex ($index, $comment) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.4.0)
- * Set the comment of an entry defined by its name - * @link http://php.net/manual/en/ziparchive.setcommentname.php - * @param string $name

- * Name of the entry. - *

- * @param string $comment

- * The contents of the comment. - *

- * @return mixed TRUE on success or FALSE on failure. - */ - public function setCommentName ($name, $comment) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.4.0)
- * Returns the comment of an entry using the entry index - * @link http://php.net/manual/en/ziparchive.getcommentindex.php - * @param int $index

- * Index of the entry - *

- * @param int $flags [optional]

- * If flags is set to ZIPARCHIVE::FL_UNCHANGED, the original unchanged - * comment is returned. - *

- * @return string the comment on success or FALSE on failure. - */ - public function getCommentIndex ($index, $flags = null) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.4.0)
- * Returns the comment of an entry using the entry name - * @link http://php.net/manual/en/ziparchive.getcommentname.php - * @param string $name

- * Name of the entry - *

- * @param int $flags [optional]

- * If flags is set to ZIPARCHIVE::FL_UNCHANGED, the original unchanged - * comment is returned. - *

- * @return string the comment on success or FALSE on failure. - */ - public function getCommentName ($name, $flags = null) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.5.0)
- * delete an entry in the archive using its index - * @link http://php.net/manual/en/ziparchive.deleteindex.php - * @param int $index

- * Index of the entry to delete. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function deleteIndex ($index) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.5.0)
- * delete an entry in the archive using its name - * @link http://php.net/manual/en/ziparchive.deletename.php - * @param string $name

- * Name of the entry to delete. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function deleteName ($name) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.5.0)
- * Get the details of an entry defined by its name. - * @link http://php.net/manual/en/ziparchive.statname.php - * @param name $name

- * Name of the entry - *

- * @param int $flags [optional]

- * The flags argument specifies how the name lookup should be done. - * Also, ZIPARCHIVE::FL_UNCHANGED may be ORed to it to request - * information about the original file in the archive, - * ignoring any changes made. - *

- * ZIPARCHIVE::FL_NOCASE - *

- * @return mixed an array containing the entry details or FALSE on failure. - */ - public function statName ($name, $flags = null) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
- * Get the details of an entry defined by its index. - * @link http://php.net/manual/en/ziparchive.statindex.php - * @param int $index

- * Index of the entry - *

- * @param int $flags [optional]

- * ZIPARCHIVE::FL_UNCHANGED may be ORed to it to request - * information about the original file in the archive, - * ignoring any changes made. - *

- * @return mixed an array containing the entry details or FALSE on failure. - */ - public function statIndex ($index, $flags = null) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.5.0)
- * Returns the index of the entry in the archive - * @link http://php.net/manual/en/ziparchive.locatename.php - * @param string $name

- * The name of the entry to look up - *

- * @param int $flags [optional]

- * The flags are specified by ORing the following values, - * or 0 for none of them. - *

- * ZIPARCHIVE::FL_NOCASE - *

- * @return mixed the index of the entry on success or FALSE on failure. - */ - public function locateName ($name, $flags = null) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.5.0)
- * Returns the name of an entry using its index - * @link http://php.net/manual/en/ziparchive.getnameindex.php - * @param int $index

- * Index of the entry. - *

- * @param int $flags [optional]

- * If flags is set to ZIPARCHIVE::FL_UNCHANGED, the original unchanged - * name is returned. - *

- * @return string the name on success or FALSE on failure. - */ - public function getNameIndex ($index, $flags = null) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
- * Revert all global changes done in the archive. - * @link http://php.net/manual/en/ziparchive.unchangearchive.php - * @return mixed TRUE on success or FALSE on failure. - */ - public function unchangeArchive () {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
- * Undo all changes done in the archive - * @link http://php.net/manual/en/ziparchive.unchangeall.php - * @return mixed TRUE on success or FALSE on failure. - */ - public function unchangeAll () {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
- * Revert all changes done to an entry at the given index - * @link http://php.net/manual/en/ziparchive.unchangeindex.php - * @param int $index

- * Index of the entry. - *

- * @return mixed TRUE on success or FALSE on failure. - */ - public function unchangeIndex ($index) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.5.0)
- * Revert all changes done to an entry with the given name. - * @link http://php.net/manual/en/ziparchive.unchangename.php - * @param string $name

- * Name of the entry. - *

- * @return mixed TRUE on success or FALSE on failure. - */ - public function unchangeName ($name) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
- * Extract the archive contents - * @link http://php.net/manual/en/ziparchive.extractto.php - * @param string $destination

- * Location where to extract the files. - *

- * @param mixed $entries [optional]

- * The entries to extract. It accepts either a single entry name or - * an array of names. - *

- * @return bool TRUE on success or FALSE on failure. - */ - public function extractTo ($destination, $entries = null) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
- * Returns the entry contents using its name - * @link http://php.net/manual/en/ziparchive.getfromname.php - * @param string $name

- * Name of the entry - *

- * @param int $length [optional]

- * The length to be read from the entry. If 0, then the - * entire entry is read. - *

- * @param int $flags [optional]

- * The flags to use to open the archive. the following values may - * be ORed to it. - *

- * ZIPARCHIVE::FL_UNCHANGED - *

- * @return mixed the contents of the entry on success or FALSE on failure. - */ - public function getFromName ($name, $length = 0, $flags = null) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.3.0)
- * Returns the entry contents using its index - * @link http://php.net/manual/en/ziparchive.getfromindex.php - * @param int $index

- * Index of the entry - *

- * @param int $length [optional]

- * The length to be read from the entry. If 0, then the - * entire entry is read. - *

- * @param int $flags [optional]

- * The flags to use to open the archive. the following values may - * be ORed to it. - *

- * ZIPARCHIVE::FL_UNCHANGED - *

- * @return mixed the contents of the entry on success or FALSE on failure. - */ - public function getFromIndex ($index, $length = 0, $flags = null) {} - - /** - * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
- * Get a file handler to the entry defined by its name (read only). - * @link http://php.net/manual/en/ziparchive.getstream.php - * @param string $name

- * The name of the entry to use. - *

- * @return resource a file pointer (resource) on success or FALSE on failure. - */ - public function getStream ($name) {} - -} - -/** - * (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
- * Open a ZIP file archive - * @link http://php.net/manual/en/function.zip-open.php - * @param string $filename

- * The file name of the ZIP archive to open. - *

- * @return resource a resource handle for later use with - * zip_read and zip_close - * or returns the number of error if filename does not - * exist or in case of other error. - */ -function zip_open ($filename) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
- * Close a ZIP file archive - * @link http://php.net/manual/en/function.zip-close.php - * @param resource $zip

- * A ZIP file previously opened with zip_open. - *

- * @return void No value is returned. - */ -function zip_close ($zip) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
- * Read next entry in a ZIP file archive - * @link http://php.net/manual/en/function.zip-read.php - * @param resource $zip

- * A ZIP file previously opened with zip_open. - *

- * @return resource a directory entry resource for later use with the - * zip_entry_... functions, or FALSE if - * there are no more entries to read, or an error code if an error - * occurred. - */ -function zip_read ($zip) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
- * Open a directory entry for reading - * @link http://php.net/manual/en/function.zip-entry-open.php - * @param resource $zip

- * A valid resource handle returned by zip_open. - *

- * @param resource $zip_entry

- * A directory entry returned by zip_read. - *

- * @param string $mode [optional]

- * Any of the modes specified in the documentation of - * fopen. - *

- *

- * Currently, mode is ignored and is always - * "rb". This is due to the fact that zip support - * in PHP is read only access. - *

- * @return bool TRUE on success or FALSE on failure. - *

- *

- * Unlike fopen and other similar functions, - * the return value of zip_entry_open only - * indicates the result of the operation and is not needed for - * reading or closing the directory entry. - */ -function zip_entry_open ($zip, $zip_entry, $mode = null) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
- * Close a directory entry - * @link http://php.net/manual/en/function.zip-entry-close.php - * @param resource $zip_entry

- * A directory entry previously opened zip_entry_open. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function zip_entry_close ($zip_entry) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
- * Read from an open directory entry - * @link http://php.net/manual/en/function.zip-entry-read.php - * @param resource $zip_entry

- * A directory entry returned by zip_read. - *

- * @param int $length [optional]

- * The number of bytes to return. If not specified, this function will - * attempt to read 1024 bytes. - *

- *

- * This should be the uncompressed length you wish to read. - *

- * @return string the data read, or FALSE if the end of the file is - * reached. - */ -function zip_entry_read ($zip_entry, $length = null) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
- * Retrieve the actual file size of a directory entry - * @link http://php.net/manual/en/function.zip-entry-filesize.php - * @param resource $zip_entry

- * A directory entry returned by zip_read. - *

- * @return int The size of the directory entry. - */ -function zip_entry_filesize ($zip_entry) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
- * Retrieve the name of a directory entry - * @link http://php.net/manual/en/function.zip-entry-name.php - * @param resource $zip_entry

- * A directory entry returned by zip_read. - *

- * @return string The name of the directory entry. - */ -function zip_entry_name ($zip_entry) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
- * Retrieve the compressed size of a directory entry - * @link http://php.net/manual/en/function.zip-entry-compressedsize.php - * @param resource $zip_entry

- * A directory entry returned by zip_read. - *

- * @return int The compressed size. - */ -function zip_entry_compressedsize ($zip_entry) {} - -/** - * (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
- * Retrieve the compression method of a directory entry - * @link http://php.net/manual/en/function.zip-entry-compressionmethod.php - * @param resource $zip_entry

- * A directory entry returned by zip_read. - *

- * @return string The compression method. - */ -function zip_entry_compressionmethod ($zip_entry) {} - -// End of zip v.1.11.0 -?> diff --git a/phpruntime/zlib.php b/phpruntime/zlib.php deleted file mode 100644 index 65c59a4..0000000 --- a/phpruntime/zlib.php +++ /dev/null @@ -1,423 +0,0 @@ - - * Output a gz-file - * @link http://php.net/manual/en/function.readgzfile.php - * @param string $filename

- * The file name. This file will be opened from the filesystem and its - * contents written to standard output. - *

- * @param int $use_include_path [optional]

- * You can set this optional parameter to 1, if you - * want to search for the file in the include_path too. - *

- * @return int the number of (uncompressed) bytes read from the file. If - * an error occurs, FALSE is returned and unless the function was - * called as @readgzfile, an error message is - * printed. - */ -function readgzfile ($filename, $use_include_path = 0) {} - -/** - * (PHP 4, PHP 5)
- * Rewind the position of a gz-file pointer - * @link http://php.net/manual/en/function.gzrewind.php - * @param resource $zp

- * The gz-file pointer. It must be valid, and must point to a file - * successfully opened by gzopen. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function gzrewind ($zp) {} - -/** - * (PHP 4, PHP 5)
- * Close an open gz-file pointer - * @link http://php.net/manual/en/function.gzclose.php - * @param resource $zp

- * The gz-file pointer. It must be valid, and must point to a file - * successfully opened by gzopen. - *

- * @return bool TRUE on success or FALSE on failure. - */ -function gzclose ($zp) {} - -/** - * (PHP 4, PHP 5)
- * Test for EOF on a gz-file pointer - * @link http://php.net/manual/en/function.gzeof.php - * @param resource $zp

- * The gz-file pointer. It must be valid, and must point to a file - * successfully opened by gzopen. - *

- * @return int TRUE if the gz-file pointer is at EOF or an error occurs; - * otherwise returns FALSE. - */ -function gzeof ($zp) {} - -/** - * (PHP 4, PHP 5)
- * Get character from gz-file pointer - * @link http://php.net/manual/en/function.gzgetc.php - * @param resource $zp

- * The gz-file pointer. It must be valid, and must point to a file - * successfully opened by gzopen. - *

- * @return string The uncompressed character or FALSE on EOF (unlike gzeof). - */ -function gzgetc ($zp) {} - -/** - * (PHP 4, PHP 5)
- * Get line from file pointer - * @link http://php.net/manual/en/function.gzgets.php - * @param resource $zp

- * The gz-file pointer. It must be valid, and must point to a file - * successfully opened by gzopen. - *

- * @param int $length

- * The length of data to get. - *

- * @return string The uncompressed string, or FALSE on error. - */ -function gzgets ($zp, $length) {} - -/** - * (PHP 4, PHP 5)
- * Get line from gz-file pointer and strip HTML tags - * @link http://php.net/manual/en/function.gzgetss.php - * @param resource $zp

- * The gz-file pointer. It must be valid, and must point to a file - * successfully opened by gzopen. - *

- * @param int $length

- * The length of data to get. - *

- * @param string $allowable_tags [optional]

- * You can use this optional parameter to specify tags which should not - * be stripped. - *

- * @return string The uncompressed and striped string, or FALSE on error. - */ -function gzgetss ($zp, $length, $allowable_tags = null) {} - -/** - * (PHP 4, PHP 5)
- * Binary-safe gz-file read - * @link http://php.net/manual/en/function.gzread.php - * @param resource $zp

- * The gz-file pointer. It must be valid, and must point to a file - * successfully opened by gzopen. - *

- * @param int $length

- * The number of bytes to read. - *

- * @return string The data that have been read. - */ -function gzread ($zp, $length) {} - -/** - * (PHP 4, PHP 5)
- * Open gz-file - * @link http://php.net/manual/en/function.gzopen.php - * @param string $filename

- * The file name. - *

- * @param string $mode

- * As in fopen (rb or - * wb) but can also include a compression level - * (wb9) or a strategy: f for - * filtered data as in wb6f, h for - * Huffman only compression as in wb1h. - * (See the description of deflateInit2 - * in zlib.h for - * more information about the strategy parameter.) - *

- * @param int $use_include_path [optional]

- * You can set this optional parameter to 1, if you - * want to search for the file in the include_path too. - *

- * @return resource a file pointer to the file opened, after that, everything you read - * from this file descriptor will be transparently decompressed and what you - * write gets compressed. - *

- *

- * If the open fails, the function returns FALSE. - */ -function gzopen ($filename, $mode, $use_include_path = 0) {} - -/** - * (PHP 4, PHP 5)
- * Output all remaining data on a gz-file pointer - * @link http://php.net/manual/en/function.gzpassthru.php - * @param resource $zp

- * The gz-file pointer. It must be valid, and must point to a file - * successfully opened by gzopen. - *

- * @return int The number of uncompressed characters read from gz - * and passed through to the input, or FALSE on error. - */ -function gzpassthru ($zp) {} - -/** - * (PHP 4, PHP 5)
- * Seek on a gz-file pointer - * @link http://php.net/manual/en/function.gzseek.php - * @param resource $zp

- * The gz-file pointer. It must be valid, and must point to a file - * successfully opened by gzopen. - *

- * @param int $offset

- * The seeked offset. - *

- * @param int $whence [optional]

- * whence values are: - * SEEK_SET - Set position equal to offset bytes. - * SEEK_CUR - Set position to current location plus offset. - *

- *

- * If whence is not specified, it is assumed to be - * SEEK_SET. - *

- * @return int Upon success, returns 0; otherwise, returns -1. Note that seeking - * past EOF is not considered an error. - */ -function gzseek ($zp, $offset, $whence = 'SEEK_SET') {} - -/** - * (PHP 4, PHP 5)
- * Tell gz-file pointer read/write position - * @link http://php.net/manual/en/function.gztell.php - * @param resource $zp

- * The gz-file pointer. It must be valid, and must point to a file - * successfully opened by gzopen. - *

- * @return int The position of the file pointer or FALSE if an error occurs. - */ -function gztell ($zp) {} - -/** - * (PHP 4, PHP 5)
- * Binary-safe gz-file write - * @link http://php.net/manual/en/function.gzwrite.php - * @param resource $zp

- * The gz-file pointer. It must be valid, and must point to a file - * successfully opened by gzopen. - *

- * @param string $string

- * The string to write. - *

- * @param int $length [optional]

- * The number of uncompressed bytes to write. If supplied, writing will - * stop after length (uncompressed) bytes have been - * written or the end of string is reached, - * whichever comes first. - *

- *

- * Note that if the length argument is given, - * then the magic_quotes_runtime - * configuration option will be ignored and no slashes will be - * stripped from string. - *

- * @return int the number of (uncompressed) bytes written to the given gz-file - * stream. - */ -function gzwrite ($zp, $string, $length = null) {} - -/** - * (PHP 4, PHP 5)
- * Alias of gzwrite - * @link http://php.net/manual/en/function.gzputs.php - * @param $fp - * @param $str - * @param $length [optional] - */ -function gzputs ($fp, $str, $length) {} - -/** - * (PHP 4, PHP 5)
- * Read entire gz-file into an array - * @link http://php.net/manual/en/function.gzfile.php - * @param string $filename

- * The file name. - *

- * @param int $use_include_path [optional]

- * You can set this optional parameter to 1, if you - * want to search for the file in the include_path too. - *

- * @return array An array containing the file, one line per cell. - */ -function gzfile ($filename, $use_include_path = 0) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Compress a string - * @link http://php.net/manual/en/function.gzcompress.php - * @param string $data

- * The data to compress. - *

- * @param int $level [optional]

- * The level of compression. Can be given as 0 for no compression up to 9 - * for maximum compression. - *

- *

- * If -1 is used, the default compression of the zlib library is used which is 6. - *

- * @return string The compressed string or FALSE if an error occurred. - */ -function gzcompress ($data, $level = -1) {} - -/** - * (PHP 4 >= 4.0.1, PHP 5)
- * Uncompress a compressed string - * @link http://php.net/manual/en/function.gzuncompress.php - * @param string $data

- * The data compressed by gzcompress. - *

- * @param int $length [optional]

- * The maximum length of data to decode. - *

- * @return string The original uncompressed data or FALSE on error. - *

- *

- * The function will return an error if the uncompressed data is more than - * 32768 times the length of the compressed input data - * or more than the optional parameter length. - */ -function gzuncompress ($data, $length = 0) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Deflate a string - * @link http://php.net/manual/en/function.gzdeflate.php - * @param string $data

- * The data to deflate. - *

- * @param int $level [optional]

- * The level of compression. Can be given as 0 for no compression up to 9 - * for maximum compression. If not given, the default compression level will - * be the default compression level of the zlib library. - *

- * @return string The deflated string or FALSE if an error occurred. - */ -function gzdeflate ($data, $level = -1) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Inflate a deflated string - * @link http://php.net/manual/en/function.gzinflate.php - * @param string $data

- * The data compressed by gzdeflate. - *

- * @param int $length [optional]

- * The maximum length of data to decode. - *

- * @return string The original uncompressed data or FALSE on error. - *

- *

- * The function will return an error if the uncompressed data is more than - * 32768 times the length of the compressed input data - * or more than the optional parameter length. - */ -function gzinflate ($data, $length = 0) {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * Create a gzip compressed string - * @link http://php.net/manual/en/function.gzencode.php - * @param string $data

- * The data to encode. - *

- * @param int $level [optional]

- * The level of compression. Can be given as 0 for no compression up to 9 - * for maximum compression. If not given, the default compression level will - * be the default compression level of the zlib library. - *

- * @param int $encoding_mode [optional]

- * The encoding mode. Can be FORCE_GZIP (the default) - * or FORCE_DEFLATE. - *

- *

- * Prior to PHP 5.4.0, using FORCE_DEFLATE results in - * a standard zlib deflated string (inclusive zlib headers) after a gzip - * file header but without the trailing crc32 checksum. - *

- *

- * In PHP 5.4.0 and later, FORCE_DEFLATE generates - * RFC 1950 compliant output, consisting of a zlib header, the deflated - * data, and an Adler checksum. - *

- * @return string The encoded string, or FALSE if an error occurred. - */ -function gzencode ($data, $level = -1, $encoding_mode = 'FORCE_GZIP') {} - -/** - * (No version information available, might only be in SVN)
- * Decodes a gzip compressed string - * @link http://php.net/manual/en/function.gzdecode.php - * @param string $data

- * The data to decode, encoded by gzencode. - *

- * @param int $length [optional]

- * The maximum length of data to decode. - *

- * @return string The decoded string, or FALSE if an error occurred. - */ -function gzdecode ($data, $length = null) {} - -/** - * (PHP 5 >= 5.4.0)
- * Compress data with the specified encoding - * @link http://php.net/manual/en/function.zlib-encode.php - * @param string $data

- *

- * @param string $encoding

- *

- * @param string $level [optional]

- *

- * @return string - */ -function zlib_encode ($data, $encoding, $level = -1) {} - -/** - * (PHP 5 >= 5.4.0)
- * Uncompress any raw/gzip/zlib encoded data - * @link http://php.net/manual/en/function.zlib-decode.php - * @param string $data

- *

- * @param string $max_decoded_len [optional]

- *

- * @return string - */ -function zlib_decode ($data, $max_decoded_len = null) {} - -/** - * (PHP 4 >= 4.3.2, PHP 5)
- * Returns the coding type used for output compression - * @link http://php.net/manual/en/function.zlib-get-coding-type.php - * @return string Possible return values are gzip, deflate, - * or FALSE. - */ -function zlib_get_coding_type () {} - -/** - * (PHP 4 >= 4.0.4, PHP 5)
- * ob_start callback function to gzip output buffer - * @link http://php.net/manual/en/function.ob-gzhandler.php - * @param string $buffer - * @param int $mode - * @return string - */ -function ob_gzhandler ($buffer, $mode) {} - -define ('FORCE_GZIP', 31); -define ('FORCE_DEFLATE', 15); -define ('ZLIB_ENCODING_RAW', -15); -define ('ZLIB_ENCODING_GZIP', 31); -define ('ZLIB_ENCODING_DEFLATE', 15); - -// End of zlib v.2.0 -?> diff --git a/table.php b/table.php deleted file mode 100644 index 46605d5..0000000 --- a/table.php +++ /dev/null @@ -1,232 +0,0 @@ -headers = $table['header']; - $this->rows = $table['rows']; - $this->crossingChar = '+'; - $this->horizontalBorderChar = '-'; - $this->verticalBorderChar = '|'; - $this->borderFormat = '%s'; - $this->cellHeaderFormat = '%s'; - $this->cellRowFormat = '%s'; - $this->paddingChar = ' '; - $this->padType = STR_PAD_RIGHT; - } - /** - * Renders table to output. - * - * Example: - * +---------------+-----------------------+------------------+ - * | ISBN | Title | Author | - * +---------------+-----------------------+------------------+ - * | 99921-58-10-7 | Divine Comedy | Dante Alighieri | - * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | - * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | - * +---------------+-----------------------+------------------+ - * - */ - public function render($out = true){ - if(!$this->rows) - exit('invalid table content'); - //获得表头行首 +---------------+-----------------------+------------------+ - $output = $this->renderRowSeparator(); - //获取头部输出| ISBN | Title | Author | - $output .= $this->renderRow($this->headers, $this->cellHeaderFormat); - //header存在的话再输出行分割符 - if ($this->headers) { - $output .= $this->renderRowSeparator(); - } - //渲染每一行 - foreach ($this->rows as $row) { - $output .= $this->renderRow($row, $this->cellRowFormat); - } - if ($this->rows) { - $output .= $this->renderRowSeparator(); - } - if($out){ - exit($output); - }else{ - $this->cleanup(); - return $output; - } - } - - //渲染表格行起始分割行 - private function renderRowSeparator(){ - if (0 === $count = $this->getNumberOfColumns()) { - return; - } - - $markup = $this->crossingChar; - for ($column = 0; $column < $count; $column++) { - $markup .= str_repeat($this->horizontalBorderChar, $this->getColumnWidth($column)) - .$this->crossingChar - ; - } - - return sprintf($this->borderFormat, $markup).PHP_EOL; - } - - /** - * 渲染表格行. - * - * Example: | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | - * - * @param array $row - * @param string $cellFormat - */ - private function renderRow(array $row, $cellFormat){ - if (empty($row)) { - return; - } - - $output = $this->renderColumnSeparator(); - for ($column = 0, $count = $this->getNumberOfColumns(); $column < $count; $column++) { - $output .= $this->renderCell($row, $column, $cellFormat); - $output .= $this->renderColumnSeparator(); - } - $output .= $this->writeln(''); - return $output; - } - - /** - * 带边距的渲染单元格. - * - * @param array $row - * @param integer $column - * @param string $cellFormat - */ - private function renderCell(array $row, $column, $cellFormat){ - $cell = isset($row[$column]) ? $row[$column] : ''; - return sprintf( - $cellFormat, - $this->str_pad( - $this->paddingChar.$cell.$this->paddingChar, - $this->getColumnWidth($column), - $this->paddingChar, - $this->padType - ) - ); - } - - /** - * 渲染水平列分隔符. - */ - private function renderColumnSeparator(){ - return(sprintf($this->borderFormat, $this->verticalBorderChar)); - } - - /** - * 获取表格的列数. - * - * @return int - */ - private function getNumberOfColumns() { - if (null !== $this->numberOfColumns) { - return $this->numberOfColumns; - } - - $columns = array(0); - $columns[] = count($this->headers); - foreach ($this->rows as $row) { - $columns[] = count($row); - } - - return $this->numberOfColumns = max($columns); - } - - /** - * 获取列宽. - * - * @param integer $column - * - * @return int - */ - private function getColumnWidth($column) { - if (isset($this->columnWidths[$column])) { - return $this->columnWidths[$column]; - } - - $lengths = array(0); - $lengths[] = $this->getCellWidth($this->headers, $column); - foreach ($this->rows as $row) { - $lengths[] = $this->getCellWidth($row, $column); - } - - return $this->columnWidths[$column] = max($lengths) + 2; - } - - /** - * 获取单元格宽度. - * - * @param array $row - * @param integer $column - * - * @return int - */ - private function getCellWidth(array $row, $column) { - if ($column < 0) { - return 0; - } - - if (isset($row[$column])) { - return $this->strlen($row[$column]); - } - - return $this->getCellWidth($row, $column - 1); - } - - /** - * Returns the length of a string, using mb_strlen if it is available. - * - * @param string $string The string to check its length - * - * @return integer The length of the string - */ - protected function strlen($string) { - // if (!function_exists('mb_strlen')) { - return (strlen($string) + mb_strlen($string,'UTF8')) / 2; - // } - - // if (false === $encoding = mb_detect_encoding($string)) { - // return strlen($string); - // } - - // return mb_strlen($string, $encoding); - } - - /** - * Called after rendering to cleanup cache data. - */ - private function cleanup(){ - $this->columnWidths = array(); - $this->numberOfColumns = null; - } - - public function writeln($line=''){ - return $line.PHP_EOL; - } - - public function str_pad($input , $pad_length ,$pad_string , $pad_type){ - $strlen = $this->strlen($input); - if($strlen < $pad_length){ - $difference = $pad_length - $strlen; - switch ($pad_type) { - case STR_PAD_RIGHT: - return $input . str_repeat($pad_string, $difference); - break; - case STR_PAD_LEFT: - return str_repeat($pad_string, $difference) . $input; - break; - default: - $left = $difference / 2; - $right = $difference - $left; - return str_repeat($pad_string, $left) . $input . str_repeat($pad_string, $right); - break; - } - }else{ - return $input; - } - } - } \ No newline at end of file diff --git a/thinkphp_database_queryer b/thinkphp_database_queryer deleted file mode 100644 index 7f3780a..0000000 --- a/thinkphp_database_queryer +++ /dev/null @@ -1,4 +0,0 @@ - -########################################################################## - -result to be display. diff --git a/tomd.php b/tomd.php deleted file mode 100644 index 4bc35e4..0000000 --- a/tomd.php +++ /dev/null @@ -1,444 +0,0 @@ - - - - - - - -GDB: The GNU Project Debugger - - - - - - [image of Archer
-Fish] - -

GDB: The GNU Project Debugger

- -
- -[bugs] -[GDB Maintainers] -[contributing] -[current cvs] -[documentation] -[download] -[home] -[irc] -[links] -[mailing lists] -[news] -[schedule] -[song] -[wiki] - -
- -

GDB: The GNU Project Debugger

- - - - - - -

What is GDB?

- -

GDB, the GNU Project debugger, allows you to see what is going on -`inside' another program while it executes -- or what another program -was doing at the moment it crashed. - -

GDB can do four main kinds of things (plus other things in support -of these) to help you catch bugs in the act: - -

- -The program being debugged can be written in Ada, C, C++, Objective-C, -Pascal (and many other languages). Those programs might be executing -on the same machine as GDB (native) or on another machine (remote). GDB -can run on most popular UNIX and Microsoft Windows variants.

- -

GDB version 7.6

- -Version 7.6 of GDB, the GNU -Debugger, is now available for download. See the ANNOUNCEMENT for details -including changes in this release.

- -An errata list (PROBLEMS) and documentation -are also available.

- -

FSF's Position regarding SCO's attacks on Free Software

- -

News

- -
- - - -
April 26th, 2013: GDB 7.6 Released!
-
-

The latest version of GDB, version 7.6, is available for download. -

-Changes in this release include: -

    -
  • New native configurations (ARM AArch64 GNU/Linux, FreeBSD/powerpc, - 86_64/Cygwin and Tilera TILE-Gx GNU/Linux) -
  • New target configurations (ARM AArch64, ARM AArch64 GNU/Linux, - Lynx 178 PowerPC, x86_64/Cygwin, and Tilera TILE-Gx GNU/Linux) -
  • Support for the "mini debuginfo" section, .gnu_debugdata -
  • The C++ ABI now defaults to the GNU v3 ABI -
  • More Python scripting improvements -
  • Some GDB/MI improvements -
  • New configure options, new commands, and options -
  • New remote packets -
  • A new "target record-btrace" has been added while the "target record" - command has been renamed to "target record-full" -
- -See the NEWS file for a more complete and detailed list of what this -release includes. -

-

- -
March 12th, 2013: GDB 7.6 branch created
-
-

The GDB 7.6 branch (gdb_7_6-branch) has been created. -To check out a copy of the branch use: -

-cvs -d :pserver:anoncvs@sourceware.org:/cvs/src co -r gdb_7_6-branch gdb
-
-

-

- -
January 9, 2012: Extensibility support using Guile
-
-

GDB ought to support extensibility using Guile, the GNU extensibility -package (an implementation of Scheme). We are looking for people to -write the code to interface the two. Please write to gdb-patches AT -sourceware DOT org if you are interested. -

-
- -
September 30, 2011: Release Mistakes in GDB Versions 6.0 - 7.3
-
-

A mistake has been detected in the release tar files for all -GDB releases from version 6.0 to version 7.3 (included). The mistake -has been corrected, and the FSF issued the following announcements: -

-

-

- -
Nov 28, 2006: Reversible Debugging
-
-

The GDB maintainers are looking for contributors interested -in reversible debugging. -

-
- -
- -Late breaking information, such as recently added features, can be -found in the NEWS file in the gdb source tree. Old announcements are in the -news archive. - - - -

- -
- -[bugs] -[GDB Maintainers] -[contributing] -[current cvs] -[documentation] -[download] -[home] -[irc] -[links] -[mailing lists] -[news] -[schedule] -[song] -[wiki] - -
- -
- -
- -

Please send FSF & GNU inquiries & questions to gnu@gnu.org. There are also other ways to -contact the FSF.

- -

This page is maintained by the GDB -developers.

- -

Copyright Free Software Foundation, Inc., 51 Franklin St - Fifth -Floor, Boston, MA 02110-1301 USA.

- -

Verbatim copying and distribution of this entire article is -permitted in any medium, provided this notice is preserved.

- -

Last modified 2013-04-26.

-
- - - -MD; - - -// $result = tomd($string); - -// header('Content-type:text/html;charset=utf-8'); -// echo "
";
-// echo ($result);
-// echo "
"; - -function tomd( $string ) { - - $string = preg_replace('/^\t+/m','',$string); - - $ELEMENTS = array( - array( - 'patterns' => 'p', - 'replacement' => function ( ) { - $params = func_get_args(); - $p = preg_replace('/^[\t\s]+/','',$params[2]); - return $p ? "\n\n".$p."\n" : ''; - } - ), - array( - 'patterns' => 'br', - 'type' => 'void', - 'replacement' => "\n", - ), - array( - 'patterns' => 'h([1-6])', - 'replacement' => function () { - $params= func_get_args(); - $hPrefix = ''; - for ( $i = 0; $i<$params[1]; $i++ ) { - $hPrefix .= '#'; - } - - $title = strtr($params[3],array( "\r\n"=>'' )); - $title = strtr($title,array( "\n"=>'' )); - $title = strtr($title,array( "\t"=>'' )); - $title = trim($title); - return "\n\n".$hPrefix.' '. $title ."\n"; - } - ), - array( - "patterns" => 'hr', - "type" => 'void', - "replacement" => "\n\n* * *\n" - ), - array( - "patterns" => 'a', - "replacement" => function () { - $params = func_get_args(); - preg_match( attrRegExp( 'href' ), $params[1], $href ); - preg_match( attrRegExp( 'title' ), $params[1], $title ); - - $text = strtr($params[2],array( "\r\n"=>'' )); - $text = strtr($text,array( "\n"=>'' )); - $text = strtr($text,array( "\t"=>'' )); - $text = trim($text); - - $content= strtr($params[0],array( "\r\n"=>'' )); - $content= strtr($content,array( "\n"=>'' )); - $content= strtr($content,array( "\t"=>'' )); - $content = trim($content); - - return $href ? '['.$text.']' - .'('.$href[1].($title && $title[1] ? ' "'.$title[1].'"' : '').')' : $content; - } - ), - array( - "patterns" => array( 'b', 'strong' ), - "replacement" => function () { - $params = func_get_args(); - return $params[2]? ' **'.$params[2].'** ' : ''; - } - ), - array( - "patterns" => array( 'i', 'em' ), - "replacement" => function () { - $params = func_get_args(); - return $params[2] ? ' _'.$params[2].'_ ' : ''; - } - ), - array( - "patterns" => 'code', - "replacement" => function ( ) { - $params = func_get_args(); - return $params[2] ? '`'.$params[2].'`' : ''; - } - ), - array( - "patterns" => 'img', - "type" => 'void', - "replacement" => function () { - $params = func_get_args(); - preg_match( attrRegExp( 'src' ), $params[1], $src ); - preg_match( attrRegExp( 'alt' ), $params[1], $alt ); - preg_match( attrRegExp( 'title' ), $params[1], $title ); - - return '!['.($alt && $alt[1] ? $alt[1] : '').']'.'('.$src[1].($title && $title[1] ? ' "'.$title[1].'"' : '').')'; - } - ), - ); - - for ( $i = 0, $len = count( $ELEMENTS ); $i<$len; $i++ ) { - if ( is_string( $ELEMENTS[$i]['patterns'] ) ) { - $string = replaceEls( $string, array( "tag" => $ELEMENTS[$i]['patterns'], - "replacement" => $ELEMENTS[$i]['replacement'], - "type" => $ELEMENTS[$i]['type'] - ) ); - } else { - for ( $j = 0, $pLen = count( $ELEMENTS[$i]['patterns'] ); $j<$pLen; $j++ ) { - $string = replaceEls( $string, array( "tag" => $ELEMENTS[$i]['patterns'][$j], - "replacement" => $ELEMENTS[$i]['replacement'], - "type" => $ELEMENTS[$i]['type'] - ) ); - } - } - } - - - // Pre code blocks - $string = preg_replace_callback( '{]*>`([\s\S\s]*?)`}i', function ( $match ) { - $match[1] = preg_replace( '/^\t+/m', ' ', $match[1] ); - $match[1] = preg_replace( '/\n/m', "\n ", $match[1] ); - return "\n\n ".$match[1]."\n"; - }, $string ); - // Lists - // Escape numbers that could trigger an ol - // If there are more than three spaces before the code, it would be in a pre tag - // Make sure we are escaping the period not matching any character - $string = preg_replace( '{^(\s{0,3}\d+)\. }', '$1. ', $string ); - // Converts lists that have no child lists (of same type) first, then works it's way up - $noChildrenRegex = '{<(ul|ol)\b[^>]*>(?:(?!}i'; - while ( preg_match( $noChildrenRegex, $string ) ) { - $string = preg_replace_callback( $noChildrenRegex, function ( $str ) { - return replaceLists( $str[0] ); - }, $string ); - } - - // Blockquotes - $deepest = '{]*>((?:(?!}i'; - while ( preg_match( $deepest, $string ) ) { - $string = preg_replace_callback( $deepest, function ( $match ) { - return replaceBlockquotes( $match[0] ); - }, $string ); - } - - - return cleanUp( $string ); -} - -function replaceEls( $html, $elProperties ) { - $pattern = $elProperties['type']==='void' - ? '<'.$elProperties['tag'].'\b([^>]*)/?>' : '<'.$elProperties['tag'].'\b([^>]*)>([\s\S]*?)'; - $regex = '{'.$pattern.'}mi'; - if ( is_string( $elProperties['replacement'] ) ) { - $markdown = preg_replace( $regex, $elProperties['replacement'], $html ); - } else { - $GLOBALS['func'] = $elProperties['replacement']; - $markdown = preg_replace_callback( $regex, function ( $match ) { - return $GLOBALS['func']($match[0], $match[1], $match[2], $match[3]); - }, $html ); - } - return $markdown; -} - -function attrRegExp( $attr ) { - return '/'.$attr.'\s*=\s*["\']?([^"\']*)["\']?'.'/i'; -} - -function cleanUp( $string ) { - $string = preg_replace( '/^[\t\r\n]+|[\t\r\n]+$/', '', $string ); - $string = preg_replace( '/\n\s+\n/', "\n\n", $string ); - $string = preg_replace( '/\n{3,}/', "\n\n", $string ); - - return $string; -} - -function replaceBlockquotes( $html ) { - $html = preg_replace_callback( '{]*>([\s\S]*?)}i', function ( $match ) { - $match[1] = preg_replace( '/^\s+|\s+$/', '', $match[1] ); - $match[1] = cleanUp( $match[1] ); - $match[1] = preg_replace( '/^/m', '> ', $match[1] ); - $match[1] = preg_replace( '/^(>([ \t]{2,}>)+)/m', '>>', $match[1] ); - - return $match[1]; - }, $html ); - - return $html; -} - -function replaceLists( $html ) { - $html = preg_replace_callback( '{<(ul|ol)\b[^>]*>([\s\S]*?)}i', function ( $match) { - $lis = explode( '', $match[2] ); - array_splice( $lis, count( $lis )-1, 1 ); - for ( $i = 0, $len = count( $lis ); $i<$len; $i++ ) { - if ( $lis[$i] ) { - $GLOBALS['prefix'] = ($match[1]==='ol') ? ($i+ 1).". " : "* "; - $lis[$i] = preg_replace_callback( '/\s*]*>([\s\S]*)/i', function ( $innerHTML ) { - $innerHTML[1] = preg_replace( '/^\s+/', '', $innerHTML[1] ); - $innerHTML[1] = preg_replace( '/\n\n/', "\n\n ", $innerHTML[1] ); - // indent nested lists - $innerHTML[1] = preg_replace( '/\n([ ]*)+(\*|\d+\.) /', "\n$1 $2 ", $innerHTML[1] ); - - return $GLOBALS['prefix'].$innerHTML[1]; - }, $lis[$i] ); - } - } - - return implode( "\n", $lis ); - }, $html ); - - return "\n\n".preg_replace( '/[ \t]+\n|\s+$/', '', $html ); -} diff --git a/tp5/.gitignore b/tp5/.gitignore new file mode 100644 index 0000000..7846e89 --- /dev/null +++ b/tp5/.gitignore @@ -0,0 +1,4 @@ +.idea +composer.lock +*.log +thinkphp diff --git a/tp5/.travis.yml b/tp5/.travis.yml new file mode 100644 index 0000000..36f7b6f --- /dev/null +++ b/tp5/.travis.yml @@ -0,0 +1,42 @@ +sudo: false + +language: php + +branches: + only: + - stable + +cache: + directories: + - $HOME/.composer/cache + +before_install: + - composer self-update + +install: + - composer install --no-dev --no-interaction --ignore-platform-reqs + - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip . + - composer require --update-no-dev --no-interaction "topthink/think-image:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0" + - composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0" + - composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0" + - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip . + +script: + - php think unit + +deploy: + provider: releases + api_key: + secure: TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw= + file: + - ThinkPHP_Core.zip + - ThinkPHP_Full.zip + skip_cleanup: true + on: + tags: true diff --git a/tp5/LICENSE.txt b/tp5/LICENSE.txt new file mode 100644 index 0000000..574a39c --- /dev/null +++ b/tp5/LICENSE.txt @@ -0,0 +1,32 @@ + +ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 +版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn) +All rights reserved。 +ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 + +Apache Licence是著名的非盈利开源组织Apache采用的协议。 +该协议和BSD类似,鼓励代码共享和尊重原作者的著作权, +允许代码修改,再作为开源或商业软件发布。需要满足 +的条件: +1. 需要给代码的用户一份Apache Licence ; +2. 如果你修改了代码,需要在被修改的文件中说明; +3. 在延伸的代码中(修改和有源代码衍生的代码中)需要 +带有原来代码中的协议,商标,专利声明和其他原来作者规 +定需要包含的说明; +4. 如果再发布的产品中包含一个Notice文件,则在Notice文 +件中需要带有本协议内容。你可以在Notice中增加自己的 +许可,但不可以表现为对Apache Licence构成更改。 +具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0 + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"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 THE +COPYRIGHT OWNER OR 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. diff --git a/tp5/README.md b/tp5/README.md new file mode 100644 index 0000000..acf2d0c --- /dev/null +++ b/tp5/README.md @@ -0,0 +1,155 @@ +ThinkPHP 5.1 +=============== + +ThinkPHP5.1对底层架构做了进一步的改进,减少依赖,其主要特性包括: + + + 采用容器统一管理对象 + + 支持Facade + + 注解路由支持 + + 路由跨域请求支持 + + 配置和路由目录独立 + + 取消系统常量 + + 助手函数增强 + + 类库别名机制 + + 增加条件查询 + + 改进查询机制 + + 配置采用二级 + + 依赖注入完善 + + +> ThinkPHP5的运行环境要求PHP5.6以上。 + + +## 目录结构 + +初始的目录结构如下: + +~~~ +www WEB部署目录(或者子目录) +├─application 应用目录 +│ ├─common 公共模块目录(可以更改) +│ ├─module_name 模块目录 +│ │ ├─common.php 模块函数文件 +│ │ ├─controller 控制器目录 +│ │ ├─model 模型目录 +│ │ ├─view 视图目录 +│ │ └─ ... 更多类库目录 +│ │ +│ ├─command.php 命令行定义文件 +│ ├─common.php 公共函数文件 +│ └─tags.php 应用行为扩展定义文件 +│ +├─config 应用配置目录 +│ ├─module_name 模块配置目录 +│ │ ├─database.php 数据库配置 +│ │ ├─cache 缓存配置 +│ │ └─ ... +│ │ +│ ├─app.php 应用配置 +│ ├─cache.php 缓存配置 +│ ├─cookie.php Cookie配置 +│ ├─database.php 数据库配置 +│ ├─log.php 日志配置 +│ ├─session.php Session配置 +│ ├─template.php 模板引擎配置 +│ └─trace.php Trace配置 +│ +├─route 路由定义目录 +│ ├─route.php 路由定义 +│ └─... 更多 +│ +├─public WEB目录(对外访问目录) +│ ├─index.php 入口文件 +│ ├─router.php 快速测试文件 +│ └─.htaccess 用于apache的重写 +│ +├─thinkphp 框架系统目录 +│ ├─lang 语言文件目录 +│ ├─library 框架类库目录 +│ │ ├─think Think类库包目录 +│ │ └─traits 系统Trait目录 +│ │ +│ ├─tpl 系统模板目录 +│ ├─base.php 基础定义文件 +│ ├─console.php 控制台入口文件 +│ ├─convention.php 框架惯例配置文件 +│ ├─helper.php 助手函数文件 +│ ├─phpunit.xml phpunit配置文件 +│ └─start.php 框架入口文件 +│ +├─extend 扩展类库目录 +├─runtime 应用的运行时目录(可写,可定制) +├─vendor 第三方类库目录(Composer依赖库) +├─build.php 自动生成定义文件(参考) +├─composer.json composer 定义文件 +├─LICENSE.txt 授权说明文件 +├─README.md README 文件 +├─think 命令行入口文件 +~~~ + +> router.php用于php自带webserver支持,可用于快速测试 +> 切换到public目录后,启动命令:php -S localhost:8888 router.php +> 上面的目录结构和名称是可以改变的,这取决于你的入口文件和配置参数。 + +## 升级指导 + +原有下面系统类库的命名空间需要调整: + +* think\App => think\facade\App (或者 App ) +* think\Cache => think\facade\Cache (或者 Cache ) +* think\Config => think\facade\Config (或者 Config ) +* think\Cookie => think\facade\Cookie (或者 Cookie ) +* think\Debug => think\facade\Debug (或者 Debug ) +* think\Hook => think\facade\Hook (或者 Hook ) +* think\Lang => think\facade\Lang (或者 Lang ) +* think\Log => think\facade\Log (或者 Log ) +* think\Request => think\facade\Request (或者 Request ) +* think\Response => think\facade\Reponse (或者 Reponse ) +* think\Route => think\facade\Route (或者 Route ) +* think\Session => think\facade\Session (或者 Session ) +* think\Url => think\facade\Url (或者 Url ) + +原有的配置文件config.php 拆分为app.php cache.php 等独立配置文件 放入config目录。 +原有的路由定义文件route.php 移动到route目录 + +## 命名规范 + +`ThinkPHP5`遵循PSR-2命名规范和PSR-4自动加载规范,并且注意如下规范: + +### 目录和文件 + +* 目录不强制规范,驼峰和小写+下划线模式均支持; +* 类库、函数文件统一以`.php`为后缀; +* 类的文件名均以命名空间定义,并且命名空间的路径和类库文件所在路径一致; +* 类名和类文件名保持一致,统一采用驼峰法命名(首字母大写); + +### 函数和类、属性命名 +* 类的命名采用驼峰法,并且首字母大写,例如 `User`、`UserType`,默认不需要添加后缀,例如`UserController`应该直接命名为`User`; +* 函数的命名使用小写字母和下划线(小写字母开头)的方式,例如 `get_client_ip`; +* 方法的命名使用驼峰法,并且首字母小写,例如 `getUserName`; +* 属性的命名使用驼峰法,并且首字母小写,例如 `tableName`、`instance`; +* 以双下划线“__”打头的函数或方法作为魔法方法,例如 `__call` 和 `__autoload`; + +### 常量和配置 +* 常量以大写字母和下划线命名,例如 `APP_PATH`和 `THINK_PATH`; +* 配置参数以小写字母和下划线命名,例如 `url_route_on` 和`url_convert`; + +### 数据表和字段 +* 数据表和字段采用小写加下划线方式命名,并注意字段名不要以下划线开头,例如 `think_user` 表和 `user_name`字段,不建议使用驼峰和中文作为数据表字段命名。 + +## 参与开发 +请参阅 [ThinkPHP5 核心框架包](https://github.com/top-think/framework)。 + +## 版权信息 + +ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 + +本项目包含的第三方源码和二进制文件之版权信息另行标注。 + +版权所有Copyright © 2006-2018 by ThinkPHP (http://thinkphp.cn) + +All rights reserved。 + +ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 + +更多细节参阅 [LICENSE.txt](LICENSE.txt) diff --git a/tp5/application/.htaccess b/tp5/application/.htaccess new file mode 100644 index 0000000..3418e55 --- /dev/null +++ b/tp5/application/.htaccess @@ -0,0 +1 @@ +deny from all \ No newline at end of file diff --git a/tp5/application/command.php b/tp5/application/command.php new file mode 100644 index 0000000..826bb2b --- /dev/null +++ b/tp5/application/command.php @@ -0,0 +1,12 @@ + +// +---------------------------------------------------------------------- + +return []; diff --git a/tp5/application/common.php b/tp5/application/common.php new file mode 100644 index 0000000..76f2b84 --- /dev/null +++ b/tp5/application/common.php @@ -0,0 +1,64 @@ + +// +---------------------------------------------------------------------- + +// 应用公共文件 + +/** ++---------------------------------------------------------- + * 字符串命名风格转换 + * type + * =0 将Java风格转换为C的风格 + * =1 将C风格转换为Java的风格 ++---------------------------------------------------------- + * @access protected ++---------------------------------------------------------- + * @param string $name 字符串 + * @param integer $type 转换类型 ++---------------------------------------------------------- + * @return string ++---------------------------------------------------------- + */ +function parse_name($name, $type = 0) +{ + if ($type) { + return ucfirst(preg_replace("/_([a-zA-Z])/e", "strtoupper('\\1')", $name)); + } else { + return strtolower(trim(preg_replace("/[A-Z]/", "_\\0", $name), "_")); + } +} + +function make_request($url, $param = array(), $httpMethod = 'GET') +{ + $oCurl = curl_init(); + if (stripos($url, "https://") !== false) { + curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, false); + } + + if ($httpMethod == 'GET') { + curl_setopt($oCurl, CURLOPT_URL, $url . "?" . http_build_query($param)); + curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1); + } else { + curl_setopt($oCurl, CURLOPT_URL, $url); + curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($oCurl, CURLOPT_POST, 1); + curl_setopt($oCurl, CURLOPT_POSTFIELDS, http_build_query($param)); + } + + $sContent = curl_exec($oCurl); + $aStatus = curl_getinfo($oCurl); + curl_close($oCurl); + if (intval($aStatus["http_code"]) == 200) { + return $sContent; + } else { + return false; + } +} diff --git a/tp5/application/index/controller/Database.php b/tp5/application/index/controller/Database.php new file mode 100644 index 0000000..3e41bd3 --- /dev/null +++ b/tp5/application/index/controller/Database.php @@ -0,0 +1,168 @@ + 1, + 'info' => $info, + 'time' => date($this->date_format, $_SERVER['REQUEST_TIME']), + 'data' => $data, + 'ttfb_time' => debug('api_begin', 'api_end', 6) . 's', + ]; + return $data; + } + + public function error($info, $data = []) + { + config('default_return_type', 'json'); + debug('api_end'); + $data = [ + 'status' => 0, + 'info' => $info, + 'time' => date($this->date_format, $_SERVER['REQUEST_TIME']), + 'data' => $data, + 'ttfb_time' => debug('api_begin', 'api_end', 6) . 's', + ]; + return $data; + } + + // 设置当前数据库配置 + public function set_current($id) + { + $ret = Databases::setCurrent($id); + if($ret === false){ + return $this->error('切换失败'); + }else{ + return $this->success('切换成功'); + } + } + + // 获取所有配置过的数据库 + public function get_all_databases(){ + $list = Databases::column('id, id,current,title,db_host,db_user,db_pwd,db_port,db_name,db_prefix'); + $add_db = [0=>['title'=>'add_database','current'=>0]]; + if($list){ + $list = $list + $add_db; + }else{ + $list = $add_db; + } + foreach ($list as $key => &$value) { + if($value['current']){ + $value['title'] = '[*]'.$value['title']; + } + } + return $this->success('success', $list); + } + + // 连接数据库 + public function connect_db($return_arr = false){ + $conf = Databases::where('current', 1)->find(); + $link = [ + // 数据库类型 + 'type' => 'mysql', + // 数据库连接DSN配置 + 'dsn' => '', + // 服务器地址 + 'hostname' => $conf['db_host'], + // 数据库名 + 'database' => $conf['db_name'], + // 数据库用户名 + 'username' => $conf['db_user'], + // 数据库密码 + 'password' => $conf['db_pwd'], + // 数据库连接端口 + 'hostport' => $conf['db_port'], + // 数据库连接参数 + 'params' => [], + // 数据库编码默认采用utf8 + 'charset' => 'utf8', + // 数据库表前缀 + 'prefix' => $conf['prefix'], + ]; + $conn = Db::connect($link); + $conn->query('SELECT VERSION();'); + return $conn; + } + + // 显示列 + public function show_colums($table){ + try { + $db = $this->connect_db(); + if (empty($db)) { + return '尚未配置数据库'; + } + } catch (\Exception $e) { + return $e->getMessage(); + } + + $table = $db->getTable($table); + $result = $db->query("SHOW FULL COLUMNS FROM {$table}"); + if (!$result) { + return $this->error(mysql_error()); + } else { + while ($row = mysql_fetch_assoc($result)) { + $res[] = $row; + } + return $this->success('query success', $res); + } + } + + // 执行sql + public function query(){ + error_reporting(7); + $table_queryer_file = PACKAGE_PATH. 'ThinkPHP-Queryer'; + $content = file_get_contents($table_queryer_file); + $sep = '##########################################################################'; + $arr_content = split($sep, $content); + $sql = trim($arr_content[0]); + try{ + $db = $this->connect_db(); + if (empty($db)) { + return '尚未配置数据库'; + } + }catch(\Exception $e){ + return $e->getMessage(); + } + $result = $db->query($sql); + $rows = array(); + if ($result) { + $i = 0; + foreach ($result as $key => $row) { + if ($key == 0) { + $header = array_keys($row); + } + + $i++; + $rows[] = array_values($row); + } + } + require PACKAGE_PATH . 'table.php'; + $in = array( + 'header' => $header ? $header : [], + 'rows' => $rows, + ); + // file_put_contents('./', data); + file_put_contents(PACKAGE_PATH.'debug.php', (var_export($in, 1))); + if ($rows) { + $table = new \table($in); + $output = $table->render(0); + } + if (!$output) { + $output = 'No results!'; + } + return $output; + } +} diff --git a/tp5/application/index/controller/Index.php b/tp5/application/index/controller/Index.php new file mode 100644 index 0000000..fbdc45e --- /dev/null +++ b/tp5/application/index/controller/Index.php @@ -0,0 +1,40 @@ +*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }

:) 2018新年快乐

ThinkPHP V5.1
12载初心不改(2006-2018) - 你值得信赖的PHP框架

'; + } + + public function hello($name = 'ThinkPHP5') + { + return 'hello,' . $name; + } + + public function build_completion(){ + $classes = $this->getAllUserClasses(); + $stb = new SublimeSnippetBuilder($classes); + $stb->buildAll(PACKAGE_PATH.'php.sublime-completions'); + return '生成php完成成功!'.PHP_EOL; + } + + // 获取全部用户定义的类 + public function getAllUserClasses(){ + $all_class = get_declared_classes(); + $ret = []; + foreach ($all_class as $class) { + $rf = new \ReflectionClass($class); + if(false == $rf->isInternal()){ + if('app\index\controller\Index' == $class){ + continue; + } + $ret[] = $class; + } + } + return $ret; + } +} diff --git a/tp5/application/index/model/Databases.php b/tp5/application/index/model/Databases.php new file mode 100644 index 0000000..c1ea994 --- /dev/null +++ b/tp5/application/index/model/Databases.php @@ -0,0 +1,21 @@ +update(['current'=>0]); + self::update(['id'=>$id, 'current'=>1]); + return true; + }catch(\Exception $e){ + self::$error = $e->getMessage(); + return false; + } + } +} diff --git a/tp5/application/tags.php b/tp5/application/tags.php new file mode 100644 index 0000000..4b18d10 --- /dev/null +++ b/tp5/application/tags.php @@ -0,0 +1,28 @@ + +// +---------------------------------------------------------------------- + +// 应用行为扩展定义文件 +return [ + // 应用初始化 + 'app_init' => [], + // 应用开始 + 'app_begin' => [], + // 模块初始化 + 'module_init' => [], + // 操作开始执行 + 'action_begin' => [], + // 视图内容过滤 + 'view_filter' => [], + // 日志写入 + 'log_write' => [], + // 应用结束 + 'app_end' => [], +]; diff --git a/tp5/build.php b/tp5/build.php new file mode 100644 index 0000000..34ba3c8 --- /dev/null +++ b/tp5/build.php @@ -0,0 +1,26 @@ + +// +---------------------------------------------------------------------- + +return [ + // 生成应用公共文件 + '__file__' => ['common.php'], + + // 定义demo模块的自动生成 (按照实际定义的文件名生成) + 'demo' => [ + '__file__' => ['common.php'], + '__dir__' => ['behavior', 'controller', 'model', 'view'], + 'controller' => ['Index', 'Test', 'UserType'], + 'model' => ['User', 'UserType'], + 'view' => ['index/index'], + ], + + // 其他更多的模块定义 +]; diff --git a/tp5/composer.json b/tp5/composer.json new file mode 100644 index 0000000..b964618 --- /dev/null +++ b/tp5/composer.json @@ -0,0 +1,34 @@ +{ + "name": "topthink/think", + "description": "the new thinkphp framework", + "type": "project", + "keywords": [ + "framework", + "thinkphp", + "ORM" + ], + "homepage": "http://thinkphp.cn/", + "license": "Apache-2.0", + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + } + ], + "require": { + "php": ">=5.6.0", + "topthink/framework": "5.1.*", + "topthink/think-migration": "^2.0" + }, + "autoload": { + "psr-4": { + "app\\": "application" + } + }, + "extra": { + "think-path": "thinkphp" + }, + "config": { + "preferred-install": "dist" + } +} diff --git a/tp5/config/app.php b/tp5/config/app.php new file mode 100644 index 0000000..a0d12e3 --- /dev/null +++ b/tp5/config/app.php @@ -0,0 +1,119 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | 应用设置 +// +---------------------------------------------------------------------- + +return [ + + // 应用调试模式 + 'app_debug' => true, + // 应用Trace + 'app_trace' => false, + // 应用模式状态 + 'app_status' => '', + // 是否支持多模块 + 'app_multi_module' => true, + // 入口自动绑定模块 + 'auto_bind_module' => false, + // 注册的根命名空间 + 'root_namespace' => [], + // 默认输出类型 + 'default_return_type' => 'html', + // 默认AJAX 数据返回格式,可选json xml ... + 'default_ajax_return' => 'json', + // 默认JSONP格式返回的处理方法 + 'default_jsonp_handler' => 'jsonpReturn', + // 默认JSONP处理方法 + 'var_jsonp_handler' => 'callback', + // 默认时区 + 'default_timezone' => 'PRC', + // 是否开启多语言 + 'lang_switch_on' => false, + // 默认全局过滤方法 用逗号分隔多个 + 'default_filter' => '', + // 默认语言 + 'default_lang' => 'zh-cn', + // 应用类库后缀 + 'class_suffix' => false, + // 控制器类后缀 + 'controller_suffix' => false, + + // 默认模块名 + 'default_module' => 'index', + // 禁止访问模块 + 'deny_module_list' => ['common'], + // 默认控制器名 + 'default_controller' => 'Index', + // 默认操作名 + 'default_action' => 'index', + // 默认验证器 + 'default_validate' => '', + // 默认的空控制器名 + 'empty_controller' => 'Error', + // 操作方法后缀 + 'action_suffix' => '', + // 自动搜索控制器 + 'controller_auto_search' => false, + + // PATHINFO变量名 用于兼容模式 + 'var_pathinfo' => 's', + // 兼容PATH_INFO获取 + 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], + // pathinfo分隔符 + 'pathinfo_depr' => '/', + // URL伪静态后缀 + 'url_html_suffix' => 'html', + // URL普通方式参数 用于自动生成 + 'url_common_param' => false, + // URL参数方式 0 按名称成对解析 1 按顺序解析 + 'url_param_type' => 0, + // 路由使用完整匹配 + 'route_complete_match' => false, + // 是否强制使用路由 + 'url_route_must' => false, + // 使用注解路由 + 'route_annotation' => false, + // 域名根,如thinkphp.cn + 'url_domain_root' => '', + // 是否自动转换URL中的控制器和操作名 + 'url_convert' => true, + // 默认的访问控制器层 + 'url_controller_layer' => 'controller', + // 表单请求类型伪装变量 + 'var_method' => '_method', + // 表单ajax伪装变量 + 'var_ajax' => '_ajax', + // 表单pjax伪装变量 + 'var_pjax' => '_pjax', + // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 + 'request_cache' => false, + // 请求缓存有效期 + 'request_cache_expire' => null, + // 全局请求缓存排除规则 + 'request_cache_except' => [], + + // 默认跳转页面对应的模板文件 + 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', + 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', + + // 异常页面的模板文件 + 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', + + // 错误显示信息,非调试模式有效 + 'error_message' => '页面错误!请稍后再试~', + // 显示错误信息 + 'show_error_msg' => false, + // 异常处理handle类 留空使用 \think\exception\Handle + 'exception_handle' => '', + +]; diff --git a/tp5/config/cache.php b/tp5/config/cache.php new file mode 100644 index 0000000..985dbb1 --- /dev/null +++ b/tp5/config/cache.php @@ -0,0 +1,25 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | 缓存设置 +// +---------------------------------------------------------------------- + +return [ + // 驱动方式 + 'type' => 'File', + // 缓存保存目录 + 'path' => '', + // 缓存前缀 + 'prefix' => '', + // 缓存有效期 0表示永久缓存 + 'expire' => 0, +]; diff --git a/tp5/config/cookie.php b/tp5/config/cookie.php new file mode 100644 index 0000000..1de0708 --- /dev/null +++ b/tp5/config/cookie.php @@ -0,0 +1,30 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | Cookie设置 +// +---------------------------------------------------------------------- +return [ + // cookie 名称前缀 + 'prefix' => '', + // cookie 保存时间 + 'expire' => 0, + // cookie 保存路径 + 'path' => '/', + // cookie 有效域名 + 'domain' => '', + // cookie 启用安全传输 + 'secure' => false, + // httponly设置 + 'httponly' => '', + // 是否使用 setcookie + 'setcookie' => true, +]; diff --git a/tp5/config/database.php b/tp5/config/database.php new file mode 100644 index 0000000..7d1bfcf --- /dev/null +++ b/tp5/config/database.php @@ -0,0 +1,57 @@ + +// +---------------------------------------------------------------------- + +use think\facade\Env; + +return [ + // 数据库类型 + 'type' => 'sqlite', + // 服务器地址 + 'hostname' => '127.0.0.1', + // 数据库名 + 'database' => '', + // 用户名 + 'username' => 'root', + // 密码 + 'password' => '', + // 端口 + 'hostport' => '', + // 连接dsn + 'dsn' => 'sqlite:'.Env::get('app_path').'../../st.sqlite3', + // 数据库连接参数 + 'params' => [], + // 数据库编码默认采用utf8 + 'charset' => 'utf8', + // 数据库表前缀 + 'prefix' => 'st_', + // 数据库调试模式 + 'debug' => true, + // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) + 'deploy' => 0, + // 数据库读写是否分离 主从式有效 + 'rw_separate' => false, + // 读写分离后 主服务器数量 + 'master_num' => 1, + // 指定从服务器序号 + 'slave_no' => '', + // 是否严格检查字段是否存在 + 'fields_strict' => true, + // 数据集返回类型 + 'resultset_type' => 'array', + // 自动写入时间戳字段 + 'auto_timestamp' => false, + // 时间字段取出后的默认时间格式 + 'datetime_format' => 'Y-m-d H:i:s', + // 是否需要进行SQL性能分析 + 'sql_explain' => false, + // Query类 + 'query' => '\\think\\db\\Query', +]; diff --git a/tp5/config/log.php b/tp5/config/log.php new file mode 100644 index 0000000..54e81ba --- /dev/null +++ b/tp5/config/log.php @@ -0,0 +1,22 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | 日志设置 +// +---------------------------------------------------------------------- +return [ + // 日志记录方式,内置 file socket 支持扩展 + 'type' => 'File', + // 日志保存目录 + 'path' => '', + // 日志记录级别 + 'level' => [], +]; diff --git a/tp5/config/session.php b/tp5/config/session.php new file mode 100644 index 0000000..1d7b6c6 --- /dev/null +++ b/tp5/config/session.php @@ -0,0 +1,26 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | 会话设置 +// +---------------------------------------------------------------------- + +return [ + 'id' => '', + // SESSION_ID的提交变量,解决flash上传跨域 + 'var_session_id' => '', + // SESSION 前缀 + 'prefix' => 'think', + // 驱动方式 支持redis memcache memcached + 'type' => '', + // 是否自动开启 SESSION + 'auto_start' => true, +]; diff --git a/tp5/config/template.php b/tp5/config/template.php new file mode 100644 index 0000000..0877562 --- /dev/null +++ b/tp5/config/template.php @@ -0,0 +1,33 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | 模板设置 +// +---------------------------------------------------------------------- + +return [ + // 模板引擎类型 支持 php think 支持扩展 + 'type' => 'Think', + // 模板路径 + 'view_path' => '', + // 模板后缀 + 'view_suffix' => 'html', + // 模板文件名分隔符 + 'view_depr' => DIRECTORY_SEPARATOR, + // 模板引擎普通标签开始标记 + 'tpl_begin' => '{', + // 模板引擎普通标签结束标记 + 'tpl_end' => '}', + // 标签库标签开始标记 + 'taglib_begin' => '{', + // 标签库标签结束标记 + 'taglib_end' => '}', +]; diff --git a/tp5/config/trace.php b/tp5/config/trace.php new file mode 100644 index 0000000..425d301 --- /dev/null +++ b/tp5/config/trace.php @@ -0,0 +1,18 @@ + +// +---------------------------------------------------------------------- + +// +---------------------------------------------------------------------- +// | Trace设置 开启 app_trace 后 有效 +// +---------------------------------------------------------------------- +return [ + // 内置Html Console 支持扩展 + 'type' => 'Html', +]; diff --git a/tp5/database/migrations/20180131082615_databases.php b/tp5/database/migrations/20180131082615_databases.php new file mode 100644 index 0000000..bf57372 --- /dev/null +++ b/tp5/database/migrations/20180131082615_databases.php @@ -0,0 +1,44 @@ +table('databases'); + $table + ->addColumn('title', 'string', ['limit' => 32, 'default' => '', 'comment' => '连接名']) + ->addColumn('current', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '是否当前使用']) + ->addColumn('db_host', 'string', ['limit' => 32, 'default' => '', 'comment' => 'DB_HOST']) + ->addColumn('db_user', 'string', ['limit' => 32, 'default' => '', 'comment' => 'DB_USER']) + ->addColumn('db_pwd', 'string', ['limit' => 32, 'default' => '', 'comment' => 'DB_PWD']) + ->addColumn('db_name', 'string', ['limit' => 32, 'default' => '', 'comment' => 'DB_NAME']) + ->addColumn('db_prefix', 'string', ['default' => '', 'comment' => 'DB_PREFIX']) + ->addColumn('db_port', 'integer', ['limit' => 5, 'default' => '', 'comment' => 'DB_PORT']) + ->create(); + } +} diff --git a/tp5/database/migrations/20180131093254_databases_delete.php b/tp5/database/migrations/20180131093254_databases_delete.php new file mode 100644 index 0000000..bdb6313 --- /dev/null +++ b/tp5/database/migrations/20180131093254_databases_delete.php @@ -0,0 +1,41 @@ +dropTable('databases'); + } +} diff --git a/tp5/database/migrations/20180131093948_databases_re_create.php b/tp5/database/migrations/20180131093948_databases_re_create.php new file mode 100644 index 0000000..6e5ebf2 --- /dev/null +++ b/tp5/database/migrations/20180131093948_databases_re_create.php @@ -0,0 +1,45 @@ +table('databases'); + $table + ->addColumn('title', 'string', ['limit' => 32, 'default' => '', 'comment' => '连接名']) + ->addColumn('current', 'integer', ['limit' => 1, 'default' => 0, 'comment' => '是否当前使用']) + ->addColumn('db_host', 'string', ['limit' => 32, 'default' => '', 'comment' => 'DB_HOST']) + ->addColumn('db_user', 'string', ['limit' => 32, 'default' => '', 'comment' => 'DB_USER']) + ->addColumn('db_pwd', 'string', ['limit' => 32, 'default' => '', 'comment' => 'DB_PWD']) + ->addColumn('db_name', 'string', ['limit' => 32, 'default' => '', 'comment' => 'DB_NAME']) + ->addColumn('db_prefix', 'string', ['default' => '', 'comment' => 'DB_PREFIX']) + ->addColumn('db_port', 'integer', ['limit' => 5, 'default' => '', 'comment' => 'DB_PORT']) + ->create(); + } +} diff --git a/tp5/database/seeds/DatabasesAdd.php b/tp5/database/seeds/DatabasesAdd.php new file mode 100644 index 0000000..c97446c --- /dev/null +++ b/tp5/database/seeds/DatabasesAdd.php @@ -0,0 +1,35 @@ + 'localhost', + 'current' => 0, + 'db_host' => '127.0.0.1', + 'db_user' => 'root', + 'db_pwd' => 'root', + 'db_name' => 'test', + 'db_prefix' => '', + 'db_port' => '3306', + ], + ]; + + $posts = $this->table('databases'); + $posts->insert($data) + ->save(); + + } +} diff --git a/tp5/extend/util/ClassMethodExtractor.php b/tp5/extend/util/ClassMethodExtractor.php new file mode 100644 index 0000000..faabdfe --- /dev/null +++ b/tp5/extend/util/ClassMethodExtractor.php @@ -0,0 +1,192 @@ + $className) { + $class = new \ReflectionClass($className); + $key = $class->getShortName(); + // dump($key); + $outputs[$key] = $this->getClassAnnotation($class); + } + return $outputs; + } + + // 将通用的类的信息数组转为速查表所需要的格式字段 name,content + public function parseChapter($classes) + { + $ret = []; + foreach ($classes as $class_name => $class) { + $temp = []; + $temp['name'] = $class_name; + $content = []; + if ($class['hasPublicMethods']) { + $content[] = "\${$class_name} = new {$class_name}();" . PHP_EOL; + } + foreach ($class['methods'] as $method_name => $method) { + $content[] = $method['docComment_formated']; + switch ($method['type']) { + case 'public_public': + $content[] = "{$class_name}->{$method_name}({$method['args_formated']})"; + break; + case 'public_static': + $content[] = "{$class_name}::{$method_name}({$method['args_formated']})"; + break; + case 'private_public': + $content[] = "\$this->{$method_name}({$method['args_formated']})"; + break; + case 'private_static': + $content[] = "self::{$method_name}({$method['args_formated']})"; + break; + default: + $content[] = "未支持的方法类型:{$method['type']}"; + break; + } + $content[] = PHP_EOL; + } + $temp['content'] = implode(PHP_EOL, $content); + $ret[] = $temp; + } + return $ret; + } + + // 转换注释风格 + public function parseMethodDoc($doc) + { + if (empty($doc)) { + return $doc; + } + // 去除类方法注释前的缩进 + $doc = str_ireplace(' ', '', $doc); + $lines = explode(PHP_EOL, $doc); + if ($lines > 1) { + return $doc; + } + if (stripos('/**', $doc) !== false) { + $arr_doc = explode(' ', $doc); + $arr_doc[0] = '//'; + array_pop($arr_doc); + return implode(' ', $arr_doc); + } + } + + public function parseParameters($class, $method, $args) + { + if ($args) { + $args_str = []; + foreach ($args as $key => $arg) { + $p = new \ReflectionParameter(array($class, $method), $key); + // 判断是否引用参数 + if ($p->isPassedByReference()) { + $arg_str_new = "&\$" . $p->getName(); + } else { + $arg_str_new = "\$" . $p->getName(); + } + if ($p->isOptional() && $p->isDefaultValueAvailable()) { + $a_clsss = $class; + // 获取某些内部类的参数会抛异常,且异常时$class会变化不是我们想知道的哪个类方法一场了 + try { + $defaul = $p->getDefaultValue(); + $arg_str_new .= is_array($defaul) ? ' = ' . '[]' : ' = ' . var_export($defaul, 1); + } catch (\Exception $e) { + trace($p->isVariadic()); + trace($a_clsss . '/' . $method . '_' . $key); + } + } + $args_str[] = $arg_str_new; + } + return implode(', ', $args_str); + } + return ''; + } + + // 获取类的注释信息 + public function getClassAnnotation($class) + { + + $ret = [ + 'hasPublicMethods' => 0, + ]; + $methods = $class->getMethods(); + foreach ($methods as $key => $method) { + $class = $method->class; + $method_name = $method->name; + $rm = new \ReflectionMethod($class, $method_name); + // 忽略构造和析构 + if ($rm->isConstructor() || $rm->isDestructor()) { + continue; + } + $foo = []; + $foo['docComment'] = $rm->getDocComment(); + $foo['docComment_formated'] = $this->parseMethodDoc($foo['docComment']); + $foo['args'] = $rm->getParameters(); + $foo['args_formated'] = $this->parseParameters($class, $method_name, $foo['args']); + if ($rm->isPublic()) { + $type = $rm->isStatic() ? 'public_static' : 'public_public'; + } else { + $type = $rm->isStatic() ? 'private_static' : 'private_public'; + } + // 只在hasPublicMethods 为0时更新值,保证设置1后不会被复写为0 + if (empty($ret['hasPublicMethods'])) { + $ret['hasPublicMethods'] = stripos($type, '_public') !== false; + } + $foo['type'] = $type; + $ret['methods'][$method_name] = $foo; + } + + return $ret; + // $className = 'think\\App'; + // $class = new \ReflectionClass($className); + // config('default_return_type', 'json'); + + // 类名 + // return $class->name; + + // ReflectionClass 实例的一个字符串表示形式 + // return $class->__toString(); + + // 同上 + // return \ReflectionClass::export($className, 1); + + // 获取类常量 + // return json_encode($class->getConstants()); + + // 获取构造方法 + // return $class->getConstructor(); + + // 类名相关 + // var_dump($class->inNamespace()); + // var_dump($class->getName()); + // var_dump($class->getNamespaceName()); + // var_dump($class->getShortName()); + + # 文件相关 + // getFileName + // getExtensionName + + // 属性相关 + // return $class->getDefaultProperties(); + // return $class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED); + + // const integer IS_STATIC = 1 ; + // const integer IS_PUBLIC = 256 ; + // const integer IS_PROTECTED = 512 ; + // const integer IS_PRIVATE = 1024 ; + + // return $class->getStaticProperties(); + + // 类注释 + // return $class->getDocComment(); + } +} diff --git a/tp5/extend/util/SnippetBuilder.php b/tp5/extend/util/SnippetBuilder.php new file mode 100644 index 0000000..e93bfed --- /dev/null +++ b/tp5/extend/util/SnippetBuilder.php @@ -0,0 +1,85 @@ +cme = new ClassMethodExtractor(); + // $this->framework_type = version_compare(THINK_VERSION, '5') >= 0 ? 5 : 3; + $this->classes = $classes; + } + + public function buildAll($path) + { + $consts = $this->getConsts(); + $functions = $this->getFunctions(); + $classes = $this->classes; + $this->ret = []; + if ($consts) { + $this->buildConsts($consts); + } + if ($functions) { + $this->buildFunction($functions); + } + if ($classes) { + foreach ($classes as $class) { + $class2 = $this->cme->getClassAnnotation(new \ReflectionClass($class)); + $this->buildClass($class2); + } + } + if ($this->ret) { + file_put_contents($path, $this->parseAll($this->ret)); + } else { + exit('没有可生成的内容'); + } + } + + // 获取常量数组 + public function getConsts() + { + $all_consts = get_defined_constants(true); + return array_keys($all_consts['user']); + } + + // 生成常量完成 + public function buildConsts($consts) + { + foreach ($consts as $key => &$const) { + $this->ret[] = $const; + } + } + + // 生成类的完成 + public function buildClass($classes) + { + + } + + // 获取定义的函数 + public function getFunctions() + { + $arr = get_defined_functions(); + $ret = []; + foreach ($arr['user'] as $key => $name) { + $foo = []; + $refFunc = new \ReflectionFunction($name); + $foo['args'] = $refFunc->getParameters(); + $ret[$name] = $foo; + } + return $ret; + } + + // 生成函数 + public function buildFunction($functions) + { + + } + +} diff --git a/tp5/extend/util/SublimeSnippetBuilder.php b/tp5/extend/util/SublimeSnippetBuilder.php new file mode 100644 index 0000000..e721cf2 --- /dev/null +++ b/tp5/extend/util/SublimeSnippetBuilder.php @@ -0,0 +1,121 @@ + $fun) { + $args_arr = [$name, '(', ')']; + if ($fun['args']) { + $args_arr = [$name, '(']; + $index = 1; + foreach ($fun['args'] as $key => $arg) { + $p = new \ReflectionParameter($name, $key); + if ($p->isPassedByReference()) { + $arg_str_new = '\&\\$' . $p->getName(); + } else { + $arg_str_new = '\\$' . $p->getName(); + } + + if ($p->isOptional() && $p->isDefaultValueAvailable()) { + // 获取某些内部类的参数会抛异常,且异常时$class会变化不是我们想知道的哪个类方法一场了 + try { + $defaul = $p->getDefaultValue(); + $arg_str_new .= is_array($defaul) ? ' = []' : ' = ' . var_export($defaul, 1); + } catch (\Exception $e) { + trace($p->isVariadic()); + trace($name . '_' . $key); + } + } + if ($index == 1) { + $p_str = sprintf('${%d:%s}', $index, $arg_str_new); + } else { + $p_str = sprintf('${%d: ,%s}', $index, $arg_str_new); + } + + $args_arr[] = $p_str; + $index++; + } + $args_arr[] = ')'; + } + $contens = implode('', $args_arr) . '$0'; + $foo = [ + 'trigger' => $name, + 'contents' => $contens, + ]; + $this->ret[] = $foo; + } + } + + public function buildClass($class) + { + if($class['methods']){ + foreach ($class['methods'] as $name => $fun) { + switch ($fun['type']) { + case 'public_static': + case 'private_static': + $trigger_name = "::{$name}"; + break; + case 'public_public': + case 'private_public': + $trigger_name = "->{$name}"; + break; + default: + $trigger_name = ''; + break; + } + $args_arr = [$trigger_name, '(', ')']; + if (empty($fun['args']) == false) { + $args_arr = [$trigger_name, '(']; + $index = 1; + foreach ($fun['args'] as $key => $p) { + if ($p->isPassedByReference()) { + $arg_str_new = '\&\\$' . $p->getName(); + } else { + $arg_str_new = '\\$' . $p->getName(); + } + + if ($p->isOptional() && $p->isDefaultValueAvailable()) { + // 获取某些内部类的参数会抛异常,且异常时$class会变化不是我们想知道的哪个类方法一场了 + try { + $defaul = $p->getDefaultValue(); + $arg_str_new .= is_array($defaul) ? ' = []' : ' = ' . var_export($defaul, 1); + } catch (\Exception $e) { + trace($p->isVariadic()); + trace($name . '_' . $key); + } + } + if ($index == 1) { + $p_str = sprintf('${%d:%s}', $index, $arg_str_new); + } else { + $p_str = sprintf('${%d: ,%s}', $index, $arg_str_new); + } + + $args_arr[] = $p_str; + $index++; + } + $args_arr[] = ')'; + } + $contens = implode('', $args_arr) . '$0'; + $foo = [ + 'trigger' => $trigger_name, + 'contents' => $contens, + ]; + $this->ret[] = $foo; + } + } + } + + public function parseAll($ret) + { + // dump($ret); + $ret = [ + "scope" => "source.php - variable.other.php", + "completions" => $ret, + ]; + return json_encode($ret, JSON_PRETTY_PRINT); + } +} diff --git a/tp5/public/.htaccess b/tp5/public/.htaccess new file mode 100644 index 0000000..cbc7868 --- /dev/null +++ b/tp5/public/.htaccess @@ -0,0 +1,8 @@ + + Options +FollowSymlinks -Multiviews + RewriteEngine On + + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] + diff --git a/tp5/public/favicon.ico b/tp5/public/favicon.ico new file mode 100644 index 0000000..e71815a Binary files /dev/null and b/tp5/public/favicon.ico differ diff --git a/tp5/public/index.php b/tp5/public/index.php new file mode 100644 index 0000000..61acd82 --- /dev/null +++ b/tp5/public/index.php @@ -0,0 +1,23 @@ + +// +---------------------------------------------------------------------- + +// [ 应用入口文件 ] +namespace think; + +define('PACKAGE_PATH', __DIR__.'/../../'); + +// 加载基础文件 +require __DIR__ .'/../thinkphp/base.php'; + +// 支持事先使用静态方法设置Request对象和Config对象 + +// 执行应用并响应 +Container::get('app')->run()->send(); diff --git a/tp5/public/robots.txt b/tp5/public/robots.txt new file mode 100644 index 0000000..eb05362 --- /dev/null +++ b/tp5/public/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: diff --git a/tp5/public/router.php b/tp5/public/router.php new file mode 100644 index 0000000..4f916b4 --- /dev/null +++ b/tp5/public/router.php @@ -0,0 +1,17 @@ + +// +---------------------------------------------------------------------- +// $Id$ + +if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SCRIPT_NAME"])) { + return false; +} else { + require __DIR__ . "/index.php"; +} diff --git a/tp5/public/static/.gitignore b/tp5/public/static/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/tp5/public/static/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/tp5/route/route.php b/tp5/route/route.php new file mode 100644 index 0000000..6f479d3 --- /dev/null +++ b/tp5/route/route.php @@ -0,0 +1,20 @@ + +// +---------------------------------------------------------------------- + +Route::get('think', function () { + return 'hello,ThinkPHP5!'; +}); + +Route::get('hello/:name', 'index/hello'); + +return [ + +]; diff --git a/tp5/runtime/.gitignore b/tp5/runtime/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/tp5/runtime/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/tp5/think b/tp5/think new file mode 100644 index 0000000..6a923b3 --- /dev/null +++ b/tp5/think @@ -0,0 +1,22 @@ +#!/usr/bin/env php + +// +---------------------------------------------------------------------- + +namespace think; + +// 加载基础文件 +require __DIR__ . '/thinkphp/base.php'; + +// 应用初始化 +Container::get('app')->path(__DIR__ . '/application/')->initialize(); + +// 控制台初始化 +Console::init(); \ No newline at end of file diff --git a/tp5/thinkphp/.gitignore b/tp5/thinkphp/.gitignore new file mode 100644 index 0000000..7e31ef5 --- /dev/null +++ b/tp5/thinkphp/.gitignore @@ -0,0 +1,4 @@ +/composer.lock +/vendor +.idea +.DS_Store diff --git a/tp5/thinkphp/.htaccess b/tp5/thinkphp/.htaccess new file mode 100644 index 0000000..3418e55 --- /dev/null +++ b/tp5/thinkphp/.htaccess @@ -0,0 +1 @@ +deny from all \ No newline at end of file diff --git a/tp5/thinkphp/CONTRIBUTING.md b/tp5/thinkphp/CONTRIBUTING.md new file mode 100644 index 0000000..6cefcb3 --- /dev/null +++ b/tp5/thinkphp/CONTRIBUTING.md @@ -0,0 +1,119 @@ +如何贡献我的源代码 +=== + +此文档介绍了 ThinkPHP 团队的组成以及运转机制,您提交的代码将给 ThinkPHP 项目带来什么好处,以及如何才能加入我们的行列。 + +## 通过 Github 贡献代码 + +ThinkPHP 目前使用 Git 来控制程序版本,如果你想为 ThinkPHP 贡献源代码,请先大致了解 Git 的使用方法。我们目前把项目托管在 GitHub 上,任何 GitHub 用户都可以向我们贡献代码。 + +参与的方式很简单,`fork`一份 ThinkPHP 的代码到你的仓库中,修改后提交,并向我们发起`pull request`申请,我们会及时对代码进行审查并处理你的申请并。审查通过后,你的代码将被`merge`进我们的仓库中,这样你就会自动出现在贡献者名单里了,非常方便。 + +我们希望你贡献的代码符合: + +* ThinkPHP 的编码规范 +* 适当的注释,能让其他人读懂 +* 遵循 Apache2 开源协议 + +**如果想要了解更多细节或有任何疑问,请继续阅读下面的内容** + +### 注意事项 + +* 本项目代码格式化标准选用 [**PSR-2**](http://www.kancloud.cn/thinkphp/php-fig-psr/3141); +* 类名和类文件名遵循 [**PSR-4**](http://www.kancloud.cn/thinkphp/php-fig-psr/3144); +* 对于 Issues 的处理,请使用诸如 `fix #xxx(Issue ID)` 的 commit title 直接关闭 issue。 +* 系统会自动在 PHP 5.4 5.5 5.6 7.0 和 HHVM 上测试修改,其中 HHVM 下的测试容许报错,请确保你的修改符合 PHP 5.4 ~ 5.6 和 PHP 7.0 的语法规范; +* 管理员不会合并造成 CI faild 的修改,若出现 CI faild 请检查自己的源代码或修改相应的[单元测试文件](tests); + +## GitHub Issue + +GitHub 提供了 Issue 功能,该功能可以用于: + +* 提出 bug +* 提出功能改进 +* 反馈使用体验 + +该功能不应该用于: + + * 提出修改意见(涉及代码署名和修订追溯问题) + * 不友善的言论 + +## 快速修改 + +**GitHub 提供了快速编辑文件的功能** + +1. 登录 GitHub 帐号; +2. 浏览项目文件,找到要进行修改的文件; +3. 点击右上角铅笔图标进行修改; +4. 填写 `Commit changes` 相关内容(Title 必填); +5. 提交修改,等待 CI 验证和管理员合并。 + +**若您需要一次提交大量修改,请继续阅读下面的内容** + +## 完整流程 + +1. `fork`本项目; +2. 克隆(`clone`)你 `fork` 的项目到本地; +3. 新建分支(`branch`)并检出(`checkout`)新分支; +4. 添加本项目到你的本地 git 仓库作为上游(`upstream`); +5. 进行修改,若你的修改包含方法或函数的增减,请记得修改[单元测试文件](tests); +6. 变基(衍合 `rebase`)你的分支到上游 master 分支; +7. `push` 你的本地仓库到 GitHub; +8. 提交 `pull request`; +9. 等待 CI 验证(若不通过则重复 5~7,GitHub 会自动更新你的 `pull request`); +10. 等待管理员处理,并及时 `rebase` 你的分支到上游 master 分支(若上游 master 分支有修改)。 + +*若有必要,可以 `git push -f` 强行推送 rebase 后的分支到自己的 `fork`* + +*绝对不可以使用 `git push -f` 强行推送修改到上游* + +### 注意事项 + +* 若对上述流程有任何不清楚的地方,请查阅 GIT 教程,如 [这个](http://backlogtool.com/git-guide/cn/); +* 对于代码**不同方面**的修改,请在自己 `fork` 的项目中**创建不同的分支**(原因参见`完整流程`第9条备注部分); +* 变基及交互式变基操作参见 [Git 交互式变基](http://pakchoi.me/2015/03/17/git-interactive-rebase/) + +## 推荐资源 + +### 开发环境 + +* XAMPP for Windows 5.5.x +* WampServer (for Windows) +* upupw Apache PHP5.4 ( for Windows) + +或自行安装 + +- Apache / Nginx +- PHP 5.4 ~ 5.6 +- MySQL / MariaDB + +*Windows 用户推荐添加 PHP bin 目录到 PATH,方便使用 composer* + +*Linux 用户自行配置环境, Mac 用户推荐使用内置 Apache 配合 Homebrew 安装 PHP 和 MariaDB* + +### 编辑器 + +Sublime Text 3 + phpfmt 插件 + +phpfmt 插件参数 + +```json +{ + "autocomplete": true, + "enable_auto_align": true, + "format_on_save": true, + "indent_with_space": true, + "psr1_naming": false, + "psr2": true, + "version": 4 +} +``` + +或其他 编辑器 / IDE 配合 PSR2 自动格式化工具 + +### Git GUI + +* SourceTree +* GitHub Desktop + +或其他 Git 图形界面客户端 diff --git a/tp5/thinkphp/LICENSE.txt b/tp5/thinkphp/LICENSE.txt new file mode 100644 index 0000000..574a39c --- /dev/null +++ b/tp5/thinkphp/LICENSE.txt @@ -0,0 +1,32 @@ + +ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 +版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn) +All rights reserved。 +ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 + +Apache Licence是著名的非盈利开源组织Apache采用的协议。 +该协议和BSD类似,鼓励代码共享和尊重原作者的著作权, +允许代码修改,再作为开源或商业软件发布。需要满足 +的条件: +1. 需要给代码的用户一份Apache Licence ; +2. 如果你修改了代码,需要在被修改的文件中说明; +3. 在延伸的代码中(修改和有源代码衍生的代码中)需要 +带有原来代码中的协议,商标,专利声明和其他原来作者规 +定需要包含的说明; +4. 如果再发布的产品中包含一个Notice文件,则在Notice文 +件中需要带有本协议内容。你可以在Notice中增加自己的 +许可,但不可以表现为对Apache Licence构成更改。 +具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0 + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"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 THE +COPYRIGHT OWNER OR 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. diff --git a/tp5/thinkphp/README.md b/tp5/thinkphp/README.md new file mode 100644 index 0000000..5da1eef --- /dev/null +++ b/tp5/thinkphp/README.md @@ -0,0 +1,61 @@ +ThinkPHP 5.1 +=============== + +[![StyleCI](https://styleci.io/repos/48530411/shield?style=flat&branch=master)](https://styleci.io/repos/48530411) +[![Build Status](https://travis-ci.org/top-think/framework.svg?branch=master)](https://travis-ci.org/top-think/framework) +[![codecov.io](http://codecov.io/github/top-think/framework/coverage.svg?branch=master)](http://codecov.io/github/github/top-think/framework?branch=master) +[![Total Downloads](https://poser.pugx.org/topthink/framework/downloads)](https://packagist.org/packages/topthink/framework) +[![Latest Stable Version](https://poser.pugx.org/topthink/framework/v/stable)](https://packagist.org/packages/topthink/framework) +[![Latest Unstable Version](https://poser.pugx.org/topthink/framework/v/unstable)](https://packagist.org/packages/topthink/framework) +[![License](https://poser.pugx.org/topthink/framework/license)](https://packagist.org/packages/topthink/framework) + +ThinkPHP5.1对底层架构做了进一步的改进,减少依赖,其主要特性包括: + + + 采用容器统一管理对象 + + 支持Facade + + 更易用的路由 + + 注解路由支持 + + 路由跨域请求支持 + + 验证类增强 + + 配置和路由目录独立 + + 取消系统常量 + + 类库别名机制 + + 模型和数据库增强 + + 依赖注入完善 + + 支持PSR-3日志规范 + +### 废除的功能: + + + 聚合模型 + + 内置控制器扩展类 + + 模型自动验证 + +> ThinkPHP5的运行环境要求PHP5.6以上。 + + +## 在线手册 + ++ [完全开发手册](https://www.kancloud.cn/manual/thinkphp5_1) ++ [升级指导](https://www.kancloud.cn/manual/thinkphp5_1/354155) + +## 命名规范 + +`ThinkPHP5`遵循PSR-2命名规范和PSR-4自动加载规范。 + +## 参与开发 + +请参阅 [ThinkPHP5 核心框架包](https://github.com/top-think/framework)。 + +## 版权信息 + +ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 + +本项目包含的第三方源码和二进制文件之版权信息另行标注。 + +版权所有Copyright © 2006-2018 by ThinkPHP (http://thinkphp.cn) + +All rights reserved。 + +ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 + +更多细节参阅 [LICENSE.txt](LICENSE.txt) diff --git a/tp5/thinkphp/base.php b/tp5/thinkphp/base.php new file mode 100644 index 0000000..fc8b7b1 --- /dev/null +++ b/tp5/thinkphp/base.php @@ -0,0 +1,103 @@ + +// +---------------------------------------------------------------------- +namespace think; + +// 载入Loader类 +require __DIR__ . '/library/think/Loader.php'; + +// 注册自动加载 +Loader::register(); + +// 注册错误和异常处理机制 +Error::register(); + +// 实现日志接口 +if (interface_exists('Psr\Log\LoggerInterface')) { + interface LoggerInterface extends \Psr\Log\LoggerInterface + {} +} else { + interface LoggerInterface + {} +} + +// 注册核心类到容器 +Container::getInstance()->bind([ + 'app' => App::class, + 'build' => Build::class, + 'cache' => Cache::class, + 'config' => Config::class, + 'cookie' => Cookie::class, + 'debug' => Debug::class, + 'env' => Env::class, + 'hook' => Hook::class, + 'lang' => Lang::class, + 'log' => Log::class, + 'request' => Request::class, + 'response' => Response::class, + 'route' => Route::class, + 'session' => Session::class, + 'url' => Url::class, + 'validate' => Validate::class, + 'view' => View::class, + 'middlewareDispatcher' => http\middleware\Dispatcher::class, + // 接口依赖注入 + 'think\LoggerInterface' => Log::class, +]); + +// 注册核心类的静态代理 +Facade::bind([ + facade\App::class => App::class, + facade\Build::class => Build::class, + facade\Cache::class => Cache::class, + facade\Config::class => Config::class, + facade\Cookie::class => Cookie::class, + facade\Debug::class => Debug::class, + facade\Env::class => Env::class, + facade\Hook::class => Hook::class, + facade\Lang::class => Lang::class, + facade\Log::class => Log::class, + facade\Request::class => Request::class, + facade\Response::class => Response::class, + facade\Route::class => Route::class, + facade\Session::class => Session::class, + facade\Url::class => Url::class, + facade\Validate::class => Validate::class, + facade\View::class => View::class, +]); + +// 注册类库别名 +Loader::addClassAlias([ + 'App' => facade\App::class, + 'Build' => facade\Build::class, + 'Cache' => facade\Cache::class, + 'Config' => facade\Config::class, + 'Cookie' => facade\Cookie::class, + 'Db' => Db::class, + 'Debug' => facade\Debug::class, + 'Env' => facade\Env::class, + 'Facade' => Facade::class, + 'Hook' => facade\Hook::class, + 'Lang' => facade\Lang::class, + 'Log' => facade\Log::class, + 'Request' => facade\Request::class, + 'Response' => facade\Response::class, + 'Route' => facade\Route::class, + 'Session' => facade\Session::class, + 'Url' => facade\Url::class, + 'Validate' => facade\Validate::class, + 'View' => facade\View::class, +]); + +// 加载惯例配置文件 +facade\Config::set(include __DIR__ . '/convention.php'); + +// 加载composer autofile文件 +Loader::loadComposerAutoloadFiles(); diff --git a/tp5/thinkphp/composer.json b/tp5/thinkphp/composer.json new file mode 100644 index 0000000..3e50496 --- /dev/null +++ b/tp5/thinkphp/composer.json @@ -0,0 +1,35 @@ +{ + "name": "topthink/framework", + "description": "the new thinkphp framework", + "type": "think-framework", + "keywords": [ + "framework", + "thinkphp", + "ORM" + ], + "homepage": "http://thinkphp.cn/", + "license": "Apache-2.0", + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + }, + { + "name": "yunwuxin", + "email": "448901948@qq.com" + } + ], + "require": { + "php": ">=5.6.0", + "topthink/think-installer": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.0|^6.0", + "johnkary/phpunit-speedtrap": "^1.0", + "mikey179/vfsStream": "~1.6", + "phploc/phploc": "2.*", + "sebastian/phpcpd": "2.*", + "squizlabs/php_codesniffer": "2.*", + "phpdocumentor/reflection-docblock": "^2.0" + } +} diff --git a/tp5/thinkphp/convention.php b/tp5/thinkphp/convention.php new file mode 100644 index 0000000..01046c4 --- /dev/null +++ b/tp5/thinkphp/convention.php @@ -0,0 +1,292 @@ + [ + // 应用名称 + 'app_name' => '', + // 应用地址 + 'app_host' => '', + // 应用调试模式 + 'app_debug' => false, + // 应用Trace + 'app_trace' => false, + // 应用模式状态 + 'app_status' => '', + // 是否支持多模块 + 'app_multi_module' => true, + // 入口自动绑定模块 + 'auto_bind_module' => false, + // 注册的根命名空间 + 'root_namespace' => [], + // 默认输出类型 + 'default_return_type' => 'html', + // 默认AJAX 数据返回格式,可选json xml ... + 'default_ajax_return' => 'json', + // 默认JSONP格式返回的处理方法 + 'default_jsonp_handler' => 'jsonpReturn', + // 默认JSONP处理方法 + 'var_jsonp_handler' => 'callback', + // 默认时区 + 'default_timezone' => 'PRC', + // 是否开启多语言 + 'lang_switch_on' => false, + // 默认全局过滤方法 用逗号分隔多个 + 'default_filter' => '', + // 默认语言 + 'default_lang' => 'zh-cn', + // 应用类库后缀 + 'class_suffix' => false, + // 控制器类后缀 + 'controller_suffix' => false, + + // +---------------------------------------------------------------------- + // | 模块设置 + // +---------------------------------------------------------------------- + + // 默认模块名 + 'default_module' => 'index', + // 禁止访问模块 + 'deny_module_list' => ['common'], + // 默认控制器名 + 'default_controller' => 'Index', + // 默认操作名 + 'default_action' => 'index', + // 默认验证器 + 'default_validate' => '', + // 默认的空模块名 + 'empty_module' => '', + // 默认的空控制器名 + 'empty_controller' => 'Error', + // 操作方法前缀 + 'use_action_prefix' => false, + // 操作方法后缀 + 'action_suffix' => '', + // 自动搜索控制器 + 'controller_auto_search' => false, + + // +---------------------------------------------------------------------- + // | URL设置 + // +---------------------------------------------------------------------- + + // PATHINFO变量名 用于兼容模式 + 'var_pathinfo' => 's', + // 兼容PATH_INFO获取 + 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], + // pathinfo分隔符 + 'pathinfo_depr' => '/', + // HTTPS代理标识 + 'https_agent_name' => '', + // URL伪静态后缀 + 'url_html_suffix' => 'html', + // URL普通方式参数 用于自动生成 + 'url_common_param' => false, + // URL参数方式 0 按名称成对解析 1 按顺序解析 + 'url_param_type' => 0, + // 是否开启路由延迟解析 + 'url_lazy_route' => false, + // 是否强制使用路由 + 'url_route_must' => false, + // 路由是否完全匹配 + 'route_complete_match' => false, + // 使用注解路由 + 'route_annotation' => false, + // 域名根,如thinkphp.cn + 'url_domain_root' => '', + // 是否自动转换URL中的控制器和操作名 + 'url_convert' => true, + // 默认的访问控制器层 + 'url_controller_layer' => 'controller', + // 表单请求类型伪装变量 + 'var_method' => '_method', + // 表单ajax伪装变量 + 'var_ajax' => '_ajax', + // 表单pjax伪装变量 + 'var_pjax' => '_pjax', + // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 + 'request_cache' => false, + // 请求缓存有效期 + 'request_cache_expire' => null, + // 全局请求缓存排除规则 + 'request_cache_except' => [], + + // 默认跳转页面对应的模板文件 + 'dispatch_success_tmpl' => __DIR__ . '/tpl/dispatch_jump.tpl', + 'dispatch_error_tmpl' => __DIR__ . '/tpl/dispatch_jump.tpl', + + // +---------------------------------------------------------------------- + // | 异常及错误设置 + // +---------------------------------------------------------------------- + + // 异常页面的模板文件 + 'exception_tmpl' => __DIR__ . '/tpl/think_exception.tpl', + + // 错误显示信息,非调试模式有效 + 'error_message' => '页面错误!请稍后再试~', + // 显示错误信息 + 'show_error_msg' => false, + // 异常处理handle类 留空使用 \think\exception\Handle + 'exception_handle' => '', + ], + + // +---------------------------------------------------------------------- + // | 模板设置 + // +---------------------------------------------------------------------- + + 'template' => [ + // 模板引擎类型 支持 php think 支持扩展 + 'type' => 'Think', + // 视图基础目录,配置目录为所有模块的视图起始目录 + 'view_base' => '', + // 当前模板的视图目录 留空为自动获取 + 'view_path' => '', + // 模板后缀 + 'view_suffix' => 'html', + // 模板文件名分隔符 + 'view_depr' => DIRECTORY_SEPARATOR, + // 模板引擎普通标签开始标记 + 'tpl_begin' => '{', + // 模板引擎普通标签结束标记 + 'tpl_end' => '}', + // 标签库标签开始标记 + 'taglib_begin' => '{', + // 标签库标签结束标记 + 'taglib_end' => '}', + ], + + // +---------------------------------------------------------------------- + // | 日志设置 + // +---------------------------------------------------------------------- + + 'log' => [ + // 日志记录方式,内置 file socket 支持扩展 + 'type' => 'File', + // 日志保存目录 + //'path' => LOG_PATH, + // 日志记录级别 + 'level' => [], + // 是否记录trace信息到日志 + 'record_trace' => false, + ], + + // +---------------------------------------------------------------------- + // | Trace设置 开启 app_trace 后 有效 + // +---------------------------------------------------------------------- + 'trace' => [ + // 内置Html Console 支持扩展 + 'type' => 'Html', + 'file' => __DIR__ . '/tpl/page_trace.tpl', + ], + + // +---------------------------------------------------------------------- + // | 缓存设置 + // +---------------------------------------------------------------------- + + 'cache' => [ + // 驱动方式 + 'type' => 'File', + // 缓存保存目录 + //'path' => CACHE_PATH, + // 缓存前缀 + 'prefix' => '', + // 缓存有效期 0表示永久缓存 + 'expire' => 0, + ], + + // +---------------------------------------------------------------------- + // | 会话设置 + // +---------------------------------------------------------------------- + + 'session' => [ + 'id' => '', + // SESSION_ID的提交变量,解决flash上传跨域 + 'var_session_id' => '', + // SESSION 前缀 + 'prefix' => 'think', + // 驱动方式 支持redis memcache memcached + 'type' => '', + // 是否自动开启 SESSION + 'auto_start' => true, + 'httponly' => true, + 'secure' => false, + ], + + // +---------------------------------------------------------------------- + // | Cookie设置 + // +---------------------------------------------------------------------- + 'cookie' => [ + // cookie 名称前缀 + 'prefix' => '', + // cookie 保存时间 + 'expire' => 0, + // cookie 保存路径 + 'path' => '/', + // cookie 有效域名 + 'domain' => '', + // cookie 启用安全传输 + 'secure' => false, + // httponly设置 + 'httponly' => '', + // 是否使用 setcookie + 'setcookie' => true, + ], + + // +---------------------------------------------------------------------- + // | 数据库设置 + // +---------------------------------------------------------------------- + + 'database' => [ + // 数据库类型 + 'type' => 'mysql', + // 数据库连接DSN配置 + 'dsn' => '', + // 服务器地址 + 'hostname' => '127.0.0.1', + // 数据库名 + 'database' => '', + // 数据库用户名 + 'username' => 'root', + // 数据库密码 + 'password' => '', + // 数据库连接端口 + 'hostport' => '', + // 数据库连接参数 + 'params' => [], + // 数据库编码默认采用utf8 + 'charset' => 'utf8', + // 数据库表前缀 + 'prefix' => '', + // 数据库调试模式 + 'debug' => false, + // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) + 'deploy' => 0, + // 数据库读写是否分离 主从式有效 + 'rw_separate' => false, + // 读写分离后 主服务器数量 + 'master_num' => 1, + // 指定从服务器序号 + 'slave_no' => '', + // 是否严格检查字段是否存在 + 'fields_strict' => true, + // 数据集返回类型 + 'resultset_type' => 'array', + // 自动写入时间戳字段 + 'auto_timestamp' => false, + // 时间字段取出后的默认时间格式 + 'datetime_format' => 'Y-m-d H:i:s', + // 是否需要进行SQL性能分析 + 'sql_explain' => false, + // 查询对象 + 'query' => '\\think\\db\\Query', + ], + + //分页配置 + 'paginate' => [ + 'type' => 'bootstrap', + 'var_page' => 'page', + 'list_rows' => 15, + ], + +]; diff --git a/tp5/thinkphp/helper.php b/tp5/thinkphp/helper.php new file mode 100644 index 0000000..461460e --- /dev/null +++ b/tp5/thinkphp/helper.php @@ -0,0 +1,691 @@ + +// +---------------------------------------------------------------------- + +//------------------------ +// ThinkPHP 助手函数 +//------------------------- + +use think\Container; +use think\Db; +use think\exception\HttpException; +use think\exception\HttpResponseException; +use think\facade\Cache; +use think\facade\Config; +use think\facade\Cookie; +use think\facade\Debug; +use think\facade\Env; +use think\facade\Hook; +use think\facade\Lang; +use think\facade\Log; +use think\facade\Request; +use think\facade\Route; +use think\facade\Session; +use think\facade\Url; +use think\Response; +use think\route\RuleItem; + +if (!function_exists('abort')) { + /** + * 抛出HTTP异常 + * @param integer|Response $code 状态码 或者 Response对象实例 + * @param string $message 错误信息 + * @param array $header 参数 + */ + function abort($code, $message = null, $header = []) + { + if ($code instanceof Response) { + throw new HttpResponseException($code); + } else { + throw new HttpException($code, $message, null, $header); + } + } +} + +if (!function_exists('action')) { + /** + * 调用模块的操作方法 参数格式 [模块/控制器/]操作 + * @param string $url 调用地址 + * @param string|array $vars 调用参数 支持字符串和数组 + * @param string $layer 要调用的控制层名称 + * @param bool $appendSuffix 是否添加类名后缀 + * @return mixed + */ + function action($url, $vars = [], $layer = 'controller', $appendSuffix = false) + { + return app()->action($url, $vars, $layer, $appendSuffix); + } +} + +if (!function_exists('app')) { + /** + * 快速获取容器中的实例 支持依赖注入 + * @param string $name 类名或标识 默认获取当前应用实例 + * @param array $args 参数 + * @param bool $newInstance 是否每次创建新的实例 + * @return object + */ + function app($name = 'think\App', $args = [], $newInstance = false) + { + return Container::get($name, $args, $newInstance); + } +} + +if (!function_exists('behavior')) { + /** + * 执行某个行为(run方法) 支持依赖注入 + * @param mixed $behavior 行为类名或者别名 + * @param mixed $args 参数 + * @return mixed + */ + function behavior($behavior, $args = null) + { + return Hook::exec($behavior, $args); + } +} + +if (!function_exists('bind')) { + /** + * 绑定一个类到容器 + * @access public + * @param string $abstract 类标识、接口 + * @param mixed $concrete 要绑定的类、闭包或者实例 + * @return Container + */ + function bind($abstract, $concrete = null) + { + return Container::getInstance()->bind($abstract, $concrete); + } +} + +if (!function_exists('cache')) { + /** + * 缓存管理 + * @param mixed $name 缓存名称,如果为数组表示进行缓存设置 + * @param mixed $value 缓存值 + * @param mixed $options 缓存参数 + * @param string $tag 缓存标签 + * @return mixed + */ + function cache($name, $value = '', $options = null, $tag = null) + { + if (is_array($options)) { + // 缓存操作的同时初始化 + Cache::connect($options); + } elseif (is_array($name)) { + // 缓存初始化 + return Cache::connect($name); + } + + if ('' === $value) { + // 获取缓存 + return 0 === strpos($name, '?') ? Cache::has(substr($name, 1)) : Cache::get($name); + } elseif (is_null($value)) { + // 删除缓存 + return Cache::rm($name); + } else { + // 缓存数据 + if (is_array($options)) { + $expire = isset($options['expire']) ? $options['expire'] : null; //修复查询缓存无法设置过期时间 + } else { + $expire = is_numeric($options) ? $options : null; //默认快捷缓存设置过期时间 + } + + if (is_null($tag)) { + return Cache::set($name, $value, $expire); + } else { + return Cache::tag($tag)->set($name, $value, $expire); + } + } + } +} + +if (!function_exists('call')) { + /** + * 调用反射执行callable 支持依赖注入 + * @param mixed $callable 支持闭包等callable写法 + * @param array $args 参数 + * @return mixed + */ + function call($callable, $args = []) + { + return Container::getInstance()->invoke($callable, $args); + } +} + +if (!function_exists('class_basename')) { + /** + * 获取类名(不包含命名空间) + * + * @param string|object $class + * @return string + */ + function class_basename($class) + { + $class = is_object($class) ? get_class($class) : $class; + return basename(str_replace('\\', '/', $class)); + } +} + +if (!function_exists('class_uses_recursive')) { + /** + *获取一个类里所有用到的trait,包括父类的 + * + * @param $class + * @return array + */ + function class_uses_recursive($class) + { + if (is_object($class)) { + $class = get_class($class); + } + + $results = []; + $classes = array_merge([$class => $class], class_parents($class)); + foreach ($classes as $class) { + $results += trait_uses_recursive($class); + } + + return array_unique($results); + } +} + +if (!function_exists('config')) { + /** + * 获取和设置配置参数 + * @param string|array $name 参数名 + * @param mixed $value 参数值 + * @return mixed + */ + function config($name = '', $value = null) + { + if (is_null($value) && is_string($name)) { + if ('.' == substr($name, -1)) { + return Config::pull(substr($name, 0, -1)); + } + + return 0 === strpos($name, '?') ? Config::has(substr($name, 1)) : Config::get($name); + } else { + return Config::set($name, $value); + } + } +} + +if (!function_exists('container')) { + /** + * 获取容器对象实例 + * @return Container + */ + function container() + { + return Container::getInstance(); + } +} + +if (!function_exists('controller')) { + /** + * 实例化控制器 格式:[模块/]控制器 + * @param string $name 资源地址 + * @param string $layer 控制层名称 + * @param bool $appendSuffix 是否添加类名后缀 + * @return \think\Controller + */ + function controller($name, $layer = 'controller', $appendSuffix = false) + { + return app()->controller($name, $layer, $appendSuffix); + } +} + +if (!function_exists('cookie')) { + /** + * Cookie管理 + * @param string|array $name cookie名称,如果为数组表示进行cookie设置 + * @param mixed $value cookie值 + * @param mixed $option 参数 + * @return mixed + */ + function cookie($name, $value = '', $option = null) + { + if (is_array($name)) { + // 初始化 + Cookie::init($name); + } elseif (is_null($name)) { + // 清除 + Cookie::clear($value); + } elseif ('' === $value) { + // 获取 + return 0 === strpos($name, '?') ? Cookie::has(substr($name, 1), $option) : Cookie::get($name); + } elseif (is_null($value)) { + // 删除 + return Cookie::delete($name); + } else { + // 设置 + return Cookie::set($name, $value, $option); + } + } +} + +if (!function_exists('db')) { + /** + * 实例化数据库类 + * @param string $name 操作的数据表名称(不含前缀) + * @param array|string $config 数据库配置参数 + * @param bool $force 是否强制重新连接 + * @return \think\db\Query + */ + function db($name = '', $config = [], $force = true) + { + return Db::connect($config, $force)->name($name); + } +} + +if (!function_exists('debug')) { + /** + * 记录时间(微秒)和内存使用情况 + * @param string $start 开始标签 + * @param string $end 结束标签 + * @param integer|string $dec 小数位 如果是m 表示统计内存占用 + * @return mixed + */ + function debug($start, $end = '', $dec = 6) + { + if ('' == $end) { + Debug::remark($start); + } else { + return 'm' == $dec ? Debug::getRangeMem($start, $end) : Debug::getRangeTime($start, $end, $dec); + } + } +} + +if (!function_exists('dump')) { + /** + * 浏览器友好的变量输出 + * @param mixed $var 变量 + * @param boolean $echo 是否输出 默认为true 如果为false 则返回输出字符串 + * @param string $label 标签 默认为空 + * @return void|string + */ + function dump($var, $echo = true, $label = null) + { + return Debug::dump($var, $echo, $label); + } +} + +if (!function_exists('env')) { + /** + * 获取环境变量值 + * @access public + * @param string $name 环境变量名(支持二级 .号分割) + * @param string $default 默认值 + * @return mixed + */ + function env($name = null, $default = null) + { + return Env::get($name, $default); + } +} + +if (!function_exists('exception')) { + /** + * 抛出异常处理 + * + * @param string $msg 异常消息 + * @param integer $code 异常代码 默认为0 + * @param string $exception 异常类 + * + * @throws Exception + */ + function exception($msg, $code = 0, $exception = '') + { + $e = $exception ?: '\think\Exception'; + throw new $e($msg, $code); + } +} + +if (!function_exists('halt')) { + /** + * 调试变量并且中断输出 + * @param mixed $var 调试变量或者信息 + */ + function halt($var) + { + dump($var); + + throw new HttpResponseException(new Response); + } +} + +if (!function_exists('input')) { + /** + * 获取输入数据 支持默认值和过滤 + * @param string $key 获取的变量名 + * @param mixed $default 默认值 + * @param string $filter 过滤方法 + * @return mixed + */ + function input($key = '', $default = null, $filter = null) + { + if (0 === strpos($key, '?')) { + $key = substr($key, 1); + $has = true; + } + + if ($pos = strpos($key, '.')) { + // 指定参数来源 + $method = substr($key, 0, $pos); + if (in_array($method, ['get', 'post', 'put', 'patch', 'delete', 'route', 'param', 'request', 'session', 'cookie', 'server', 'env', 'path', 'file'])) { + $key = substr($key, $pos + 1); + } else { + $method = 'param'; + } + } else { + // 默认为自动判断 + $method = 'param'; + } + + if (isset($has)) { + return request()->has($key, $method, $default); + } else { + return request()->$method($key, $default, $filter); + } + } +} + +if (!function_exists('json')) { + /** + * 获取\think\response\Json对象实例 + * @param mixed $data 返回的数据 + * @param integer $code 状态码 + * @param array $header 头部 + * @param array $options 参数 + * @return \think\response\Json + */ + function json($data = [], $code = 200, $header = [], $options = []) + { + return Response::create($data, 'json', $code, $header, $options); + } +} + +if (!function_exists('jsonp')) { + /** + * 获取\think\response\Jsonp对象实例 + * @param mixed $data 返回的数据 + * @param integer $code 状态码 + * @param array $header 头部 + * @param array $options 参数 + * @return \think\response\Jsonp + */ + function jsonp($data = [], $code = 200, $header = [], $options = []) + { + return Response::create($data, 'jsonp', $code, $header, $options); + } +} + +if (!function_exists('lang')) { + /** + * 获取语言变量值 + * @param string $name 语言变量名 + * @param array $vars 动态变量值 + * @param string $lang 语言 + * @return mixed + */ + function lang($name, $vars = [], $lang = '') + { + return Lang::get($name, $vars, $lang); + } +} + +if (!function_exists('model')) { + /** + * 实例化Model + * @param string $name Model名称 + * @param string $layer 业务层名称 + * @param bool $appendSuffix 是否添加类名后缀 + * @return \think\Model + */ + function model($name = '', $layer = 'model', $appendSuffix = false) + { + return app()->model($name, $layer, $appendSuffix); + } +} + +if (!function_exists('parse_name')) { + /** + * 字符串命名风格转换 + * type 0 将Java风格转换为C的风格 1 将C风格转换为Java的风格 + * @param string $name 字符串 + * @param integer $type 转换类型 + * @param bool $ucfirst 首字母是否大写(驼峰规则) + * @return string + */ + function parse_name($name, $type = 0, $ucfirst = true) + { + if ($type) { + $name = preg_replace_callback('/_([a-zA-Z])/', function ($match) { + return strtoupper($match[1]); + }, $name); + + return $ucfirst ? ucfirst($name) : lcfirst($name); + } else { + return strtolower(trim(preg_replace("/[A-Z]/", "_\\0", $name), "_")); + } + } +} + +if (!function_exists('redirect')) { + /** + * 获取\think\response\Redirect对象实例 + * @param mixed $url 重定向地址 支持Url::build方法的地址 + * @param array|integer $params 额外参数 + * @param integer $code 状态码 + * @return \think\response\Redirect + */ + function redirect($url = [], $params = [], $code = 302) + { + if (is_integer($params)) { + $code = $params; + $params = []; + } + + return Response::create($url, 'redirect', $code)->params($params); + } +} + +if (!function_exists('request')) { + /** + * 获取当前Request对象实例 + * @return Request + */ + function request() + { + return app('request'); + } +} + +if (!function_exists('response')) { + /** + * 创建普通 Response 对象实例 + * @param mixed $data 输出数据 + * @param int|string $code 状态码 + * @param array $header 头信息 + * @param string $type + * @return Response + */ + function response($data = [], $code = 200, $header = [], $type = 'html') + { + return Response::create($data, $type, $code, $header); + } +} + +if (!function_exists('route')) { + /** + * 路由注册 + * @param string $rule 路由规则 + * @param mixed $route 路由地址 + * @param array $option 路由参数 + * @param array $pattern 变量规则 + * @return RuleItem + */ + function route($rule, $route, $option = [], $pattern = []) + { + return Route::rule($rule, $route, '*', $option, $pattern); + } +} + +if (!function_exists('session')) { + /** + * Session管理 + * @param string|array $name session名称,如果为数组表示进行session设置 + * @param mixed $value session值 + * @param string $prefix 前缀 + * @return mixed + */ + function session($name, $value = '', $prefix = null) + { + if (is_array($name)) { + // 初始化 + Session::init($name); + } elseif (is_null($name)) { + // 清除 + Session::clear($value); + } elseif ('' === $value) { + // 判断或获取 + return 0 === strpos($name, '?') ? Session::has(substr($name, 1), $prefix) : Session::get($name, $prefix); + } elseif (is_null($value)) { + // 删除 + return Session::delete($name, $prefix); + } else { + // 设置 + return Session::set($name, $value, $prefix); + } + } +} + +if (!function_exists('token')) { + /** + * 生成表单令牌 + * @param string $name 令牌名称 + * @param mixed $type 令牌生成方法 + * @return string + */ + function token($name = '__token__', $type = 'md5') + { + $token = Request::token($name, $type); + + return ''; + } +} + +if (!function_exists('trace')) { + /** + * 记录日志信息 + * @param mixed $log log信息 支持字符串和数组 + * @param string $level 日志级别 + * @return array|void + */ + function trace($log = '[think]', $level = 'log') + { + if ('[think]' === $log) { + return Log::getLog(); + } else { + Log::record($log, $level); + } + } +} + +if (!function_exists('trait_uses_recursive')) { + /** + * 获取一个trait里所有引用到的trait + * + * @param string $trait + * @return array + */ + function trait_uses_recursive($trait) + { + $traits = class_uses($trait); + foreach ($traits as $trait) { + $traits += trait_uses_recursive($trait); + } + + return $traits; + } +} + +if (!function_exists('url')) { + /** + * Url生成 + * @param string $url 路由地址 + * @param string|array $vars 变量 + * @param bool|string $suffix 生成的URL后缀 + * @param bool|string $domain 域名 + * @return string + */ + function url($url = '', $vars = '', $suffix = true, $domain = false) + { + return Url::build($url, $vars, $suffix, $domain); + } +} + +if (!function_exists('validate')) { + /** + * 实例化验证器 + * @param string $name 验证器名称 + * @param string $layer 业务层名称 + * @param bool $appendSuffix 是否添加类名后缀 + * @return \think\Validate + */ + function validate($name = '', $layer = 'validate', $appendSuffix = false) + { + return app()->validate($name, $layer, $appendSuffix); + } +} + +if (!function_exists('view')) { + /** + * 渲染模板输出 + * @param string $template 模板文件 + * @param array $vars 模板变量 + * @param integer $code 状态码 + * @param callable $filer 内容过滤 + * @return \think\response\View + */ + function view($template = '', $vars = [], $code = 200, $filter = null) + { + return Response::create($template, 'view', $code)->assign($vars)->filter($filter); + } +} + +if (!function_exists('widget')) { + /** + * 渲染输出Widget + * @param string $name Widget名称 + * @param array $data 传入的参数 + * @return mixed + */ + function widget($name, $data = []) + { + return app()->action($name, $data, 'widget'); + } +} + +if (!function_exists('xml')) { + /** + * 获取\think\response\Xml对象实例 + * @param mixed $data 返回的数据 + * @param integer $code 状态码 + * @param array $header 头部 + * @param array $options 参数 + * @return \think\response\Xml + */ + function xml($data = [], $code = 200, $header = [], $options = []) + { + return Response::create($data, 'xml', $code, $header, $options); + } +} diff --git a/tp5/thinkphp/lang/zh-cn.php b/tp5/thinkphp/lang/zh-cn.php new file mode 100644 index 0000000..dd8084d --- /dev/null +++ b/tp5/thinkphp/lang/zh-cn.php @@ -0,0 +1,135 @@ + +// +---------------------------------------------------------------------- + +// 核心中文语言包 +return [ + // 系统错误提示 + 'Undefined variable' => '未定义变量', + 'Undefined index' => '未定义数组索引', + 'Undefined offset' => '未定义数组下标', + 'Parse error' => '语法解析错误', + 'Type error' => '类型错误', + 'Fatal error' => '致命错误', + 'syntax error' => '语法错误', + + // 框架核心错误提示 + 'dispatch type not support' => '不支持的调度类型', + 'method param miss' => '方法参数错误', + 'method not exists' => '方法不存在', + 'module not exists' => '模块不存在', + 'controller not exists' => '控制器不存在', + 'class not exists' => '类不存在', + 'property not exists' => '类的属性不存在', + 'template not exists' => '模板文件不存在', + 'illegal controller name' => '非法的控制器名称', + 'illegal action name' => '非法的操作名称', + 'url suffix deny' => '禁止的URL后缀访问', + 'Route Not Found' => '当前访问路由未定义', + 'Undefined db type' => '未定义数据库类型', + 'variable type error' => '变量类型错误', + 'PSR-4 error' => 'PSR-4 规范错误', + 'not support total' => '简洁模式下不能获取数据总数', + 'not support last' => '简洁模式下不能获取最后一页', + 'error session handler' => '错误的SESSION处理器类', + 'not allow php tag' => '模板不允许使用PHP语法', + 'not support' => '不支持', + 'redisd master' => 'Redisd 主服务器错误', + 'redisd slave' => 'Redisd 从服务器错误', + 'must run at sae' => '必须在SAE运行', + 'memcache init error' => '未开通Memcache服务,请在SAE管理平台初始化Memcache服务', + 'KVDB init error' => '没有初始化KVDB,请在SAE管理平台初始化KVDB服务', + 'fields not exists' => '数据表字段不存在', + 'where express error' => '查询表达式错误', + 'no data to update' => '没有任何数据需要更新', + 'miss data to insert' => '缺少需要写入的数据', + 'miss complex primary data' => '缺少复合主键数据', + 'miss update condition' => '缺少更新条件', + 'model data Not Found' => '模型数据不存在', + 'table data not Found' => '表数据不存在', + 'delete without condition' => '没有条件不会执行删除操作', + 'miss relation data' => '缺少关联表数据', + 'tag attr must' => '模板标签属性必须', + 'tag error' => '模板标签错误', + 'cache write error' => '缓存写入失败', + 'sae mc write error' => 'SAE mc 写入错误', + 'route name not exists' => '路由标识不存在(或参数不够)', + 'invalid request' => '非法请求', + 'bind attr has exists' => '模型的属性已经存在', + 'relation data not exists' => '关联数据不存在', + 'relation not support' => '关联不支持', + 'chunk not support order' => 'Chunk不支持调用order方法', + + // 上传错误信息 + 'unknown upload error' => '未知上传错误!', + 'file write error' => '文件写入失败!', + 'upload temp dir not found' => '找不到临时文件夹!', + 'no file to uploaded' => '没有文件被上传!', + 'only the portion of file is uploaded' => '文件只有部分被上传!', + 'upload File size exceeds the maximum value' => '上传文件大小超过了最大值!', + 'upload write error' => '文件上传保存错误!', + 'has the same filename: {:filename}' => '存在同名文件:{:filename}', + 'upload illegal files' => '非法上传文件', + 'illegal image files' => '非法图片文件', + 'extensions to upload is not allowed' => '上传文件后缀不允许', + 'mimetype to upload is not allowed' => '上传文件MIME类型不允许!', + 'filesize not match' => '上传文件大小不符!', + 'directory {:path} creation failed' => '目录 {:path} 创建失败!', + + // Validate Error Message + ':attribute require' => ':attribute不能为空', + ':attribute must' => ':attribute必须', + ':attribute must be numeric' => ':attribute必须是数字', + ':attribute must be integer' => ':attribute必须是整数', + ':attribute must be float' => ':attribute必须是浮点数', + ':attribute must be bool' => ':attribute必须是布尔值', + ':attribute not a valid email address' => ':attribute格式不符', + ':attribute not a valid mobile' => ':attribute格式不符', + ':attribute must be a array' => ':attribute必须是数组', + ':attribute must be yes,on or 1' => ':attribute必须是yes、on或者1', + ':attribute not a valid datetime' => ':attribute不是一个有效的日期或时间格式', + ':attribute not a valid file' => ':attribute不是有效的上传文件', + ':attribute not a valid image' => ':attribute不是有效的图像文件', + ':attribute must be alpha' => ':attribute只能是字母', + ':attribute must be alpha-numeric' => ':attribute只能是字母和数字', + ':attribute must be alpha-numeric, dash, underscore' => ':attribute只能是字母、数字和下划线_及破折号-', + ':attribute not a valid domain or ip' => ':attribute不是有效的域名或者IP', + ':attribute must be chinese' => ':attribute只能是汉字', + ':attribute must be chinese or alpha' => ':attribute只能是汉字、字母', + ':attribute must be chinese,alpha-numeric' => ':attribute只能是汉字、字母和数字', + ':attribute must be chinese,alpha-numeric,underscore, dash' => ':attribute只能是汉字、字母、数字和下划线_及破折号-', + ':attribute not a valid url' => ':attribute不是有效的URL地址', + ':attribute not a valid ip' => ':attribute不是有效的IP地址', + ':attribute must be dateFormat of :rule' => ':attribute必须使用日期格式 :rule', + ':attribute must be in :rule' => ':attribute必须在 :rule 范围内', + ':attribute be notin :rule' => ':attribute不能在 :rule 范围内', + ':attribute must between :1 - :2' => ':attribute只能在 :1 - :2 之间', + ':attribute not between :1 - :2' => ':attribute不能在 :1 - :2 之间', + 'size of :attribute must be :rule' => ':attribute长度不符合要求 :rule', + 'max size of :attribute must be :rule' => ':attribute长度不能超过 :rule', + 'min size of :attribute must be :rule' => ':attribute长度不能小于 :rule', + ':attribute cannot be less than :rule' => ':attribute日期不能小于 :rule', + ':attribute cannot exceed :rule' => ':attribute日期不能超过 :rule', + ':attribute not within :rule' => '不在有效期内 :rule', + 'access IP is not allowed' => '不允许的IP访问', + 'access IP denied' => '禁止的IP访问', + ':attribute out of accord with :2' => ':attribute和确认字段:2不一致', + ':attribute cannot be same with :2' => ':attribute和比较字段:2不能相同', + ':attribute must greater than or equal :rule' => ':attribute必须大于等于 :rule', + ':attribute must greater than :rule' => ':attribute必须大于 :rule', + ':attribute must less than or equal :rule' => ':attribute必须小于等于 :rule', + ':attribute must less than :rule' => ':attribute必须小于 :rule', + ':attribute must equal :rule' => ':attribute必须等于 :rule', + ':attribute has exists' => ':attribute已存在', + ':attribute not conform to the rules' => ':attribute不符合指定规则', + 'invalid Request method' => '无效的请求类型', + 'invalid token' => '令牌数据无效', + 'not conform to the rules' => '规则错误', +]; diff --git a/tp5/thinkphp/library/think/App.php b/tp5/thinkphp/library/think/App.php new file mode 100644 index 0000000..8892585 --- /dev/null +++ b/tp5/thinkphp/library/think/App.php @@ -0,0 +1,875 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +use think\exception\ClassNotFoundException; +use think\exception\HttpResponseException; +use think\route\Dispatch; + +/** + * App 应用管理 + */ +class App implements \ArrayAccess +{ + const VERSION = '5.1.5'; + + /** + * 当前模块路径 + * @var string + */ + protected $modulePath; + + /** + * 应用调试模式 + * @var bool + */ + protected $debug = true; + + /** + * 应用开始时间 + * @var float + */ + protected $beginTime; + + /** + * 应用内存初始占用 + * @var integer + */ + protected $beginMem; + + /** + * 应用类库命名空间 + * @var string + */ + protected $namespace = 'app'; + + /** + * 应用类库后缀 + * @var bool + */ + protected $suffix = false; + + /** + * 严格路由检测 + * @var bool + */ + protected $routeMust; + + /** + * 应用类库目录 + * @var string + */ + protected $appPath; + + /** + * 框架目录 + * @var string + */ + protected $thinkPath; + + /** + * 应用根目录 + * @var string + */ + protected $rootPath; + + /** + * 运行时目录 + * @var string + */ + protected $runtimePath; + + /** + * 配置目录 + * @var string + */ + protected $configPath; + + /** + * 路由目录 + * @var string + */ + protected $routePath; + + /** + * 配置后缀 + * @var string + */ + protected $configExt; + + /** + * 应用调度实例 + * @var Dispatch + */ + protected $dispatch; + + /** + * 容器对象实例 + * @var Container + */ + protected $container; + + /** + * 绑定模块(控制器) + * @var string + */ + protected $bind; + + public function __construct($appPath = '') + { + $this->appPath = $appPath ?: realpath(dirname($_SERVER['SCRIPT_FILENAME']) . '/../application') . '/'; + $this->container = Container::getInstance(); + } + + /** + * 绑定模块或者控制器 + * @access public + * @param string $bind + * @return $this + */ + public function bind($bind) + { + $this->bind = $bind; + return $this; + } + + /** + * 设置应用类库目录 + * @access public + * @param string $path 路径 + * @return $this + */ + public function path($path) + { + $this->appPath = $path; + return $this; + } + + /** + * 初始化应用 + * @access public + * @return void + */ + public function initialize() + { + $this->beginTime = microtime(true); + $this->beginMem = memory_get_usage(); + $this->thinkPath = dirname(dirname(__DIR__)) . '/'; + $this->rootPath = dirname(realpath($this->appPath)) . '/'; + $this->runtimePath = $this->rootPath . 'runtime/'; + $this->routePath = $this->rootPath . 'route/'; + $this->configPath = $this->rootPath . 'config/'; + + // 设置路径环境变量 + $this->env->set([ + 'think_path' => $this->thinkPath, + 'root_path' => $this->rootPath, + 'app_path' => $this->appPath, + 'config_path' => $this->configPath, + 'route_path' => $this->routePath, + 'runtime_path' => $this->runtimePath, + 'extend_path' => $this->rootPath . 'extend/', + 'vendor_path' => $this->rootPath . 'vendor/', + ]); + + // 加载环境变量配置文件 + if (is_file($this->rootPath . '.env')) { + $this->env->load($this->rootPath . '.env'); + } + + $this->namespace = $this->env->get('app_namespace', $this->namespace); + $this->env->set('app_namespace', $this->namespace); + + // 注册应用命名空间 + Loader::addNamespace($this->namespace, $this->appPath); + + $this->configExt = $this->env->get('config_ext', '.php'); + + // 初始化应用 + $this->init(); + + // 开启类名后缀 + $this->suffix = $this->config('app.class_suffix'); + + // 应用调试模式 + $this->debug = $this->env->get('app_debug', $this->config('app.app_debug')); + $this->env->set('app_debug', $this->debug); + + if (!$this->debug) { + ini_set('display_errors', 'Off'); + } elseif (PHP_SAPI != 'cli') { + //重新申请一块比较大的buffer + if (ob_get_level() > 0) { + $output = ob_get_clean(); + } + ob_start(); + if (!empty($output)) { + echo $output; + } + } + + // 注册根命名空间 + if (!empty($this->config('app.root_namespace'))) { + Loader::addNamespace($this->config('app.root_namespace')); + } + + // 注册类库别名 + Loader::addClassAlias($this->config->pull('alias')); + + // 设置系统时区 + date_default_timezone_set($this->config('app.default_timezone')); + + // 监听app_init + $this->hook->listen('app_init'); + } + + /** + * 初始化应用或模块 + * @access public + * @param string $module 模块名 + * @return void + */ + public function init($module = '') + { + // 定位模块目录 + $module = $module ? $module . DIRECTORY_SEPARATOR : ''; + $path = $this->appPath . $module; + + // 加载初始化文件 + if (is_file($path . 'init.php')) { + include $path . 'init.php'; + } elseif (is_file($this->runtimePath . $module . 'init.php')) { + include $this->runtimePath . $module . 'init.php'; + } else { + // 加载行为扩展文件 + if (is_file($path . 'tags.php')) { + $this->hook->import(include $path . 'tags.php'); + } + + // 加载公共文件 + if (is_file($path . 'common.php')) { + include $path . 'common.php'; + } + + if ('' == $module) { + // 加载系统助手函数 + include $this->thinkPath . 'helper.php'; + } + + // 注册服务的容器对象实例 + if (is_file($path . 'provider.php')) { + $this->container->bind(include $path . 'provider.php'); + } + + // 自动读取配置文件 + if (is_dir($path . 'config')) { + $dir = $path . 'config'; + } elseif (is_dir($this->configPath . $module)) { + $dir = $this->configPath . $module; + } + + $files = isset($dir) ? scandir($dir) : []; + + foreach ($files as $file) { + if ('.' . pathinfo($file, PATHINFO_EXTENSION) === $this->configExt) { + $filename = $dir . DIRECTORY_SEPARATOR . $file; + $this->config->load($filename, pathinfo($file, PATHINFO_FILENAME)); + } + } + } + + $this->request->filter($this->config('app.default_filter')); + } + + /** + * 执行应用程序 + * @access public + * @return Response + * @throws Exception + */ + public function run() + { + // 初始化应用 + $this->initialize(); + + try { + if ($this->bind) { + // 模块/控制器绑定 + $this->route->bind($this->bind); + } elseif ($this->config('app.auto_bind_module')) { + // 入口自动绑定 + $name = pathinfo($this->request->baseFile(), PATHINFO_FILENAME); + if ($name && 'index' != $name && is_dir($this->appPath . $name)) { + $this->route->bind($name); + } + } + + // 读取默认语言 + $this->lang->range($this->config('app.default_lang')); + if ($this->config('app.lang_switch_on')) { + // 开启多语言机制 检测当前语言 + $this->lang->detect(); + } + + $this->request->langset($this->lang->range()); + + // 加载系统语言包 + $this->lang->load([ + $this->thinkPath . 'lang/' . $this->request->langset() . '.php', + $this->appPath . 'lang/' . $this->request->langset() . '.php', + ]); + + // 监听app_dispatch + $this->hook->listen('app_dispatch'); + + // 获取应用调度信息 + $dispatch = $this->dispatch; + if (empty($dispatch)) { + // 进行URL路由检测 + $dispatch = $this->routeCheck(); + } + + // 记录当前调度信息 + $this->request->dispatch($dispatch); + + // 记录路由和请求信息 + if ($this->debug) { + $this->log('[ ROUTE ] ' . var_export($this->request->routeInfo(), true)); + $this->log('[ HEADER ] ' . var_export($this->request->header(), true)); + $this->log('[ PARAM ] ' . var_export($this->request->param(), true)); + } + + // 监听app_begin + $this->hook->listen('app_begin'); + + // 请求缓存检查 + $this->request->cache( + $this->config('app.request_cache'), + $this->config('app.request_cache_expire'), + $this->config('app.request_cache_except') + ); + + // 执行调度 + $data = $dispatch->run(); + + } catch (HttpResponseException $exception) { + $data = $exception->getResponse(); + } + + $this->middlewareDispatcher->add(function (Request $request, $next) use ($data) { + // 输出数据到客户端 + if ($data instanceof Response) { + $response = $data; + } elseif (!is_null($data)) { + // 默认自动识别响应输出类型 + $isAjax = $request->isAjax(); + $type = $isAjax ? $this->config('app.default_ajax_return') : $this->config('app.default_return_type'); + + $response = Response::create($data, $type); + } else { + $response = Response::create(); + } + return $response; + }); + + $response = $this->middlewareDispatcher->dispatch($this->request); + + // 监听app_end + $this->hook->listen('app_end', $response); + + return $response; + } + + /** + * 设置当前请求的调度信息 + * @access public + * @param Dispatch $dispatch 调度信息 + * @return $this + */ + public function dispatch(Dispatch $dispatch) + { + $this->dispatch = $dispatch; + return $this; + } + + /** + * 记录调试信息 + * @access public + * @param mixed $msg 调试信息 + * @param string $type 信息类型 + * @return void + */ + public function log($log, $type = 'info') + { + $this->debug && $this->log->record($log, $type); + } + + /** + * 获取配置参数 为空则获取所有配置 + * @access public + * @param string $name 配置参数名(支持二级配置 .号分割) + * @return mixed + */ + public function config($name = '') + { + return $this->config->get($name); + } + + /** + * URL路由检测(根据PATH_INFO) + * @access public + * @return Dispatch + */ + public function routeCheck() + { + $path = $this->request->path(); + $depr = $this->config('app.pathinfo_depr'); + + // 路由检测 + $files = scandir($this->routePath); + foreach ($files as $file) { + if (strpos($file, '.php')) { + $filename = $this->routePath . $file; + // 导入路由配置 + $rules = include $filename; + if (is_array($rules)) { + $this->route->import($rules); + } + } + } + + if ($this->config('app.route_annotation')) { + // 自动生成路由定义 + if ($this->debug) { + $this->build->buildRoute($this->config('app.controller_suffix')); + } + + $filename = $this->runtimePath . 'build_route.php'; + + if (is_file($filename)) { + include $filename; + } + } + + // 是否强制路由模式 + $must = !is_null($this->routeMust) ? $this->routeMust : $this->config('app.url_route_must'); + + // 路由检测 返回一个Dispatch对象 + return $this->route->check($path, $depr, $must, $this->config('app.route_complete_match')); + } + + /** + * 设置应用的路由检测机制 + * @access public + * @param bool $must 是否强制检测路由 + * @return $this + */ + public function routeMust($must = false) + { + $this->routeMust = $must; + return $this; + } + + /** + * 解析模块和类名 + * @access protected + * @param string $name 资源地址 + * @param string $layer 验证层名称 + * @param bool $appendSuffix 是否添加类名后缀 + * @return array + */ + protected function parseModuleAndClass($name, $layer, $appendSuffix) + { + if (false !== strpos($name, '\\')) { + $class = $name; + $module = $this->request->module(); + } else { + if (strpos($name, '/')) { + list($module, $name) = explode('/', $name, 2); + } else { + $module = $this->request->module(); + } + + $class = $this->parseClass($module, $layer, $name, $appendSuffix); + } + + return [$module, $class]; + } + + /** + * 实例化应用类库 + * @access public + * @param string $name 类名称 + * @param string $layer 业务层名称 + * @param bool $appendSuffix 是否添加类名后缀 + * @param string $common 公共模块名 + * @return object + * @throws ClassNotFoundException + */ + public function create($name, $layer, $appendSuffix = false, $common = 'common') + { + $guid = $name . $layer; + + if ($this->__isset($guid)) { + return $this->__get($guid); + } + + list($module, $class) = $this->parseModuleAndClass($name, $layer, $appendSuffix); + + if (class_exists($class)) { + $object = $this->__get($class); + } else { + $class = str_replace('\\' . $module . '\\', '\\' . $common . '\\', $class); + if (class_exists($class)) { + $object = $this->__get($class); + } else { + throw new ClassNotFoundException('class not exists:' . $class, $class); + } + } + + $this->__set($guid, $class); + + return $object; + } + + /** + * 实例化(分层)模型 + * @access public + * @param string $name Model名称 + * @param string $layer 业务层名称 + * @param bool $appendSuffix 是否添加类名后缀 + * @param string $common 公共模块名 + * @return Model + * @throws ClassNotFoundException + */ + public function model($name = '', $layer = 'model', $appendSuffix = false, $common = 'common') + { + return $this->create($name, $layer, $appendSuffix, $common); + } + + /** + * 实例化(分层)控制器 格式:[模块名/]控制器名 + * @access public + * @param string $name 资源地址 + * @param string $layer 控制层名称 + * @param bool $appendSuffix 是否添加类名后缀 + * @param string $empty 空控制器名称 + * @return object + * @throws ClassNotFoundException + */ + public function controller($name, $layer = 'controller', $appendSuffix = false, $empty = '') + { + list($module, $class) = $this->parseModuleAndClass($name, $layer, $appendSuffix); + + if (class_exists($class)) { + return $this->__get($class); + } elseif ($empty && class_exists($emptyClass = $this->parseClass($module, $layer, $empty, $appendSuffix))) { + return $this->__get($emptyClass); + } else { + throw new ClassNotFoundException('class not exists:' . $class, $class); + } + } + + /** + * 实例化验证类 格式:[模块名/]验证器名 + * @access public + * @param string $name 资源地址 + * @param string $layer 验证层名称 + * @param bool $appendSuffix 是否添加类名后缀 + * @param string $common 公共模块名 + * @return Validate + * @throws ClassNotFoundException + */ + public function validate($name = '', $layer = 'validate', $appendSuffix = false, $common = 'common') + { + $name = $name ?: $this->config('default_validate'); + + if (empty($name)) { + return new Validate; + } + + return $this->create($name, $layer, $appendSuffix, $common); + } + + /** + * 数据库初始化 + * @access public + * @param mixed $config 数据库配置 + * @param bool|string $name 连接标识 true 强制重新连接 + * @return \think\db\Query + */ + public function db($config = [], $name = false) + { + return Db::connect($config, $name); + } + + /** + * 远程调用模块的操作方法 参数格式 [模块/控制器/]操作 + * @access public + * @param string $url 调用地址 + * @param string|array $vars 调用参数 支持字符串和数组 + * @param string $layer 要调用的控制层名称 + * @param bool $appendSuffix 是否添加类名后缀 + * @return mixed + * @throws ClassNotFoundException + */ + public function action($url, $vars = [], $layer = 'controller', $appendSuffix = false) + { + $info = pathinfo($url); + $action = $info['basename']; + $module = '.' != $info['dirname'] ? $info['dirname'] : $this->request->controller(); + $class = $this->controller($module, $layer, $appendSuffix); + + if (is_scalar($vars)) { + if (strpos($vars, '=')) { + parse_str($vars, $vars); + } else { + $vars = [$vars]; + } + } + + return $this->container->invokeMethod([$class, $action . $this->config('action_suffix')], $vars); + } + + /** + * 解析应用类的类名 + * @access public + * @param string $module 模块名 + * @param string $layer 层名 controller model ... + * @param string $name 类名 + * @param bool $appendSuffix + * @return string + */ + public function parseClass($module, $layer, $name, $appendSuffix = false) + { + $name = str_replace(['/', '.'], '\\', $name); + $array = explode('\\', $name); + $class = Loader::parseName(array_pop($array), 1) . ($this->suffix || $appendSuffix ? ucfirst($layer) : ''); + $path = $array ? implode('\\', $array) . '\\' : ''; + + return $this->namespace . '\\' . ($module ? $module . '\\' : '') . $layer . '\\' . $path . $class; + } + + /** + * 获取框架版本 + * @access public + * @return string + */ + public function version() + { + return static::VERSION; + } + + /** + * 是否为调试模式 + * @access public + * @return bool + */ + public function isDebug() + { + return $this->debug; + } + + /** + * 获取模块路径 + * @access public + * @return string + */ + public function getModulePath() + { + return $this->modulePath; + } + + /** + * 设置模块路径 + * @access public + * @param string $path 路径 + * @return void + */ + public function setModulePath($path) + { + $this->modulePath = $path; + $this->env->set('module_path', $path); + } + + /** + * 获取应用根目录 + * @access public + * @return string + */ + public function getRootPath() + { + return $this->rootPath; + } + + /** + * 获取应用类库目录 + * @access public + * @return string + */ + public function getAppPath() + { + return $this->appPath; + } + + /** + * 获取应用运行时目录 + * @access public + * @return string + */ + public function getRuntimePath() + { + return $this->runtimePath; + } + + /** + * 获取核心框架目录 + * @access public + * @return string + */ + public function getThinkPath() + { + return $this->thinkPath; + } + + /** + * 获取路由目录 + * @access public + * @return string + */ + public function getRoutePath() + { + return $this->routePath; + } + + /** + * 获取应用配置目录 + * @access public + * @return string + */ + public function getConfigPath() + { + return $this->configPath; + } + + /** + * 获取配置后缀 + * @access public + * @return string + */ + public function getConfigExt() + { + return $this->configExt; + } + + /** + * 获取应用类库命名空间 + * @access public + * @return string + */ + public function getNamespace() + { + return $this->namespace; + } + + /** + * 设置应用类库命名空间 + * @access public + * @param string $namespace 命名空间名称 + * @return $this + */ + public function setNamespace($namespace) + { + $this->namespace = $namespace; + return $this; + } + + /** + * 是否启用类库后缀 + * @access public + * @return bool + */ + public function getSuffix() + { + return $this->suffix; + } + + /** + * 获取应用开启时间 + * @access public + * @return float + */ + public function getBeginTime() + { + return $this->beginTime; + } + + /** + * 获取应用初始内存占用 + * @access public + * @return integer + */ + public function getBeginMem() + { + return $this->beginMem; + } + + /** + * 获取容器实例 + * @access public + * @return Container + */ + public function container() + { + return $this->container; + } + + public function __set($name, $value) + { + $this->container->bind($name, $value); + } + + public function __get($name) + { + return $this->container->make($name); + } + + public function __isset($name) + { + return $this->container->bound($name); + } + + public function __unset($name) + { + $this->container->__unset($name); + } + + public function offsetExists($key) + { + return $this->__isset($key); + } + + public function offsetGet($key) + { + return $this->__get($key); + } + + public function offsetSet($key, $value) + { + $this->__set($key, $value); + } + + public function offsetUnset($key) + { + $this->__unset($key); + } +} diff --git a/tp5/thinkphp/library/think/Build.php b/tp5/thinkphp/library/think/Build.php new file mode 100644 index 0000000..ed3ffe4 --- /dev/null +++ b/tp5/thinkphp/library/think/Build.php @@ -0,0 +1,374 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +class Build +{ + /** + * 应用对象 + * @var App + */ + protected $app; + + /** + * 应用目录 + * @var string + */ + protected $basePath; + + public function __construct(App $app) + { + $this->app = $app; + $this->basePath = $this->app->getAppPath(); + } + + /** + * 根据传入的build资料创建目录和文件 + * @access public + * @param array $build build列表 + * @param string $namespace 应用类库命名空间 + * @param bool $suffix 类库后缀 + * @return void + */ + public function run(array $build = [], $namespace = 'app', $suffix = false) + { + // 锁定 + $lockfile = $this->basePath . 'build.lock'; + + if (is_writable($lockfile)) { + return; + } elseif (!touch($lockfile)) { + throw new Exception('应用目录[' . $this->basePath . ']不可写,目录无法自动生成!
请手动生成项目目录~', 10006); + } + + foreach ($build as $module => $list) { + if ('__dir__' == $module) { + // 创建目录列表 + $this->buildDir($list); + } elseif ('__file__' == $module) { + // 创建文件列表 + $this->buildFile($list); + } else { + // 创建模块 + $this->module($module, $list, $namespace, $suffix); + } + } + + // 解除锁定 + unlink($lockfile); + } + + /** + * 创建目录 + * @access protected + * @param array $list 目录列表 + * @return void + */ + protected function buildDir($list) + { + foreach ($list as $dir) { + $this->checkDirBuild($this->basePath . $dir); + } + } + + /** + * 创建文件 + * @access protected + * @param array $list 文件列表 + * @return void + */ + protected function buildFile($list) + { + foreach ($list as $file) { + if (!is_dir($this->basePath . dirname($file))) { + // 创建目录 + mkdir($this->basePath . dirname($file), 0755, true); + } + + if (!is_file($this->basePath . $file)) { + file_put_contents($this->basePath . $file, 'php' == pathinfo($file, PATHINFO_EXTENSION) ? "basePath . $module)) { + // 创建模块目录 + mkdir($this->basePath . $module); + } + + if (basename($this->app->getRuntimePath()) != $module) { + // 创建配置文件和公共文件 + $this->buildCommon($module); + // 创建模块的默认页面 + $this->buildHello($module, $namespace, $suffix); + } + + if (empty($list)) { + // 创建默认的模块目录和文件 + $list = [ + '__file__' => ['common.php'], + '__dir__' => ['controller', 'model', 'view', 'config'], + ]; + } + + // 创建子目录和文件 + foreach ($list as $path => $file) { + $modulePath = $this->basePath . $module . '/'; + if ('__dir__' == $path) { + // 生成子目录 + foreach ($file as $dir) { + $this->checkDirBuild($modulePath . $dir); + } + } elseif ('__file__' == $path) { + // 生成(空白)文件 + foreach ($file as $name) { + if (!is_file($modulePath . $name)) { + file_put_contents($modulePath . $name, 'php' == pathinfo($name, PATHINFO_EXTENSION) ? "checkDirBuild(dirname($filename)); + $content = ''; + break; + default: + // 其他文件 + $content = "app->getNameSpace(); + $modules = glob($this->basePath . '*', GLOB_ONLYDIR); + $content = 'app->config('app.url_controller_layer'); + } + + foreach ($modules as $module) { + $module = basename($module); + + if (in_array($module, $this->app->config('app.deny_module_list'))) { + continue; + } + + $controllers = glob($this->basePath . $module . '/' . $layer . '/*.php'); + + foreach ($controllers as $controller) { + $content .= $this->getControllerRoute($namespace, $module, basename($controller, '.php'), $alias, $layer); + } + } + + $filename = $this->app->getRuntimePath() . 'build_route.php'; + file_put_contents($filename, $content); + + return $filename; + } + + /** + * 生成控制器类的路由规则 + * @access protected + * @param string $namespace 应用命名空间 + * @param string $module 模块 + * @param string $controller 控制器名 + * @param bool $suffix 类库后缀 + * @param string $layer 控制器层目录名 + * @return string + */ + protected function getControllerRoute($namespace, $module, $controller, $alias = false, $layer = '') + { + $class = new \ReflectionClass($namespace . '\\' . $module . '\\' . $layer . '\\' . $controller); + $content = ''; + $comment = $class->getDocComment(); + + if ($alias) { + $controller = substr($controller, 0, -10); + } + + if (false !== strpos($comment, '@route(')) { + $comment = $this->parseRouteComment($comment); + $route = $module . '/' . $controller; + $comment = preg_replace('/route\(\s?([\'\"][\-\_\/\:\<\>\?\$\[\]\w]+[\'\"])\s?\)/is', 'Route::resourece(\1,\'' . $route . '\')', $comment); + $content .= PHP_EOL . $comment; + } elseif (false !== strpos($comment, '@alias(')) { + $comment = $this->parseRouteComment($comment, '@alias('); + $route = $module . '/' . $controller; + $comment = preg_replace('/alias\(\s?([\'\"][\-\_\/\w]+[\'\"])\s?\)/is', 'Route::alias(\1,\'' . $route . '\')', $comment); + $content .= PHP_EOL . $comment; + } + + $methods = $class->getMethods(\ReflectionMethod::IS_PUBLIC); + + foreach ($methods as $method) { + $comment = $this->getMethodRouteComment($module, $controller, $method); + if ($comment) { + $content .= PHP_EOL . $comment; + } + } + + return $content; + } + + /** + * 解析路由注释 + * @access protected + * @param string $comment + * @param string $tag + * @return string + */ + protected function parseRouteComment($comment, $tag = '@route(') + { + $comment = substr($comment, 3, -2); + $comment = explode(PHP_EOL, substr(strstr(trim($comment), $tag), 1)); + $comment = array_map(function ($item) {return trim(trim($item), ' \t*');}, $comment); + + if (count($comment) > 1) { + $key = array_search('', $comment); + $comment = array_slice($comment, 0, false === $key ? 1 : $key); + } + + $comment = implode(PHP_EOL . "\t", $comment) . ';'; + + if (strpos($comment, '{')) { + $comment = preg_replace_callback('/\{\s?.*?\s?\}/s', function ($matches) { + return false !== strpos($matches[0], '"') ? '[' . substr(var_export(json_decode($matches[0], true), true), 7, -1) . ']' : $matches[0]; + }, $comment); + } + return $comment; + } + + /** + * 获取方法的路由注释 + * @access protected + * @param string $module 模块 + * @param string $controller 控制器名 + * @param \ReflectMethod $reflectMethod + * @return string|void + */ + protected function getMethodRouteComment($module, $controller, $reflectMethod) + { + $comment = $reflectMethod->getDocComment(); + + if (false !== strpos($comment, '@route(')) { + $comment = $this->parseRouteComment($comment); + $action = $reflectMethod->getName(); + + if ($suffix = $this->app->config('app.action_suffix')) { + $action = substr($action, 0, -strlen($suffix)); + } + + $route = $module . '/' . $controller . '/' . $action; + $comment = preg_replace('/route\s?\(\s?([\'\"][\-\_\/\:\<\>\?\$\[\]\w]+[\'\"])\s?\,?\s?[\'\"]?(\w+?)[\'\"]?\s?\)/is', 'Route::\2(\1,\'' . $route . '\')', $comment); + $comment = preg_replace('/route\s?\(\s?([\'\"][\-\_\/\:\<\>\?\$\[\]\w]+[\'\"])\s?\)/is', 'Route::rule(\1,\'' . $route . '\')', $comment); + + return $comment; + } + } + + /** + * 创建模块的欢迎页面 + * @access protected + * @param string $module 模块名 + * @param string $namespace 应用类库命名空间 + * @param bool $suffix 类库后缀 + * @return void + */ + protected function buildHello($module, $namespace, $suffix = false) + { + $filename = $this->basePath . ($module ? $module . DIRECTORY_SEPARATOR : '') . 'controller' . DIRECTORY_SEPARATOR . 'Index' . ($suffix ? 'Controller' : '') . '.php'; + if (!is_file($filename)) { + $content = file_get_contents($this->app->getThinkPath() . 'tpl' . DIRECTORY_SEPARATOR . 'default_index.tpl'); + $content = str_replace(['{$app}', '{$module}', '{layer}', '{$suffix}'], [$namespace, $module ? $module . '\\' : '', 'controller', $suffix ? 'Controller' : ''], $content); + $this->checkDirBuild(dirname($filename)); + + file_put_contents($filename, $content); + } + } + + /** + * 创建模块的公共文件 + * @access protected + * @param string $module 模块名 + * @return void + */ + protected function buildCommon($module) + { + $filename = $this->app->getConfigPath() . ($module ? $module . DIRECTORY_SEPARATOR : '') . 'app.php'; + $this->checkDirBuild(dirname($filename)); + + if (!is_file($filename)) { + file_put_contents($filename, "basePath . ($module ? $module . DIRECTORY_SEPARATOR : '') . 'common.php'; + + if (!is_file($filename)) { + file_put_contents($filename, " +// +---------------------------------------------------------------------- + +namespace think; + +use think\cache\Driver; + +class Cache +{ + /** + * 缓存实例 + * @var array + */ + protected $instance = []; + + /** + * 应用对象 + * @var App + */ + protected $app; + + /** + * 操作句柄 + * @var object + */ + protected $handler; + + public function __construct(App $app) + { + $this->app = $app; + } + + /** + * 连接缓存 + * @access public + * @param array $options 配置数组 + * @param bool|string $name 缓存连接标识 true 强制重新连接 + * @return Driver + */ + public function connect(array $options = [], $name = false) + { + $type = !empty($options['type']) ? $options['type'] : 'File'; + + if (false === $name) { + $name = md5(serialize($options)); + } + + if (true === $name || !isset($this->instance[$name])) { + $class = false !== strpos($type, '\\') ? $type : '\\think\\cache\\driver\\' . ucwords($type); + + // 记录初始化信息 + $this->app->log('[ CACHE ] INIT ' . $type); + + if (true === $name) { + $name = md5(serialize($options)); + } + + $this->instance[$name] = new $class($options); + } + + return $this->instance[$name]; + } + + /** + * 自动初始化缓存 + * @access public + * @param array $options 配置数组 + * @return Driver + */ + public function init(array $options = []) + { + if (is_null($this->handler)) { + // 自动初始化缓存 + $config = $this->app['config']; + + if (empty($options) && 'complex' == $config->get('cache.type')) { + $default = $config->get('cache.default'); + $options = $config->get('cache.' . $default['type']) ?: $default; + } elseif (empty($options)) { + $options = $config->pull('cache'); + } + + $this->handler = $this->connect($options); + } + + return $this->handler; + } + + /** + * 切换缓存类型 需要配置 cache.type 为 complex + * @access public + * @param string $name 缓存标识 + * @return Driver + */ + public function store($name = '') + { + if ('' !== $name && 'complex' == $this->app['config']->get('cache.type')) { + return $this->connect($this->app['config']->get('cache.' . $name), strtolower($name)); + } + + return $this->init(); + } + + public function __call($method, $args) + { + return call_user_func_array([$this->init(), $method], $args); + } + +} diff --git a/tp5/thinkphp/library/think/Collection.php b/tp5/thinkphp/library/think/Collection.php new file mode 100644 index 0000000..929b519 --- /dev/null +++ b/tp5/thinkphp/library/think/Collection.php @@ -0,0 +1,388 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +use ArrayAccess; +use ArrayIterator; +use Countable; +use IteratorAggregate; +use JsonSerializable; + +class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSerializable +{ + /** + * 数据集数据 + * @var array + */ + protected $items = []; + + public function __construct($items = []) + { + $this->items = $this->convertToArray($items); + } + + public static function make($items = []) + { + return new static($items); + } + + /** + * 是否为空 + * @access public + * @return bool + */ + public function isEmpty() + { + return empty($this->items); + } + + public function toArray() + { + return array_map(function ($value) { + return ($value instanceof Model || $value instanceof self) ? $value->toArray() : $value; + }, $this->items); + } + + public function all() + { + return $this->items; + } + + /** + * 合并数组 + * + * @access public + * @param mixed $items + * @return static + */ + public function merge($items) + { + return new static(array_merge($this->items, $this->convertToArray($items))); + } + + /** + * 比较数组,返回差集 + * + * @access public + * @param mixed $items + * @return static + */ + public function diff($items) + { + return new static(array_diff($this->items, $this->convertToArray($items))); + } + + /** + * 交换数组中的键和值 + * + * @access public + * @return static + */ + public function flip() + { + return new static(array_flip($this->items)); + } + + /** + * 比较数组,返回交集 + * + * @access public + * @param mixed $items + * @return static + */ + public function intersect($items) + { + return new static(array_intersect($this->items, $this->convertToArray($items))); + } + + /** + * 返回数组中所有的键名 + * + * @access public + * @return static + */ + public function keys() + { + return new static(array_keys($this->items)); + } + + /** + * 删除数组的最后一个元素(出栈) + * + * @access public + * @return mixed + */ + public function pop() + { + return array_pop($this->items); + } + + /** + * 通过使用用户自定义函数,以字符串返回数组 + * + * @access public + * @param callable $callback + * @param mixed $initial + * @return mixed + */ + public function reduce(callable $callback, $initial = null) + { + return array_reduce($this->items, $callback, $initial); + } + + /** + * 以相反的顺序返回数组。 + * + * @access public + * @return static + */ + public function reverse() + { + return new static(array_reverse($this->items)); + } + + /** + * 删除数组中首个元素,并返回被删除元素的值 + * + * @access public + * @return mixed + */ + public function shift() + { + return array_shift($this->items); + } + + /** + * 在数组结尾插入一个元素 + * @access public + * @param mixed $value + * @param mixed $key + * @return void + */ + public function push($value, $key = null) + { + if (is_null($key)) { + $this->items[] = $value; + } else { + $this->items[$key] = $value; + } + } + + /** + * 把一个数组分割为新的数组块. + * + * @access public + * @param int $size + * @param bool $preserveKeys + * @return static + */ + public function chunk($size, $preserveKeys = false) + { + $chunks = []; + + foreach (array_chunk($this->items, $size, $preserveKeys) as $chunk) { + $chunks[] = new static($chunk); + } + + return new static($chunks); + } + + /** + * 在数组开头插入一个元素 + * @access public + * @param mixed $value + * @param mixed $key + * @return void + */ + public function unshift($value, $key = null) + { + if (is_null($key)) { + array_unshift($this->items, $value); + } else { + $this->items = [$key => $value] + $this->items; + } + } + + /** + * 给每个元素执行个回调 + * + * @access public + * @param callable $callback + * @return $this + */ + public function each(callable $callback) + { + foreach ($this->items as $key => $item) { + $result = $callback($item, $key); + + if (false === $result) { + break; + } elseif (!is_object($item)) { + $this->items[$key] = $result; + } + } + + return $this; + } + + /** + * 用回调函数过滤数组中的元素 + * @access public + * @param callable|null $callback + * @return static + */ + public function filter(callable $callback = null) + { + if ($callback) { + return new static(array_filter($this->items, $callback)); + } + + return new static(array_filter($this->items)); + } + + /** + * 返回数据中指定的一列 + * @access public + * @param mixed $columnKey 键名 + * @param mixed $indexKey 作为索引值的列 + * @return array + */ + public function column($columnKey, $indexKey = null) + { + return array_column($this->items, $columnKey, $indexKey); + } + + /** + * 对数组排序 + * + * @access public + * @param callable|null $callback + * @return static + */ + public function sort(callable $callback = null) + { + $items = $this->items; + + $callback = $callback ?: function ($a, $b) { + return $a == $b ? 0 : (($a < $b) ? -1 : 1); + + }; + + uasort($items, $callback); + + return new static($items); + } + + /** + * 将数组打乱 + * + * @access public + * @return static + */ + public function shuffle() + { + $items = $this->items; + + shuffle($items); + + return new static($items); + } + + /** + * 截取数组 + * + * @access public + * @param int $offset + * @param int $length + * @param bool $preserveKeys + * @return static + */ + public function slice($offset, $length = null, $preserveKeys = false) + { + return new static(array_slice($this->items, $offset, $length, $preserveKeys)); + } + + // ArrayAccess + public function offsetExists($offset) + { + return array_key_exists($offset, $this->items); + } + + public function offsetGet($offset) + { + return $this->items[$offset]; + } + + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->items[] = $value; + } else { + $this->items[$offset] = $value; + } + } + + public function offsetUnset($offset) + { + unset($this->items[$offset]); + } + + //Countable + public function count() + { + return count($this->items); + } + + //IteratorAggregate + public function getIterator() + { + return new ArrayIterator($this->items); + } + + //JsonSerializable + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * 转换当前数据集为JSON字符串 + * @access public + * @param integer $options json参数 + * @return string + */ + public function toJson($options = JSON_UNESCAPED_UNICODE) + { + return json_encode($this->toArray(), $options); + } + + public function __toString() + { + return $this->toJson(); + } + + /** + * 转换成数组 + * + * @access public + * @param mixed $items + * @return array + */ + protected function convertToArray($items) + { + if ($items instanceof self) { + return $items->all(); + } + + return (array) $items; + } +} diff --git a/tp5/thinkphp/library/think/Config.php b/tp5/thinkphp/library/think/Config.php new file mode 100644 index 0000000..e30471a --- /dev/null +++ b/tp5/thinkphp/library/think/Config.php @@ -0,0 +1,314 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +class Config implements \ArrayAccess +{ + /** + * 配置参数 + * @var array + */ + private $config = []; + + /** + * 缓存前缀 + * @var string + */ + private $prefix = 'app'; + + /** + * 设置配置参数默认前缀 + * @access public + * @param string $prefix 前缀 + * @return void + */ + public function setDefaultPrefix($prefix) + { + $this->prefix = $prefix; + } + + /** + * 解析配置文件或内容 + * @access public + * @param string $config 配置文件路径或内容 + * @param string $type 配置解析类型 + * @param string $name 配置名(如设置即表示二级配置) + * @return mixed + */ + public function parse($config, $type = '', $name = '') + { + if (empty($type)) { + $type = pathinfo($config, PATHINFO_EXTENSION); + } + + $class = false !== strpos($type, '\\') ? $type : '\\think\\config\\driver\\' . ucwords($type); + + return $this->set((new $class())->parse($config), $name); + } + + /** + * 加载配置文件(多种格式) + * @access public + * @param string $file 配置文件名 + * @param string $name 一级配置名 + * @return mixed + */ + public function load($file, $name = '') + { + if (is_file($file)) { + $name = strtolower($name); + $type = pathinfo($file, PATHINFO_EXTENSION); + + if ('php' == $type) { + return $this->set(include $file, $name); + } elseif ('yaml' == $type && function_exists('yaml_parse_file')) { + return $this->set(yaml_parse_file($file), $name); + } else { + return $this->parse($file, $type, $name); + } + } else { + return $this->config; + } + } + + /** + * 自动加载配置文件(PHP格式) + * @access public + * @param string $name 配置名 + * @return void + */ + protected function autoLoad($name) + { + // 如果尚未载入 则动态加载配置文件 + $module = Container::get('request')->module(); + $module = $module ? $module . '/' : ''; + $app = Container::get('app'); + $path = $app->getAppPath() . $module; + + if (is_dir($path . 'config')) { + $file = $path . 'config/' . $name . $app->getConfigExt(); + } elseif (is_dir($app->getConfigPath() . $module)) { + $file = $app->getConfigPath() . $module . $name . $app->getConfigExt(); + } + + if (isset($file) && is_file($file)) { + $this->load($file, $name); + } + } + + /** + * 检测配置是否存在 + * @access public + * @param string $name 配置参数名(支持多级配置 .号分割) + * @return bool + */ + public function has($name) + { + if (!strpos($name, '.')) { + $name = $this->prefix . '.' . $name; + } + + return $this->get($name) ? true : false; + } + + /** + * 获取一级配置 + * @access public + * @param string $name 一级配置名 + * @return array + */ + public function pull($name) + { + $name = strtolower($name); + + if (!isset($this->config[$name])) { + // 如果尚未载入 则动态加载配置文件 + $this->autoLoad($name); + } + + return isset($this->config[$name]) ? $this->config[$name] : []; + } + + /** + * 获取配置参数 为空则获取所有配置 + * @access public + * @param string $name 配置参数名(支持多级配置 .号分割) + * @return mixed + */ + public function get($name = null) + { + // 无参数时获取所有 + if (empty($name)) { + return $this->config; + } + + if (!strpos($name, '.')) { + $name = $this->prefix . '.' . $name; + } elseif ('.' == substr($name, -1)) { + return $this->pull(substr($name, 0, -1)); + } + + $name = explode('.', $name); + $name[0] = strtolower($name[0]); + $config = $this->config; + + if (!isset($config[$name[0]])) { + // 如果尚未载入 则动态加载配置文件 + $this->autoLoad($name[0]); + } + + // 按.拆分成多维数组进行判断 + foreach ($name as $val) { + if (isset($config[$val])) { + $config = $config[$val]; + } else { + return; + } + } + + return $config; + } + + /** + * 设置配置参数 name为数组则为批量设置 + * @access public + * @param string|array $name 配置参数名(支持三级配置 .号分割) + * @param mixed $value 配置值 + * @return mixed + */ + public function set($name, $value = null) + { + if (is_string($name)) { + if (!strpos($name, '.')) { + $name = $this->prefix . '.' . $name; + } + + $name = explode('.', $name, 3); + + if (count($name) == 2) { + $this->config[strtolower($name[0])][$name[1]] = $value; + } else { + $this->config[strtolower($name[0])][$name[1]][$name[2]] = $value; + } + + return $value; + } elseif (is_array($name)) { + // 批量设置 + if (!empty($value)) { + if (isset($this->config[$value])) { + $result = array_merge($this->config[$value], $name); + } else { + $result = $name; + } + + $this->config[$value] = $result; + } else { + $result = $this->config = array_merge($this->config, $name); + } + } else { + // 为空直接返回 已有配置 + $result = $this->config; + } + + return $result; + } + + /** + * 移除配置 + * @access public + * @param string $name 配置参数名(支持三级配置 .号分割) + * @return void + */ + public function remove($name) + { + if (!strpos($name, '.')) { + $name = $this->prefix . '.' . $name; + } + + $name = explode('.', $name, 3); + + if (count($name) == 2) { + unset($this->config[strtolower($name[0])][$name[1]]); + } else { + unset($this->config[strtolower($name[0])][$name[1]][$name[2]]); + } + } + + /** + * 重置配置参数 + * @access public + * @param string $prefix 配置前缀名 + * @return void + */ + public function reset($prefix = '') + { + if ('' === $prefix) { + $this->config = []; + } else { + $this->config[$prefix] = []; + } + } + + /** + * 设置配置 + * @access public + * @param string $name 参数名 + * @param mixed $value 值 + */ + public function __set($name, $value) + { + return $this->set($name, $value); + } + + /** + * 获取配置参数 + * @access public + * @param string $name 参数名 + * @return mixed + */ + public function __get($name) + { + return $this->get($name); + } + + /** + * 检测是否存在参数 + * @access public + * @param string $name 参数名 + * @return bool + */ + public function __isset($name) + { + return $this->has($name); + } + + // ArrayAccess + public function offsetSet($name, $value) + { + $this->set($name, $value); + } + + public function offsetExists($name) + { + return $this->has($name); + } + + public function offsetUnset($name) + { + $this->remove($name); + } + + public function offsetGet($name) + { + return $this->get($name); + } +} diff --git a/tp5/thinkphp/library/think/Console.php b/tp5/thinkphp/library/think/Console.php new file mode 100644 index 0000000..5cb1ccd --- /dev/null +++ b/tp5/thinkphp/library/think/Console.php @@ -0,0 +1,762 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +use think\console\Command; +use think\console\command\Help as HelpCommand; +use think\console\Input; +use think\console\input\Argument as InputArgument; +use think\console\input\Definition as InputDefinition; +use think\console\input\Option as InputOption; +use think\console\Output; +use think\console\output\driver\Buffer; + +class Console +{ + + private $name; + private $version; + + /** @var Command[] */ + private $commands = []; + + private $wantHelps = false; + + private $catchExceptions = true; + private $autoExit = true; + private $definition; + private $defaultCommand; + + private static $defaultCommands = [ + "think\\console\\command\\Help", + "think\\console\\command\\Lists", + "think\\console\\command\\Build", + "think\\console\\command\\Clear", + "think\\console\\command\\make\\Controller", + "think\\console\\command\\make\\Model", + "think\\console\\command\\optimize\\Autoload", + "think\\console\\command\\optimize\\Config", + "think\\console\\command\\optimize\\Schema", + "think\\console\\command\\optimize\\Route", + "think\\console\\command\\RunServer", + ]; + + public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN') + { + $this->name = $name; + $this->version = $version; + + $this->defaultCommand = 'list'; + $this->definition = $this->getDefaultInputDefinition(); + + foreach ($this->getDefaultCommands() as $command) { + $this->add($command); + } + } + + public static function init($run = true) + { + static $console; + + if (!$console) { + // 实例化console + $console = new self('Think Console', '0.1'); + + // 读取指令集 + $file = Container::get('env')->get('app_path') . 'command.php'; + + if (is_file($file)) { + $commands = include $file; + + if (is_array($commands)) { + foreach ($commands as $command) { + if (class_exists($command) && is_subclass_of($command, "\\think\\console\\Command")) { + // 注册指令 + $console->add(new $command()); + } + } + } + } + } + + if ($run) { + // 运行 + return $console->run(); + } else { + return $console; + } + } + + /** + * @access public + * @param string $command + * @param array $parameters + * @param string $driver + * @return Output|Buffer + */ + public static function call($command, array $parameters = [], $driver = 'buffer') + { + $console = self::init(false); + + array_unshift($parameters, $command); + + $input = new Input($parameters); + $output = new Output($driver); + + $console->setCatchExceptions(false); + $console->find($command)->run($input, $output); + + return $output; + } + + /** + * 执行当前的指令 + * @access public + * @return int + * @throws \Exception + * @api + */ + public function run() + { + $input = new Input(); + $output = new Output(); + + $this->configureIO($input, $output); + + try { + $exitCode = $this->doRun($input, $output); + } catch (\Exception $e) { + if (!$this->catchExceptions) { + throw $e; + } + + $output->renderException($e); + + $exitCode = $e->getCode(); + if (is_numeric($exitCode)) { + $exitCode = (int) $exitCode; + if (0 === $exitCode) { + $exitCode = 1; + } + } else { + $exitCode = 1; + } + } + + if ($this->autoExit) { + if ($exitCode > 255) { + $exitCode = 255; + } + + exit($exitCode); + } + + return $exitCode; + } + + /** + * 执行指令 + * @access public + * @param Input $input + * @param Output $output + * @return int + */ + public function doRun(Input $input, Output $output) + { + if (true === $input->hasParameterOption(['--version', '-V'])) { + $output->writeln($this->getLongVersion()); + + return 0; + } + + $name = $this->getCommandName($input); + + if (true === $input->hasParameterOption(['--help', '-h'])) { + if (!$name) { + $name = 'help'; + $input = new Input(['help']); + } else { + $this->wantHelps = true; + } + } + + if (!$name) { + $name = $this->defaultCommand; + $input = new Input([$this->defaultCommand]); + } + + $command = $this->find($name); + + $exitCode = $this->doRunCommand($command, $input, $output); + + return $exitCode; + } + + /** + * 设置输入参数定义 + * @access public + * @param InputDefinition $definition + */ + public function setDefinition(InputDefinition $definition) + { + $this->definition = $definition; + } + + /** + * 获取输入参数定义 + * @access public + * @return InputDefinition The InputDefinition instance + */ + public function getDefinition() + { + return $this->definition; + } + + /** + * Gets the help message. + * @access public + * @return string A help message. + */ + public function getHelp() + { + return $this->getLongVersion(); + } + + /** + * 是否捕获异常 + * @access public + * @param bool $boolean + * @api + */ + public function setCatchExceptions($boolean) + { + $this->catchExceptions = (bool) $boolean; + } + + /** + * 是否自动退出 + * @access public + * @param bool $boolean + * @api + */ + public function setAutoExit($boolean) + { + $this->autoExit = (bool) $boolean; + } + + /** + * 获取名称 + * @access public + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * 设置名称 + * @access public + * @param string $name + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * 获取版本 + * @access public + * @return string + * @api + */ + public function getVersion() + { + return $this->version; + } + + /** + * 设置版本 + * @access public + * @param string $version + */ + public function setVersion($version) + { + $this->version = $version; + } + + /** + * 获取完整的版本号 + * @access public + * @return string + */ + public function getLongVersion() + { + if ('UNKNOWN' !== $this->getName() && 'UNKNOWN' !== $this->getVersion()) { + return sprintf('%s version %s', $this->getName(), $this->getVersion()); + } + + return 'Console Tool'; + } + + /** + * 注册一个指令 + * @access public + * @param string $name + * @return Command + */ + public function register($name) + { + return $this->add(new Command($name)); + } + + /** + * 添加指令 + * @access public + * @param Command[] $commands + */ + public function addCommands(array $commands) + { + foreach ($commands as $command) { + $this->add($command); + } + } + + /** + * 添加一个指令 + * @access public + * @param Command $command + * @return Command + */ + public function add(Command $command) + { + $command->setConsole($this); + + if (!$command->isEnabled()) { + $command->setConsole(null); + return; + } + + if (null === $command->getDefinition()) { + throw new \LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', get_class($command))); + } + + $this->commands[$command->getName()] = $command; + + foreach ($command->getAliases() as $alias) { + $this->commands[$alias] = $command; + } + + return $command; + } + + /** + * 获取指令 + * @access public + * @param string $name 指令名称 + * @return Command + * @throws \InvalidArgumentException + */ + public function get($name) + { + if (!isset($this->commands[$name])) { + throw new \InvalidArgumentException(sprintf('The command "%s" does not exist.', $name)); + } + + $command = $this->commands[$name]; + + if ($this->wantHelps) { + $this->wantHelps = false; + + /** @var HelpCommand $helpCommand */ + $helpCommand = $this->get('help'); + $helpCommand->setCommand($command); + + return $helpCommand; + } + + return $command; + } + + /** + * 某个指令是否存在 + * @access public + * @param string $name 指令名称 + * @return bool + */ + public function has($name) + { + return isset($this->commands[$name]); + } + + /** + * 获取所有的命名空间 + * @access public + * @return array + */ + public function getNamespaces() + { + $namespaces = []; + foreach ($this->commands as $command) { + $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName())); + + foreach ($command->getAliases() as $alias) { + $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias)); + } + } + + return array_values(array_unique(array_filter($namespaces))); + } + + /** + * 查找注册命名空间中的名称或缩写。 + * @access public + * @param string $namespace + * @return string + * @throws \InvalidArgumentException + */ + public function findNamespace($namespace) + { + $allNamespaces = $this->getNamespaces(); + $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { + return preg_quote($matches[1]) . '[^:]*'; + }, $namespace); + $namespaces = preg_grep('{^' . $expr . '}', $allNamespaces); + + if (empty($namespaces)) { + $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace); + + if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) { + if (1 == count($alternatives)) { + $message .= "\n\nDid you mean this?\n "; + } else { + $message .= "\n\nDid you mean one of these?\n "; + } + + $message .= implode("\n ", $alternatives); + } + + throw new \InvalidArgumentException($message); + } + + $exact = in_array($namespace, $namespaces, true); + if (count($namespaces) > 1 && !$exact) { + throw new \InvalidArgumentException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces)))); + } + + return $exact ? $namespace : reset($namespaces); + } + + /** + * 查找指令 + * @access public + * @param string $name 名称或者别名 + * @return Command + * @throws \InvalidArgumentException + */ + public function find($name) + { + $allCommands = array_keys($this->commands); + + $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { + return preg_quote($matches[1]) . '[^:]*'; + }, $name); + + $commands = preg_grep('{^' . $expr . '}', $allCommands); + + if (empty($commands) || count(preg_grep('{^' . $expr . '$}', $commands)) < 1) { + if (false !== $pos = strrpos($name, ':')) { + $this->findNamespace(substr($name, 0, $pos)); + } + + $message = sprintf('Command "%s" is not defined.', $name); + + if ($alternatives = $this->findAlternatives($name, $allCommands)) { + if (1 == count($alternatives)) { + $message .= "\n\nDid you mean this?\n "; + } else { + $message .= "\n\nDid you mean one of these?\n "; + } + $message .= implode("\n ", $alternatives); + } + + throw new \InvalidArgumentException($message); + } + + if (count($commands) > 1) { + $commandList = $this->commands; + + $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands) { + $commandName = $commandList[$nameOrAlias]->getName(); + + return $commandName === $nameOrAlias || !in_array($commandName, $commands); + }); + } + + $exact = in_array($name, $commands, true); + if (count($commands) > 1 && !$exact) { + $suggestions = $this->getAbbreviationSuggestions(array_values($commands)); + + throw new \InvalidArgumentException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions)); + } + + return $this->get($exact ? $name : reset($commands)); + } + + /** + * 获取所有的指令 + * @access public + * @param string $namespace 命名空间 + * @return Command[] + * @api + */ + public function all($namespace = null) + { + if (null === $namespace) { + return $this->commands; + } + + $commands = []; + foreach ($this->commands as $name => $command) { + if ($this->extractNamespace($name, substr_count($namespace, ':') + 1) === $namespace) { + $commands[$name] = $command; + } + } + + return $commands; + } + + /** + * 获取可能的指令名 + * @access public + * @param array $names + * @return array + */ + public static function getAbbreviations($names) + { + $abbrevs = []; + foreach ($names as $name) { + for ($len = strlen($name); $len > 0; --$len) { + $abbrev = substr($name, 0, $len); + $abbrevs[$abbrev][] = $name; + } + } + + return $abbrevs; + } + + /** + * 配置基于用户的参数和选项的输入和输出实例。 + * @access protected + * @param Input $input 输入实例 + * @param Output $output 输出实例 + */ + protected function configureIO(Input $input, Output $output) + { + if (true === $input->hasParameterOption(['--ansi'])) { + $output->setDecorated(true); + } elseif (true === $input->hasParameterOption(['--no-ansi'])) { + $output->setDecorated(false); + } + + if (true === $input->hasParameterOption(['--no-interaction', '-n'])) { + $input->setInteractive(false); + } + + if (true === $input->hasParameterOption(['--quiet', '-q'])) { + $output->setVerbosity(Output::VERBOSITY_QUIET); + } else { + if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || $input->getParameterOption('--verbose') === 3) { + $output->setVerbosity(Output::VERBOSITY_DEBUG); + } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || $input->getParameterOption('--verbose') === 2) { + $output->setVerbosity(Output::VERBOSITY_VERY_VERBOSE); + } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) { + $output->setVerbosity(Output::VERBOSITY_VERBOSE); + } + } + } + + /** + * 执行指令 + * @access protected + * @param Command $command 指令实例 + * @param Input $input 输入实例 + * @param Output $output 输出实例 + * @return int + * @throws \Exception + */ + protected function doRunCommand(Command $command, Input $input, Output $output) + { + return $command->run($input, $output); + } + + /** + * 获取指令的基础名称 + * @access protected + * @param Input $input + * @return string + */ + protected function getCommandName(Input $input) + { + return $input->getFirstArgument(); + } + + /** + * 获取默认输入定义 + * @access protected + * @return InputDefinition + */ + protected function getDefaultInputDefinition() + { + return new InputDefinition([ + new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'), + new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'), + new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this console version'), + new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'), + new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'), + new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'), + new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'), + new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'), + ]); + } + + /** + * 设置默认命令 + * @access protected + * @return Command[] An array of default Command instances + */ + protected function getDefaultCommands() + { + $defaultCommands = []; + + foreach (self::$defaultCommands as $classname) { + if (class_exists($classname) && is_subclass_of($classname, "think\\console\\Command")) { + $defaultCommands[] = new $classname(); + } + } + + return $defaultCommands; + } + + public static function addDefaultCommands(array $classnames) + { + self::$defaultCommands = array_merge(self::$defaultCommands, $classnames); + } + + /** + * 获取可能的建议 + * @access private + * @param array $abbrevs + * @return string + */ + private function getAbbreviationSuggestions($abbrevs) + { + return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], count($abbrevs) > 2 ? sprintf(' and %d more', count($abbrevs) - 2) : ''); + } + + /** + * 返回命名空间部分 + * @access public + * @param string $name 指令 + * @param string $limit 部分的命名空间的最大数量 + * @return string + */ + public function extractNamespace($name, $limit = null) + { + $parts = explode(':', $name); + array_pop($parts); + + return implode(':', null === $limit ? $parts : array_slice($parts, 0, $limit)); + } + + /** + * 查找可替代的建议 + * @access private + * @param string $name + * @param array|\Traversable $collection + * @return array + */ + private function findAlternatives($name, $collection) + { + $threshold = 1e3; + $alternatives = []; + + $collectionParts = []; + foreach ($collection as $item) { + $collectionParts[$item] = explode(':', $item); + } + + foreach (explode(':', $name) as $i => $subname) { + foreach ($collectionParts as $collectionName => $parts) { + $exists = isset($alternatives[$collectionName]); + if (!isset($parts[$i]) && $exists) { + $alternatives[$collectionName] += $threshold; + continue; + } elseif (!isset($parts[$i])) { + continue; + } + + $lev = levenshtein($subname, $parts[$i]); + if ($lev <= strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) { + $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev; + } elseif ($exists) { + $alternatives[$collectionName] += $threshold; + } + } + } + + foreach ($collection as $item) { + $lev = levenshtein($name, $item); + if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) { + $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev; + } + } + + $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { + return $lev < 2 * $threshold; + }); + asort($alternatives); + + return array_keys($alternatives); + } + + /** + * 设置默认的指令 + * @access public + * @param string $commandName The Command name + */ + public function setDefaultCommand($commandName) + { + $this->defaultCommand = $commandName; + } + + /** + * 返回所有的命名空间 + * @access private + * @param string $name + * @return array + */ + private function extractAllNamespaces($name) + { + $parts = explode(':', $name, -1); + $namespaces = []; + + foreach ($parts as $part) { + if (count($namespaces)) { + $namespaces[] = end($namespaces) . ':' . $part; + } else { + $namespaces[] = $part; + } + } + + return $namespaces; + } + +} diff --git a/tp5/thinkphp/library/think/Container.php b/tp5/thinkphp/library/think/Container.php new file mode 100644 index 0000000..b934cb3 --- /dev/null +++ b/tp5/thinkphp/library/think/Container.php @@ -0,0 +1,295 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +use Closure; +use InvalidArgumentException; +use ReflectionClass; +use ReflectionFunction; +use ReflectionMethod; + +class Container +{ + /** + * 容器对象实例 + * @var Container + */ + protected static $instance; + + /** + * 容器中的对象实例 + * @var array + */ + protected $instances = []; + + /** + * 容器绑定标识 + * @var array + */ + protected $bind = []; + + /** + * 获取当前容器的实例(单例) + * @access public + * @return static + */ + public static function getInstance() + { + if (is_null(static::$instance)) { + static::$instance = new static; + } + + return static::$instance; + } + + /** + * 获取容器中的对象实例 + * @access public + * @param string $abstract 类名或者标识 + * @param array|true $vars 变量 + * @param bool $newInstance 是否每次创建新的实例 + * @return object + */ + public static function get($abstract, $vars = [], $newInstance = false) + { + return static::getInstance()->make($abstract, $vars, $newInstance); + } + + /** + * 绑定一个类、闭包、实例、接口实现到容器 + * @access public + * @param string $abstract 类标识、接口 + * @param mixed $concrete 要绑定的类、闭包或者实例 + * @return Container + */ + public static function set($abstract, $concrete = null) + { + return static::getInstance()->bind($abstract, $concrete); + } + + /** + * 绑定一个类、闭包、实例、接口实现到容器 + * @access public + * @param string|array $abstract 类标识、接口 + * @param mixed $concrete 要绑定的类、闭包或者实例 + * @return $this + */ + public function bind($abstract, $concrete = null) + { + if (is_array($abstract)) { + $this->bind = array_merge($this->bind, $abstract); + } elseif ($concrete instanceof Closure) { + $this->bind[$abstract] = $concrete; + } elseif (is_object($concrete)) { + $this->instances[$abstract] = $concrete; + } else { + $this->bind[$abstract] = $concrete; + } + + return $this; + } + + /** + * 绑定一个类实例当容器 + * @access public + * @param string $abstract 类名或者标识 + * @param object $instance 类的实例 + * @return $this + */ + public function instance($abstract, $instance) + { + if (isset($this->bind[$abstract])) { + $abstract = $this->bind[$abstract]; + } + + $this->instances[$abstract] = $instance; + + return $this; + } + + /** + * 判断容器中是否存在类及标识 + * @access public + * @param string $abstract 类名或者标识 + * @return bool + */ + public function bound($abstract) + { + return isset($this->bind[$abstract]) || isset($this->instances[$abstract]); + } + + /** + * 判断容器中是否存在类及标识 + * @access public + * @param string $name 类名或者标识 + * @return bool + */ + public function has($name) + { + return $this->bound($name); + } + + /** + * 创建类的实例 + * @access public + * @param string $abstract 类名或者标识 + * @param array|true $args 变量 + * @param bool $newInstance 是否每次创建新的实例 + * @return object + */ + public function make($abstract, $vars = [], $newInstance = false) + { + if (true === $vars) { + // 总是创建新的实例化对象 + $newInstance = true; + $vars = []; + } + + if (isset($this->instances[$abstract]) && !$newInstance) { + $object = $this->instances[$abstract]; + } else { + if (isset($this->bind[$abstract])) { + $concrete = $this->bind[$abstract]; + + if ($concrete instanceof Closure) { + $object = $this->invokeFunction($concrete, $vars); + } else { + $object = $this->make($concrete, $vars, $newInstance); + } + } else { + $object = $this->invokeClass($abstract, $vars); + } + + if (!$newInstance) { + $this->instances[$abstract] = $object; + } + } + + return $object; + } + + /** + * 执行函数或者闭包方法 支持参数调用 + * @access public + * @param string|array|\Closure $function 函数或者闭包 + * @param array $vars 变量 + * @return mixed + */ + public function invokeFunction($function, $vars = []) + { + $reflect = new ReflectionFunction($function); + $args = $this->bindParams($reflect, $vars); + + return $reflect->invokeArgs($args); + } + + /** + * 调用反射执行类的方法 支持参数绑定 + * @access public + * @param string|array $method 方法 + * @param array $vars 变量 + * @return mixed + */ + public function invokeMethod($method, $vars = []) + { + if (is_array($method)) { + $class = is_object($method[0]) ? $method[0] : $this->invokeClass($method[0]); + $reflect = new ReflectionMethod($class, $method[1]); + } else { + // 静态方法 + $reflect = new ReflectionMethod($method); + } + + $args = $this->bindParams($reflect, $vars); + + return $reflect->invokeArgs(isset($class) ? $class : null, $args); + } + + /** + * 调用反射执行callable 支持参数绑定 + * @access public + * @param mixed $callable + * @param array $vars 变量 + * @return mixed + */ + public function invoke($callable, $vars = []) + { + if ($callable instanceof Closure) { + $result = $this->invokeFunction($callable, $vars); + } else { + $result = $this->invokeMethod($callable, $vars); + } + + return $result; + } + + /** + * 调用反射执行类的实例化 支持依赖注入 + * @access public + * @param string $class 类名 + * @param array $vars 变量 + * @return mixed + */ + public function invokeClass($class, $vars = []) + { + $reflect = new ReflectionClass($class); + $constructor = $reflect->getConstructor(); + + if ($constructor) { + $args = $this->bindParams($constructor, $vars); + } else { + $args = []; + } + + return $reflect->newInstanceArgs($args); + } + + /** + * 绑定参数 + * @access protected + * @param \ReflectionMethod|\ReflectionFunction $reflect 反射类 + * @param array $vars 变量 + * @return array + */ + protected function bindParams($reflect, $vars = []) + { + $args = []; + + if ($reflect->getNumberOfParameters() > 0) { + // 判断数组类型 数字数组时按顺序绑定参数 + reset($vars); + $type = key($vars) === 0 ? 1 : 0; + $params = $reflect->getParameters(); + + foreach ($params as $param) { + $name = $param->getName(); + $class = $param->getClass(); + + if ($class) { + $className = $class->getName(); + $args[] = $this->make($className); + } elseif (1 == $type && !empty($vars)) { + $args[] = array_shift($vars); + } elseif (0 == $type && isset($vars[$name])) { + $args[] = $vars[$name]; + } elseif ($param->isDefaultValueAvailable()) { + $args[] = $param->getDefaultValue(); + } else { + throw new InvalidArgumentException('method param miss:' . $name); + } + } + } + + return $args; + } + +} diff --git a/tp5/thinkphp/library/think/Controller.php b/tp5/thinkphp/library/think/Controller.php new file mode 100644 index 0000000..cc3953d --- /dev/null +++ b/tp5/thinkphp/library/think/Controller.php @@ -0,0 +1,242 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +use think\exception\ValidateException; +use traits\controller\Jump; + +class Controller +{ + use Jump; + + /** + * 视图类实例 + * @var \think\View + */ + protected $view; + + /** + * Request实例 + * @var \think\Request + */ + protected $request; + + /** + * 应用实例 + * @var \think\App + */ + protected $app; + + /** + * 验证失败是否抛出异常 + * @var bool + */ + protected $failException = false; + + /** + * 是否批量验证 + * @var bool + */ + protected $batchValidate = false; + + /** + * 前置操作方法列表 + * @var array $beforeActionList + */ + protected $beforeActionList = []; + + /** + * 构造方法 + * @access public + */ + public function __construct() + { + $this->request = Container::get('request'); + $this->app = Container::get('app'); + $this->view = Container::get('view')->init( + $this->app['config']->pull('template') + ); + + // 控制器初始化 + $this->initialize(); + + // 前置操作方法 + if ($this->beforeActionList) { + foreach ($this->beforeActionList as $method => $options) { + is_numeric($method) ? + $this->beforeAction($options) : + $this->beforeAction($method, $options); + } + } + } + + // 初始化 + protected function initialize() + {} + + /** + * 前置操作 + * @access protected + * @param string $method 前置操作方法名 + * @param array $options 调用参数 ['only'=>[...]] 或者['except'=>[...]] + */ + protected function beforeAction($method, $options = []) + { + if (isset($options['only'])) { + if (is_string($options['only'])) { + $options['only'] = explode(',', $options['only']); + } + if (!in_array($this->request->action(), $options['only'])) { + return; + } + } elseif (isset($options['except'])) { + if (is_string($options['except'])) { + $options['except'] = explode(',', $options['except']); + } + if (in_array($this->request->action(), $options['except'])) { + return; + } + } + + call_user_func([$this, $method]); + } + + /** + * 加载模板输出 + * @access protected + * @param string $template 模板文件名 + * @param array $vars 模板输出变量 + * @param array $config 模板参数 + * @return mixed + */ + protected function fetch($template = '', $vars = [], $config = []) + { + return $this->view->fetch($template, $vars, $config); + } + + /** + * 渲染内容输出 + * @access protected + * @param string $content 模板内容 + * @param array $vars 模板输出变量 + * @param array $config 模板参数 + * @return mixed + */ + protected function display($content = '', $vars = [], $config = []) + { + return $this->view->display($content, $vars, $config); + } + + /** + * 模板变量赋值 + * @access protected + * @param mixed $name 要显示的模板变量 + * @param mixed $value 变量的值 + * @return $this + */ + protected function assign($name, $value = '') + { + $this->view->assign($name, $value); + + return $this; + } + + /** + * 视图过滤 + * @access protected + * @param Callable $filter 过滤方法或闭包 + * @return $this + */ + protected function filter($filter) + { + $this->view->filter($filter); + + return $this; + } + + /** + * 初始化模板引擎 + * @access protected + * @param array|string $engine 引擎参数 + * @return $this + */ + protected function engine($engine) + { + $this->view->engine($engine); + + return $this; + } + + /** + * 设置验证失败后是否抛出异常 + * @access protected + * @param bool $fail 是否抛出异常 + * @return $this + */ + protected function validateFailException($fail = true) + { + $this->failException = $fail; + + return $this; + } + + /** + * 验证数据 + * @access protected + * @param array $data 数据 + * @param string|array $validate 验证器名或者验证规则数组 + * @param array $message 提示信息 + * @param bool $batch 是否批量验证 + * @param mixed $callback 回调方法(闭包) + * @return array|string|true + * @throws ValidateException + */ + protected function validate($data, $validate, $message = [], $batch = false, $callback = null) + { + if (is_array($validate)) { + $v = $this->app->validate(); + $v->rule($validate); + } else { + if (strpos($validate, '.')) { + // 支持场景 + list($validate, $scene) = explode('.', $validate); + } + $v = $this->app->validate($validate); + if (!empty($scene)) { + $v->scene($scene); + } + } + + // 是否批量验证 + if ($batch || $this->batchValidate) { + $v->batch(true); + } + + if (is_array($message)) { + $v->message($message); + } + + if ($callback && is_callable($callback)) { + call_user_func_array($callback, [$v, &$data]); + } + + if (!$v->check($data)) { + if ($this->failException) { + throw new ValidateException($v->getError()); + } else { + return $v->getError(); + } + } else { + return true; + } + } +} diff --git a/tp5/thinkphp/library/think/Cookie.php b/tp5/thinkphp/library/think/Cookie.php new file mode 100644 index 0000000..c645fde --- /dev/null +++ b/tp5/thinkphp/library/think/Cookie.php @@ -0,0 +1,262 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +class Cookie +{ + /** + * 配置参数 + * @var array + */ + protected $config = [ + // cookie 名称前缀 + 'prefix' => '', + // cookie 保存时间 + 'expire' => 0, + // cookie 保存路径 + 'path' => '/', + // cookie 有效域名 + 'domain' => '', + // cookie 启用安全传输 + 'secure' => false, + // httponly设置 + 'httponly' => false, + // 是否使用 setcookie + 'setcookie' => true, + ]; + + /** + * 是否初始化 + * @var bool + */ + protected $init; + + /** + * Cookie初始化 + * @access public + * @param array $config + * @return void + */ + public function init(array $config = []) + { + if (empty($config)) { + $config = Container::get('config')->pull('cookie'); + } + + $this->config = array_merge($this->config, array_change_key_case($config)); + + if (!empty($this->config['httponly'])) { + ini_set('session.cookie_httponly', 1); + } + + $this->init = true; + } + + /** + * 设置或者获取cookie作用域(前缀) + * @access public + * @param string $prefix + * @return string|void + */ + public function prefix($prefix = '') + { + if (empty($prefix)) { + return $this->config['prefix']; + } + + $this->config['prefix'] = $prefix; + } + + /** + * Cookie 设置、获取、删除 + * + * @access public + * @param string $name cookie名称 + * @param mixed $value cookie值 + * @param mixed $option 可选参数 可能会是 null|integer|string + * @return void + */ + public function set($name, $value = '', $option = null) + { + !isset($this->init) && $this->init(); + + // 参数设置(会覆盖黙认设置) + if (!is_null($option)) { + if (is_numeric($option)) { + $option = ['expire' => $option]; + } elseif (is_string($option)) { + parse_str($option, $option); + } + + $config = array_merge($this->config, array_change_key_case($option)); + } else { + $config = $this->config; + } + + $name = $config['prefix'] . $name; + + // 设置cookie + if (is_array($value)) { + array_walk_recursive($value, [$this, 'jsonFormatProtect'], 'encode'); + $value = 'think:' . json_encode($value); + } + + $expire = !empty($config['expire']) ? $_SERVER['REQUEST_TIME'] + intval($config['expire']) : 0; + + if ($config['setcookie']) { + setcookie($name, $value, $expire, $config['path'], $config['domain'], $config['secure'], $config['httponly']); + } + + $_COOKIE[$name] = $value; + } + + /** + * 永久保存Cookie数据 + * @access public + * @param string $name cookie名称 + * @param mixed $value cookie值 + * @param mixed $option 可选参数 可能会是 null|integer|string + * @return void + */ + public function forever($name, $value = '', $option = null) + { + if (is_null($option) || is_numeric($option)) { + $option = []; + } + + $option['expire'] = 315360000; + + $this->set($name, $value, $option); + } + + /** + * 判断Cookie数据 + * @access public + * @param string $name cookie名称 + * @param string|null $prefix cookie前缀 + * @return bool + */ + public function has($name, $prefix = null) + { + !isset($this->init) && $this->init(); + + $prefix = !is_null($prefix) ? $prefix : $this->config['prefix']; + $name = $prefix . $name; + + return isset($_COOKIE[$name]); + } + + /** + * Cookie获取 + * @access public + * @param string $name cookie名称 留空获取全部 + * @param string|null $prefix cookie前缀 + * @return mixed + */ + public function get($name = '', $prefix = null) + { + !isset($this->init) && $this->init(); + + $prefix = !is_null($prefix) ? $prefix : $this->config['prefix']; + $key = $prefix . $name; + + if ('' == $name) { + if ($prefix) { + $value = []; + foreach ($_COOKIE as $k => $val) { + if (0 === strpos($k, $prefix)) { + $value[$k] = $val; + } + } + } else { + $value = $_COOKIE; + } + } elseif (isset($_COOKIE[$key])) { + $value = $_COOKIE[$key]; + + if (0 === strpos($value, 'think:')) { + $value = substr($value, 6); + $value = json_decode($value, true); + array_walk_recursive($value, [$this, 'jsonFormatProtect'], 'decode'); + } + } else { + $value = null; + } + + return $value; + } + + /** + * Cookie删除 + * @access public + * @param string $name cookie名称 + * @param string|null $prefix cookie前缀 + * @return void + */ + public function delete($name, $prefix = null) + { + !isset($this->init) && $this->init(); + + $config = $this->config; + $prefix = !is_null($prefix) ? $prefix : $config['prefix']; + $name = $prefix . $name; + + if ($config['setcookie']) { + setcookie($name, '', $_SERVER['REQUEST_TIME'] - 3600, $config['path'], $config['domain'], $config['secure'], $config['httponly']); + } + + // 删除指定cookie + unset($_COOKIE[$name]); + } + + /** + * Cookie清空 + * @access public + * @param string|null $prefix cookie前缀 + * @return void + */ + public function clear($prefix = null) + { + // 清除指定前缀的所有cookie + if (empty($_COOKIE)) { + return; + } + + !isset($this->init) && $this->init(); + + // 要删除的cookie前缀,不指定则删除config设置的指定前缀 + $config = $this->config; + $prefix = !is_null($prefix) ? $prefix : $config['prefix']; + + if ($prefix) { + // 如果前缀为空字符串将不作处理直接返回 + foreach ($_COOKIE as $key => $val) { + if (0 === strpos($key, $prefix)) { + if ($config['setcookie']) { + setcookie($key, '', $_SERVER['REQUEST_TIME'] - 3600, $config['path'], $config['domain'], $config['secure'], $config['httponly']); + } + unset($_COOKIE[$key]); + } + } + } + + return; + } + + private function jsonFormatProtect(&$val, $key, $type = 'encode') + { + if (!empty($val) && true !== $val) { + $val = 'decode' == $type ? urldecode($val) : urlencode($val); + } + } + +} diff --git a/tp5/thinkphp/library/think/Db.php b/tp5/thinkphp/library/think/Db.php new file mode 100644 index 0000000..21770e0 --- /dev/null +++ b/tp5/thinkphp/library/think/Db.php @@ -0,0 +1,69 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +/** + * Class Db + * @package think + * @method \think\db\Query table(string $table) static 指定数据表(含前缀) + * @method \think\db\Query name(string $name) static 指定数据表(不含前缀) + * @method \think\db\Query where(mixed $field, string $op = null, mixed $condition = null) static 查询条件 + * @method \think\db\Query join(mixed $join, mixed $condition = null, string $type = 'INNER') static JOIN查询 + * @method \think\db\Query view(mixed $join, mixed $field = null, mixed $on = null, string $type = 'INNER') static 视图查询 + * @method \think\db\Query union(mixed $union, boolean $all = false) static UNION查询 + * @method \think\db\Query limit(mixed $offset, integer $length = null) static 查询LIMIT + * @method \think\db\Query order(mixed $field, string $order = null) static 查询ORDER + * @method \think\db\Query cache(mixed $key = null , integer $expire = null) static 设置查询缓存 + * @method mixed value(string $field) static 获取某个字段的值 + * @method array column(string $field, string $key = '') static 获取某个列的值 + * @method mixed find(mixed $data = null) static 查询单个记录 + * @method mixed select(mixed $data = null) static 查询多个记录 + * @method integer insert(array $data, boolean $replace = false, boolean $getLastInsID = false, string $sequence = null) static 插入一条记录 + * @method integer insertGetId(array $data, boolean $replace = false, string $sequence = null) static 插入一条记录并返回自增ID + * @method integer insertAll(array $dataSet) static 插入多条记录 + * @method integer update(array $data) static 更新记录 + * @method integer delete(mixed $data = null) static 删除记录 + * @method boolean chunk(integer $count, callable $callback, string $column = null) static 分块获取数据 + * @method \Generator cursor(mixed $data = null) static 使用游标查找记录 + * @method mixed query(string $sql, array $bind = [], boolean $master = false, bool $pdo = false) static SQL查询 + * @method integer execute(string $sql, array $bind = [], boolean $fetch = false, boolean $getLastInsID = false, string $sequence = null) static SQL执行 + * @method \think\Paginator paginate(integer $listRows = 15, mixed $simple = null, array $config = []) static 分页查询 + * @method mixed transaction(callable $callback) static 执行数据库事务 + * @method void startTrans() static 启动事务 + * @method void commit() static 用于非自动提交状态下面的查询提交 + * @method void rollback() static 事务回滚 + * @method boolean batchQuery(array $sqlArray) static 批处理执行SQL语句 + * @method string getLastInsID($sequence = null) static 获取最近插入的ID + */ +class Db +{ + /** + * 查询次数 + * @var integer + */ + public static $queryTimes = 0; + + /** + * 执行次数 + * @var integer + */ + public static $executeTimes = 0; + + public static function __callStatic($method, $args) + { + $class = Container::get('config')->get('database.query') ?: '\\think\\db\\Query'; + + $query = new $class(); + + return call_user_func_array([$query, $method], $args); + } +} diff --git a/tp5/thinkphp/library/think/Debug.php b/tp5/thinkphp/library/think/Debug.php new file mode 100644 index 0000000..8a384e1 --- /dev/null +++ b/tp5/thinkphp/library/think/Debug.php @@ -0,0 +1,259 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +use think\exception\ClassNotFoundException; +use think\model\Collection as ModelCollection; +use think\response\Redirect; + +class Debug +{ + /** + * 区间时间信息 + * @var array + */ + protected $info = []; + + /** + * 区间内存信息 + * @var array + */ + protected $mem = []; + + /** + * 应用对象 + * @var App + */ + protected $app; + + public function __construct(App $app) + { + $this->app = $app; + } + + /** + * 记录时间(微秒)和内存使用情况 + * @access public + * @param string $name 标记位置 + * @param mixed $value 标记值 留空则取当前 time 表示仅记录时间 否则同时记录时间和内存 + * @return void + */ + public function remark($name, $value = '') + { + // 记录时间和内存使用 + $this->info[$name] = is_float($value) ? $value : microtime(true); + + if ('time' != $value) { + $this->mem['mem'][$name] = is_float($value) ? $value : memory_get_usage(); + $this->mem['peak'][$name] = memory_get_peak_usage(); + } + } + + /** + * 统计某个区间的时间(微秒)使用情况 + * @access public + * @param string $start 开始标签 + * @param string $end 结束标签 + * @param integer|string $dec 小数位 + * @return integer + */ + public function getRangeTime($start, $end, $dec = 6) + { + if (!isset($this->info[$end])) { + $this->info[$end] = microtime(true); + } + + return number_format(($this->info[$end] - $this->info[$start]), $dec); + } + + /** + * 统计从开始到统计时的时间(微秒)使用情况 + * @access public + * @param integer|string $dec 小数位 + * @return integer + */ + public function getUseTime($dec = 6) + { + return number_format((microtime(true) - $this->app->getBeginTime()), $dec); + } + + /** + * 获取当前访问的吞吐率情况 + * @access public + * @return string + */ + public function getThroughputRate() + { + return number_format(1 / $this->getUseTime(), 2) . 'req/s'; + } + + /** + * 记录区间的内存使用情况 + * @access public + * @param string $start 开始标签 + * @param string $end 结束标签 + * @param integer|string $dec 小数位 + * @return string + */ + public function getRangeMem($start, $end, $dec = 2) + { + if (!isset($this->mem['mem'][$end])) { + $this->mem['mem'][$end] = memory_get_usage(); + } + + $size = $this->mem['mem'][$end] - $this->mem['mem'][$start]; + $a = ['B', 'KB', 'MB', 'GB', 'TB']; + $pos = 0; + + while ($size >= 1024) { + $size /= 1024; + $pos++; + } + + return round($size, $dec) . " " . $a[$pos]; + } + + /** + * 统计从开始到统计时的内存使用情况 + * @access public + * @param integer|string $dec 小数位 + * @return string + */ + public function getUseMem($dec = 2) + { + $size = memory_get_usage() - $this->app->getBeginMem(); + $a = ['B', 'KB', 'MB', 'GB', 'TB']; + $pos = 0; + + while ($size >= 1024) { + $size /= 1024; + $pos++; + } + + return round($size, $dec) . " " . $a[$pos]; + } + + /** + * 统计区间的内存峰值情况 + * @access public + * @param string $start 开始标签 + * @param string $end 结束标签 + * @param integer|string $dec 小数位 + * @return string + */ + public function getMemPeak($start, $end, $dec = 2) + { + if (!isset($this->mem['peak'][$end])) { + $this->mem['peak'][$end] = memory_get_peak_usage(); + } + + $size = $this->mem['peak'][$end] - $this->mem['peak'][$start]; + $a = ['B', 'KB', 'MB', 'GB', 'TB']; + $pos = 0; + + while ($size >= 1024) { + $size /= 1024; + $pos++; + } + + return round($size, $dec) . " " . $a[$pos]; + } + + /** + * 获取文件加载信息 + * @access public + * @param bool $detail 是否显示详细 + * @return integer|array + */ + public function getFile($detail = false) + { + if ($detail) { + $files = get_included_files(); + $info = []; + + foreach ($files as $key => $file) { + $info[] = $file . ' ( ' . number_format(filesize($file) / 1024, 2) . ' KB )'; + } + + return $info; + } + + return count(get_included_files()); + } + + /** + * 浏览器友好的变量输出 + * @access public + * @param mixed $var 变量 + * @param boolean $echo 是否输出 默认为true 如果为false 则返回输出字符串 + * @param string $label 标签 默认为空 + * @param integer $flags htmlspecialchars flags + * @return void|string + */ + public function dump($var, $echo = true, $label = null, $flags = ENT_SUBSTITUTE) + { + $label = (null === $label) ? '' : rtrim($label) . ':'; + if ($var instanceof Model || $var instanceof ModelCollection) { + $var = $var->toArray(); + } + + ob_start(); + var_dump($var); + + $output = ob_get_clean(); + $output = preg_replace('/\]\=\>\n(\s+)/m', '] => ', $output); + + if (PHP_SAPI == 'cli') { + $output = PHP_EOL . $label . $output . PHP_EOL; + } else { + if (!extension_loaded('xdebug')) { + $output = htmlspecialchars($output, $flags); + } + $output = '
' . $label . $output . '
'; + } + if ($echo) { + echo($output); + return; + } else { + return $output; + } + } + + public function inject(Response $response, &$content) + { + $config = $this->app['config']->pull('trace'); + $type = isset($config['type']) ? $config['type'] : 'Html'; + $class = false !== strpos($type, '\\') ? $type : '\\think\\debug\\' . ucwords($type); + unset($config['type']); + + if (class_exists($class)) { + $trace = new $class($config); + } else { + throw new ClassNotFoundException('class not exists:' . $class, $class); + } + + if ($response instanceof Redirect) { + //TODO 记录 + } else { + $output = $trace->output($response, $this->app['log']->getLog()); + if (is_string($output)) { + // trace调试信息注入 + $pos = strripos($content, ''); + if (false !== $pos) { + $content = substr($content, 0, $pos) . $output . substr($content, $pos); + } else { + $content = $content . $output; + } + } + } + } +} diff --git a/tp5/thinkphp/library/think/Env.php b/tp5/thinkphp/library/think/Env.php new file mode 100644 index 0000000..2c41794 --- /dev/null +++ b/tp5/thinkphp/library/think/Env.php @@ -0,0 +1,109 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +class Env +{ + /** + * 环境变量数据 + * @var array + */ + protected $data = []; + + public function __construct() + { + $this->data = $_ENV; + } + + /** + * 读取环境变量定义文件 + * @access public + * @param string $file 环境变量定义文件 + * @return void + */ + public function load($file) + { + $env = parse_ini_file($file, true); + $this->set($env); + } + + /** + * 获取环境变量值 + * @access public + * @param string $name 环境变量名 + * @param mixed $default 默认值 + * @return mixed + */ + public function get($name = null, $default = null) + { + if (is_null($name)) { + return $this->data; + } + + $name = strtoupper(str_replace('.', '_', $name)); + + if (isset($this->data[$name])) { + return $this->data[$name]; + } + + return $this->getEnv($name, $default); + } + + protected function getEnv($name, $default = null) + { + $result = getenv('PHP_' . $name); + + if (false !== $result) { + if ('false' === $result) { + $result = false; + } elseif ('true' === $result) { + $result = true; + } + + if (!isset($this->data[$name])) { + $this->data[$name] = $result; + } + + return $result; + } else { + return $default; + } + } + + /** + * 设置环境变量值 + * @access public + * @param string|array $env 环境变量 + * @param mixed $value 值 + * @return void + */ + public function set($env, $value = null) + { + if (is_array($env)) { + $env = array_change_key_case($env, CASE_UPPER); + + foreach ($env as $key => $val) { + if (is_array($val)) { + foreach ($val as $k => $v) { + $this->data[$key . '_' . strtoupper($k)] = $v; + } + } else { + $this->data[$key] = $val; + } + } + } else { + $name = strtoupper(str_replace('.', '_', $env)); + + $this->data[$name] = $value; + } + } +} diff --git a/tp5/thinkphp/library/think/Error.php b/tp5/thinkphp/library/think/Error.php new file mode 100644 index 0000000..c00a36a --- /dev/null +++ b/tp5/thinkphp/library/think/Error.php @@ -0,0 +1,128 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +use think\console\Output as ConsoleOutput; +use think\exception\ErrorException; +use think\exception\Handle; +use think\exception\ThrowableError; + +class Error +{ + /** + * 注册异常处理 + * @access public + * @return void + */ + public static function register() + { + error_reporting(E_ALL); + set_error_handler([__CLASS__, 'appError']); + set_exception_handler([__CLASS__, 'appException']); + register_shutdown_function([__CLASS__, 'appShutdown']); + } + + /** + * Exception Handler + * @access public + * @param \Exception|\Throwable $e + */ + public static function appException($e) + { + if (!$e instanceof \Exception) { + $e = new ThrowableError($e); + } + + self::getExceptionHandler()->report($e); + + if (PHP_SAPI == 'cli') { + self::getExceptionHandler()->renderForConsole(new ConsoleOutput, $e); + } else { + self::getExceptionHandler()->render($e)->send(); + } + } + + /** + * Error Handler + * @access public + * @param integer $errno 错误编号 + * @param integer $errstr 详细错误信息 + * @param string $errfile 出错的文件 + * @param integer $errline 出错行号 + * @throws ErrorException + */ + public static function appError($errno, $errstr, $errfile = '', $errline = 0) + { + $exception = new ErrorException($errno, $errstr, $errfile, $errline); + if (error_reporting() & $errno) { + // 将错误信息托管至 think\exception\ErrorException + throw $exception; + } else { + self::getExceptionHandler()->report($exception); + } + } + + /** + * Shutdown Handler + * @access public + */ + public static function appShutdown() + { + if (!is_null($error = error_get_last()) && self::isFatal($error['type'])) { + // 将错误信息托管至think\ErrorException + $exception = new ErrorException($error['type'], $error['message'], $error['file'], $error['line']); + + self::appException($exception); + } + + // 写入日志 + Container::get('log')->save(); + } + + /** + * 确定错误类型是否致命 + * + * @access protected + * @param int $type + * @return bool + */ + protected static function isFatal($type) + { + return in_array($type, [E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE]); + } + + /** + * Get an instance of the exception handler. + * + * @access public + * @return Handle + */ + public static function getExceptionHandler() + { + static $handle; + + if (!$handle) { + // 异常处理handle + $class = Container::get('config')->get('exception_handle'); + if ($class && is_string($class) && class_exists($class) && is_subclass_of($class, "\\think\\exception\\Handle")) { + $handle = new $class; + } else { + $handle = new Handle; + if ($class instanceof \Closure) { + $handle->setRender($class); + } + } + } + + return $handle; + } +} diff --git a/tp5/thinkphp/library/think/Exception.php b/tp5/thinkphp/library/think/Exception.php new file mode 100644 index 0000000..414a090 --- /dev/null +++ b/tp5/thinkphp/library/think/Exception.php @@ -0,0 +1,56 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +class Exception extends \Exception +{ + + /** + * 保存异常页面显示的额外Debug数据 + * @var array + */ + protected $data = []; + + /** + * 设置异常额外的Debug数据 + * 数据将会显示为下面的格式 + * + * Exception Data + * -------------------------------------------------- + * Label 1 + * key1 value1 + * key2 value2 + * Label 2 + * key1 value1 + * key2 value2 + * + * @access protected + * @param string $label 数据分类,用于异常页面显示 + * @param array $data 需要显示的数据,必须为关联数组 + */ + final protected function setData($label, array $data) + { + $this->data[$label] = $data; + } + + /** + * 获取异常额外Debug数据 + * 主要用于输出到异常页面便于调试 + * @access public + * @return array 由setData设置的Debug数据 + */ + final public function getData() + { + return $this->data; + } + +} diff --git a/tp5/thinkphp/library/think/Facade.php b/tp5/thinkphp/library/think/Facade.php new file mode 100644 index 0000000..2cda381 --- /dev/null +++ b/tp5/thinkphp/library/think/Facade.php @@ -0,0 +1,122 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +class Facade +{ + /** + * 绑定对象 + * @var array + */ + protected static $bind = []; + + /** + * 始终创建新的对象实例 + * @var bool + */ + protected static $alwaysNewInstance; + + /** + * 绑定类的静态代理 + * @static + * @access public + * @param string|array $name 类标识 + * @param string $class 类名 + * @return object + */ + public static function bind($name, $class = null) + { + if (__CLASS__ != static::class) { + return self::__callStatic('bind', func_get_args()); + } + + if (is_array($name)) { + self::$bind = array_merge(self::$bind, $name); + } else { + self::$bind[$name] = $class; + } + } + + /** + * 创建Facade实例 + * @static + * @access protected + * @param string $class 类名或标识 + * @param array $args 变量 + * @param bool $newInstance 是否每次创建新的实例 + * @return object + */ + protected static function createFacade($class = '', $args = [], $newInstance = false) + { + $class = $class ?: static::class; + $facadeClass = static::getFacadeClass(); + + if ($facadeClass) { + $class = $facadeClass; + } elseif (isset(self::$bind[$class])) { + $class = self::$bind[$class]; + } + + if (static::$alwaysNewInstance) { + $newInstance = true; + } + + return Container::getInstance()->make($class, $args, $newInstance); + } + + /** + * 获取当前Facade对应类名 + * @access protected + * @return string + */ + protected static function getFacadeClass() + {} + + /** + * 带参数实例化当前Facade类 + * @access public + * @return object + */ + public static function instance(...$args) + { + return self::createFacade('', $args); + } + + /** + * 调用类的实例 + * @access public + * @param string $class 类名或者标识 + * @param array|true $args 变量 + * @param bool $newInstance 是否每次创建新的实例 + * @return object + */ + public static function make($class, $args = [], $newInstance = false) + { + if (__CLASS__ != static::class) { + return self::__callStatic('make', func_get_args()); + } + + if (true === $args) { + // 总是创建新的实例化对象 + $newInstance = true; + $args = []; + } + + return self::createFacade($class, $args, $newInstance); + } + + // 调用实际类的方法 + public static function __callStatic($method, $params) + { + return call_user_func_array([static::createFacade(), $method], $params); + } +} diff --git a/tp5/thinkphp/library/think/File.php b/tp5/thinkphp/library/think/File.php new file mode 100644 index 0000000..00e83a5 --- /dev/null +++ b/tp5/thinkphp/library/think/File.php @@ -0,0 +1,494 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +use SplFileObject; + +class File extends SplFileObject +{ + /** + * 错误信息 + * @var string + */ + private $error = ''; + + /** + * 当前完整文件名 + * @var string + */ + protected $filename; + + /** + * 上传文件名 + * @var string + */ + protected $saveName; + + /** + * 上传文件命名规则 + * @var string + */ + protected $rule = 'date'; + + /** + * 上传文件验证规则 + * @var array + */ + protected $validate = []; + + /** + * 是否单元测试 + * @var bool + */ + protected $isTest; + + /** + * 上传文件信息 + * @var array + */ + protected $info = []; + + /** + * 文件hash规则 + * @var array + */ + protected $hash = []; + + public function __construct($filename, $mode = 'r') + { + parent::__construct($filename, $mode); + + $this->filename = $this->getRealPath() ?: $this->getPathname(); + } + + /** + * 是否测试 + * @access public + * @param bool $test 是否测试 + * @return $this + */ + public function isTest($test = false) + { + $this->isTest = $test; + + return $this; + } + + /** + * 设置上传信息 + * @access public + * @param array $info 上传文件信息 + * @return $this + */ + public function setUploadInfo($info) + { + $this->info = $info; + + return $this; + } + + /** + * 获取上传文件的信息 + * @access public + * @param string $name + * @return array|string + */ + public function getInfo($name = '') + { + return isset($this->info[$name]) ? $this->info[$name] : $this->info; + } + + /** + * 获取上传文件的文件名 + * @access public + * @return string + */ + public function getSaveName() + { + return $this->saveName; + } + + /** + * 设置上传文件的保存文件名 + * @access public + * @param string $saveName + * @return $this + */ + public function setSaveName($saveName) + { + $this->saveName = $saveName; + + return $this; + } + + /** + * 获取文件的哈希散列值 + * @access public + * @param string $type + * @return string + */ + public function hash($type = 'sha1') + { + if (!isset($this->hash[$type])) { + $this->hash[$type] = hash_file($type, $this->filename); + } + + return $this->hash[$type]; + } + + /** + * 检查目录是否可写 + * @access public + * @param string $path 目录 + * @return boolean + */ + protected function checkPath($path) + { + if (is_dir($path)) { + return true; + } + + if (mkdir($path, 0755, true)) { + return true; + } else { + $this->error = ['directory {:path} creation failed', ['path' => $path]]; + return false; + } + } + + /** + * 获取文件类型信息 + * @access public + * @return string + */ + public function getMime() + { + $finfo = finfo_open(FILEINFO_MIME_TYPE); + + return finfo_file($finfo, $this->filename); + } + + /** + * 设置文件的命名规则 + * @access public + * @param string $rule 文件命名规则 + * @return $this + */ + public function rule($rule) + { + $this->rule = $rule; + + return $this; + } + + /** + * 设置上传文件的验证规则 + * @access public + * @param array $rule 验证规则 + * @return $this + */ + public function validate($rule = []) + { + $this->validate = $rule; + + return $this; + } + + /** + * 检测是否合法的上传文件 + * @access public + * @return bool + */ + public function isValid() + { + if ($this->isTest) { + return is_file($this->filename); + } + + return is_uploaded_file($this->filename); + } + + /** + * 检测上传文件 + * @access public + * @param array $rule 验证规则 + * @return bool + */ + public function check($rule = []) + { + $rule = $rule ?: $this->validate; + + /* 检查文件大小 */ + if (isset($rule['size']) && !$this->checkSize($rule['size'])) { + $this->error = 'filesize not match'; + return false; + } + + /* 检查文件Mime类型 */ + if (isset($rule['type']) && !$this->checkMime($rule['type'])) { + $this->error = 'mimetype to upload is not allowed'; + return false; + } + + /* 检查文件后缀 */ + if (isset($rule['ext']) && !$this->checkExt($rule['ext'])) { + $this->error = 'extensions to upload is not allowed'; + return false; + } + + /* 检查图像文件 */ + if (!$this->checkImg()) { + $this->error = 'illegal image files'; + return false; + } + + return true; + } + + /** + * 检测上传文件后缀 + * @access public + * @param array|string $ext 允许后缀 + * @return bool + */ + public function checkExt($ext) + { + if (is_string($ext)) { + $ext = explode(',', $ext); + } + + $extension = strtolower(pathinfo($this->getInfo('name'), PATHINFO_EXTENSION)); + + if (!in_array($extension, $ext)) { + return false; + } + + return true; + } + + /** + * 检测图像文件 + * @access public + * @return bool + */ + public function checkImg() + { + $extension = strtolower(pathinfo($this->getInfo('name'), PATHINFO_EXTENSION)); + + /* 对图像文件进行严格检测 */ + if (in_array($extension, ['gif', 'jpg', 'jpeg', 'bmp', 'png', 'swf']) && !in_array($this->getImageType($this->filename), [1, 2, 3, 4, 6, 13])) { + return false; + } + + return true; + } + + // 判断图像类型 + protected function getImageType($image) + { + if (function_exists('exif_imagetype')) { + return exif_imagetype($image); + } else { + try { + $info = getimagesize($image); + return $info ? $info[2] : false; + } catch (\Exception $e) { + return false; + } + } + } + + /** + * 检测上传文件大小 + * @access public + * @param integer $size 最大大小 + * @return bool + */ + public function checkSize($size) + { + if ($this->getSize() > $size) { + return false; + } + + return true; + } + + /** + * 检测上传文件类型 + * @access public + * @param array|string $mime 允许类型 + * @return bool + */ + public function checkMime($mime) + { + if (is_string($mime)) { + $mime = explode(',', $mime); + } + + if (!in_array(strtolower($this->getMime()), $mime)) { + return false; + } + + return true; + } + + /** + * 移动文件 + * @access public + * @param string $path 保存路径 + * @param string|bool $savename 保存的文件名 默认自动生成 + * @param boolean $replace 同名文件是否覆盖 + * @return false|File false-失败 否则返回File实例 + */ + public function move($path, $savename = true, $replace = true) + { + // 文件上传失败,捕获错误代码 + if (!empty($this->info['error'])) { + $this->error($this->info['error']); + return false; + } + + // 检测合法性 + if (!$this->isValid()) { + $this->error = 'upload illegal files'; + return false; + } + + // 验证上传 + if (!$this->check()) { + return false; + } + + $path = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; + // 文件保存命名规则 + $saveName = $this->buildSaveName($savename); + $filename = $path . $saveName; + + // 检测目录 + if (false === $this->checkPath(dirname($filename))) { + return false; + } + + /* 不覆盖同名文件 */ + if (!$replace && is_file($filename)) { + $this->error = ['has the same filename: {:filename}', ['filename' => $filename]]; + return false; + } + + /* 移动文件 */ + if ($this->isTest) { + rename($this->filename, $filename); + } elseif (!move_uploaded_file($this->filename, $filename)) { + $this->error = 'upload write error'; + return false; + } + + // 返回 File对象实例 + $file = new self($filename); + $file->setSaveName($saveName); + $file->setUploadInfo($this->info); + + return $file; + } + + /** + * 获取保存文件名 + * @access public + * @param string|bool $savename 保存的文件名 默认自动生成 + * @return string + */ + protected function buildSaveName($savename) + { + if (true === $savename) { + // 自动生成文件名 + if ($this->rule instanceof \Closure) { + $savename = call_user_func_array($this->rule, [$this]); + } else { + switch ($this->rule) { + case 'date': + $savename = date('Ymd') . '/' . md5(microtime(true)); + break; + default: + if (in_array($this->rule, hash_algos())) { + $hash = $this->hash($this->rule); + $savename = substr($hash, 0, 2) . '/' . substr($hash, 2); + } elseif (is_callable($this->rule)) { + $savename = call_user_func($this->rule); + } else { + $savename = date('Ymd') . '/' . md5(microtime(true)); + } + } + } + } elseif ('' === $savename || false === $savename) { + $savename = $this->getInfo('name'); + } + + if (!strpos($savename, '.')) { + $savename .= '.' . pathinfo($this->getInfo('name'), PATHINFO_EXTENSION); + } + + return $savename; + } + + /** + * 获取错误代码信息 + * @access public + * @param int $errorNo 错误号 + */ + private function error($errorNo) + { + switch ($errorNo) { + case 1: + case 2: + $this->error = 'upload File size exceeds the maximum value'; + break; + case 3: + $this->error = 'only the portion of file is uploaded'; + break; + case 4: + $this->error = 'no file to uploaded'; + break; + case 6: + $this->error = 'upload temp dir not found'; + break; + case 7: + $this->error = 'file write error'; + break; + default: + $this->error = 'unknown upload error'; + } + } + + /** + * 获取错误信息(支持多语言) + * @access public + * @return string + */ + public function getError() + { + $lang = Container::get('lang'); + + if (is_array($this->error)) { + list($msg, $vars) = $this->error; + } else { + $msg = $this->error; + $vars = []; + } + + return $lang->has($msg) ? $lang->get($msg, $vars) : $msg; + } + + public function __call($method, $args) + { + return $this->hash($method); + } +} diff --git a/tp5/thinkphp/library/think/Hook.php b/tp5/thinkphp/library/think/Hook.php new file mode 100644 index 0000000..30b6730 --- /dev/null +++ b/tp5/thinkphp/library/think/Hook.php @@ -0,0 +1,215 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +class Hook +{ + /** + * 钩子行为定义 + * @var array + */ + private $tags = []; + + /** + * 绑定行为列表 + * @var array + */ + protected $bind = []; + + /** + * 入口方法名称 + * @var string + */ + private static $portal = 'run'; + + /** + * 指定入口方法名称 + * @access public + * @param string $name 方法名 + * @return $this + */ + public function portal($name) + { + self::$portal = $name; + return $this; + } + + /** + * 指定行为标识 便于调用 + * @access public + * @param string|array $name 行为标识 + * @param mixed $behavior 行为 + * @return $this + */ + public function alias($name, $behavior = null) + { + if (is_array($name)) { + $this->bind = array_merge($this->bind, $name); + } else { + $this->bind[$name] = $behavior; + } + + return $this; + } + + /** + * 动态添加行为扩展到某个标签 + * @access public + * @param string $tag 标签名称 + * @param mixed $behavior 行为名称 + * @param bool $first 是否放到开头执行 + * @return void + */ + public function add($tag, $behavior, $first = false) + { + isset($this->tags[$tag]) || $this->tags[$tag] = []; + + if (is_array($behavior) && !is_callable($behavior)) { + if (!array_key_exists('_overlay', $behavior)) { + $this->tags[$tag] = array_merge($this->tags[$tag], $behavior); + } else { + unset($behavior['_overlay']); + $this->tags[$tag] = $behavior; + } + } elseif ($first) { + array_unshift($this->tags[$tag], $behavior); + } else { + $this->tags[$tag][] = $behavior; + } + } + + /** + * 批量导入插件 + * @access public + * @param array $tags 插件信息 + * @param bool $recursive 是否递归合并 + * @return void + */ + public function import(array $tags, $recursive = true) + { + if ($recursive) { + foreach ($tags as $tag => $behavior) { + $this->add($tag, $behavior); + } + } else { + $this->tags = $tags + $this->tags; + } + } + + /** + * 获取插件信息 + * @access public + * @param string $tag 插件位置 留空获取全部 + * @return array + */ + public function get($tag = '') + { + if (empty($tag)) { + //获取全部的插件信息 + return $this->tags; + } else { + return array_key_exists($tag, $this->tags) ? $this->tags[$tag] : []; + } + } + + /** + * 监听标签的行为 + * @access public + * @param string $tag 标签名称 + * @param mixed $params 传入参数 + * @param bool $once 只获取一个有效返回值 + * @return mixed + */ + public function listen($tag, $params = null, $once = false) + { + $results = []; + $tags = $this->get($tag); + + foreach ($tags as $key => $name) { + $results[$key] = $this->execTag($name, $tag, $params); + + if (false === $results[$key]) { + // 如果返回false 则中断行为执行 + break; + } elseif (!is_null($results[$key]) && $once) { + break; + } + } + + return $once ? end($results) : $results; + } + + /** + * 执行行为 + * @access public + * @param mixed $class 行为 + * @param mixed $params 参数 + * @return mixed + */ + public function exec($class, $params = null) + { + if ($class instanceof \Closure || is_array($class)) { + $method = $class; + } else { + if (isset($this->bind[$class])) { + $class = $this->bind[$class]; + } + $method = [$class, self::$portal]; + } + + return Container::getInstance()->invoke($method, [$params]); + } + + /** + * 执行某个标签的行为 + * @access protected + * @param mixed $class 要执行的行为 + * @param string $tag 方法名(标签名) + * @param mixed $params 参数 + * @return mixed + */ + protected function execTag($class, $tag = '', $params = null) + { + $app = Container::get('app'); + + $app->isDebug() && $app['debug']->remark('behavior_start', 'time'); + + $method = Loader::parseName($tag, 1, false); + + if ($class instanceof \Closure) { + $call = $class; + $class = 'Closure'; + } elseif (strpos($class, '::')) { + $call = $class; + } else { + $obj = Container::get($class); + + if (!is_callable([$obj, $method])) { + $method = self::$portal; + } + + $call = [$class, $method]; + $class = $class . '->' . $method; + } + + $result = Container::getInstance()->invoke($call, [$params]); + + if ($app->isDebug()) { + $debug = $app['debug']; + $debug->remark('behavior_end', 'time'); + $app->log('[ BEHAVIOR ] Run ' . $class . ' @' . $tag . ' [ RunTime:' . $debug->getRangeTime('behavior_start', 'behavior_end') . 's ]'); + } + + return $result; + } + +} diff --git a/tp5/thinkphp/library/think/Lang.php b/tp5/thinkphp/library/think/Lang.php new file mode 100644 index 0000000..ba4f700 --- /dev/null +++ b/tp5/thinkphp/library/think/Lang.php @@ -0,0 +1,265 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +class Lang +{ + /** + * 多语言信息 + * @var array + */ + private $lang = []; + + /** + * 当前语言 + * @var string + */ + private $range = 'zh-cn'; + + /** + * 多语言自动侦测变量名 + * @var string + */ + protected $langDetectVar = 'lang'; + + /** + * 多语言cookie变量 + * @var string + */ + protected $langCookieVar = 'think_var'; + + /** + * 允许的多语言列表 + * @var array + */ + protected $allowLangList = []; + + /** + * Accept-Language转义为对应语言包名称 系统默认配置 + * @var string + */ + protected $acceptLanguage = [ + 'zh-hans-cn' => 'zh-cn', + ]; + + // 设定当前的语言 + public function range($range = '') + { + if ('' == $range) { + return $this->range; + } else { + $this->range = $range; + } + } + + /** + * 设置语言定义(不区分大小写) + * @access public + * @param string|array $name 语言变量 + * @param string $value 语言值 + * @param string $range 语言作用域 + * @return mixed + */ + public function set($name, $value = null, $range = '') + { + $range = $range ?: $this->range; + // 批量定义 + if (!isset($this->lang[$range])) { + $this->lang[$range] = []; + } + + if (is_array($name)) { + return $this->lang[$range] = array_change_key_case($name) + $this->lang[$range]; + } else { + return $this->lang[$range][strtolower($name)] = $value; + } + } + + /** + * 加载语言定义(不区分大小写) + * @access public + * @param string|array $file 语言文件 + * @param string $range 语言作用域 + * @return array + */ + public function load($file, $range = '') + { + $range = $range ?: $this->range; + if (!isset($this->lang[$range])) { + $this->lang[$range] = []; + } + + // 批量定义 + if (is_string($file)) { + $file = [$file]; + } + + $lang = []; + + foreach ($file as $_file) { + if (is_file($_file)) { + // 记录加载信息 + Container::get('app')->log('[ LANG ] ' . $_file); + $_lang = include $_file; + if (is_array($_lang)) { + $lang = array_change_key_case($_lang) + $lang; + } + } + } + + if (!empty($lang)) { + $this->lang[$range] = $lang + $this->lang[$range]; + } + + return $this->lang[$range]; + } + + /** + * 获取语言定义(不区分大小写) + * @access public + * @param string|null $name 语言变量 + * @param string $range 语言作用域 + * @return bool + */ + public function has($name, $range = '') + { + $range = $range ?: $this->range; + + return isset($this->lang[$range][strtolower($name)]); + } + + /** + * 获取语言定义(不区分大小写) + * @access public + * @param string|null $name 语言变量 + * @param array $vars 变量替换 + * @param string $range 语言作用域 + * @return mixed + */ + public function get($name = null, $vars = [], $range = '') + { + $range = $range ?: $this->range; + + // 空参数返回所有定义 + if (empty($name)) { + return $this->lang[$range]; + } + + $key = strtolower($name); + $value = isset($this->lang[$range][$key]) ? $this->lang[$range][$key] : $name; + + // 变量解析 + if (!empty($vars) && is_array($vars)) { + /** + * Notes: + * 为了检测的方便,数字索引的判断仅仅是参数数组的第一个元素的key为数字0 + * 数字索引采用的是系统的 sprintf 函数替换,用法请参考 sprintf 函数 + */ + if (key($vars) === 0) { + // 数字索引解析 + array_unshift($vars, $value); + $value = call_user_func_array('sprintf', $vars); + } else { + // 关联索引解析 + $replace = array_keys($vars); + foreach ($replace as &$v) { + $v = "{:{$v}}"; + } + $value = str_replace($replace, $vars, $value); + } + } + + return $value; + } + + /** + * 自动侦测设置获取语言选择 + * @access public + * @return string + */ + public function detect() + { + // 自动侦测设置获取语言选择 + $langSet = ''; + + if (isset($_GET[$this->langDetectVar])) { + // url中设置了语言变量 + $langSet = strtolower($_GET[$this->langDetectVar]); + } elseif (isset($_COOKIE[$this->langCookieVar])) { + // Cookie中设置了语言变量 + $langSet = strtolower($_COOKIE[$this->langCookieVar]); + } elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { + // 自动侦测浏览器语言 + preg_match('/^([a-z\d\-]+)/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches); + $langSet = strtolower($matches[1]); + $acceptLangs = Container::get('config')->get('header_accept_lang'); + if (isset($acceptLangs[$langSet])) { + $langSet = $acceptLangs[$langSet]; + } elseif (isset($this->acceptLanguage[$langSet])) { + $langSet = $this->acceptLanguage[$langSet]; + } + } + + if (empty($this->allowLangList) || in_array($langSet, $this->allowLangList)) { + // 合法的语言 + $this->range = $langSet ?: $this->range; + } + + return $this->range; + } + + /** + * 设置当前语言到Cookie + * @access public + * @param string $lang 语言 + * @return void + */ + public function saveToCookie($lang = null) + { + $range = $lang ?: $this->range; + + $_COOKIE[$this->langCookieVar] = $range; + } + + /** + * 设置语言自动侦测的变量 + * @access public + * @param string $var 变量名称 + * @return void + */ + public function setLangDetectVar($var) + { + $this->langDetectVar = $var; + } + + /** + * 设置语言的cookie保存变量 + * @access public + * @param string $var 变量名称 + * @return void + */ + public function setLangCookieVar($var) + { + $this->langCookieVar = $var; + } + + /** + * 设置允许的语言列表 + * @access public + * @param array $list 语言列表 + * @return void + */ + public function setAllowLangList($list) + { + $this->allowLangList = $list; + } +} diff --git a/tp5/thinkphp/library/think/Loader.php b/tp5/thinkphp/library/think/Loader.php new file mode 100644 index 0000000..76fbde9 --- /dev/null +++ b/tp5/thinkphp/library/think/Loader.php @@ -0,0 +1,369 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +class Loader +{ + /** + * 类名映射信息 + * @var array + */ + protected static $map = []; + + /** + * 类库别名 + * @var array + */ + protected static $classAlias = []; + + /** + * PSR-4 + * @var array + */ + private static $prefixLengthsPsr4 = []; + private static $prefixDirsPsr4 = []; + private static $fallbackDirsPsr4 = []; + + /** + * PSR-0 + * @var array + */ + private static $prefixesPsr0 = []; + private static $fallbackDirsPsr0 = []; + + /** + * 自动加载的文件列表 + * @var array + */ + private static $autoloadFiles = []; + + /** + * Composer安装路径 + * @var string + */ + private static $composerPath; + + // 注册自动加载机制 + public static function register($autoload = '') + { + // 注册系统自动加载 + spl_autoload_register($autoload ?: 'think\\Loader::autoload', true, true); + + // 注册命名空间定义 + self::addNamespace([ + 'think' => __DIR__ . '/', + 'traits' => __DIR__ . '/../traits/', + ]); + + $path = dirname($_SERVER['SCRIPT_FILENAME']); + if (is_file('./think')) { + $rootPath = realpath($path) . '/'; + } else { + $rootPath = realpath($path . '/../') . '/'; + } + + // 加载类库映射文件 + if (is_file($rootPath . 'runtime/classmap.php')) { + self::addClassMap(__include_file($rootPath . 'runtime/classmap.php')); + } + + self::$composerPath = $rootPath . 'vendor/composer/'; + + // Composer自动加载支持 + if (is_dir(self::$composerPath)) { + self::registerComposerLoader(self::$composerPath); + } + + // 自动加载extend目录 + self::addAutoLoadDir($rootPath . 'extend'); + } + + // 自动加载 + public static function autoload($class) + { + if (isset(self::$classAlias[$class])) { + return class_alias(self::$classAlias[$class], $class); + } + + if ($file = self::findFile($class)) { + + // Win环境严格区分大小写 + if (strpos(PHP_OS, 'WIN') !== false && pathinfo($file, PATHINFO_FILENAME) != pathinfo(realpath($file), PATHINFO_FILENAME)) { + return false; + } + + __include_file($file); + return true; + } + } + + /** + * 查找文件 + * @access private + * @param string $class + * @return string|false + */ + private static function findFile($class) + { + if (!empty(self::$map[$class])) { + // 类库映射 + return self::$map[$class]; + } + + // 查找 PSR-4 + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . '.php'; + + $first = $class[0]; + if (isset(self::$prefixLengthsPsr4[$first])) { + foreach (self::$prefixLengthsPsr4[$first] as $prefix => $length) { + if (0 === strpos($class, $prefix)) { + foreach (self::$prefixDirsPsr4[$prefix] as $dir) { + if (is_file($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { + return $file; + } + } + } + } + } + + // 查找 PSR-4 fallback dirs + foreach (self::$fallbackDirsPsr4 as $dir) { + if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // 查找 PSR-0 + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . '.php'; + } + + if (isset(self::$prefixesPsr0[$first])) { + foreach (self::$prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // 查找 PSR-0 fallback dirs + foreach (self::$fallbackDirsPsr0 as $dir) { + if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + return self::$map[$class] = false; + } + + // 注册classmap + public static function addClassMap($class, $map = '') + { + if (is_array($class)) { + self::$map = array_merge(self::$map, $class); + } else { + self::$map[$class] = $map; + } + } + + // 注册命名空间 + public static function addNamespace($namespace, $path = '') + { + if (is_array($namespace)) { + foreach ($namespace as $prefix => $paths) { + self::addPsr4($prefix . '\\', rtrim($paths, DIRECTORY_SEPARATOR), true); + } + } else { + self::addPsr4($namespace . '\\', rtrim($path, DIRECTORY_SEPARATOR), true); + } + } + + // 添加Ps0空间 + private static function addPsr0($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + self::$fallbackDirsPsr0 = array_merge( + (array) $paths, + self::$fallbackDirsPsr0 + ); + } else { + self::$fallbackDirsPsr0 = array_merge( + self::$fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset(self::$prefixesPsr0[$first][$prefix])) { + self::$prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + + if ($prepend) { + self::$prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + self::$prefixesPsr0[$first][$prefix] + ); + } else { + self::$prefixesPsr0[$first][$prefix] = array_merge( + self::$prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + // 添加Psr4空间 + private static function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + self::$fallbackDirsPsr4 = array_merge( + (array) $paths, + self::$fallbackDirsPsr4 + ); + } else { + self::$fallbackDirsPsr4 = array_merge( + self::$fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset(self::$prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + + self::$prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + self::$prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + self::$prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + self::$prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + self::$prefixDirsPsr4[$prefix] = array_merge( + self::$prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + // 注册自动加载类库目录 + public static function addAutoLoadDir($path) + { + self::$fallbackDirsPsr4[] = $path; + } + + // 注册类别名 + public static function addClassAlias($alias, $class = null) + { + if (is_array($alias)) { + self::$classAlias = array_merge(self::$classAlias, $alias); + } else { + self::$classAlias[$alias] = $class; + } + } + + // 注册composer自动加载 + public static function registerComposerLoader($composerPath) + { + if (is_file($composerPath . 'autoload_namespaces.php')) { + $map = require $composerPath . 'autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + self::addPsr0($namespace, $path); + } + } + + if (is_file($composerPath . 'autoload_psr4.php')) { + $map = require $composerPath . 'autoload_psr4.php'; + foreach ($map as $namespace => $path) { + self::addPsr4($namespace, $path); + } + } + + if (is_file($composerPath . 'autoload_classmap.php')) { + $classMap = require $composerPath . 'autoload_classmap.php'; + if ($classMap) { + self::addClassMap($classMap); + } + } + } + + // 加载composer autofile文件 + public static function loadComposerAutoloadFiles() + { + if (is_file(self::$composerPath . 'autoload_files.php')) { + $includeFiles = require self::$composerPath . 'autoload_files.php'; + foreach ($includeFiles as $fileIdentifier => $file) { + if (empty(self::$autoloadFiles[$fileIdentifier])) { + __require_file($file); + self::$autoloadFiles[$fileIdentifier] = true; + } + } + } + } + + /** + * 字符串命名风格转换 + * type 0 将Java风格转换为C的风格 1 将C风格转换为Java的风格 + * @access public + * @param string $name 字符串 + * @param integer $type 转换类型 + * @param bool $ucfirst 首字母是否大写(驼峰规则) + * @return string + */ + public static function parseName($name, $type = 0, $ucfirst = true) + { + if ($type) { + $name = preg_replace_callback('/_([a-zA-Z])/', function ($match) { + return strtoupper($match[1]); + }, $name); + return $ucfirst ? ucfirst($name) : lcfirst($name); + } else { + return strtolower(trim(preg_replace("/[A-Z]/", "_\\0", $name), "_")); + } + } +} + +/** + * 作用范围隔离 + * + * @param $file + * @return mixed + */ +function __include_file($file) +{ + return include $file; +} + +function __require_file($file) +{ + return require $file; +} diff --git a/tp5/thinkphp/library/think/Log.php b/tp5/thinkphp/library/think/Log.php new file mode 100644 index 0000000..4925814 --- /dev/null +++ b/tp5/thinkphp/library/think/Log.php @@ -0,0 +1,372 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +use think\exception\ClassNotFoundException; + +class Log implements LoggerInterface +{ + const EMERGENCY = 'emergency'; + const ALERT = 'alert'; + const CRITICAL = 'critical'; + const ERROR = 'error'; + const WARNING = 'warning'; + const NOTICE = 'notice'; + const INFO = 'info'; + const DEBUG = 'debug'; + const SQL = 'sql'; + + /** + * 日志信息 + * @var array + */ + protected $log = []; + + /** + * 配置参数 + * @var array + */ + protected $config = []; + + /** + * 日志写入驱动 + * @var object + */ + protected $driver; + + /** + * 日志授权key + * @var string + */ + protected $key; + + /** + * 应用对象 + * @var App + */ + protected $app; + + public function __construct(App $app) + { + $this->app = $app; + } + + /** + * 日志初始化 + * @access public + * @param array $config + * @return $this + */ + public function init($config = []) + { + $type = isset($config['type']) ? $config['type'] : 'File'; + $class = false !== strpos($type, '\\') ? $type : '\\think\\log\\driver\\' . ucwords($type); + + $this->config = $config; + + unset($config['type']); + + if (class_exists($class)) { + $this->driver = new $class($config); + } else { + throw new ClassNotFoundException('class not exists:' . $class, $class); + } + + // 记录初始化信息 + $this->app->isDebug() && $this->record('[ LOG ] INIT ' . $type); + + return $this; + } + + /** + * 获取日志信息 + * @access public + * @param string $type 信息类型 + * @return array + */ + public function getLog($type = '') + { + return $type ? $this->log[$type] : $this->log; + } + + /** + * 记录日志信息 + * @access public + * @param mixed $msg 日志信息 + * @param string $type 日志级别 + * @param array $context 替换内容 + * @return $this + */ + public function record($msg, $type = 'info', array $context = []) + { + if (is_string($msg)) { + $replace = []; + foreach ($context as $key => $val) { + $replace['{' . $key . '}'] = $val; + } + + $msg = strtr($msg, $replace); + } + + $this->log[$type][] = $msg; + + if (PHP_SAPI == 'cli') { + // 命令行日志实时写入 + $this->save(); + } + + return $this; + } + + /** + * 清空日志信息 + * @access public + * @return $this + */ + public function clear() + { + $this->log = []; + + return $this; + } + + /** + * 当前日志记录的授权key + * @access public + * @param string $key 授权key + * @return $this + */ + public function key($key) + { + $this->key = $key; + + return $this; + } + + /** + * 检查日志写入权限 + * @access public + * @param array $config 当前日志配置参数 + * @return bool + */ + public function check($config) + { + if ($this->key && !empty($config['allow_key']) && !in_array($this->key, $config['allow_key'])) { + return false; + } + + return true; + } + + /** + * 保存调试信息 + * @access public + * @return bool + */ + public function save() + { + if (!empty($this->log)) { + if (is_null($this->driver)) { + $this->init($this->app['config']->pull('log')); + } + + if (!$this->check($this->config)) { + // 检测日志写入权限 + return false; + } + + if (empty($this->config['level'])) { + // 获取全部日志 + $log = $this->log; + if (!$this->app->isDebug() && isset($log['debug'])) { + unset($log['debug']); + } + } else { + // 记录允许级别 + $log = []; + foreach ($this->config['level'] as $level) { + if (isset($this->log[$level])) { + $log[$level] = $this->log[$level]; + } + } + } + + $result = $this->driver->save($log); + if ($result) { + $this->log = []; + } + + return $result; + } + + return true; + } + + /** + * 实时写入日志信息 并支持行为 + * @access public + * @param mixed $msg 调试信息 + * @param string $type 日志级别 + * @param bool $force 是否强制写入 + * @return bool + */ + public function write($msg, $type = 'info', $force = false) + { + // 封装日志信息 + $log = $this->log; + + if (true === $force || empty($this->config['level'])) { + $log[$type][] = $msg; + } elseif (in_array($type, $this->config['level'])) { + $log[$type][] = $msg; + } else { + return false; + } + + // 监听log_write + $this->app['hook']->listen('log_write', $log); + + if (is_null($this->driver)) { + $this->init($this->app['config']->pull('log')); + } + + // 写入日志 + $result = $this->driver->save($log); + + if ($result) { + $this->log = []; + } + + return $result; + } + + /** + * 记录日志信息 + * @access public + * @param string $level 日志级别 + * @param mixed $message 日志信息 + * @param array $context 替换内容 + * @return void + */ + public function log($level, $message, array $context = []) + { + $this->record($message, $level, $context); + } + + /** + * 记录emergency信息 + * @access public + * @param mixed $message 日志信息 + * @param array $context 替换内容 + * @return void + */ + public function emergency($message, array $context = []) + { + $this->log(__FUNCTION__, $message, $context); + } + + /** + * 记录警报信息 + * @access public + * @param mixed $message 日志信息 + * @param array $context 替换内容 + * @return void + */ + public function alert($message, array $context = []) + { + $this->log(__FUNCTION__, $message, $context); + } + + /** + * 记录紧急情况 + * @access public + * @param mixed $message 日志信息 + * @param array $context 替换内容 + * @return void + */ + public function critical($message, array $context = []) + { + $this->log(__FUNCTION__, $message, $context); + } + + /** + * 记录错误信息 + * @access public + * @param mixed $message 日志信息 + * @param array $context 替换内容 + * @return void + */ + public function error($message, array $context = []) + { + $this->log(__FUNCTION__, $message, $context); + } + + /** + * 记录warning信息 + * @access public + * @param mixed $message 日志信息 + * @param array $context 替换内容 + * @return void + */ + public function warning($message, array $context = []) + { + $this->log(__FUNCTION__, $message, $context); + } + + /** + * 记录notice信息 + * @access public + * @param mixed $message 日志信息 + * @param array $context 替换内容 + * @return void + */ + public function notice($message, array $context = []) + { + $this->log(__FUNCTION__, $message, $context); + } + + /** + * 记录一般信息 + * @access public + * @param mixed $message 日志信息 + * @param array $context 替换内容 + * @return void + */ + public function info($message, array $context = []) + { + $this->log(__FUNCTION__, $message, $context); + } + + /** + * 记录调试信息 + * @access public + * @param mixed $message 日志信息 + * @param array $context 替换内容 + * @return void + */ + public function debug($message, array $context = []) + { + $this->log(__FUNCTION__, $message, $context); + } + + /** + * 记录sql信息 + * @access public + * @param mixed $message 日志信息 + * @param array $context 替换内容 + * @return void + */ + public function sql($message, array $context = []) + { + $this->log(__FUNCTION__, $message, $context); + } +} diff --git a/tp5/thinkphp/library/think/Model.php b/tp5/thinkphp/library/think/Model.php new file mode 100644 index 0000000..3b67346 --- /dev/null +++ b/tp5/thinkphp/library/think/Model.php @@ -0,0 +1,1011 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +use think\db\Query; + +/** + * Class Model + * @package think + * @mixin Query + */ +abstract class Model implements \JsonSerializable, \ArrayAccess +{ + use model\concern\Attribute; + use model\concern\RelationShip; + use model\concern\ModelEvent; + use model\concern\TimeStamp; + use model\concern\Conversion; + + /** + * 是否更新数据 + * @var bool + */ + private $isUpdate = false; + + /** + * 是否强制更新所有数据 + * @var bool + */ + private $force = false; + + /** + * 更新条件 + * @var array + */ + private $updateWhere; + + /** + * 数据库配置信息 + * @var array|string + */ + protected $connection = []; + + /** + * 数据库查询对象类名 + * @var string + */ + protected $query; + + /** + * 模型名称 + * @var string + */ + protected $name; + + /** + * 数据表名称 + * @var string + */ + protected $table; + + /** + * 写入自动完成定义 + * @var array + */ + protected $auto = []; + + /** + * 新增自动完成定义 + * @var array + */ + protected $insert = []; + + /** + * 更新自动完成定义 + * @var array + */ + protected $update = []; + + /** + * 初始化过的模型. + * @var array + */ + protected static $initialized = []; + + /** + * 查询对象实例 + * @var Query + */ + protected $queryInstance; + + /** + * 错误信息 + * @var mixed + */ + protected $error; + + /** + * 架构函数 + * @access public + * @param array|object $data 数据 + */ + public function __construct($data = []) + { + if (is_object($data)) { + $this->data = get_object_vars($data); + } else { + $this->data = $data; + } + + if ($this->disuse) { + // 废弃字段 + foreach ((array) $this->disuse as $key) { + if (array_key_exists($key, $this->data)) { + unset($this->data[$key]); + } + } + } + + // 记录原始数据 + $this->origin = $this->data; + + $config = Container::get('config'); + + if (empty($this->name)) { + // 当前模型名 + $name = str_replace('\\', '/', static::class); + $this->name = basename($name); + if ($config->get('class_suffix')) { + $suffix = basename(dirname($name)); + $this->name = substr($this->name, 0, -strlen($suffix)); + } + } + + if (is_null($this->autoWriteTimestamp)) { + // 自动写入时间戳 + $this->autoWriteTimestamp = $config->get('database.auto_timestamp'); + } + + if (is_null($this->dateFormat)) { + // 设置时间戳格式 + $this->dateFormat = $config->get('database.datetime_format'); + } + + if (is_null($this->resultSetType)) { + $this->resultSetType = $config->get('database.resultset_type'); + } + + if (is_null($this->query)) { + // 设置查询对象 + $this->query = $config->get('database.query'); + } + + if (!empty($this->connection) && is_array($this->connection)) { + // 设置模型的数据库连接 + $this->connection = array_merge($config->pull('database'), $this->connection); + } + + // 执行初始化操作 + $this->initialize(); + } + + /** + * 获取当前模型名称 + * @access public + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * 创建新的模型实例 + * @access public + * @param array|object $data 数据 + * @param bool $isUpdate 是否为更新 + * @param mixed $where 更新条件 + * @return Model + */ + public function newInstance($data = [], $isUpdate = false, $where = null) + { + return (new static($data))->isUpdate($isUpdate, $where); + } + + /** + * 创建模型的查询对象 + * @access protected + * @return Query + */ + protected function buildQuery() + { + // 设置当前模型 确保查询返回模型对象 + $class = $this->query; + $query = (new $class())->connect($this->connection)->model($this)->json($this->json); + + // 设置当前数据表和模型名 + if (!empty($this->table)) { + $query->table($this->table); + } else { + $query->name($this->name); + } + + if (!empty($this->pk)) { + $query->pk($this->pk); + } + + return $query; + } + + /** + * 获取当前模型的数据库查询对象 + * @access public + * @param Query $query 查询对象实例 + * @return $this + */ + public function setQuery($query) + { + $this->queryInstance = $query; + return $this; + } + + /** + * 获取当前模型的数据库查询对象 + * @access public + * @param bool $useBaseQuery 是否调用全局查询范围 + * @return Query + */ + public function db($useBaseQuery = true) + { + if ($this->queryInstance) { + return $this->queryInstance; + } + + $query = $this->buildQuery(); + + if ($useBaseQuery) { + // 软删除 + if (method_exists($this, 'getDeleteTimeField')) { + $field = $this->getDeleteTimeField(true); + if ($field) { + $query->useSoftDelete($field); + } + } + + // 全局作用域 + if (method_exists($this, 'base')) { + call_user_func_array([$this, 'base'], [ & $query]); + } + } + + // 返回当前模型的数据库查询对象 + return $query; + } + + /** + * 初始化模型 + * @access protected + * @return void + */ + protected function initialize() + { + if (!isset(static::$initialized[static::class])) { + static::$initialized[static::class] = true; + static::init(); + } + } + + /** + * 初始化处理 + * @access protected + * @return void + */ + protected static function init() + {} + + /** + * 数据自动完成 + * @access protected + * @param array $auto 要自动更新的字段列表 + * @return void + */ + protected function autoCompleteData($auto = []) + { + foreach ($auto as $field => $value) { + if (is_integer($field)) { + $field = $value; + $value = null; + } + + if (!isset($this->data[$field])) { + $default = null; + } else { + $default = $this->data[$field]; + } + + $this->setAttr($field, !is_null($value) ? $value : $default); + } + } + + /** + * 更新是否强制写入数据 而不做比较 + * @access public + * @param bool $force + * @return $this + */ + public function force($force = true) + { + $this->force = $force; + return $this; + } + + /** + * 保存当前数据对象 + * @access public + * @param array $data 数据 + * @param array $where 更新条件 + * @param string $sequence 自增序列名 + * @return integer|false + */ + public function save($data = [], $where = [], $sequence = null) + { + if (is_string($data)) { + $sequence = $data; + $data = []; + } + + if (!$this->checkBeforeSave($data, $where)) { + return false; + } + + $result = $this->isUpdate ? $this->updateData($where) : $this->insertData($sequence); + + if (false === $result) { + return false; + } + + // 写入回调 + $this->trigger('after_write'); + + // 重新记录原始数据 + $this->origin = $this->data; + + return $result; + } + + /** + * 写入之前检查数据 + * @access protected + * @param array $data 数据 + * @param array $where 保存条件 + * @return bool + */ + protected function checkBeforeSave($data, $where) + { + if (!empty($data)) { + + // 数据对象赋值 + foreach ($data as $key => $value) { + $this->setAttr($key, $value, $data); + } + + if (!empty($where)) { + $this->isUpdate = true; + $this->updateWhere = $where; + } + } + + // 数据自动完成 + $this->autoCompleteData($this->auto); + + // 事件回调 + if (false === $this->trigger('before_write')) { + return false; + } + + return true; + } + + /** + * 检查数据是否允许写入 + * @access protected + * @param array $autoFields 自动完成的字段列表 + * @return array + */ + protected function checkAllowFields(array $append = []) + { + // 检测字段 + if (empty($this->field) || true === $this->field) { + $query = $this->db(false); + $table = $this->table ?: $query->getTable(); + + $this->field = $query->getConnection()->getTableFields($table); + + $field = $this->field; + } else { + $field = array_merge($this->field, $append); + + if ($this->autoWriteTimestamp) { + array_push($field, $this->createTime, $this->updateTime); + } + } + + if ($this->disuse) { + // 废弃字段 + $field = array_diff($field, (array) $this->disuse); + } + return $field; + } + + /** + * 保存写入数据 + * @access protected + * @param array $where 保存条件 + * @return int|false + */ + protected function updateData($where) + { + // 自动更新 + $this->autoCompleteData($this->update); + + // 事件回调 + if (false === $this->trigger('before_update')) { + return false; + } + + // 获取有更新的数据 + $data = $this->getChangedData(); + + if (empty($data)) { + // 关联更新 + if (!empty($this->relationWrite)) { + $this->autoRelationUpdate(); + } + + return 0; + } elseif ($this->autoWriteTimestamp && $this->updateTime && !isset($data[$this->updateTime])) { + // 自动写入更新时间 + $data[$this->updateTime] = $this->autoWriteTimestamp($this->updateTime); + + $this->data[$this->updateTime] = $data[$this->updateTime]; + } + + if (empty($where) && !empty($this->updateWhere)) { + $where = $this->updateWhere; + } + + // 检查允许字段 + $allowFields = $this->checkAllowFields(array_merge($this->auto, $this->update)); + + // 保留主键数据 + foreach ($this->data as $key => $val) { + if ($this->isPk($key)) { + $data[$key] = $val; + } + } + + $pk = $this->getPk(); + $array = []; + + foreach ((array) $pk as $key) { + if (isset($data[$key])) { + $array[$key] = [$key, '=', $data[$key]]; + unset($data[$key]); + } + } + + if (!empty($array)) { + $where = $array; + } + + if (!empty($this->relationWrite)) { + foreach ($this->relationWrite as $name => $val) { + if (is_array($val)) { + foreach ($val as $key) { + if (isset($data[$key])) { + unset($data[$key]); + } + } + } + } + } + + // 模型更新 + $result = $this->db(false)->where($where)->strict(false)->field($allowFields)->update($data); + + // 关联更新 + if (!empty($this->relationWrite)) { + $this->autoRelationUpdate(); + } + + // 更新回调 + $this->trigger('after_update'); + + return $result; + } + + /** + * 新增写入数据 + * @access protected + * @param string $sequence 自增名 + * @return int|false + */ + protected function insertData($sequence) + { + // 自动写入 + $this->autoCompleteData($this->insert); + + // 时间戳自动写入 + $this->checkTimeStampWrite(); + + if (false === $this->trigger('before_insert')) { + return false; + } + + // 检查允许字段 + $allowFields = $this->checkAllowFields(array_merge($this->auto, $this->insert)); + + $result = $this->db(false)->strict(false)->field($allowFields)->insert($this->data, false, false, $sequence); + + // 获取自动增长主键 + if ($result && $insertId = $this->db(false)->getLastInsID($sequence)) { + $pk = $this->getPk(); + + foreach ((array) $pk as $key) { + if (!isset($this->data[$key]) || '' == $this->data[$key]) { + $this->data[$key] = $insertId; + } + } + } + + // 关联写入 + if (!empty($this->relationWrite)) { + $this->autoRelationInsert(); + } + + // 标记为更新 + $this->isUpdate = true; + + // 新增回调 + $this->trigger('after_insert'); + + return $result; + } + + /** + * 字段值(延迟)增长 + * @access public + * @param string $field 字段名 + * @param integer $step 增长值 + * @param integer $lazyTime 延时时间(s) + * @return integer|true + * @throws Exception + */ + public function setInc($field, $step = 1, $lazyTime = 0) + { + // 读取更新条件 + $where = $this->getWhere(); + + $result = $this->db(false)->where($where)->setInc($field, $step, $lazyTime); + + if (true !== $result) { + $this->data[$field] += $step; + } + + return $result; + } + + /** + * 字段值(延迟)增长 + * @access public + * @param string $field 字段名 + * @param integer $step 增长值 + * @param integer $lazyTime 延时时间(s) + * @return integer|true + * @throws Exception + */ + public function setDec($field, $step = 1, $lazyTime = 0) + { + // 读取更新条件 + $where = $this->getWhere(); + + $result = $this->db(false)->where($where)->setDec($field, $step, $lazyTime); + + if (true !== $result) { + $this->data[$field] -= $step; + } + + return $result; + } + + /** + * 获取当前的更新条件 + * @access protected + * @return mixed + */ + protected function getWhere() + { + // 删除条件 + $pk = $this->getPk(); + + if (is_string($pk) && isset($this->data[$pk])) { + $where[] = [$pk, '=', $this->data[$pk]]; + } elseif (!empty($this->updateWhere)) { + $where = $this->updateWhere; + } else { + $where = null; + } + + return $where; + } + + /** + * 保存多个数据到当前数据对象 + * @access public + * @param array $dataSet 数据 + * @param boolean $replace 是否自动识别更新和写入 + * @return Collection + * @throws \Exception + */ + public function saveAll($dataSet, $replace = true) + { + $result = []; + + $db = $this->db(false); + $db->startTrans(); + + try { + $pk = $this->getPk(); + + if (is_string($pk) && $replace) { + $auto = true; + } + + foreach ($dataSet as $key => $data) { + if ($this->isUpdate || (!empty($auto) && isset($data[$pk]))) { + $result[$key] = self::update($data, [], $this->field); + } else { + $result[$key] = self::create($data, $this->field); + } + } + + $db->commit(); + + return $this->toCollection($result); + } catch (\Exception $e) { + $db->rollback(); + throw $e; + } + } + + /** + * 是否为更新数据 + * @access public + * @param mixed $update + * @param mixed $where + * @return $this + */ + public function isUpdate($update = true, $where = null) + { + if (is_bool($update)) { + $this->isUpdate = $update; + + if (!empty($where)) { + $this->updateWhere = $where; + } + } else { + $this->isUpdate = true; + $this->updateWhere = $update; + } + + return $this; + } + + /** + * 删除当前的记录 + * @access public + * @return integer + */ + public function delete() + { + if (false === $this->trigger('before_delete')) { + return false; + } + + // 读取更新条件 + $where = $this->getWhere(); + + // 删除当前模型数据 + $result = $this->db(false)->where($where)->delete(); + + // 关联删除 + if (!empty($this->relationWrite)) { + $this->autoRelationDelete(); + } + + $this->trigger('after_delete'); + + // 清空数据 + $this->data = []; + $this->origin = []; + + return $result; + } + + /** + * 设置自动完成的字段( 规则通过修改器定义) + * @access public + * @param array $fields 需要自动完成的字段 + * @return $this + */ + public function auto($fields) + { + $this->auto = $fields; + + return $this; + } + + /** + * 写入数据 + * @access public + * @param array $data 数据数组 + * @param array|true $field 允许字段 + * @return static + */ + public static function create($data = [], $field = null) + { + $model = new static(); + + if (!empty($field)) { + $model->allowField($field); + } + + $model->isUpdate(false)->save($data, []); + + return $model; + } + + /** + * 更新数据 + * @access public + * @param array $data 数据数组 + * @param array $where 更新条件 + * @param array|true $field 允许字段 + * @return static + */ + public static function update($data = [], $where = [], $field = null) + { + $model = new static(); + + if (!empty($field)) { + $model->allowField($field); + } + + $model->isUpdate(true)->save($data, $where); + + return $model; + } + + /** + * 查找单条记录 + * @access public + * @param mixed $data 主键值或者查询条件(闭包) + * @param mixed $with 关联预查询 + * @param bool $cache 是否缓存 + * @param bool $failException 是否抛出异常 + * @return static|null + * @throws exception\DbException + */ + public static function get($data, $with = [], $cache = false, $failException = false) + { + if (is_null($data)) { + return; + } + + if (true === $with || is_int($with)) { + $cache = $with; + $with = []; + } + + $query = static::parseQuery($data, $with, $cache); + + return $query->failException($failException)->find($data); + } + + /** + * 查找单条记录 如果不存在直接抛出异常 + * @access public + * @param mixed $data 主键值或者查询条件(闭包) + * @param mixed $with 关联预查询 + * @param bool $cache 是否缓存 + * @return static|null + * @throws exception\DbException + */ + public static function getOrFail($data, $with = [], $cache = false) + { + return self::get($data, $with, $cache, true); + } + + /** + * 查找所有记录 + * @access public + * @param mixed $data 主键列表或者查询条件(闭包) + * @param array|string $with 关联预查询 + * @param bool $cache 是否缓存 + * @return static[]|false + * @throws exception\DbException + */ + public static function all($data = null, $with = [], $cache = false) + { + if (true === $with || is_int($with)) { + $cache = $with; + $with = []; + } + + $query = static::parseQuery($data, $with, $cache); + + return $query->select($data); + } + + /** + * 分析查询表达式 + * @access public + * @param mixed $data 主键列表或者查询条件(闭包) + * @param string $with 关联预查询 + * @param bool $cache 是否缓存 + * @return Query + */ + protected static function parseQuery(&$data, $with, $cache) + { + $result = self::with($with)->cache($cache); + + if (is_array($data) && key($data) !== 0) { + $result = $result->where($data); + $data = null; + } elseif ($data instanceof \Closure) { + $data($result); + $data = null; + } elseif ($data instanceof Query) { + $result = $data->with($with)->cache($cache); + $data = null; + } + + return $result; + } + + /** + * 删除记录 + * @access public + * @param mixed $data 主键列表 支持闭包查询条件 + * @return integer 成功删除的记录数 + */ + public static function destroy($data) + { + $model = new static(); + + $query = $model->db(); + + if (empty($data) && 0 !== $data) { + return 0; + } elseif (is_array($data) && key($data) !== 0) { + $query->where($data); + $data = null; + } elseif ($data instanceof \Closure) { + $data($query); + $data = null; + } + + $resultSet = $query->select($data); + $count = 0; + + if ($resultSet) { + foreach ($resultSet as $data) { + $result = $data->delete(); + $count += $result; + } + } + + return $count; + } + + /** + * 获取错误信息 + * @access public + * @return mixed + */ + public function getError() + { + return $this->error; + } + + /** + * 解序列化后处理 + */ + public function __wakeup() + { + $this->initialize(); + } + + public function __debugInfo() + { + return [ + 'data' => $this->data, + 'relation' => $this->relation, + ]; + } + + /** + * 修改器 设置数据对象的值 + * @access public + * @param string $name 名称 + * @param mixed $value 值 + * @return void + */ + public function __set($name, $value) + { + $this->setAttr($name, $value); + } + + /** + * 获取器 获取数据对象的值 + * @access public + * @param string $name 名称 + * @return mixed + */ + public function __get($name) + { + return $this->getAttr($name); + } + + /** + * 检测数据对象的值 + * @access public + * @param string $name 名称 + * @return boolean + */ + public function __isset($name) + { + if (array_key_exists($name, $this->data) || array_key_exists($name, $this->relation)) { + return true; + } else { + return false; + } + } + + /** + * 销毁数据对象的值 + * @access public + * @param string $name 名称 + * @return void + */ + public function __unset($name) + { + unset($this->data[$name], $this->relation[$name]); + } + + // ArrayAccess + public function offsetSet($name, $value) + { + $this->setAttr($name, $value); + } + + public function offsetExists($name) + { + return $this->__isset($name); + } + + public function offsetUnset($name) + { + $this->__unset($name); + } + + public function offsetGet($name) + { + return $this->getAttr($name); + } + + /** + * 设置是否使用全局查询范围 + * @access public + * @param bool $use 是否启用全局查询范围 + * @return Query + */ + public static function useGlobalScope($use) + { + $model = new static(); + + return $model->db($use); + } + + public function __call($method, $args) + { + return call_user_func_array([$this->db(), $method], $args); + } + + public static function __callStatic($method, $args) + { + $model = new static(); + + return call_user_func_array([$model->db(), $method], $args); + } +} diff --git a/tp5/thinkphp/library/think/Paginator.php b/tp5/thinkphp/library/think/Paginator.php new file mode 100644 index 0000000..3fccdf9 --- /dev/null +++ b/tp5/thinkphp/library/think/Paginator.php @@ -0,0 +1,437 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +use ArrayAccess; +use ArrayIterator; +use Countable; +use IteratorAggregate; +use JsonSerializable; +use Traversable; + +abstract class Paginator implements ArrayAccess, Countable, IteratorAggregate, JsonSerializable +{ + /** + * 是否简洁模式 + * @var bool + */ + protected $simple = false; + + /** + * 数据集 + * @var Collection + */ + protected $items; + + /** + * 当前页 + * @var integer + */ + protected $currentPage; + + /** + * 最后一页 + * @var integer + */ + protected $lastPage; + + /** + * 数据总数 + * @var integer|null + */ + protected $total; + + /** + * 每页数量 + * @var integer + */ + protected $listRows; + + /** + * 是否有下一页 + * @var bool + */ + protected $hasMore; + + /** + * 分页配置 + * @var array + */ + protected $options = [ + 'var_page' => 'page', + 'path' => '/', + 'query' => [], + 'fragment' => '', + ]; + + public function __construct($items, $listRows, $currentPage = null, $total = null, $simple = false, $options = []) + { + $this->options = array_merge($this->options, $options); + + $this->options['path'] = '/' != $this->options['path'] ? rtrim($this->options['path'], '/') : $this->options['path']; + + $this->simple = $simple; + $this->listRows = $listRows; + + if (!$items instanceof Collection) { + $items = Collection::make($items); + } + + if ($simple) { + $this->currentPage = $this->setCurrentPage($currentPage); + $this->hasMore = count($items) > ($this->listRows); + $items = $items->slice(0, $this->listRows); + } else { + $this->total = $total; + $this->lastPage = (int) ceil($total / $listRows); + $this->currentPage = $this->setCurrentPage($currentPage); + $this->hasMore = $this->currentPage < $this->lastPage; + } + $this->items = $items; + } + + /** + * @access public + * @param $items + * @param $listRows + * @param null $currentPage + * @param bool $simple + * @param null $total + * @param array $options + * @return Paginator + */ + public static function make($items, $listRows, $currentPage = null, $total = null, $simple = false, $options = []) + { + return new static($items, $listRows, $currentPage, $total, $simple, $options); + } + + protected function setCurrentPage($currentPage) + { + if (!$this->simple && $currentPage > $this->lastPage) { + return $this->lastPage > 0 ? $this->lastPage : 1; + } + + return $currentPage; + } + + /** + * 获取页码对应的链接 + * + * @access protected + * @param $page + * @return string + */ + protected function url($page) + { + if ($page <= 0) { + $page = 1; + } + + if (strpos($this->options['path'], '[PAGE]') === false) { + $parameters = [$this->options['var_page'] => $page]; + $path = $this->options['path']; + } else { + $parameters = []; + $path = str_replace('[PAGE]', $page, $this->options['path']); + } + + if (count($this->options['query']) > 0) { + $parameters = array_merge($this->options['query'], $parameters); + } + + $url = $path; + if (!empty($parameters)) { + $url .= '?' . urldecode(http_build_query($parameters, null, '&')); + } + + return $url . $this->buildFragment(); + } + + /** + * 自动获取当前页码 + * @access public + * @param string $varPage + * @param int $default + * @return int + */ + public static function getCurrentPage($varPage = 'page', $default = 1) + { + $page = Container::get('request')->param($varPage); + + if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int) $page >= 1) { + return $page; + } + + return $default; + } + + /** + * 自动获取当前的path + * @access public + * @return string + */ + public static function getCurrentPath() + { + return Container::get('request')->baseUrl(); + } + + public function total() + { + if ($this->simple) { + throw new \DomainException('not support total'); + } + + return $this->total; + } + + public function listRows() + { + return $this->listRows; + } + + public function currentPage() + { + return $this->currentPage; + } + + public function lastPage() + { + if ($this->simple) { + throw new \DomainException('not support last'); + } + + return $this->lastPage; + } + + /** + * 数据是否足够分页 + * @access public + * @return boolean + */ + public function hasPages() + { + return !(1 == $this->currentPage && !$this->hasMore); + } + + /** + * 创建一组分页链接 + * + * @access public + * @param int $start + * @param int $end + * @return array + */ + public function getUrlRange($start, $end) + { + $urls = []; + + for ($page = $start; $page <= $end; $page++) { + $urls[$page] = $this->url($page); + } + + return $urls; + } + + /** + * 设置URL锚点 + * + * @access public + * @param string|null $fragment + * @return $this + */ + public function fragment($fragment) + { + $this->options['fragment'] = $fragment; + + return $this; + } + + /** + * 添加URL参数 + * + * @access public + * @param array|string $key + * @param string|null $value + * @return $this + */ + public function appends($key, $value = null) + { + if (!is_array($key)) { + $queries = [$key => $value]; + } else { + $queries = $key; + } + + foreach ($queries as $k => $v) { + if ($k !== $this->options['var_page']) { + $this->options['query'][$k] = $v; + } + } + + return $this; + } + + /** + * 构造锚点字符串 + * + * @access public + * @return string + */ + protected function buildFragment() + { + return $this->options['fragment'] ? '#' . $this->options['fragment'] : ''; + } + + /** + * 渲染分页html + * @access public + * @return mixed + */ + abstract public function render(); + + public function items() + { + return $this->items->all(); + } + + public function getCollection() + { + return $this->items; + } + + public function isEmpty() + { + return $this->items->isEmpty(); + } + + /** + * 给每个元素执行个回调 + * + * @access public + * @param callable $callback + * @return $this + */ + public function each(callable $callback) + { + foreach ($this->items as $key => $item) { + $result = $callback($item, $key); + + if (false === $result) { + break; + } elseif (!is_object($item)) { + $this->items[$key] = $result; + } + } + + return $this; + } + + /** + * Retrieve an external iterator + * @access public + * @return Traversable An instance of an object implementing Iterator or + * Traversable + */ + public function getIterator() + { + return new ArrayIterator($this->items->all()); + } + + /** + * Whether a offset exists + * @access public + * @param mixed $offset + * @return bool + */ + public function offsetExists($offset) + { + return $this->items->offsetExists($offset); + } + + /** + * Offset to retrieve + * @access public + * @param mixed $offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->items->offsetGet($offset); + } + + /** + * Offset to set + * @access public + * @param mixed $offset + * @param mixed $value + */ + public function offsetSet($offset, $value) + { + $this->items->offsetSet($offset, $value); + } + + /** + * Offset to unset + * @access public + * @param mixed $offset + * @return void + * @since 5.0.0 + */ + public function offsetUnset($offset) + { + $this->items->offsetUnset($offset); + } + + /** + * Count elements of an object + */ + public function count() + { + return $this->items->count(); + } + + public function __toString() + { + return (string) $this->render(); + } + + public function toArray() + { + try { + $total = $this->total(); + } catch (\DomainException $e) { + $total = null; + } + + return [ + 'total' => $total, + 'per_page' => $this->listRows(), + 'current_page' => $this->currentPage(), + 'last_page' => $this->lastPage, + 'data' => $this->items->toArray(), + ]; + } + + /** + * Specify data which should be serialized to JSON + */ + public function jsonSerialize() + { + return $this->toArray(); + } + + public function __call($name, $arguments) + { + return call_user_func_array([$this->getCollection(), $name], $arguments); + } + +} diff --git a/tp5/thinkphp/library/think/Process.php b/tp5/thinkphp/library/think/Process.php new file mode 100644 index 0000000..3b574db --- /dev/null +++ b/tp5/thinkphp/library/think/Process.php @@ -0,0 +1,1268 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +use think\process\exception\Failed as ProcessFailedException; +use think\process\exception\Timeout as ProcessTimeoutException; +use think\process\pipes\Pipes; +use think\process\pipes\Unix as UnixPipes; +use think\process\pipes\Windows as WindowsPipes; +use think\process\Utils; + +class Process +{ + + const ERR = 'err'; + const OUT = 'out'; + + const STATUS_READY = 'ready'; + const STATUS_STARTED = 'started'; + const STATUS_TERMINATED = 'terminated'; + + const STDIN = 0; + const STDOUT = 1; + const STDERR = 2; + + const TIMEOUT_PRECISION = 0.2; + + private $callback; + private $commandline; + private $cwd; + private $env; + private $input; + private $starttime; + private $lastOutputTime; + private $timeout; + private $idleTimeout; + private $options; + private $exitcode; + private $fallbackExitcode; + private $processInformation; + private $outputDisabled = false; + private $stdout; + private $stderr; + private $enhanceWindowsCompatibility = true; + private $enhanceSigchildCompatibility; + private $process; + private $status = self::STATUS_READY; + private $incrementalOutputOffset = 0; + private $incrementalErrorOutputOffset = 0; + private $tty; + private $pty; + + private $useFileHandles = false; + + /** @var Pipes */ + private $processPipes; + + private $latestSignal; + + private static $sigchild; + + /** + * @var array + */ + public static $exitCodes = [ + 0 => 'OK', + 1 => 'General error', + 2 => 'Misuse of shell builtins', + 126 => 'Invoked command cannot execute', + 127 => 'Command not found', + 128 => 'Invalid exit argument', + // signals + 129 => 'Hangup', + 130 => 'Interrupt', + 131 => 'Quit and dump core', + 132 => 'Illegal instruction', + 133 => 'Trace/breakpoint trap', + 134 => 'Process aborted', + 135 => 'Bus error: "access to undefined portion of memory object"', + 136 => 'Floating point exception: "erroneous arithmetic operation"', + 137 => 'Kill (terminate immediately)', + 138 => 'User-defined 1', + 139 => 'Segmentation violation', + 140 => 'User-defined 2', + 141 => 'Write to pipe with no one reading', + 142 => 'Signal raised by alarm', + 143 => 'Termination (request to terminate)', + // 144 - not defined + 145 => 'Child process terminated, stopped (or continued*)', + 146 => 'Continue if stopped', + 147 => 'Stop executing temporarily', + 148 => 'Terminal stop signal', + 149 => 'Background process attempting to read from tty ("in")', + 150 => 'Background process attempting to write to tty ("out")', + 151 => 'Urgent data available on socket', + 152 => 'CPU time limit exceeded', + 153 => 'File size limit exceeded', + 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"', + 155 => 'Profiling timer expired', + // 156 - not defined + 157 => 'Pollable event', + // 158 - not defined + 159 => 'Bad syscall', + ]; + + /** + * 构造方法 + * @access public + * @param string $commandline 指令 + * @param string|null $cwd 工作目录 + * @param array|null $env 环境变量 + * @param string|null $input 输入 + * @param int|float|null $timeout 超时时间 + * @param array $options proc_open的选项 + * @throws \RuntimeException + * @api + */ + public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = []) + { + if (!function_exists('proc_open')) { + throw new \RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.'); + } + + $this->commandline = $commandline; + $this->cwd = $cwd; + + if (null === $this->cwd && (defined('ZEND_THREAD_SAFE') || '\\' === DIRECTORY_SEPARATOR)) { + $this->cwd = getcwd(); + } + if (null !== $env) { + $this->setEnv($env); + } + + $this->input = $input; + $this->setTimeout($timeout); + $this->useFileHandles = '\\' === DIRECTORY_SEPARATOR; + $this->pty = false; + $this->enhanceWindowsCompatibility = true; + $this->enhanceSigchildCompatibility = '\\' !== DIRECTORY_SEPARATOR && $this->isSigchildEnabled(); + $this->options = array_replace([ + 'suppress_errors' => true, + 'binary_pipes' => true, + ], $options); + } + + public function __destruct() + { + $this->stop(); + } + + public function __clone() + { + $this->resetProcessData(); + } + + /** + * 运行指令 + * @access public + * @param callback|null $callback + * @return int + */ + public function run($callback = null) + { + $this->start($callback); + + return $this->wait(); + } + + /** + * 运行指令 + * @access public + * @param callable|null $callback + * @return self + * @throws \RuntimeException + * @throws ProcessFailedException + */ + public function mustRun($callback = null) + { + if ($this->isSigchildEnabled() && !$this->enhanceSigchildCompatibility) { + throw new \RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.'); + } + + if (0 !== $this->run($callback)) { + throw new ProcessFailedException($this); + } + + return $this; + } + + /** + * 启动进程并写到 STDIN 输入后返回。 + * @access public + * @param callable|null $callback + * @throws \RuntimeException + * @throws \RuntimeException + * @throws \LogicException + */ + public function start($callback = null) + { + if ($this->isRunning()) { + throw new \RuntimeException('Process is already running'); + } + if ($this->outputDisabled && null !== $callback) { + throw new \LogicException('Output has been disabled, enable it to allow the use of a callback.'); + } + + $this->resetProcessData(); + $this->starttime = $this->lastOutputTime = microtime(true); + $this->callback = $this->buildCallback($callback); + $descriptors = $this->getDescriptors(); + + $commandline = $this->commandline; + + if ('\\' === DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) { + $commandline = 'cmd /V:ON /E:ON /C "(' . $commandline . ')'; + foreach ($this->processPipes->getFiles() as $offset => $filename) { + $commandline .= ' ' . $offset . '>' . Utils::escapeArgument($filename); + } + $commandline .= '"'; + + if (!isset($this->options['bypass_shell'])) { + $this->options['bypass_shell'] = true; + } + } + + $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options); + + if (!is_resource($this->process)) { + throw new \RuntimeException('Unable to launch a new process.'); + } + $this->status = self::STATUS_STARTED; + + if ($this->tty) { + return; + } + + $this->updateStatus(false); + $this->checkTimeout(); + } + + /** + * 重启进程 + * @access public + * @param callable|null $callback + * @return Process + * @throws \RuntimeException + * @throws \RuntimeException + */ + public function restart($callback = null) + { + if ($this->isRunning()) { + throw new \RuntimeException('Process is already running'); + } + + $process = clone $this; + $process->start($callback); + + return $process; + } + + /** + * 等待要终止的进程 + * @access public + * @param callable|null $callback + * @return int + */ + public function wait($callback = null) + { + $this->requireProcessIsStarted(__FUNCTION__); + + $this->updateStatus(false); + if (null !== $callback) { + $this->callback = $this->buildCallback($callback); + } + + do { + $this->checkTimeout(); + $running = '\\' === DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen(); + $close = '\\' !== DIRECTORY_SEPARATOR || !$running; + $this->readPipes(true, $close); + } while ($running); + + while ($this->isRunning()) { + usleep(1000); + } + + if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) { + throw new \RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig'])); + } + + return $this->exitcode; + } + + /** + * 获取PID + * @access public + * @return int|null + * @throws \RuntimeException + */ + public function getPid() + { + if ($this->isSigchildEnabled()) { + throw new \RuntimeException('This PHP has been compiled with --enable-sigchild. The process identifier can not be retrieved.'); + } + + $this->updateStatus(false); + + return $this->isRunning() ? $this->processInformation['pid'] : null; + } + + /** + * 将一个 POSIX 信号发送到进程中 + * @access public + * @param int $signal + * @return Process + */ + public function signal($signal) + { + $this->doSignal($signal, true); + + return $this; + } + + /** + * 禁用从底层过程获取输出和错误输出。 + * @access public + * @return Process + */ + public function disableOutput() + { + if ($this->isRunning()) { + throw new \RuntimeException('Disabling output while the process is running is not possible.'); + } + if (null !== $this->idleTimeout) { + throw new \LogicException('Output can not be disabled while an idle timeout is set.'); + } + + $this->outputDisabled = true; + + return $this; + } + + /** + * 开启从底层过程获取输出和错误输出。 + * @access public + * @return Process + * @throws \RuntimeException + */ + public function enableOutput() + { + if ($this->isRunning()) { + throw new \RuntimeException('Enabling output while the process is running is not possible.'); + } + + $this->outputDisabled = false; + + return $this; + } + + /** + * 输出是否禁用 + * @access public + * @return bool + */ + public function isOutputDisabled() + { + return $this->outputDisabled; + } + + /** + * 获取当前的输出管道 + * @access public + * @return string + * @throws \LogicException + * @api + */ + public function getOutput() + { + if ($this->outputDisabled) { + throw new \LogicException('Output has been disabled.'); + } + + $this->requireProcessIsStarted(__FUNCTION__); + + $this->readPipes(false, '\\' === DIRECTORY_SEPARATOR ? !$this->processInformation['running'] : true); + + return $this->stdout; + } + + /** + * 以增量方式返回的输出结果。 + * @access public + * @return string + */ + public function getIncrementalOutput() + { + $this->requireProcessIsStarted(__FUNCTION__); + + $data = $this->getOutput(); + + $latest = substr($data, $this->incrementalOutputOffset); + + if (false === $latest) { + return ''; + } + + $this->incrementalOutputOffset = strlen($data); + + return $latest; + } + + /** + * 清空输出 + * @access public + * @return Process + */ + public function clearOutput() + { + $this->stdout = ''; + $this->incrementalOutputOffset = 0; + + return $this; + } + + /** + * 返回当前的错误输出的过程 (STDERR)。 + * @access public + * @return string + */ + public function getErrorOutput() + { + if ($this->outputDisabled) { + throw new \LogicException('Output has been disabled.'); + } + + $this->requireProcessIsStarted(__FUNCTION__); + + $this->readPipes(false, '\\' === DIRECTORY_SEPARATOR ? !$this->processInformation['running'] : true); + + return $this->stderr; + } + + /** + * 以增量方式返回 errorOutput + * @access public + * @return string + */ + public function getIncrementalErrorOutput() + { + $this->requireProcessIsStarted(__FUNCTION__); + + $data = $this->getErrorOutput(); + + $latest = substr($data, $this->incrementalErrorOutputOffset); + + if (false === $latest) { + return ''; + } + + $this->incrementalErrorOutputOffset = strlen($data); + + return $latest; + } + + /** + * 清空 errorOutput + * @access public + * @return Process + */ + public function clearErrorOutput() + { + $this->stderr = ''; + $this->incrementalErrorOutputOffset = 0; + + return $this; + } + + /** + * 获取退出码 + * @access public + * @return null|int + */ + public function getExitCode() + { + if ($this->isSigchildEnabled() && !$this->enhanceSigchildCompatibility) { + throw new \RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.'); + } + + $this->updateStatus(false); + + return $this->exitcode; + } + + /** + * 获取退出文本 + * @access public + * @return null|string + */ + public function getExitCodeText() + { + if (null === $exitcode = $this->getExitCode()) { + return; + } + + return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error'; + } + + /** + * 检查是否成功 + * @access public + * @return bool + */ + public function isSuccessful() + { + return 0 === $this->getExitCode(); + } + + /** + * 是否未捕获的信号已被终止子进程 + * @access public + * @return bool + */ + public function hasBeenSignaled() + { + $this->requireProcessIsTerminated(__FUNCTION__); + + if ($this->isSigchildEnabled()) { + throw new \RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.'); + } + + $this->updateStatus(false); + + return $this->processInformation['signaled']; + } + + /** + * 返回导致子进程终止其执行的数。 + * @access public + * @return int + */ + public function getTermSignal() + { + $this->requireProcessIsTerminated(__FUNCTION__); + + if ($this->isSigchildEnabled()) { + throw new \RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.'); + } + + $this->updateStatus(false); + + return $this->processInformation['termsig']; + } + + /** + * 检查子进程信号是否已停止 + * @access public + * @return bool + */ + public function hasBeenStopped() + { + $this->requireProcessIsTerminated(__FUNCTION__); + + $this->updateStatus(false); + + return $this->processInformation['stopped']; + } + + /** + * 返回导致子进程停止其执行的数。 + * @access public + * @return int + */ + public function getStopSignal() + { + $this->requireProcessIsTerminated(__FUNCTION__); + + $this->updateStatus(false); + + return $this->processInformation['stopsig']; + } + + /** + * 检查是否正在运行 + * @access public + * @return bool + */ + public function isRunning() + { + if (self::STATUS_STARTED !== $this->status) { + return false; + } + + $this->updateStatus(false); + + return $this->processInformation['running']; + } + + /** + * 检查是否已开始 + * @access public + * @return bool + */ + public function isStarted() + { + return self::STATUS_READY != $this->status; + } + + /** + * 检查是否已终止 + * @access public + * @return bool + */ + public function isTerminated() + { + $this->updateStatus(false); + + return self::STATUS_TERMINATED == $this->status; + } + + /** + * 获取当前的状态 + * @access public + * @return string + */ + public function getStatus() + { + $this->updateStatus(false); + + return $this->status; + } + + /** + * 终止进程 + * @access public + */ + public function stop() + { + if ($this->isRunning()) { + if ('\\' === DIRECTORY_SEPARATOR && !$this->isSigchildEnabled()) { + exec(sprintf('taskkill /F /T /PID %d 2>&1', $this->getPid()), $output, $exitCode); + if ($exitCode > 0) { + throw new \RuntimeException('Unable to kill the process'); + } + } else { + $pids = preg_split('/\s+/', `ps -o pid --no-heading --ppid {$this->getPid()}`); + foreach ($pids as $pid) { + if (is_numeric($pid)) { + posix_kill($pid, 9); + } + } + } + } + + $this->updateStatus(false); + if ($this->processInformation['running']) { + $this->close(); + } + + return $this->exitcode; + } + + /** + * 添加一行输出 + * @access public + * @param string $line + */ + public function addOutput($line) +{ + $this->lastOutputTime = microtime(true); + $this->stdout .= $line; + } + + /** + * 添加一行错误输出 + * @access public + * @param string $line + */ + public function addErrorOutput($line) +{ + $this->lastOutputTime = microtime(true); + $this->stderr .= $line; + } + + /** + * 获取被执行的指令 + * @access public + * @return string + */ + public function getCommandLine() +{ + return $this->commandline; + } + + /** + * 设置指令 + * @access public + * @param string $commandline + * @return self + */ + public function setCommandLine($commandline) +{ + $this->commandline = $commandline; + + return $this; + } + + /** + * 获取超时时间 + * @access public + * @return float|null + */ + public function getTimeout() +{ + return $this->timeout; + } + + /** + * 获取idle超时时间 + * @access public + * @return float|null + */ + public function getIdleTimeout() +{ + return $this->idleTimeout; + } + + /** + * 设置超时时间 + * @access public + * @param int|float|null $timeout + * @return self + */ + public function setTimeout($timeout) +{ + $this->timeout = $this->validateTimeout($timeout); + + return $this; + } + + /** + * 设置idle超时时间 + * @access public + * @param int|float|null $timeout + * @return self + */ + public function setIdleTimeout($timeout) +{ + if (null !== $timeout && $this->outputDisabled) { + throw new \LogicException('Idle timeout can not be set while the output is disabled.'); + } + + $this->idleTimeout = $this->validateTimeout($timeout); + + return $this; + } + + /** + * 设置TTY + * @access public + * @param bool $tty + * @return self + */ + public function setTty($tty) +{ + if ('\\' === DIRECTORY_SEPARATOR && $tty) { + throw new \RuntimeException('TTY mode is not supported on Windows platform.'); + } + if ($tty && (!file_exists('/dev/tty') || !is_readable('/dev/tty'))) { + throw new \RuntimeException('TTY mode requires /dev/tty to be readable.'); + } + + $this->tty = (bool) $tty; + + return $this; + } + + /** + * 检查是否是tty模式 + * @access public + * @return bool + */ + public function isTty() +{ + return $this->tty; + } + + /** + * 设置pty模式 + * @access public + * @param bool $bool + * @return self + */ + public function setPty($bool) +{ + $this->pty = (bool) $bool; + + return $this; + } + + /** + * 是否是pty模式 + * @access public + * @return bool + */ + public function isPty() +{ + return $this->pty; + } + + /** + * 获取工作目录 + * @access public + * @return string|null + */ + public function getWorkingDirectory() +{ + if (null === $this->cwd) { + return getcwd() ?: null; + } + + return $this->cwd; + } + + /** + * 设置工作目录 + * @access public + * @param string $cwd + * @return self + */ + public function setWorkingDirectory($cwd) +{ + $this->cwd = $cwd; + + return $this; + } + + /** + * 获取环境变量 + * @access public + * @return array + */ + public function getEnv() +{ + return $this->env; + } + + /** + * 设置环境变量 + * @access public + * @param array $env + * @return self + */ + public function setEnv(array $env) +{ + $env = array_filter($env, function ($value) { + return !is_array($value); + }); + + $this->env = []; + foreach ($env as $key => $value) { + $this->env[(binary) $key] = (binary) $value; + } + + return $this; + } + + /** + * 获取输入 + * @access public + * @return null|string + */ + public function getInput() +{ + return $this->input; + } + + /** + * 设置输入 + * @access public + * @param mixed $input + * @return self + */ + public function setInput($input) +{ + if ($this->isRunning()) { + throw new \LogicException('Input can not be set while the process is running.'); + } + + $this->input = Utils::validateInput(sprintf('%s::%s', __CLASS__, __FUNCTION__), $input); + + return $this; + } + + /** + * 获取proc_open的选项 + * @access public + * @return array + */ + public function getOptions() +{ + return $this->options; + } + + /** + * 设置proc_open的选项 + * @access public + * @param array $options + * @return self + */ + public function setOptions(array $options) +{ + $this->options = $options; + + return $this; + } + + /** + * 是否兼容windows + * @access public + * @return bool + */ + public function getEnhanceWindowsCompatibility() +{ + return $this->enhanceWindowsCompatibility; + } + + /** + * 设置是否兼容windows + * @access public + * @param bool $enhance + * @return self + */ + public function setEnhanceWindowsCompatibility($enhance) +{ + $this->enhanceWindowsCompatibility = (bool) $enhance; + + return $this; + } + + /** + * 返回是否 sigchild 兼容模式激活 + * @access public + * @return bool + */ + public function getEnhanceSigchildCompatibility() +{ + return $this->enhanceSigchildCompatibility; + } + + /** + * 激活 sigchild 兼容性模式。 + * @access public + * @param bool $enhance + * @return self + */ + public function setEnhanceSigchildCompatibility($enhance) +{ + $this->enhanceSigchildCompatibility = (bool) $enhance; + + return $this; + } + + /** + * 是否超时 + */ + public function checkTimeout() +{ + if (self::STATUS_STARTED !== $this->status) { + return; + } + + if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) { + $this->stop(); + + throw new ProcessTimeoutException($this, ProcessTimeoutException::TYPE_GENERAL); + } + + if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) { + $this->stop(); + + throw new ProcessTimeoutException($this, ProcessTimeoutException::TYPE_IDLE); + } + } + + /** + * 是否支持pty + * @access public + * @return bool + */ + public static function isPtySupported() +{ + static $result; + + if (null !== $result) { + return $result; + } + + if ('\\' === DIRECTORY_SEPARATOR) { + return $result = false; + } + + $proc = @proc_open('echo 1', [['pty'], ['pty'], ['pty']], $pipes); + if (is_resource($proc)) { + proc_close($proc); + + return $result = true; + } + + return $result = false; + } + + /** + * 创建所需的 proc_open 的描述符 + * @access private + * @return array + */ + private function getDescriptors() +{ + if ('\\' === DIRECTORY_SEPARATOR) { + $this->processPipes = WindowsPipes::create($this, $this->input); + } else { + $this->processPipes = UnixPipes::create($this, $this->input); + } + $descriptors = $this->processPipes->getDescriptors($this->outputDisabled); + + if (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) { + + $descriptors = array_merge($descriptors, [['pipe', 'w']]); + + $this->commandline = '(' . $this->commandline . ') 3>/dev/null; code=$?; echo $code >&3; exit $code'; + } + + return $descriptors; + } + + /** + * 建立 wait () 使用的回调。 + * @access protected + * @param callable|null $callback + * @return callable + */ + protected function buildCallback($callback) +{ + $out = self::OUT; + $callback = function ($type, $data) use ($callback, $out) { + if ($out == $type) { + $this->addOutput($data); + } else { + $this->addErrorOutput($data); + } + + if (null !== $callback) { + call_user_func($callback, $type, $data); + } + }; + + return $callback; + } + + /** + * 更新状态 + * @access protected + * @param bool $blocking + */ + protected function updateStatus($blocking) +{ + if (self::STATUS_STARTED !== $this->status) { + return; + } + + $this->processInformation = proc_get_status($this->process); + $this->captureExitCode(); + + $this->readPipes($blocking, '\\' === DIRECTORY_SEPARATOR ? !$this->processInformation['running'] : true); + + if (!$this->processInformation['running']) { + $this->close(); + } + } + + /** + * 是否开启 '--enable-sigchild' + * @access protected + * @return bool + */ + protected function isSigchildEnabled() +{ + if (null !== self::$sigchild) { + return self::$sigchild; + } + + if (!function_exists('phpinfo')) { + return self::$sigchild = false; + } + + ob_start(); + phpinfo(INFO_GENERAL); + + return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild'); + } + + /** + * 验证是否超时 + * @access private + * @param int|float|null $timeout + * @return float|null + */ + private function validateTimeout($timeout) +{ + $timeout = (float) $timeout; + + if (0.0 === $timeout) { + $timeout = null; + } elseif ($timeout < 0) { + throw new \InvalidArgumentException('The timeout value must be a valid positive integer or float number.'); + } + + return $timeout; + } + + /** + * 读取pipes + * @access private + * @param bool $blocking + * @param bool $close + */ + private function readPipes($blocking, $close) +{ + $result = $this->processPipes->readAndWrite($blocking, $close); + + $callback = $this->callback; + foreach ($result as $type => $data) { + if (3 == $type) { + $this->fallbackExitcode = (int) $data; + } else { + $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data); + } + } + } + + /** + * 捕获退出码 + */ + private function captureExitCode() +{ + if (isset($this->processInformation['exitcode']) && -1 != $this->processInformation['exitcode']) { + $this->exitcode = $this->processInformation['exitcode']; + } + } + + /** + * 关闭资源 + * @access private + * @return int 退出码 + */ + private function close() +{ + $this->processPipes->close(); + if (is_resource($this->process)) { + $exitcode = proc_close($this->process); + } else { + $exitcode = -1; + } + + $this->exitcode = -1 !== $exitcode ? $exitcode : (null !== $this->exitcode ? $this->exitcode : -1); + $this->status = self::STATUS_TERMINATED; + + if (-1 === $this->exitcode && null !== $this->fallbackExitcode) { + $this->exitcode = $this->fallbackExitcode; + } elseif (-1 === $this->exitcode && $this->processInformation['signaled'] + && 0 < $this->processInformation['termsig'] + ) { + $this->exitcode = 128 + $this->processInformation['termsig']; + } + + return $this->exitcode; + } + + /** + * 重置数据 + */ + private function resetProcessData() +{ + $this->starttime = null; + $this->callback = null; + $this->exitcode = null; + $this->fallbackExitcode = null; + $this->processInformation = null; + $this->stdout = null; + $this->stderr = null; + $this->process = null; + $this->latestSignal = null; + $this->status = self::STATUS_READY; + $this->incrementalOutputOffset = 0; + $this->incrementalErrorOutputOffset = 0; + } + + /** + * 将一个 POSIX 信号发送到进程中。 + * @access private + * @param int $signal + * @param bool $throwException + * @return bool + */ + private function doSignal($signal, $throwException) +{ + if (!$this->isRunning()) { + if ($throwException) { + throw new \LogicException('Can not send signal on a non running process.'); + } + + return false; + } + + if ($this->isSigchildEnabled()) { + if ($throwException) { + throw new \RuntimeException('This PHP has been compiled with --enable-sigchild. The process can not be signaled.'); + } + + return false; + } + + if (true !== @proc_terminate($this->process, $signal)) { + if ($throwException) { + throw new \RuntimeException(sprintf('Error while sending signal `%s`.', $signal)); + } + + return false; + } + + $this->latestSignal = $signal; + + return true; + } + + /** + * 确保进程已经开启 + * @access private + * @param string $functionName + */ + private function requireProcessIsStarted($functionName) +{ + if (!$this->isStarted()) { + throw new \LogicException(sprintf('Process must be started before calling %s.', $functionName)); + } + } + + /** + * 确保进程已经终止 + * @access private + * @param string $functionName + */ + private function requireProcessIsTerminated($functionName) +{ + if (!$this->isTerminated()) { + throw new \LogicException(sprintf('Process must be terminated before calling %s.', $functionName)); + } + } +} diff --git a/tp5/thinkphp/library/think/Request.php b/tp5/thinkphp/library/think/Request.php new file mode 100644 index 0000000..1868c5f --- /dev/null +++ b/tp5/thinkphp/library/think/Request.php @@ -0,0 +1,1875 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +use think\exception\HttpResponseException; + +class Request +{ + /** + * 对象实例 + * @var object + */ + protected $instance; + + /** + * 配置对象 + * @var Config + */ + protected $config; + + /** + * 请求类型 + * @var string + */ + protected $method; + + /** + * 域名(含协议及端口) + * @var string + */ + protected $domain; + + /** + * 子域名 + * @var string + */ + protected $subDomain; + + /** + * 泛域名 + * @var string + */ + protected $panDomain; + + /** + * 当前URL地址 + * @var string + */ + protected $url; + + /** + * 基础URL + * @var string + */ + protected $baseUrl; + + /** + * 当前执行的文件 + * @var string + */ + protected $baseFile; + + /** + * 访问的ROOT地址 + * @var string + */ + protected $root; + + /** + * pathinfo + * @var string + */ + protected $pathinfo; + + /** + * pathinfo(不含后缀) + * @var string + */ + protected $path; + + /** + * 当前路由信息 + * @var array + */ + protected $routeInfo = []; + + /** + * 当前调度信息 + * @var array + */ + protected $dispatch = []; + + /** + * 当前模块名 + * @var string + */ + protected $module; + + /** + * 当前控制器名 + * @var string + */ + protected $controller; + + /** + * 当前操作名 + * @var string + */ + protected $action; + + /** + * 当前语言集 + * @var string + */ + protected $langset; + + /** + * 当前请求参数 + * @var array + */ + protected $param = []; + + /** + * 当前GET参数 + * @var array + */ + protected $get = []; + + /** + * 当前POST参数 + * @var array + */ + protected $post = []; + + /** + * 当前REQUEST参数 + * @var array + */ + protected $request = []; + + /** + * 当前ROUTE参数 + * @var array + */ + protected $route = []; + + /** + * 当前PUT参数 + * @var array + */ + protected $put; + + /** + * 当前SESSION参数 + * @var array + */ + protected $session = []; + + /** + * 当前FILE参数 + * @var array + */ + protected $file = []; + + /** + * 当前COOKIE参数 + * @var array + */ + protected $cookie = []; + + /** + * 当前SERVER参数 + * @var array + */ + protected $server = []; + + /** + * 当前ENV参数 + * @var array + */ + protected $env = []; + + /** + * 当前HEADER参数 + * @var array + */ + protected $header = []; + + /** + * 资源类型定义 + * @var array + */ + protected $mimeType = [ + 'xml' => 'application/xml,text/xml,application/x-xml', + 'json' => 'application/json,text/x-json,application/jsonrequest,text/json', + 'js' => 'text/javascript,application/javascript,application/x-javascript', + 'css' => 'text/css', + 'rss' => 'application/rss+xml', + 'yaml' => 'application/x-yaml,text/yaml', + 'atom' => 'application/atom+xml', + 'pdf' => 'application/pdf', + 'text' => 'text/plain', + 'image' => 'image/png,image/jpg,image/jpeg,image/pjpeg,image/gif,image/webp,image/*', + 'csv' => 'text/csv', + 'html' => 'text/html,application/xhtml+xml,*/*', + ]; + + /** + * 当前请求内容 + * @var string + */ + protected $content; + + /** + * 全局过滤规则 + * @var array + */ + protected $filter; + + /** + * 扩展方法 + * @var array + */ + protected $hook = []; + + /** + * php://input内容 + * @var string + */ + // php://input + protected $input; + + /** + * 请求缓存 + * @var array + */ + protected $cache; + + /** + * 缓存是否检查 + * @var bool + */ + protected $isCheckCache; + + /** + * 架构函数 + * @access public + * @param array $options 参数 + */ + public function __construct($options = []) + { + foreach ($options as $name => $item) { + if (property_exists($this, $name)) { + $this->$name = $item; + } + } + + $this->config = Container::get('config'); + + if (is_null($this->filter)) { + $this->filter = $this->config->get('default_filter'); + } + + // 保存 php://input + $this->input = file_get_contents('php://input'); + } + + public function __call($method, $args) + { + if (array_key_exists($method, $this->hook)) { + array_unshift($args, $this); + return call_user_func_array($this->hook[$method], $args); + } else { + throw new Exception('method not exists:' . static::class . '->' . $method); + } + } + + /** + * Hook 方法注入 + * @access public + * @param string|array $method 方法名 + * @param mixed $callback callable + * @return void + */ + public function hook($method, $callback = null) + { + if (is_array($method)) { + $this->hook = array_merge($this->hook, $method); + } else { + $this->hook[$method] = $callback; + } + } + + /** + * 创建一个URL请求 + * @access public + * @param string $uri URL地址 + * @param string $method 请求类型 + * @param array $params 请求参数 + * @param array $cookie + * @param array $files + * @param array $server + * @param string $content + * @return \think\Request + */ + public function create($uri, $method = 'GET', $params = [], $cookie = [], $files = [], $server = [], $content = null) + { + $server['PATH_INFO'] = ''; + $server['REQUEST_METHOD'] = strtoupper($method); + $info = parse_url($uri); + if (isset($info['host'])) { + $server['SERVER_NAME'] = $info['host']; + $server['HTTP_HOST'] = $info['host']; + } + if (isset($info['scheme'])) { + if ('https' === $info['scheme']) { + $server['HTTPS'] = 'on'; + $server['SERVER_PORT'] = 443; + } else { + unset($server['HTTPS']); + $server['SERVER_PORT'] = 80; + } + } + if (isset($info['port'])) { + $server['SERVER_PORT'] = $info['port']; + $server['HTTP_HOST'] = $server['HTTP_HOST'] . ':' . $info['port']; + } + if (isset($info['user'])) { + $server['PHP_AUTH_USER'] = $info['user']; + } + if (isset($info['pass'])) { + $server['PHP_AUTH_PW'] = $info['pass']; + } + if (!isset($info['path'])) { + $info['path'] = '/'; + } + $options = []; + $options[strtolower($method)] = $params; + $queryString = ''; + if (isset($info['query'])) { + parse_str(html_entity_decode($info['query']), $query); + if (!empty($params)) { + $params = array_replace($query, $params); + $queryString = http_build_query($query, '', '&'); + } else { + $params = $query; + $queryString = $info['query']; + } + } elseif (!empty($params)) { + $queryString = http_build_query($params, '', '&'); + } + if ($queryString) { + parse_str($queryString, $get); + $options['get'] = isset($options['get']) ? array_merge($get, $options['get']) : $get; + } + + $server['REQUEST_URI'] = $info['path'] . ('' !== $queryString ? '?' . $queryString : ''); + $server['QUERY_STRING'] = $queryString; + $options['cookie'] = $cookie; + $options['param'] = $params; + $options['file'] = $files; + $options['server'] = $server; + $options['url'] = $server['REQUEST_URI']; + $options['baseUrl'] = $info['path']; + $options['pathinfo'] = '/' == $info['path'] ? '/' : ltrim($info['path'], '/'); + $options['method'] = $server['REQUEST_METHOD']; + $options['domain'] = isset($info['scheme']) ? $info['scheme'] . '://' . $server['HTTP_HOST'] : ''; + $options['content'] = $content; + + foreach ($options as $name => $item) { + if (property_exists($this, $name)) { + $this->$name = $item; + } + } + + return $this; + } + + /** + * 设置或获取当前包含协议的域名 + * @access public + * @param string $domain 域名 + * @return string|$this + */ + public function domain($domain = null) + { + if (!is_null($domain)) { + $this->domain = $domain; + return $this; + } elseif (!$this->domain) { + $this->domain = $this->scheme() . '://' . $this->host(); + } + + return $this->domain; + } + + /** + * 获取当前子域名 + * @access public + * @return string|$this + */ + public function subDomain() + { + if (is_null($this->subDomain)) { + // 获取当前主域名 + $rootDomain = $this->config->get('app.url_domain_root'); + + if ($rootDomain) { + // 配置域名根 例如 thinkphp.cn 163.com.cn 如果是国家级域名 com.cn net.cn 之类的域名需要配置 + $domain = explode('.', rtrim(stristr($this->host(), $rootDomain, true), '.')); + } else { + $domain = explode('.', $this->host(), -2); + } + + $this->subDomain = implode('.', $domain); + } + + return $this->subDomain; + } + + /** + * 设置或获取当前泛域名的值 + * @access public + * @param string $domain 域名 + * @return string|$this + */ + public function panDomain($domain = null) + { + if (is_null($domain)) { + return $this->panDomain; + } else { + $this->panDomain = $domain; + return $this; + } + } + + /** + * 设置或获取当前完整URL 包括QUERY_STRING + * @access public + * @param string|true $url URL地址 true 带域名获取 + * @return string|$this + */ + public function url($url = null) + { + if (!is_null($url) && true !== $url) { + $this->url = $url; + return $this; + } elseif (!$this->url) { + if ($this->isCli()) { + $this->url = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : ''; + } elseif (isset($_SERVER['HTTP_X_REWRITE_URL'])) { + $this->url = $_SERVER['HTTP_X_REWRITE_URL']; + } elseif (isset($_SERVER['REQUEST_URI'])) { + $this->url = $_SERVER['REQUEST_URI']; + } elseif (isset($_SERVER['ORIG_PATH_INFO'])) { + $this->url = $_SERVER['ORIG_PATH_INFO'] . (!empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : ''); + } else { + $this->url = ''; + } + } + + return true === $url ? $this->domain() . $this->url : $this->url; + } + + /** + * 设置或获取当前URL 不含QUERY_STRING + * @access public + * @param string $url URL地址 + * @return string|$this + */ + public function baseUrl($url = null) + { + if (!is_null($url) && true !== $url) { + $this->baseUrl = $url; + return $this; + } elseif (!$this->baseUrl) { + $str = $this->url(); + $this->baseUrl = strpos($str, '?') ? strstr($str, '?', true) : $str; + } + + return true === $url ? $this->domain() . $this->baseUrl : $this->baseUrl; + } + + /** + * 设置或获取当前执行的文件 SCRIPT_NAME + * @access public + * @param string $file 当前执行的文件 + * @return string|$this + */ + public function baseFile($file = null) + { + if (!is_null($file) && true !== $file) { + $this->baseFile = $file; + return $this; + } elseif (!$this->baseFile) { + $url = ''; + if (!$this->isCli()) { + $script_name = basename($_SERVER['SCRIPT_FILENAME']); + if (basename($_SERVER['SCRIPT_NAME']) === $script_name) { + $url = $_SERVER['SCRIPT_NAME']; + } elseif (basename($_SERVER['PHP_SELF']) === $script_name) { + $url = $_SERVER['PHP_SELF']; + } elseif (isset($_SERVER['ORIG_SCRIPT_NAME']) && basename($_SERVER['ORIG_SCRIPT_NAME']) === $script_name) { + $url = $_SERVER['ORIG_SCRIPT_NAME']; + } elseif (($pos = strpos($_SERVER['PHP_SELF'], '/' . $script_name)) !== false) { + $url = substr($_SERVER['SCRIPT_NAME'], 0, $pos) . '/' . $script_name; + } elseif (isset($_SERVER['DOCUMENT_ROOT']) && strpos($_SERVER['SCRIPT_FILENAME'], $_SERVER['DOCUMENT_ROOT']) === 0) { + $url = str_replace('\\', '/', str_replace($_SERVER['DOCUMENT_ROOT'], '', $_SERVER['SCRIPT_FILENAME'])); + } + } + $this->baseFile = $url; + } + + return true === $file ? $this->domain() . $this->baseFile : $this->baseFile; + } + + /** + * 设置或获取URL访问根地址 + * @access public + * @param string $url URL地址 + * @return string|$this + */ + public function root($url = null) + { + if (!is_null($url) && true !== $url) { + $this->root = $url; + return $this; + } elseif (!$this->root) { + $file = $this->baseFile(); + if ($file && 0 !== strpos($this->url(), $file)) { + $file = str_replace('\\', '/', dirname($file)); + } + $this->root = rtrim($file, '/'); + } + + return true === $url ? $this->domain() . $this->root : $this->root; + } + + /** + * 获取URL访问根目录 + * @access public + * @return string + */ + public function rootUrl() + { + $base = $this->root(); + $root = strpos($base, '.') ? ltrim(dirname($base), DIRECTORY_SEPARATOR) : $base; + + if ('' != $root) { + $root = '/' . ltrim($root, '/'); + } + + return $root; + } + + /** + * 获取当前请求URL的pathinfo信息(含URL后缀) + * @access public + * @return string + */ + public function pathinfo() + { + if (is_null($this->pathinfo)) { + if (isset($_GET[$this->config->get('var_pathinfo')])) { + // 判断URL里面是否有兼容模式参数 + $_SERVER['PATH_INFO'] = $_GET[$this->config->get('var_pathinfo')]; + unset($_GET[$this->config->get('var_pathinfo')]); + } elseif ($this->isCli()) { + // CLI模式下 index.php module/controller/action/params/... + $_SERVER['PATH_INFO'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : ''; + } elseif ('cli-server' == PHP_SAPI) { + $_SERVER['PATH_INFO'] = strpos($_SERVER['REQUEST_URI'], '?') ? strstr($_SERVER['REQUEST_URI'], '?', true) : $_SERVER['REQUEST_URI']; + } + + // 分析PATHINFO信息 + if (!isset($_SERVER['PATH_INFO'])) { + foreach ($this->config->get('pathinfo_fetch') as $type) { + if (!empty($_SERVER[$type])) { + $_SERVER['PATH_INFO'] = (0 === strpos($_SERVER[$type], $_SERVER['SCRIPT_NAME'])) ? + substr($_SERVER[$type], strlen($_SERVER['SCRIPT_NAME'])) : $_SERVER[$type]; + break; + } + } + } + + $this->pathinfo = empty($_SERVER['PATH_INFO']) ? '/' : ltrim($_SERVER['PATH_INFO'], '/'); + } + + return $this->pathinfo; + } + + /** + * 获取当前请求URL的pathinfo信息(不含URL后缀) + * @access public + * @return string + */ + public function path() + { + if (is_null($this->path)) { + $suffix = $this->config->get('url_html_suffix'); + $pathinfo = $this->pathinfo(); + if (false === $suffix) { + // 禁止伪静态访问 + $this->path = $pathinfo; + } elseif ($suffix) { + // 去除正常的URL后缀 + $this->path = preg_replace('/\.(' . ltrim($suffix, '.') . ')$/i', '', $pathinfo); + } else { + // 允许任何后缀访问 + $this->path = preg_replace('/\.' . $this->ext() . '$/i', '', $pathinfo); + } + } + + return $this->path; + } + + /** + * 当前URL的访问后缀 + * @access public + * @return string + */ + public function ext() + { + return pathinfo($this->pathinfo(), PATHINFO_EXTENSION); + } + + /** + * 获取当前请求的时间 + * @access public + * @param bool $float 是否使用浮点类型 + * @return integer|float + */ + public function time($float = false) + { + return $float ? $_SERVER['REQUEST_TIME_FLOAT'] : $_SERVER['REQUEST_TIME']; + } + + /** + * 当前请求的资源类型 + * @access public + * @return false|string + */ + public function type() + { + $accept = $this->server('HTTP_ACCEPT'); + + if (empty($accept)) { + return false; + } + + foreach ($this->mimeType as $key => $val) { + $array = explode(',', $val); + foreach ($array as $k => $v) { + if (stristr($accept, $v)) { + return $key; + } + } + } + + return false; + } + + /** + * 设置资源类型 + * @access public + * @param string|array $type 资源类型名 + * @param string $val 资源类型 + * @return void + */ + public function mimeType($type, $val = '') + { + if (is_array($type)) { + $this->mimeType = array_merge($this->mimeType, $type); + } else { + $this->mimeType[$type] = $val; + } + } + + /** + * 当前的请求类型 + * @access public + * @param bool $method true 获取原始请求类型 + * @return string + */ + public function method($method = false) + { + if (true === $method) { + // 获取原始请求类型 + return $this->isCli() ? 'GET' : (isset($this->server['REQUEST_METHOD']) ? $this->server['REQUEST_METHOD'] : $_SERVER['REQUEST_METHOD']); + } elseif (!$this->method) { + if (isset($_POST[$this->config->get('var_method')])) { + $this->method = strtoupper($_POST[$this->config->get('var_method')]); + $this->{$this->method}($_POST); + } elseif (isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) { + $this->method = strtoupper($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']); + } else { + $this->method = $this->isCli() ? 'GET' : (isset($this->server['REQUEST_METHOD']) ? $this->server['REQUEST_METHOD'] : $_SERVER['REQUEST_METHOD']); + } + } + + return $this->method; + } + + /** + * 是否为GET请求 + * @access public + * @return bool + */ + public function isGet() + { + return $this->method() == 'GET'; + } + + /** + * 是否为POST请求 + * @access public + * @return bool + */ + public function isPost() + { + return $this->method() == 'POST'; + } + + /** + * 是否为PUT请求 + * @access public + * @return bool + */ + public function isPut() + { + return $this->method() == 'PUT'; + } + + /** + * 是否为DELTE请求 + * @access public + * @return bool + */ + public function isDelete() + { + return $this->method() == 'DELETE'; + } + + /** + * 是否为HEAD请求 + * @access public + * @return bool + */ + public function isHead() + { + return $this->method() == 'HEAD'; + } + + /** + * 是否为PATCH请求 + * @access public + * @return bool + */ + public function isPatch() + { + return $this->method() == 'PATCH'; + } + + /** + * 是否为OPTIONS请求 + * @access public + * @return bool + */ + public function isOptions() + { + return $this->method() == 'OPTIONS'; + } + + /** + * 是否为cli + * @access public + * @return bool + */ + public function isCli() + { + return PHP_SAPI == 'cli'; + } + + /** + * 是否为cgi + * @access public + * @return bool + */ + public function isCgi() + { + return strpos(PHP_SAPI, 'cgi') === 0; + } + + /** + * 获取当前请求的参数 + * @access public + * @param mixed $name 变量名 + * @param mixed $default 默认值 + * @param string|array $filter 过滤方法 + * @return mixed + */ + public function param($name = '', $default = null, $filter = '') + { + if (empty($this->param)) { + $method = $this->method(true); + + // 自动获取请求变量 + switch ($method) { + case 'POST': + $vars = $this->post(false); + break; + case 'PUT': + case 'DELETE': + case 'PATCH': + $vars = $this->put(false); + break; + default: + $vars = []; + } + + // 当前请求参数和URL地址中的参数合并 + $this->param = array_merge($this->get(false), $vars, $this->route(false)); + } + + if (true === $name) { + // 获取包含文件上传信息的数组 + $file = $this->file(); + $data = is_array($file) ? array_merge($this->param, $file) : $this->param; + return $this->input($data, '', $default, $filter); + } + + return $this->input($this->param, $name, $default, $filter); + } + + /** + * 设置获取路由参数 + * @access public + * @param mixed $name 变量名 + * @param mixed $default 默认值 + * @param string|array $filter 过滤方法 + * @return mixed + */ + public function route($name = '', $default = null, $filter = '') + { + if (is_array($name)) { + $this->param = []; + return $this->route = array_merge($this->route, $name); + } + + return $this->input($this->route, $name, $default, $filter); + } + + /** + * 设置获取GET参数 + * @access public + * @param mixed $name 变量名 + * @param mixed $default 默认值 + * @param string|array $filter 过滤方法 + * @return mixed + */ + public function get($name = '', $default = null, $filter = '') + { + if (empty($this->get)) { + $this->get = $_GET; + } + + if (is_array($name)) { + $this->param = []; + return $this->get = array_merge($this->get, $name); + } + + return $this->input($this->get, $name, $default, $filter); + } + + /** + * 设置获取POST参数 + * @access public + * @param mixed $name 变量名 + * @param mixed $default 默认值 + * @param string|array $filter 过滤方法 + * @return mixed + */ + public function post($name = '', $default = null, $filter = '') + { + if (empty($this->post)) { + $content = $this->input; + if (empty($_POST) && false !== strpos($this->contentType(), 'application/json')) { + $this->post = (array) json_decode($content, true); + } else { + $this->post = $_POST; + } + } + + if (is_array($name)) { + $this->param = []; + return $this->post = array_merge($this->post, $name); + } + + return $this->input($this->post, $name, $default, $filter); + } + + /** + * 设置获取PUT参数 + * @access public + * @param mixed $name 变量名 + * @param mixed $default 默认值 + * @param string|array $filter 过滤方法 + * @return mixed + */ + public function put($name = '', $default = null, $filter = '') + { + if (is_null($this->put)) { + $content = $this->input; + if (false !== strpos($this->contentType(), 'application/json')) { + $this->put = (array) json_decode($content, true); + } else { + parse_str($content, $this->put); + } + } + + if (is_array($name)) { + $this->param = []; + return $this->put = is_null($this->put) ? $name : array_merge($this->put, $name); + } + + return $this->input($this->put, $name, $default, $filter); + } + + /** + * 设置获取DELETE参数 + * @access public + * @param mixed $name 变量名 + * @param mixed $default 默认值 + * @param string|array $filter 过滤方法 + * @return mixed + */ + public function delete($name = '', $default = null, $filter = '') + { + return $this->put($name, $default, $filter); + } + + /** + * 设置获取PATCH参数 + * @access public + * @param mixed $name 变量名 + * @param mixed $default 默认值 + * @param string|array $filter 过滤方法 + * @return mixed + */ + public function patch($name = '', $default = null, $filter = '') + { + return $this->put($name, $default, $filter); + } + + /** + * 获取request变量 + * @access public + * @param mixed $name 数据名称 + * @param string $default 默认值 + * @param string|array $filter 过滤方法 + * @return mixed + */ + public function request($name = '', $default = null, $filter = '') + { + if (empty($this->request)) { + $this->request = $_REQUEST; + } + + if (is_array($name)) { + $this->param = []; + return $this->request = array_merge($this->request, $name); + } + + return $this->input($this->request, $name, $default, $filter); + } + + /** + * 获取session数据 + * @access public + * @param mixed $name 数据名称 + * @param string $default 默认值 + * @param string|array $filter 过滤方法 + * @return mixed + */ + public function session($name = '', $default = null, $filter = '') + { + if (empty($this->session)) { + $this->session = Container::get('session')->get(); + } + + if (is_array($name)) { + return $this->session = array_merge($this->session, $name); + } + + return $this->input($this->session, $name, $default, $filter); + } + + /** + * 获取cookie参数 + * @access public + * @param mixed $name 数据名称 + * @param string $default 默认值 + * @param string|array $filter 过滤方法 + * @return mixed + */ + public function cookie($name = '', $default = null, $filter = '') + { + $cookie = Container::get('cookie'); + + if (empty($this->cookie)) { + $this->cookie = $cookie->get(); + } + + if (is_array($name)) { + return $this->cookie = array_merge($this->cookie, $name); + } elseif (!empty($name)) { + $data = $cookie->has($name) ? $cookie->get($name) : $default; + } else { + $data = $this->cookie; + } + + // 解析过滤器 + $filter = $this->getFilter($filter, $default); + + if (is_array($data)) { + array_walk_recursive($data, [$this, 'filterValue'], $filter); + reset($data); + } else { + $this->filterValue($data, $name, $filter); + } + + return $data; + } + + /** + * 获取server参数 + * @access public + * @param mixed $name 数据名称 + * @param string $default 默认值 + * @param string|array $filter 过滤方法 + * @return mixed + */ + public function server($name = '', $default = null, $filter = '') + { + if (empty($this->server)) { + $this->server = $_SERVER; + } + + if (is_array($name)) { + return $this->server = array_merge($this->server, $name); + } + + return $this->input($this->server, false === $name ? false : strtoupper($name), $default, $filter); + } + + /** + * 获取上传的文件信息 + * @access public + * @param string|array $name 名称 + * @return null|array|\think\File + */ + public function file($name = '') + { + if (empty($this->file)) { + $this->file = isset($_FILES) ? $_FILES : []; + } + + if (is_array($name)) { + return $this->file = array_merge($this->file, $name); + } + + $files = $this->file; + if (!empty($files)) { + // 处理上传文件 + $array = []; + foreach ($files as $key => $file) { + if (is_array($file['name'])) { + $item = []; + $keys = array_keys($file); + $count = count($file['name']); + for ($i = 0; $i < $count; $i++) { + if (empty($file['tmp_name'][$i]) || !is_file($file['tmp_name'][$i])) { + continue; + } + $temp['key'] = $key; + foreach ($keys as $_key) { + $temp[$_key] = $file[$_key][$i]; + } + $item[] = (new File($temp['tmp_name']))->setUploadInfo($temp); + } + $array[$key] = $item; + } else { + if ($file instanceof File) { + $array[$key] = $file; + } else { + if (empty($file['tmp_name']) || !is_file($file['tmp_name'])) { + continue; + } + $array[$key] = (new File($file['tmp_name']))->setUploadInfo($file); + } + } + } + if (strpos($name, '.')) { + list($name, $sub) = explode('.', $name); + } + if ('' === $name) { + // 获取全部文件 + return $array; + } elseif (isset($sub) && isset($array[$name][$sub])) { + return $array[$name][$sub]; + } elseif (isset($array[$name])) { + return $array[$name]; + } + } + + return; + } + + /** + * 获取环境变量 + * @access public + * @param mixed $name 数据名称 + * @param string $default 默认值 + * @param string|array $filter 过滤方法 + * @return mixed + */ + public function env($name = '', $default = null, $filter = '') + { + if (empty($this->env)) { + $this->env = Container::get('env')->get(); + } + + if (is_array($name)) { + return $this->env = array_merge($this->env, $name); + } + + return $this->input($this->env, false === $name ? false : strtoupper($name), $default, $filter); + } + + /** + * 设置或者获取当前的Header + * @access public + * @param string|array $name header名称 + * @param string $default 默认值 + * @return string + */ + public function header($name = '', $default = null) + { + if (empty($this->header)) { + $header = []; + if (function_exists('apache_request_headers') && $result = apache_request_headers()) { + $header = $result; + } else { + $server = $this->server ?: $_SERVER; + foreach ($server as $key => $val) { + if (0 === strpos($key, 'HTTP_')) { + $key = str_replace('_', '-', strtolower(substr($key, 5))); + $header[$key] = $val; + } + } + if (isset($server['CONTENT_TYPE'])) { + $header['content-type'] = $server['CONTENT_TYPE']; + } + if (isset($server['CONTENT_LENGTH'])) { + $header['content-length'] = $server['CONTENT_LENGTH']; + } + } + $this->header = array_change_key_case($header); + } + + if (is_array($name)) { + return $this->header = array_merge($this->header, $name); + } + + if ('' === $name) { + return $this->header; + } + + $name = str_replace('_', '-', strtolower($name)); + + return isset($this->header[$name]) ? $this->header[$name] : $default; + } + + /** + * 获取变量 支持过滤和默认值 + * @access public + * @param array $data 数据源 + * @param string|false $name 字段名 + * @param mixed $default 默认值 + * @param string|array $filter 过滤函数 + * @return mixed + */ + public function input($data = [], $name = '', $default = null, $filter = '') + { + if (false === $name) { + // 获取原始数据 + return $data; + } + + $name = (string) $name; + if ('' != $name) { + // 解析name + if (strpos($name, '/')) { + list($name, $type) = explode('/', $name); + } else { + $type = 's'; + } + // 按.拆分成多维数组进行判断 + foreach (explode('.', $name) as $val) { + if (isset($data[$val])) { + $data = $data[$val]; + } else { + // 无输入数据,返回默认值 + return $default; + } + } + if (is_object($data)) { + return $data; + } + } + + // 解析过滤器 + $filter = $this->getFilter($filter, $default); + + if (is_array($data)) { + array_walk_recursive($data, [$this, 'filterValue'], $filter); + reset($data); + } else { + $this->filterValue($data, $name, $filter); + } + + if (isset($type) && $data !== $default) { + // 强制类型转换 + $this->typeCast($data, $type); + } + + return $data; + } + + /** + * 设置或获取当前的过滤规则 + * @access public + * @param mixed $filter 过滤规则 + * @return mixed + */ + public function filter($filter = null) + { + if (is_null($filter)) { + return $this->filter; + } else { + $this->filter = $filter; + } + } + + protected function getFilter($filter, $default) + { + if (is_null($filter)) { + $filter = []; + } else { + $filter = $filter ?: $this->filter; + if (is_string($filter) && false === strpos($filter, '/')) { + $filter = explode(',', $filter); + } else { + $filter = (array) $filter; + } + } + + $filter[] = $default; + + return $filter; + } + + /** + * 递归过滤给定的值 + * @access public + * @param mixed $value 键值 + * @param mixed $key 键名 + * @param array $filters 过滤方法+默认值 + * @return mixed + */ + private function filterValue(&$value, $key, $filters) + { + $default = array_pop($filters); + + foreach ($filters as $filter) { + if (is_callable($filter)) { + // 调用函数或者方法过滤 + $value = call_user_func($filter, $value); + } elseif (is_scalar($value)) { + if (false !== strpos($filter, '/')) { + // 正则过滤 + if (!preg_match($filter, $value)) { + // 匹配不成功返回默认值 + $value = $default; + break; + } + } elseif (!empty($filter)) { + // filter函数不存在时, 则使用filter_var进行过滤 + // filter为非整形值时, 调用filter_id取得过滤id + $value = filter_var($value, is_int($filter) ? $filter : filter_id($filter)); + if (false === $value) { + $value = $default; + break; + } + } + } + } + + return $value; + } + + /** + * 强制类型转换 + * @access public + * @param string $data + * @param string $type + * @return mixed + */ + private function typeCast(&$data, $type) + { + switch (strtolower($type)) { + // 数组 + case 'a': + $data = (array) $data; + break; + // 数字 + case 'd': + $data = (int) $data; + break; + // 浮点 + case 'f': + $data = (float) $data; + break; + // 布尔 + case 'b': + $data = (boolean) $data; + break; + // 字符串 + case 's': + default: + if (is_scalar($data)) { + $data = (string) $data; + } else { + throw new \InvalidArgumentException('variable type error:' . gettype($data)); + } + } + } + + /** + * 是否存在某个请求参数 + * @access public + * @param string $name 变量名 + * @param string $type 变量类型 + * @param bool $checkEmpty 是否检测空值 + * @return mixed + */ + public function has($name, $type = 'param', $checkEmpty = false) + { + if (empty($this->$type)) { + $param = $this->$type(); + } else { + $param = $this->$type; + } + + // 按.拆分成多维数组进行判断 + foreach (explode('.', $name) as $val) { + if (isset($param[$val])) { + $param = $param[$val]; + } else { + return false; + } + } + + return ($checkEmpty && '' === $param) ? false : true; + } + + /** + * 获取指定的参数 + * @access public + * @param string|array $name 变量名 + * @param string $type 变量类型 + * @return mixed + */ + public function only($name, $type = 'param') + { + $param = $this->$type(); + + if (is_string($name)) { + $name = explode(',', $name); + } + + $item = []; + foreach ($name as $key => $val) { + + if (is_int($key)) { + $default = null; + $key = $val; + } else { + $default = $val; + } + + if (isset($param[$key])) { + $item[$key] = $param[$key]; + } elseif (isset($default)) { + $item[$key] = $default; + } + } + + return $item; + } + + /** + * 排除指定参数获取 + * @access public + * @param string|array $name 变量名 + * @param string $type 变量类型 + * @return mixed + */ + public function except($name, $type = 'param') + { + $param = $this->$type(); + if (is_string($name)) { + $name = explode(',', $name); + } + + foreach ($name as $key) { + if (isset($param[$key])) { + unset($param[$key]); + } + } + + return $param; + } + + /** + * 当前是否ssl + * @access public + * @return bool + */ + public function isSsl() + { + $server = array_merge($_SERVER, $this->server); + + if (isset($server['HTTPS']) && ('1' == $server['HTTPS'] || 'on' == strtolower($server['HTTPS']))) { + return true; + } elseif (isset($server['REQUEST_SCHEME']) && 'https' == $server['REQUEST_SCHEME']) { + return true; + } elseif (isset($server['SERVER_PORT']) && ('443' == $server['SERVER_PORT'])) { + return true; + } elseif (isset($server['HTTP_X_FORWARDED_PROTO']) && 'https' == $server['HTTP_X_FORWARDED_PROTO']) { + return true; + } elseif ($this->config->get('https_agent_name') && isset($server[$this->config->get('https_agent_name')])) { + return true; + } + + return false; + } + + /** + * 当前是否Ajax请求 + * @access public + * @param bool $ajax true 获取原始ajax请求 + * @return bool + */ + public function isAjax($ajax = false) + { + $value = $this->server('HTTP_X_REQUESTED_WITH', '', 'strtolower'); + $result = ('xmlhttprequest' == $value) ? true : false; + + if (true === $ajax) { + return $result; + } else { + return $this->param($this->config->get('var_ajax')) ? true : $result; + } + } + + /** + * 当前是否Pjax请求 + * @access public + * @param bool $pjax true 获取原始pjax请求 + * @return bool + */ + public function isPjax($pjax = false) + { + $result = !is_null($this->server('HTTP_X_PJAX')) ? true : false; + + if (true === $pjax) { + return $result; + } else { + return $this->param($this->config->get('var_pjax')) ? true : $result; + } + } + + /** + * 获取客户端IP地址 + * @access public + * @param integer $type 返回类型 0 返回IP地址 1 返回IPV4地址数字 + * @param boolean $adv 是否进行高级模式获取(有可能被伪装) + * @return mixed + */ + public function ip($type = 0, $adv = true) + { + $type = $type ? 1 : 0; + static $ip = null; + + if (null !== $ip) { + return $ip[$type]; + } + + if ($adv) { + if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { + $arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); + $pos = array_search('unknown', $arr); + if (false !== $pos) { + unset($arr[$pos]); + } + $ip = trim(current($arr)); + } elseif (isset($_SERVER['HTTP_CLIENT_IP'])) { + $ip = $_SERVER['HTTP_CLIENT_IP']; + } elseif (isset($_SERVER['REMOTE_ADDR'])) { + $ip = $_SERVER['REMOTE_ADDR']; + } + } elseif (isset($_SERVER['REMOTE_ADDR'])) { + $ip = $_SERVER['REMOTE_ADDR']; + } + + // IP地址合法验证 + $long = sprintf("%u", ip2long($ip)); + $ip = $long ? [$ip, $long] : ['0.0.0.0', 0]; + + return $ip[$type]; + } + + /** + * 检测是否使用手机访问 + * @access public + * @return bool + */ + public function isMobile() + { + if (isset($_SERVER['HTTP_VIA']) && stristr($_SERVER['HTTP_VIA'], "wap")) { + return true; + } elseif (isset($_SERVER['HTTP_ACCEPT']) && strpos(strtoupper($_SERVER['HTTP_ACCEPT']), "VND.WAP.WML")) { + return true; + } elseif (isset($_SERVER['HTTP_X_WAP_PROFILE']) || isset($_SERVER['HTTP_PROFILE'])) { + return true; + } elseif (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/(blackberry|configuration\/cldc|hp |hp-|htc |htc_|htc-|iemobile|kindle|midp|mmp|motorola|mobile|nokia|opera mini|opera |Googlebot-Mobile|YahooSeeker\/M1A1-R2D2|android|iphone|ipod|mobi|palm|palmos|pocket|portalmmm|ppc;|smartphone|sonyericsson|sqh|spv|symbian|treo|up.browser|up.link|vodafone|windows ce|xda |xda_)/i', $_SERVER['HTTP_USER_AGENT'])) { + return true; + } else { + return false; + } + } + + /** + * 当前URL地址中的scheme参数 + * @access public + * @return string + */ + public function scheme() + { + return $this->isSsl() ? 'https' : 'http'; + } + + /** + * 当前请求URL地址中的query参数 + * @access public + * @return string + */ + public function query() + { + return $this->server('QUERY_STRING'); + } + + /** + * 当前请求的host + * @access public + * @return string + */ + public function host() + { + if (isset($_SERVER['HTTP_X_REAL_HOST'])) { + return $_SERVER['HTTP_X_REAL_HOST']; + } + + return $this->server('HTTP_HOST'); + } + + /** + * 当前请求URL地址中的port参数 + * @access public + * @return integer + */ + public function port() + { + return $this->server('SERVER_PORT'); + } + + /** + * 当前请求 SERVER_PROTOCOL + * @access public + * @return integer + */ + public function protocol() + { + return $this->server('SERVER_PROTOCOL'); + } + + /** + * 当前请求 REMOTE_PORT + * @access public + * @return integer + */ + public function remotePort() + { + return $this->server('REMOTE_PORT'); + } + + /** + * 当前请求 HTTP_CONTENT_TYPE + * @access public + * @return string + */ + public function contentType() + { + $contentType = $this->server('CONTENT_TYPE'); + + if ($contentType) { + if (strpos($contentType, ';')) { + list($type) = explode(';', $contentType); + } else { + $type = $contentType; + } + return trim($type); + } + + return ''; + } + + /** + * 获取当前请求的路由信息 + * @access public + * @param array $route 路由名称 + * @return array + */ + public function routeInfo($route = []) + { + if (!empty($route)) { + $this->routeInfo = $route; + } else { + return $this->routeInfo; + } + } + + /** + * 设置或者获取当前请求的调度信息 + * @access public + * @param array $dispatch 调度信息 + * @return array + */ + public function dispatch($dispatch = null) + { + if (!is_null($dispatch)) { + $this->dispatch = $dispatch; + } + + return $this->dispatch; + } + + /** + * 设置或者获取当前的模块名 + * @access public + * @param string $module 模块名 + * @return string|Request + */ + public function module($module = null) + { + if (!is_null($module)) { + $this->module = $module; + return $this; + } else { + return $this->module ?: ''; + } + } + + /** + * 设置或者获取当前的控制器名 + * @access public + * @param string $controller 控制器名 + * @return string|Request + */ + public function controller($controller = null) + { + if (!is_null($controller)) { + $this->controller = $controller; + return $this; + } else { + return $this->controller ?: ''; + } + } + + /** + * 设置或者获取当前的操作名 + * @access public + * @param string $action 操作名 + * @return string|Request + */ + public function action($action = null) + { + if (!is_null($action)) { + $this->action = $action; + return $this; + } else { + return $this->action ?: ''; + } + } + + /** + * 设置或者获取当前的语言 + * @access public + * @param string $lang 语言名 + * @return string|Request + */ + public function langset($lang = null) + { + if (!is_null($lang)) { + $this->langset = $lang; + return $this; + } else { + return $this->langset ?: ''; + } + } + + /** + * 设置或者获取当前请求的content + * @access public + * @return string + */ + public function getContent() + { + if (is_null($this->content)) { + $this->content = $this->input; + } + + return $this->content; + } + + /** + * 获取当前请求的php://input + * @access public + * @return string + */ + public function getInput() + { + return $this->input; + } + + /** + * 生成请求令牌 + * @access public + * @param string $name 令牌名称 + * @param mixed $type 令牌生成方法 + * @return string + */ + public function token($name = '__token__', $type = 'md5') + { + $type = is_callable($type) ? $type : 'md5'; + $token = call_user_func($type, $_SERVER['REQUEST_TIME_FLOAT']); + + if ($this->isAjax()) { + header($name . ': ' . $token); + } + + Container::get('session')->set($name, $token); + + return $token; + } + + /** + * 设置当前地址的请求缓存 + * @access public + * @param string $key 缓存标识,支持变量规则 ,例如 item/:name/:id + * @param mixed $expire 缓存有效期 + * @param array $except 缓存排除 + * @param string $tag 缓存标签 + * @return void + */ + public function cache($key, $expire = null, $except = [], $tag = null) + { + if (!is_array($except)) { + $tag = $except; + $except = []; + } + + if (false !== $key && $this->isGet() && !$this->isCheckCache) { + // 标记请求缓存检查 + $this->isCheckCache = true; + if (false === $expire) { + // 关闭当前缓存 + return; + } + + foreach ($except as $rule) { + if (0 === stripos($this->url(), $rule)) { + return; + } + } + + if ($key instanceof \Closure) { + $key = call_user_func_array($key, [$this]); + } elseif (true === $key) { + // 自动缓存功能 + $key = '__URL__'; + } elseif (strpos($key, '|')) { + list($key, $fun) = explode('|', $key); + } + + // 特殊规则替换 + if (false !== strpos($key, '__')) { + $key = str_replace(['__MODULE__', '__CONTROLLER__', '__ACTION__', '__URL__'], [$this->module, $this->controller, $this->action, md5($this->url(true))], $key); + } + + if (false !== strpos($key, ':')) { + $param = $this->param(); + foreach ($param as $item => $val) { + if (is_string($val) && false !== strpos($key, ':' . $item)) { + $key = str_replace(':' . $item, $val, $key); + } + } + } elseif (strpos($key, ']')) { + if ('[' . $this->ext() . ']' == $key) { + // 缓存某个后缀的请求 + $key = md5($this->url()); + } else { + return; + } + } + + if (isset($fun)) { + $key = $fun($key); + } + $cache = Container::get('cache'); + if (strtotime($this->server('HTTP_IF_MODIFIED_SINCE')) + $expire > $_SERVER['REQUEST_TIME']) { + // 读取缓存 + $response = Response::create()->code(304); + throw new HttpResponseException($response); + } elseif ($cache->has($key)) { + list($content, $header) = $cache->get($key); + $response = Response::create($content)->header($header); + throw new HttpResponseException($response); + } else { + $this->cache = [$key, $expire, $tag]; + } + } + } + + /** + * 读取请求缓存设置 + * @access public + * @return array + */ + public function getCache() + { + return $this->cache; + } + +} diff --git a/tp5/thinkphp/library/think/Response.php b/tp5/thinkphp/library/think/Response.php new file mode 100644 index 0000000..e554ab3 --- /dev/null +++ b/tp5/thinkphp/library/think/Response.php @@ -0,0 +1,403 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +use think\response\Redirect as RedirectResponse; + +class Response +{ + /** + * 原始数据 + * @var mixed + */ + protected $data; + + /** + * 当前contentType + * @var string + */ + protected $contentType = 'text/html'; + + /** + * 字符集 + * @var string + */ + protected $charset = 'utf-8'; + + /** + * 状态码 + * @var integer + */ + protected $code = 200; + + /** + * 是否允许请求缓存 + * @var bool + */ + protected $allowCache = true; + + /** + * 输出参数 + * @var array + */ + protected $options = []; + + /** + * header参数 + * @var array + */ + protected $header = []; + + /** + * 输出内容 + * @var string + */ + protected $content = null; + + /** + * 架构函数 + * @access public + * @param mixed $data 输出数据 + * @param int $code + * @param array $header + * @param array $options 输出参数 + */ + public function __construct($data = '', $code = 200, array $header = [], $options = []) + { + $this->data($data); + + if (!empty($options)) { + $this->options = array_merge($this->options, $options); + } + + $this->contentType($this->contentType, $this->charset); + + $this->code = $code; + $this->header = array_merge($this->header, $header); + } + + /** + * 创建Response对象 + * @access public + * @param mixed $data 输出数据 + * @param string $type 输出类型 + * @param int $code + * @param array $header + * @param array $options 输出参数 + * @return Response + */ + public static function create($data = '', $type = '', $code = 200, array $header = [], $options = []) + { + $type = empty($type) ? 'null' : strtolower($type); + + $class = false !== strpos($type, '\\') ? $type : '\\think\\response\\' . ucfirst($type); + + if (class_exists($class)) { + return new $class($data, $code, $header, $options); + } else { + return new static($data, $code, $header, $options); + } + } + + /** + * 发送数据到客户端 + * @access public + * @return void + * @throws \InvalidArgumentException + */ + public function send() + { + // 监听response_send + Container::get('hook')->listen('response_send', $this); + + // 处理输出数据 + $data = $this->getContent(); + + // Trace调试注入 + if (Container::get('env')->get('app_trace', Container::get('app')->config('app.app_trace'))) { + Container::get('debug')->inject($this, $data); + } + + if (200 == $this->code && $this->allowCache) { + $cache = Container::get('request')->getCache(); + if ($cache) { + $this->header['Cache-Control'] = 'max-age=' . $cache[1] . ',must-revalidate'; + $this->header['Last-Modified'] = gmdate('D, d M Y H:i:s') . ' GMT'; + $this->header['Expires'] = gmdate('D, d M Y H:i:s', $_SERVER['REQUEST_TIME'] + $cache[1]) . ' GMT'; + + Container::get('cache')->tag($cache[2])->set($cache[0], [$data, $this->header], $cache[1]); + } + } + + if (!headers_sent() && !empty($this->header)) { + // 发送状态码 + http_response_code($this->code); + // 发送头部信息 + foreach ($this->header as $name => $val) { + header($name . (!is_null($val) ? ':' . $val : '')); + } + } + + $this->sendData($data); + + if (function_exists('fastcgi_finish_request')) { + // 提高页面响应 + fastcgi_finish_request(); + } + + // 监听response_end + Container::get('hook')->listen('response_end', $this); + + // 清空当次请求有效的数据 + if (!($this instanceof RedirectResponse)) { + Container::get('session')->flush(); + } + } + + /** + * 处理数据 + * @access protected + * @param mixed $data 要处理的数据 + * @return mixed + */ + protected function output($data) + { + return $data; + } + + /** + * 输出数据 + * @access protected + * @param string $data 要处理的数据 + * @return void + */ + protected function sendData($data) + { + echo $data; + } + + /** + * 输出的参数 + * @access public + * @param mixed $options 输出参数 + * @return $this + */ + public function options($options = []) + { + $this->options = array_merge($this->options, $options); + + return $this; + } + + /** + * 输出数据设置 + * @access public + * @param mixed $data 输出数据 + * @return $this + */ + public function data($data) + { + $this->data = $data; + + return $this; + } + + /** + * 是否允许请求缓存 + * @access public + * @param bool $cache 允许请求缓存 + * @return $this + */ + public function allowCache($cache) + { + $this->allowCache = $cache; + + return $this; + } + + /** + * 设置响应头 + * @access public + * @param string|array $name 参数名 + * @param string $value 参数值 + * @return $this + */ + public function header($name, $value = null) + { + if (is_array($name)) { + $this->header = array_merge($this->header, $name); + } else { + $this->header[$name] = $value; + } + + return $this; + } + + /** + * 设置页面输出内容 + * @access public + * @param mixed $content + * @return $this + */ + public function content($content) + { + if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([ + $content, + '__toString', + ]) + ) { + throw new \InvalidArgumentException(sprintf('variable type error: %s', gettype($content))); + } + + $this->content = (string) $content; + + return $this; + } + + /** + * 发送HTTP状态 + * @access public + * @param integer $code 状态码 + * @return $this + */ + public function code($code) + { + $this->code = $code; + + return $this; + } + + /** + * LastModified + * @access public + * @param string $time + * @return $this + */ + public function lastModified($time) + { + $this->header['Last-Modified'] = $time; + + return $this; + } + + /** + * Expires + * @access public + * @param string $time + * @return $this + */ + public function expires($time) + { + $this->header['Expires'] = $time; + + return $this; + } + + /** + * ETag + * @access public + * @param string $eTag + * @return $this + */ + public function eTag($eTag) + { + $this->header['ETag'] = $eTag; + + return $this; + } + + /** + * 页面缓存控制 + * @access public + * @param string $cache 状态码 + * @return $this + */ + public function cacheControl($cache) + { + $this->header['Cache-control'] = $cache; + + return $this; + } + + /** + * 页面输出类型 + * @access public + * @param string $contentType 输出类型 + * @param string $charset 输出编码 + * @return $this + */ + public function contentType($contentType, $charset = 'utf-8') + { + $this->header['Content-Type'] = $contentType . '; charset=' . $charset; + + return $this; + } + + /** + * 获取头部信息 + * @access public + * @param string $name 头部名称 + * @return mixed + */ + public function getHeader($name = '') + { + if (!empty($name)) { + return isset($this->header[$name]) ? $this->header[$name] : null; + } else { + return $this->header; + } + } + + /** + * 获取原始数据 + * @access public + * @return mixed + */ + public function getData() + { + return $this->data; + } + + /** + * 获取输出数据 + * @access public + * @return mixed + */ + public function getContent() + { + if (null == $this->content) { + $content = $this->output($this->data); + + if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([ + $content, + '__toString', + ]) + ) { + throw new \InvalidArgumentException(sprintf('variable type error: %s', gettype($content))); + } + + $this->content = (string) $content; + } + + return $this->content; + } + + /** + * 获取状态码 + * @access public + * @return integer + */ + public function getCode() + { + return $this->code; + } +} diff --git a/tp5/thinkphp/library/think/Route.php b/tp5/thinkphp/library/think/Route.php new file mode 100644 index 0000000..ae7919e --- /dev/null +++ b/tp5/thinkphp/library/think/Route.php @@ -0,0 +1,1041 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +use think\exception\RouteNotFoundException; +use think\route\dispatch\Url as UrlDispatch; +use think\route\Domain; +use think\route\Resource; +use think\route\RuleGroup; +use think\route\RuleItem; + +class Route +{ + /** + * REST定义 + * @var array + */ + protected $rest = [ + 'index' => ['get', '', 'index'], + 'create' => ['get', '/create', 'create'], + 'edit' => ['get', '/:id/edit', 'edit'], + 'read' => ['get', '/:id', 'read'], + 'save' => ['post', '', 'save'], + 'update' => ['put', '/:id', 'update'], + 'delete' => ['delete', '/:id', 'delete'], + ]; + + /** + * 请求方法前缀定义 + * @var array + */ + protected $methodPrefix = [ + 'get' => 'get', + 'post' => 'post', + 'put' => 'put', + 'delete' => 'delete', + 'patch' => 'patch', + ]; + + /** + * 配置对象 + * @var Config + */ + protected $config; + + /** + * 请求对象 + * @var Request + */ + protected $request; + + /** + * 当前HOST + * @var string + */ + protected $host; + + /** + * 当前域名 + * @var string + */ + protected $domain; + + /** + * 当前分组 + * @var string + */ + protected $group; + + /** + * 路由标识 + * @var array + */ + protected $name = []; + + /** + * 路由绑定 + * @var array + */ + protected $bind = []; + + /** + * 域名对象 + * @var array + */ + protected $domains = []; + + /** + * 跨域路由规则 + * @var RuleGroup + */ + protected $cross; + + /** + * 当前路由标识 + * @var string + */ + protected $ruleName; + + /** + * 路由别名 + * @var array + */ + protected $alias = []; + + public function __construct(Request $request, Config $config) + { + $this->config = $config; + $this->request = $request; + $this->host = $this->request->host(); + + $this->setDefaultDomain(); + } + + /** + * 初始化默认域名 + * @access protected + * @return void + */ + protected function setDefaultDomain() + { + // 默认域名 + $this->domain = $this->host; + + // 注册默认域名 + $domain = new Domain($this, $this->host); + + $this->domains[$this->host] = $domain; + + // 默认分组 + $this->group = $this->createTopGroup($domain); + } + + /** + * 创建一个域名下的顶级路由分组 + * @access protected + * @param Domain $domain 域名 + * @return RuleGroup + */ + protected function createTopGroup(Domain $domain) + { + $group = new RuleGroup($this); + // 注册分组到当前域名 + $domain->addRule($group); + + return $group; + } + + /** + * 设置当前域名 + * @access public + * @param RuleGroup $group 域名 + * @return void + */ + public function setGroup(RuleGroup $group) + { + $this->group = $group; + } + + /** + * 获取当前分组 + * @access public + * @return RuleGroup + */ + public function getGroup() + { + return $this->group; + } + + /** + * 注册变量规则 + * @access public + * @param string|array $name 变量名 + * @param string $rule 变量规则 + * @return $this + */ + public function pattern($name, $rule = '') + { + $this->group->pattern($name, $rule); + + return $this; + } + + /** + * 注册路由参数 + * @access public + * @param string|array $name 参数名 + * @param mixed $value 值 + * @return $this + */ + public function option($name, $value = '') + { + $this->group->option($name, $value); + + return $this; + } + + /** + * 获取当前根域名 + * @access protected + * @return string + */ + protected function getRootDomain() + { + $root = $this->config->get('app.url_domain_root'); + if (!$root) { + $item = explode('.', $this->host); + $count = count($item); + $root = $count > 1 ? $item[$count - 2] . '.' . $item[$count - 1] : $item[0]; + } + return $root; + } + + /** + * 注册域名路由 + * @access public + * @param string|array $name 子域名 + * @param mixed $rule 路由规则 + * @param array $option 路由参数 + * @param array $pattern 变量规则 + * @return Domain + */ + public function domain($name, $rule = '', $option = [], $pattern = []) + { + // 支持多个域名使用相同路由规则 + $domainName = is_array($name) ? array_shift($name) : $name; + + if ('*' != $domainName && !strpos($domainName, '.')) { + $domainName .= '.' . $this->getRootDomain(); + } + + $route = $this->config->get('url_lazy_route') ? $rule : null; + + $domain = new Domain($this, $domainName, $route, $option, $pattern); + + if (is_null($route)) { + // 获取原始分组 + $originGroup = $this->group; + // 设置当前域名 + $this->domain = $domainName; + $this->group = $this->createTopGroup($domain); + + // 解析域名路由规则 + $this->parseGroupRule($domain, $rule); + + // 还原默认域名 + $this->domain = $this->host; + // 还原默认分组 + $this->group = $originGroup; + } + + $this->domains[$domainName] = $domain; + + if (is_array($name) && !empty($name)) { + $root = $this->getRootDomain(); + foreach ($name as $item) { + if (!strpos($item, '.')) { + $item .= '.' . $root; + } + + $this->domains[$item] = $domainName; + } + } + + // 返回域名对象 + return $domain; + } + + /** + * 解析分组和域名的路由规则及绑定 + * @access public + * @param RuleGroup $group 分组路由对象 + * @param mixed $rule 路由规则 + * @return void + */ + public function parseGroupRule($group, $rule) + { + if ($rule instanceof \Closure) { + Container::getInstance()->invokeFunction($rule); + } elseif ($rule instanceof Response) { + $group->setRule($rule); + } elseif (is_array($rule)) { + $this->rules($rule); + } elseif ($rule) { + if (false !== strpos($rule, '?')) { + list($rule, $query) = explode('?', $rule); + parse_str($query, $vars); + $group->append($vars); + } + + $this->bind($rule); + } + } + + /** + * 获取域名 + * @access public + * @return array + */ + public function getDomains() + { + return $this->domains; + } + + /** + * 设置路由绑定 + * @access public + * @param string $bind 绑定信息 + * @return $this + */ + public function bind($bind) + { + $this->bind[$this->domain] = $bind; + + return $this; + } + + /** + * 读取路由绑定 + * @access public + * @param string $domain 域名 + * @return string|null + */ + public function getBind($domain = null) + { + if (is_null($domain)) { + $domain = $this->domain; + } + + $subDomain = $this->request->subDomain(); + + if (strpos($subDomain, '.')) { + $name = '*' . strstr($subDomain, '.'); + } + + if (isset($this->bind[$domain])) { + $result = $this->bind[$domain]; + } elseif (isset($name) && isset($this->bind[$name])) { + $result = $this->bind[$name]; + } elseif (isset($this->bind['*'])) { + $result = $this->bind['*']; + } else { + $result = null; + } + + return $result; + } + + /** + * 设置当前路由标识 + * @access public + * @param string $name 路由命名标识 + * @return $this + */ + public function name($name) + { + $this->ruleName = $name; + + return $this; + } + + /** + * 读取路由标识 + * @access public + * @param string $name 路由标识 + * @return mixed + */ + public function getName($name = null) + { + if (is_null($name)) { + return $this->name; + } + + $name = strtolower($name); + + return isset($this->name[$name]) ? $this->name[$name] : null; + } + + /** + * 批量导入路由标识 + * @access public + * @param array $name 路由标识 + * @return $this + */ + public function setName($name) + { + $this->name = $name; + return $this; + } + + /** + * 导入配置文件的路由规则 + * @access public + * @param array $rules 路由规则 + * @param string $type 请求类型 + * @return void + */ + public function import(array $rules, $type = '*') + { + // 检查域名部署 + if (isset($rules['__domain__'])) { + foreach ($rules['__domain__'] as $key => $rule) { + $this->domain($key, $rule); + } + unset($rules['__domain__']); + } + + // 检查变量规则 + if (isset($rules['__pattern__'])) { + $this->pattern($rules['__pattern__']); + unset($rules['__pattern__']); + } + + // 检查路由别名 + if (isset($rules['__alias__'])) { + $this->alias($rules['__alias__']); + unset($rules['__alias__']); + } + + // 检查资源路由 + if (isset($rules['__rest__'])) { + foreach ($rules['__rest__'] as $key => $rule) { + $this->resource($key, $rule); + } + unset($rules['__rest__']); + } + + // 检查路由规则(包含分组) + foreach ($rules as $key => $val) { + if (is_numeric($key)) { + $key = array_shift($val); + } + + if (empty($val)) { + continue; + } + + if (is_string($key) && 0 === strpos($key, '[')) { + $key = substr($key, 1, -1); + $this->group($key, $val); + } elseif (is_array($val)) { + $this->rule($key, $val[0], $type, $val[1], isset($val[2]) ? $val[2] : []); + } else { + $this->rule($key, $val, $type); + } + } + } + + /** + * 注册路由规则 + * @access public + * @param string $rule 路由规则 + * @param mixed $route 路由地址 + * @param string $method 请求类型 + * @param array $option 路由参数 + * @param array $pattern 变量规则 + * @return RuleItem + */ + public function rule($rule, $route, $method = '*', $option = [], $pattern = []) + { + // 读取路由标识 + if (is_array($rule)) { + $name = $rule[0]; + $rule = $rule[1]; + } elseif ($this->ruleName) { + $name = $this->ruleName; + + $this->ruleName = null; + } elseif (is_string($route)) { + $name = $route; + } + + $method = strtolower($method); + + // 创建路由规则实例 + $ruleItem = new RuleItem($this, $this->group, $rule, $route, $method, $option, $pattern); + + if (isset($name)) { + // 上级完整分组名 + $group = $this->group->getFullName(); + + if ($group) { + $rule = $group . '/' . $rule; + } + + // 设置路由标识 用于URL快速生成 + $this->setRuleName($rule, $name, $option); + } + + // 添加到当前分组 + $this->group->addRule($ruleItem, $method); + + if (!empty($option['cross_domain'])) { + $this->setCrossDomainRule($ruleItem, $method); + } + + return $ruleItem; + } + + /** + * 设置路由标识 用于URL反解生成 + * @access public + * @param string $rule 路由规则 + * @param string $name 路由标识 + * @param array $option 路由参数 + * @return void + */ + public function setRuleName($rule, $name, $option = []) + { + $vars = $this->parseVar($rule); + + if (isset($option['ext'])) { + $suffix = $option['ext']; + } elseif ($this->group->getOption('ext')) { + $suffix = $this->group->getOption('ext'); + } else { + $suffix = null; + } + + $this->name[strtolower($name)][] = [$rule, $vars, $this->domain, $suffix]; + } + + /** + * 设置跨域有效路由规则 + * @access public + * @param Rule $rule 路由规则 + * @param string $method 请求类型 + * @return $this + */ + public function setCrossDomainRule($rule, $method = '*') + { + if (!isset($this->cross)) { + $this->cross = new RuleGroup($this); + } + + $this->cross->addRule($rule, $method); + + return $this; + } + + /** + * 批量注册路由规则 + * @access public + * @param array $rules 路由规则 + * @param string $method 请求类型 + * @param array $option 路由参数 + * @param array $pattern 变量规则 + * @return void + */ + public function rules($rules, $method = '*', $option = [], $pattern = []) + { + foreach ($rules as $key => $val) { + if (is_numeric($key)) { + $key = array_shift($val); + } + + if (is_array($val)) { + $route = array_shift($val); + $option = $val ? array_shift($val) : []; + $pattern = $val ? array_shift($val) : []; + } else { + $route = $val; + } + + $this->rule($key, $route, $method, $option, $pattern); + } + } + + /** + * 注册路由分组 + * @access public + * @param string|array $name 分组名称或者参数 + * @param array|\Closure $route 分组路由 + * @param array $option 路由参数 + * @param array $pattern 变量规则 + * @return RuleGroup + */ + public function group($name, $route, $option = [], $pattern = []) + { + if (is_array($name)) { + $option = $name; + $name = isset($option['name']) ? $option['name'] : ''; + } + + // 创建分组实例 + $rule = $this->config->get('url_lazy_route') ? $route : null; + $group = new RuleGroup($this, $this->group, $name, $rule, $option, $pattern); + + if (is_null($rule)) { + // 解析分组路由 + $parent = $this->getGroup(); + + $this->group = $group; + + // 解析分组路由规则 + $this->parseGroupRule($group, $route); + + $this->group = $parent; + } + + // 注册子分组 + $this->group->addRule($group); + + if (!empty($option['cross_domain'])) { + $this->setCrossDomainRule($group); + } + + return $group; + } + + /** + * 注册路由 + * @access public + * @param string $rule 路由规则 + * @param string $route 路由地址 + * @param array $option 路由参数 + * @param array $pattern 变量规则 + * @return RuleItem + */ + public function any($rule, $route = '', $option = [], $pattern = []) + { + return $this->rule($rule, $route, '*', $option, $pattern); + } + + /** + * 注册GET路由 + * @access public + * @param string $rule 路由规则 + * @param string $route 路由地址 + * @param array $option 路由参数 + * @param array $pattern 变量规则 + * @return RuleItem + */ + public function get($rule, $route = '', $option = [], $pattern = []) + { + return $this->rule($rule, $route, 'GET', $option, $pattern); + } + + /** + * 注册POST路由 + * @access public + * @param string $rule 路由规则 + * @param string $route 路由地址 + * @param array $option 路由参数 + * @param array $pattern 变量规则 + * @return RuleItem + */ + public function post($rule, $route = '', $option = [], $pattern = []) + { + return $this->rule($rule, $route, 'POST', $option, $pattern); + } + + /** + * 注册PUT路由 + * @access public + * @param string $rule 路由规则 + * @param string $route 路由地址 + * @param array $option 路由参数 + * @param array $pattern 变量规则 + * @return RuleItem + */ + public function put($rule, $route = '', $option = [], $pattern = []) + { + return $this->rule($rule, $route, 'PUT', $option, $pattern); + } + + /** + * 注册DELETE路由 + * @access public + * @param string $rule 路由规则 + * @param string $route 路由地址 + * @param array $option 路由参数 + * @param array $pattern 变量规则 + * @return RuleItem + */ + public function delete($rule, $route = '', $option = [], $pattern = []) + { + return $this->rule($rule, $route, 'DELETE', $option, $pattern); + } + + /** + * 注册PATCH路由 + * @access public + * @param string $rule 路由规则 + * @param string $route 路由地址 + * @param array $option 路由参数 + * @param array $pattern 变量规则 + * @return RuleItem + */ + public function patch($rule, $route = '', $option = [], $pattern = []) + { + return $this->rule($rule, $route, 'PATCH', $option, $pattern); + } + + /** + * 注册资源路由 + * @access public + * @param string $rule 路由规则 + * @param string $route 路由地址 + * @param array $option 路由参数 + * @param array $pattern 变量规则 + * @return Resource + */ + public function resource($rule, $route = '', $option = [], $pattern = []) + { + $resource = new Resource($this, $this->group, $rule, $route, $option, $pattern, $this->rest); + + // 添加到当前分组 + $this->group->addRule($resource); + + return $resource; + } + + /** + * 注册控制器路由 操作方法对应不同的请求后缀 + * @access public + * @param string $rule 路由规则 + * @param string $route 路由地址 + * @param array $option 路由参数 + * @param array $pattern 变量规则 + * @return $this + */ + public function controller($rule, $route = '', $option = [], $pattern = []) + { + foreach ($this->methodPrefix as $type => $val) { + $this->$type($rule . '/:action', $route . '/' . $val . ':action', $option, $pattern); + } + + return $this; + } + + /** + * 注册视图路由 + * @access public + * @param string|array $rule 路由规则 + * @param string $template 路由模板地址 + * @param array $vars 模板变量 + * @param array $option 路由参数 + * @param array $pattern 变量规则 + * @return RuleItem + */ + public function view($rule, $template = '', $vars = [], $option = [], $pattern = []) + { + return $this->rule($rule, $template, 'GET', $option, $pattern)->view($vars); + } + + /** + * 注册重定向路由 + * @access public + * @param string|array $rule 路由规则 + * @param string $template 路由模板地址 + * @param array $status 状态码 + * @param array $option 路由参数 + * @param array $pattern 变量规则 + * @return RuleItem + */ + public function redirect($rule, $route = '', $status = 301, $option = [], $pattern = []) + { + return $this->rule($rule, $route, '*', $option, $pattern)->redirect()->status($status); + } + + /** + * 注册别名路由 + * @access public + * @param string|array $rule 路由别名 + * @param string $route 路由地址 + * @param array $option 路由参数 + * @return $this + */ + public function alias($rule = null, $route = '', $option = []) + { + if (is_array($rule)) { + $this->alias = array_merge($this->alias, $rule); + } else { + $this->alias[$rule] = $option ? [$route, $option] : $route; + } + + return $this; + } + + /** + * 获取别名路由定义 + * @access public + * @param string $name 路由别名 + * @return string|array|null + */ + public function getAlias($name = null) + { + if (is_null($name)) { + return $this->alias; + } + + return isset($this->alias[$name]) ? $this->alias[$name] : null; + } + + /** + * 设置不同请求类型下面的方法前缀 + * @access public + * @param string|array $method 请求类型 + * @param string $prefix 类型前缀 + * @return $this + */ + public function setMethodPrefix($method, $prefix = '') + { + if (is_array($method)) { + $this->methodPrefix = array_merge($this->methodPrefix, array_change_key_case($method)); + } else { + $this->methodPrefix[strtolower($method)] = $prefix; + } + + return $this; + } + + /** + * 获取请求类型的方法前缀 + * @access public + * @param string $method 请求类型 + * @param string $prefix 类型前缀 + * @return string|null + */ + public function getMethodPrefix($method) + { + $method = strtolower($method); + + return isset($this->methodPrefix[$method]) ? $this->methodPrefix[$method] : null; + } + + /** + * rest方法定义和修改 + * @access public + * @param string $name 方法名称 + * @param array|bool $resource 资源 + * @return $this + */ + public function rest($name, $resource = []) + { + if (is_array($name)) { + $this->rest = $resource ? $name : array_merge($this->rest, $name); + } else { + $this->rest[$name] = $resource; + } + + return $this; + } + + /** + * 获取rest方法定义的参数 + * @access public + * @param string $name 方法名称 + * @return array|null + */ + public function getRest($name = null) + { + if (is_null($name)) { + return $this->rest; + } + + return isset($this->rest[$name]) ? $this->rest[$name] : null; + } + + /** + * 注册未匹配路由规则后的处理 + * @access public + * @param string $route 路由地址 + * @param string $method 请求类型 + * @param array $option 路由参数 + * @return RuleItem + */ + public function miss($route, $method = '*', $option = []) + { + return $this->rule('', $route, $method, $option)->isMiss(); + } + + /** + * 注册一个自动解析的URL路由 + * @access public + * @param string $route 路由地址 + * @return RuleItem + */ + public function auto($route) + { + return $this->rule('', $route)->isAuto(); + } + + /** + * 检测URL路由 + * @access public + * @param string $url URL地址 + * @param string $depr URL分隔符 + * @param bool $must 是否强制路由 + * @param bool $completeMatch 路由是否完全匹配 + * @return Dispatch + * @throws RouteNotFoundException + */ + public function check($url, $depr = '/', $must = false, $completeMatch = false) + { + // 自动检测域名路由 + $domain = $this->checkDomain(); + $url = str_replace($depr, '|', $url); + + $result = $domain->check($this->request, $url, $depr, $completeMatch); + + if (false === $result && !empty($this->cross)) { + // 检测跨越路由 + $result = $this->cross->check($this->request, $url, $depr, $completeMatch); + } + + if (false !== $result) { + // 路由匹配 + return $result; + } elseif ($must) { + // 强制路由不匹配则抛出异常 + throw new RouteNotFoundException(); + } else { + // 默认路由解析 + return new UrlDispatch($url, ['depr' => $depr, 'auto_search' => $this->config->get('app.controller_auto_search')]); + } + } + + /** + * 检测域名的路由规则 + * @access protected + * @param string $host 当前主机地址 + * @return Domain + */ + protected function checkDomain() + { + // 获取当前子域名 + $subDomain = $this->request->subDomain(); + + $item = false; + + if ($subDomain && count($this->domains) > 1) { + $domain = explode('.', $subDomain); + $domain2 = array_pop($domain); + + if ($domain) { + // 存在三级域名 + $domain3 = array_pop($domain); + } + + if ($subDomain && isset($this->domains[$subDomain])) { + // 子域名配置 + $item = $this->domains[$subDomain]; + } elseif (isset($this->domains['*.' . $domain2]) && !empty($domain3)) { + // 泛三级域名 + $item = $this->domains['*.' . $domain2]; + $panDomain = $domain3; + } elseif (isset($this->domains['*']) && !empty($domain2)) { + // 泛二级域名 + if ('www' != $domain2) { + $item = $this->domains['*']; + $panDomain = $domain2; + } + } + + if (isset($panDomain)) { + // 保存当前泛域名 + $this->request->panDomain($panDomain); + } + } + + if (false === $item) { + // 检测当前完整域名 + $item = $this->domains[$this->host]; + } + + if (is_string($item)) { + $item = $this->domains[$item]; + } + + return $item; + } + + /** + * 分析路由规则中的变量 + * @access public + * @param string $rule 路由规则 + * @return array + */ + public function parseVar($rule) + { + // 提取路由规则中的变量 + $var = []; + + foreach (explode('/', $rule) as $val) { + $optional = false; + + if (false !== strpos($val, '<') && preg_match_all('/<(\w+(\??))>/', $val, $matches)) { + foreach ($matches[1] as $name) { + if (strpos($name, '?')) { + $name = substr($name, 0, -1); + $optional = true; + } else { + $optional = false; + } + $var[$name] = $optional ? 2 : 1; + } + } + + if (0 === strpos($val, '[:')) { + // 可选参数 + $optional = true; + $val = substr($val, 1, -1); + } + + if (0 === strpos($val, ':')) { + // URL变量 + $name = substr($val, 1); + if ('$' == substr($name, -1)) { + $name = substr($name, 0, -1); + } + + $var[$name] = $optional ? 2 : 1; + } + } + + return $var; + } + + /** + * 设置全局的路由分组参数 + * @access public + * @param string $method 方法名 + * @param array $args 调用参数 + * @return RuleGroup + */ + public function __call($method, $args) + { + return call_user_func_array([$this->group, $method], $args); + } +} diff --git a/tp5/thinkphp/library/think/Session.php b/tp5/thinkphp/library/think/Session.php new file mode 100644 index 0000000..f52bbc6 --- /dev/null +++ b/tp5/thinkphp/library/think/Session.php @@ -0,0 +1,531 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +use think\exception\ClassNotFoundException; + +class Session +{ + /** + * 前缀 + * @var string + */ + protected $prefix = ''; + + /** + * 是否初始化 + * @var bool + */ + protected $init = null; + + /** + * 锁驱动 + * @var object + */ + protected $lockDriver = null; + + /** + * 锁key + * @var string + */ + protected $sessKey = 'PHPSESSID'; + + /** + * 锁超时时间 + * @var integer + */ + protected $lockTimeout = 3; + + /** + * 是否启用锁机制 + * @var bool + */ + protected $lock = false; + + /** + * 设置或者获取session作用域(前缀) + * @access public + * @param string $prefix + * @return string|void + */ + public function prefix($prefix = '') + { + empty($this->init) && $this->boot(); + + if (empty($prefix) && null !== $prefix) { + return $this->prefix; + } else { + $this->prefix = $prefix; + } + } + + /** + * session初始化 + * @access public + * @param array $config + * @return void + * @throws \think\Exception + */ + public function init(array $config = []) + { + if (empty($config)) { + $config = Container::get('config')->pull('session'); + } + + // 记录初始化信息 + Container::get('app')->log('[ SESSION ] INIT ' . var_export($config, true)); + $isDoStart = false; + if (isset($config['use_trans_sid'])) { + ini_set('session.use_trans_sid', $config['use_trans_sid'] ? 1 : 0); + } + + // 启动session + if (!empty($config['auto_start']) && PHP_SESSION_ACTIVE != session_status()) { + ini_set('session.auto_start', 0); + $isDoStart = true; + } + + if (isset($config['prefix'])) { + $this->prefix = $config['prefix']; + } + + if (isset($config['use_lock'])) { + $this->lock = $config['use_lock']; + } + + if (isset($config['var_session_id']) && isset($_REQUEST[$config['var_session_id']])) { + session_id($_REQUEST[$config['var_session_id']]); + } elseif (isset($config['id']) && !empty($config['id'])) { + session_id($config['id']); + } + + if (isset($config['name'])) { + session_name($config['name']); + } + + if (isset($config['path'])) { + session_save_path($config['path']); + } + + if (isset($config['domain'])) { + ini_set('session.cookie_domain', $config['domain']); + } + + if (isset($config['expire'])) { + ini_set('session.gc_maxlifetime', $config['expire']); + ini_set('session.cookie_lifetime', $config['expire']); + } + + if (isset($config['secure'])) { + ini_set('session.cookie_secure', $config['secure']); + } + + if (isset($config['httponly'])) { + ini_set('session.cookie_httponly', $config['httponly']); + } + + if (isset($config['use_cookies'])) { + ini_set('session.use_cookies', $config['use_cookies'] ? 1 : 0); + } + + if (isset($config['cache_limiter'])) { + session_cache_limiter($config['cache_limiter']); + } + + if (isset($config['cache_expire'])) { + session_cache_expire($config['cache_expire']); + } + + if (!empty($config['type'])) { + // 读取session驱动 + $class = false !== strpos($config['type'], '\\') ? $config['type'] : '\\think\\session\\driver\\' . ucwords($config['type']); + + // 检查驱动类 + if (!class_exists($class) || !session_set_save_handler(new $class($config))) { + throw new ClassNotFoundException('error session handler:' . $class, $class); + } + } + + if ($isDoStart) { + session_start(); + $this->init = true; + } else { + $this->init = false; + } + } + + /** + * session自动启动或者初始化 + * @access public + * @return void + */ + public function boot() + { + if (is_null($this->init)) { + $this->init(); + } elseif (false === $this->init) { + if (PHP_SESSION_ACTIVE != session_status()) { + session_start(); + } + $this->init = true; + } + } + + /** + * session设置 + * @access public + * @param string $name session名称 + * @param mixed $value session值 + * @param string|null $prefix 作用域(前缀) + * @return void + */ + public function set($name, $value, $prefix = null) + { + $this->lock(); + + empty($this->init) && $this->boot(); + + $prefix = !is_null($prefix) ? $prefix : $this->prefix; + + if (strpos($name, '.')) { + // 二维数组赋值 + list($name1, $name2) = explode('.', $name); + if ($prefix) { + $_SESSION[$prefix][$name1][$name2] = $value; + } else { + $_SESSION[$name1][$name2] = $value; + } + } elseif ($prefix) { + $_SESSION[$prefix][$name] = $value; + } else { + $_SESSION[$name] = $value; + } + + $this->unlock(); + } + + /** + * session获取 + * @access public + * @param string $name session名称 + * @param string|null $prefix 作用域(前缀) + * @return mixed + */ + public function get($name = '', $prefix = null) + { + $this->lock(); + + empty($this->init) && $this->boot(); + + $prefix = !is_null($prefix) ? $prefix : $this->prefix; + + $value = $prefix ? (!empty($_SESSION[$prefix]) ? $_SESSION[$prefix] : []) : $_SESSION; + + if ('' != $name) { + $name = explode('.', $name); + + foreach ($name as $val) { + if (isset($value[$val])) { + $value = $value[$val]; + } else { + $value = null; + break; + } + } + } + + $this->unlock(); + + return $value; + } + + /** + * session 读写锁驱动实例化 + */ + protected function initDriver() + { + // 不在 init 方法中实例化lockDriver,是因为 init 方法不一定先于 set 或 get 方法调用 + $config = Container::get('config')->pull('session'); + + if (!empty($config['type']) && isset($config['use_lock']) && $config['use_lock']) { + // 读取session驱动 + $class = false !== strpos($config['type'], '\\') ? $config['type'] : '\\think\\session\\driver\\' . ucwords($config['type']); + + // 检查驱动类及类中是否存在 lock 和 unlock 函数 + if (class_exists($class) && method_exists($class, 'lock') && method_exists($class, 'unlock')) { + $this->lockDriver = new $class($config); + } + } + + // 通过cookie获得session_id + if (isset($config['name']) && $config['name']) { + $this->sessKey = $config['name']; + } + + if (isset($config['lock_timeout']) && $config['lock_timeout'] > 0) { + $this->lockTimeout = $config['lock_timeout']; + } + } + + /** + * session 读写加锁 + * @access protected + * @return void + */ + protected function lock() + { + if (empty($this->lock)) { + return; + } + + $this->initDriver(); + + if (null !== $this->lockDriver && method_exists($this->lockDriver, 'lock')) { + $t = time(); + // 使用 session_id 作为互斥条件,即只对同一 session_id 的会话互斥。第一次请求没有 session_id + $sessID = isset($_COOKIE[$this->sessKey]) ? $_COOKIE[$this->sessKey] : ''; + + do { + if (time() - $t > $this->lockTimeout) { + $this->unlock(); + } + } while (!$this->lockDriver->lock($sessID, $this->lockTimeout)); + } + } + + /** + * session 读写解锁 + * @access protected + * @return void + */ + protected function unlock() + { + if (empty($this->lock)) { + return; + } + + $this->pause(); + + if ($this->lockDriver && method_exists($this->lockDriver, 'unlock')) { + $sessID = isset($_COOKIE[$this->sessKey]) ? $_COOKIE[$this->sessKey] : ''; + $this->lockDriver->unlock($sessID); + } + } + + /** + * session获取并删除 + * @access public + * @param string $name session名称 + * @param string|null $prefix 作用域(前缀) + * @return mixed + */ + public function pull($name, $prefix = null) + { + $result = $this->get($name, $prefix); + + if ($result) { + $this->delete($name, $prefix); + return $result; + } else { + return; + } + } + + /** + * session设置 下一次请求有效 + * @access public + * @param string $name session名称 + * @param mixed $value session值 + * @param string|null $prefix 作用域(前缀) + * @return void + */ + public function flash($name, $value) + { + $this->set($name, $value); + + if (!$this->has('__flash__.__time__')) { + $this->set('__flash__.__time__', $_SERVER['REQUEST_TIME_FLOAT']); + } + + $this->push('__flash__', $name); + } + + /** + * 清空当前请求的session数据 + * @access public + * @return void + */ + public function flush() + { + if (!$this->init) { + return; + } + + $item = $this->get('__flash__'); + + if (!empty($item)) { + $time = $item['__time__']; + + if ($_SERVER['REQUEST_TIME_FLOAT'] > $time) { + unset($item['__time__']); + $this->delete($item); + $this->set('__flash__', []); + } + } + } + + /** + * 删除session数据 + * @access public + * @param string|array $name session名称 + * @param string|null $prefix 作用域(前缀) + * @return void + */ + public function delete($name, $prefix = null) + { + empty($this->init) && $this->boot(); + + $prefix = !is_null($prefix) ? $prefix : $this->prefix; + + if (is_array($name)) { + foreach ($name as $key) { + $this->delete($key, $prefix); + } + } elseif (strpos($name, '.')) { + list($name1, $name2) = explode('.', $name); + if ($prefix) { + unset($_SESSION[$prefix][$name1][$name2]); + } else { + unset($_SESSION[$name1][$name2]); + } + } else { + if ($prefix) { + unset($_SESSION[$prefix][$name]); + } else { + unset($_SESSION[$name]); + } + } + } + + /** + * 清空session数据 + * @access public + * @param string|null $prefix 作用域(前缀) + * @return void + */ + public function clear($prefix = null) + { + empty($this->init) && $this->boot(); + $prefix = !is_null($prefix) ? $prefix : $this->prefix; + + if ($prefix) { + unset($_SESSION[$prefix]); + } else { + $_SESSION = []; + } + } + + /** + * 判断session数据 + * @access public + * @param string $name session名称 + * @param string|null $prefix + * @return bool + */ + public function has($name, $prefix = null) + { + empty($this->init) && $this->boot(); + $prefix = !is_null($prefix) ? $prefix : $this->prefix; + + if (strpos($name, '.')) { + // 支持数组 + list($name1, $name2) = explode('.', $name); + + return $prefix ? isset($_SESSION[$prefix][$name1][$name2]) : isset($_SESSION[$name1][$name2]); + } else { + return $prefix ? isset($_SESSION[$prefix][$name]) : isset($_SESSION[$name]); + } + } + + /** + * 添加数据到一个session数组 + * @access public + * @param string $key + * @param mixed $value + * @return void + */ + public function push($key, $value) + { + $array = $this->get($key); + + if (is_null($array)) { + $array = []; + } + + $array[] = $value; + + $this->set($key, $array); + } + + /** + * 启动session + * @access public + * @return void + */ + public function start() + { + session_start(); + + $this->init = true; + } + + /** + * 销毁session + * @access public + * @return void + */ + public function destroy() + { + if (!empty($_SESSION)) { + $_SESSION = []; + } + + session_unset(); + session_destroy(); + + $this->init = null; + $this->lockDriver = null; + } + + /** + * 重新生成session_id + * @access public + * @param bool $delete 是否删除关联会话文件 + * @return void + */ + public function regenerate($delete = false) + { + session_regenerate_id($delete); + } + + /** + * 暂停session + * @access public + * @return void + */ + public function pause() + { + // 暂停session + session_write_close(); + $this->init = false; + } +} diff --git a/tp5/thinkphp/library/think/Template.php b/tp5/thinkphp/library/think/Template.php new file mode 100644 index 0000000..b97c839 --- /dev/null +++ b/tp5/thinkphp/library/think/Template.php @@ -0,0 +1,1340 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +use think\exception\TemplateNotFoundException; + +/** + * ThinkPHP分离出来的模板引擎 + * 支持XML标签和普通标签的模板解析 + * 编译型模板引擎 支持动态缓存 + */ +class Template +{ + /** + * 模板变量 + * @var array + */ + protected $data = []; + + /** + * 模板配置参数 + * @var array + */ + protected $config = [ + 'view_path' => '', // 模板路径 + 'view_base' => '', + 'view_suffix' => 'html', // 默认模板文件后缀 + 'view_depr' => DIRECTORY_SEPARATOR, + 'cache_suffix' => 'php', // 默认模板缓存后缀 + 'tpl_deny_func_list' => 'echo,exit', // 模板引擎禁用函数 + 'tpl_deny_php' => false, // 默认模板引擎是否禁用PHP原生代码 + 'tpl_begin' => '{', // 模板引擎普通标签开始标记 + 'tpl_end' => '}', // 模板引擎普通标签结束标记 + 'strip_space' => false, // 是否去除模板文件里面的html空格与换行 + 'tpl_cache' => true, // 是否开启模板编译缓存,设为false则每次都会重新编译 + 'compile_type' => 'file', // 模板编译类型 + 'cache_prefix' => '', // 模板缓存前缀标识,可以动态改变 + 'cache_time' => 0, // 模板缓存有效期 0 为永久,(以数字为值,单位:秒) + 'layout_on' => false, // 布局模板开关 + 'layout_name' => 'layout', // 布局模板入口文件 + 'layout_item' => '{__CONTENT__}', // 布局模板的内容替换标识 + 'taglib_begin' => '{', // 标签库标签开始标记 + 'taglib_end' => '}', // 标签库标签结束标记 + 'taglib_load' => true, // 是否使用内置标签库之外的其它标签库,默认自动检测 + 'taglib_build_in' => 'cx', // 内置标签库名称(标签使用不必指定标签库名称),以逗号分隔 注意解析顺序 + 'taglib_pre_load' => '', // 需要额外加载的标签库(须指定标签库名称),多个以逗号分隔 + 'display_cache' => false, // 模板渲染缓存 + 'cache_id' => '', // 模板缓存ID + 'tpl_replace_string' => [], + 'tpl_var_identify' => 'array', // .语法变量识别,array|object|'', 为空时自动识别 + 'default_filter' => 'htmlentities', // 默认过滤方法 用于普通标签输出 + ]; + + /** + * 保留内容信息 + * @var array + */ + private $literal = []; + + /** + * 模板包含信息 + * @var array + */ + private $includeFile = []; + + /** + * 模板存储对象 + * @var object + */ + protected $storage; + + /** + * 架构函数 + * @access public + * @param array $config + */ + public function __construct(array $config = []) + { + $this->config['cache_path'] = Container::get('app')->getRuntimePath() . 'temp/'; + $this->config = array_merge($this->config, $config); + $this->config['taglib_begin_origin'] = $this->config['taglib_begin']; + $this->config['taglib_end_origin'] = $this->config['taglib_end']; + $this->config['taglib_begin'] = $this->stripPreg($this->config['taglib_begin']); + $this->config['taglib_end'] = $this->stripPreg($this->config['taglib_end']); + $this->config['tpl_begin'] = $this->stripPreg($this->config['tpl_begin']); + $this->config['tpl_end'] = $this->stripPreg($this->config['tpl_end']); + + // 初始化模板编译存储器 + $type = $this->config['compile_type'] ? $this->config['compile_type'] : 'File'; + $class = false !== strpos($type, '\\') ? $type : '\\think\\template\\driver\\' . ucwords($type); + $this->storage = new $class(); + } + + /** + * 字符串替换 避免正则混淆 + * @access private + * @param string $str + * @return string + */ + private function stripPreg($str) + { + return str_replace( + ['{', '}', '(', ')', '|', '[', ']', '-', '+', '*', '.', '^', '?'], + ['\{', '\}', '\(', '\)', '\|', '\[', '\]', '\-', '\+', '\*', '\.', '\^', '\?'], + $str); + } + + /** + * 模板变量赋值 + * @access public + * @param mixed $name + * @param mixed $value + * @return void + */ + public function assign($name, $value = '') + { + if (is_array($name)) { + $this->data = array_merge($this->data, $name); + } else { + $this->data[$name] = $value; + } + } + + /** + * 模板引擎参数赋值 + * @access public + * @param mixed $name + * @param mixed $value + */ + public function __set($name, $value) + { + $this->config[$name] = $value; + } + + /** + * 模板引擎配置项 + * @access public + * @param array|string $config + * @return void|array + */ + public function config($config) + { + if (is_array($config)) { + $this->config = array_merge($this->config, $config); + } elseif (isset($this->config[$config])) { + return $this->config[$config]; + } else { + return; + } + } + + /** + * 模板变量获取 + * @access public + * @param string $name 变量名 + * @return mixed + */ + public function get($name = '') + { + if ('' == $name) { + return $this->data; + } else { + $data = $this->data; + + foreach (explode('.', $name) as $key => $val) { + if (isset($data[$val])) { + $data = $data[$val]; + } else { + $data = null; + break; + } + } + + return $data; + } + } + + /** + * 渲染模板文件 + * @access public + * @param string $template 模板文件 + * @param array $vars 模板变量 + * @param array $config 模板参数 + * @return void + */ + public function fetch($template, $vars = [], $config = []) + { + if ($vars) { + $this->data = $vars; + } + + if ($config) { + $this->config($config); + } + + $cache = Container::get('cache'); + + if (!empty($this->config['cache_id']) && $this->config['display_cache']) { + // 读取渲染缓存 + $cacheContent = $cache->get($this->config['cache_id']); + + if (false !== $cacheContent) { + echo $cacheContent; + return; + } + } + + $template = $this->parseTemplateFile($template); + + if ($template) { + $cacheFile = $this->config['cache_path'] . $this->config['cache_prefix'] . md5($this->config['layout_name'] . $template) . '.' . ltrim($this->config['cache_suffix'], '.'); + + if (!$this->checkCache($cacheFile)) { + // 缓存无效 重新模板编译 + $content = file_get_contents($template); + $this->compiler($content, $cacheFile); + } + + // 页面缓存 + ob_start(); + ob_implicit_flush(0); + + // 读取编译存储 + $this->storage->read($cacheFile, $this->data); + + // 获取并清空缓存 + $content = ob_get_clean(); + + if (!empty($this->config['cache_id']) && $this->config['display_cache']) { + // 缓存页面输出 + $cache->set($this->config['cache_id'], $content, $this->config['cache_time']); + } + + echo $content; + } + } + + /** + * 渲染模板内容 + * @access public + * @param string $content 模板内容 + * @param array $vars 模板变量 + * @param array $config 模板参数 + * @return void + */ + public function display($content, $vars = [], $config = []) + { + if ($vars) { + $this->data = $vars; + } + + if ($config) { + $this->config($config); + } + + $cacheFile = $this->config['cache_path'] . $this->config['cache_prefix'] . md5($content) . '.' . ltrim($this->config['cache_suffix'], '.'); + + if (!$this->checkCache($cacheFile)) { + // 缓存无效 模板编译 + $this->compiler($content, $cacheFile); + } + + // 读取编译存储 + $this->storage->read($cacheFile, $this->data); + } + + /** + * 设置布局 + * @access public + * @param mixed $name 布局模板名称 false 则关闭布局 + * @param string $replace 布局模板内容替换标识 + * @return object + */ + public function layout($name, $replace = '') + { + if (false === $name) { + // 关闭布局 + $this->config['layout_on'] = false; + } else { + // 开启布局 + $this->config['layout_on'] = true; + + // 名称必须为字符串 + if (is_string($name)) { + $this->config['layout_name'] = $name; + } + + if (!empty($replace)) { + $this->config['layout_item'] = $replace; + } + } + + return $this; + } + + /** + * 检查编译缓存是否有效 + * 如果无效则需要重新编译 + * @access private + * @param string $cacheFile 缓存文件名 + * @return boolean + */ + private function checkCache($cacheFile) + { + // 未开启缓存功能 + if (!$this->config['tpl_cache']) { + return false; + } + + // 缓存文件不存在 + if (!is_file($cacheFile)) { + return false; + } + + // 读取缓存文件失败 + if (!$handle = @fopen($cacheFile, "r")) { + return false; + } + + // 读取第一行 + preg_match('/\/\*(.+?)\*\//', fgets($handle), $matches); + + if (!isset($matches[1])) { + return false; + } + + $includeFile = unserialize($matches[1]); + + if (!is_array($includeFile)) { + return false; + } + + // 检查模板文件是否有更新 + foreach ($includeFile as $path => $time) { + if (is_file($path) && filemtime($path) > $time) { + // 模板文件如果有更新则缓存需要更新 + return false; + } + } + + // 检查编译存储是否有效 + return $this->storage->check($cacheFile, $this->config['cache_time']); + } + + /** + * 检查编译缓存是否存在 + * @access public + * @param string $cacheId 缓存的id + * @return boolean + */ + public function isCache($cacheId) + { + if ($cacheId && $this->config['display_cache']) { + // 缓存页面输出 + return Container::get('cache')->has($cacheId); + } + + return false; + } + + /** + * 编译模板文件内容 + * @access private + * @param string $content 模板内容 + * @param string $cacheFile 缓存文件名 + * @return void + */ + private function compiler(&$content, $cacheFile) + { + // 判断是否启用布局 + if ($this->config['layout_on']) { + if (false !== strpos($content, '{__NOLAYOUT__}')) { + // 可以单独定义不使用布局 + $content = str_replace('{__NOLAYOUT__}', '', $content); + } else { + // 读取布局模板 + $layoutFile = $this->parseTemplateFile($this->config['layout_name']); + + if ($layoutFile) { + // 替换布局的主体内容 + $content = str_replace($this->config['layout_item'], $content, file_get_contents($layoutFile)); + } + } + } else { + $content = str_replace('{__NOLAYOUT__}', '', $content); + } + + // 模板解析 + $this->parse($content); + + if ($this->config['strip_space']) { + /* 去除html空格与换行 */ + $find = ['~>\s+<~', '~>(\s+\n|\r)~']; + $replace = ['><', '>']; + $content = preg_replace($find, $replace, $content); + } + + // 优化生成的php代码 + $content = preg_replace('/\?>\s*<\?php\s(?!echo\b)/s', '', $content); + + // 模板过滤输出 + $replace = $this->config['tpl_replace_string']; + $content = str_replace(array_keys($replace), array_values($replace), $content); + + // 添加安全代码及模板引用记录 + $content = 'includeFile) . '*/ ?>' . "\n" . $content; + // 编译存储 + $this->storage->write($cacheFile, $content); + + $this->includeFile = []; + + return; + } + + /** + * 模板解析入口 + * 支持普通标签和TagLib解析 支持自定义标签库 + * @access public + * @param string $content 要解析的模板内容 + * @return void + */ + public function parse(&$content) + { + // 内容为空不解析 + if (empty($content)) { + return; + } + + // 替换literal标签内容 + $this->parseLiteral($content); + + // 解析继承 + $this->parseExtend($content); + + // 解析布局 + $this->parseLayout($content); + + // 检查include语法 + $this->parseInclude($content); + + // 替换包含文件中literal标签内容 + $this->parseLiteral($content); + + // 检查PHP语法 + $this->parsePhp($content); + + // 获取需要引入的标签库列表 + // 标签库只需要定义一次,允许引入多个一次 + // 一般放在文件的最前面 + // 格式: + // 当TAGLIB_LOAD配置为true时才会进行检测 + if ($this->config['taglib_load']) { + $tagLibs = $this->getIncludeTagLib($content); + + if (!empty($tagLibs)) { + // 对导入的TagLib进行解析 + foreach ($tagLibs as $tagLibName) { + $this->parseTagLib($tagLibName, $content); + } + } + } + + // 预先加载的标签库 无需在每个模板中使用taglib标签加载 但必须使用标签库XML前缀 + if ($this->config['taglib_pre_load']) { + $tagLibs = explode(',', $this->config['taglib_pre_load']); + + foreach ($tagLibs as $tag) { + $this->parseTagLib($tag, $content); + } + } + + // 内置标签库 无需使用taglib标签导入就可以使用 并且不需使用标签库XML前缀 + $tagLibs = explode(',', $this->config['taglib_build_in']); + + foreach ($tagLibs as $tag) { + $this->parseTagLib($tag, $content, true); + } + + // 解析普通模板标签 {$tagName} + $this->parseTag($content); + + // 还原被替换的Literal标签 + $this->parseLiteral($content, true); + + return; + } + + /** + * 检查PHP语法 + * @access private + * @param string $content 要解析的模板内容 + * @return void + * @throws \think\Exception + */ + private function parsePhp(&$content) + { + // 短标签的情况要将' . "\n", $content); + + // PHP语法检查 + if ($this->config['tpl_deny_php'] && false !== strpos($content, 'getRegex('layout'), $content, $matches)) { + // 替换Layout标签 + $content = str_replace($matches[0], '', $content); + // 解析Layout标签 + $array = $this->parseAttr($matches[0]); + + if (!$this->config['layout_on'] || $this->config['layout_name'] != $array['name']) { + // 读取布局模板 + $layoutFile = $this->parseTemplateFile($array['name']); + + if ($layoutFile) { + $replace = isset($array['replace']) ? $array['replace'] : $this->config['layout_item']; + // 替换布局的主体内容 + $content = str_replace($replace, $content, file_get_contents($layoutFile)); + } + } + } else { + $content = str_replace('{__NOLAYOUT__}', '', $content); + } + + return; + } + + /** + * 解析模板中的include标签 + * @access private + * @param string $content 要解析的模板内容 + * @return void + */ + private function parseInclude(&$content) + { + $regex = $this->getRegex('include'); + $func = function ($template) use (&$func, &$regex, &$content) { + if (preg_match_all($regex, $template, $matches, PREG_SET_ORDER)) { + foreach ($matches as $match) { + $array = $this->parseAttr($match[0]); + $file = $array['file']; + unset($array['file']); + + // 分析模板文件名并读取内容 + $parseStr = $this->parseTemplateName($file); + + foreach ($array as $k => $v) { + // 以$开头字符串转换成模板变量 + if (0 === strpos($v, '$')) { + $v = $this->get(substr($v, 1)); + } + + $parseStr = str_replace('[' . $k . ']', $v, $parseStr); + } + + $content = str_replace($match[0], $parseStr, $content); + // 再次对包含文件进行模板分析 + $func($parseStr); + } + unset($matches); + } + }; + + // 替换模板中的include标签 + $func($content); + } + + /** + * 解析模板中的extend标签 + * @access private + * @param string $content 要解析的模板内容 + * @return void + */ + private function parseExtend(&$content) + { + $regex = $this->getRegex('extend'); + $array = $blocks = $baseBlocks = []; + $extend = ''; + + $func = function ($template) use (&$func, &$regex, &$array, &$extend, &$blocks, &$baseBlocks) { + if (preg_match($regex, $template, $matches)) { + if (!isset($array[$matches['name']])) { + $array[$matches['name']] = 1; + // 读取继承模板 + $extend = $this->parseTemplateName($matches['name']); + + // 递归检查继承 + $func($extend); + + // 取得block标签内容 + $blocks = array_merge($blocks, $this->parseBlock($template)); + + return; + } + } else { + // 取得顶层模板block标签内容 + $baseBlocks = $this->parseBlock($template, true); + + if (empty($extend)) { + // 无extend标签但有block标签的情况 + $extend = $template; + } + } + }; + + $func($content); + + if (!empty($extend)) { + if ($baseBlocks) { + $children = []; + foreach ($baseBlocks as $name => $val) { + $replace = $val['content']; + + if (!empty($children[$name])) { + // 如果包含有子block标签 + foreach ($children[$name] as $key) { + $replace = str_replace($baseBlocks[$key]['begin'] . $baseBlocks[$key]['content'] . $baseBlocks[$key]['end'], $blocks[$key]['content'], $replace); + } + } + + if (isset($blocks[$name])) { + // 带有{__block__}表示与所继承模板的相应标签合并,而不是覆盖 + $replace = str_replace(['{__BLOCK__}', '{__block__}'], $replace, $blocks[$name]['content']); + + if (!empty($val['parent'])) { + // 如果不是最顶层的block标签 + $parent = $val['parent']; + + if (isset($blocks[$parent])) { + $blocks[$parent]['content'] = str_replace($blocks[$name]['begin'] . $blocks[$name]['content'] . $blocks[$name]['end'], $replace, $blocks[$parent]['content']); + } + + $blocks[$name]['content'] = $replace; + $children[$parent][] = $name; + + continue; + } + } elseif (!empty($val['parent'])) { + // 如果子标签没有被继承则用原值 + $children[$val['parent']][] = $name; + $blocks[$name] = $val; + } + + if (!$val['parent']) { + // 替换模板中的顶级block标签 + $extend = str_replace($val['begin'] . $val['content'] . $val['end'], $replace, $extend); + } + } + } + + $content = $extend; + unset($blocks, $baseBlocks); + } + } + + /** + * 替换页面中的literal标签 + * @access private + * @param string $content 模板内容 + * @param boolean $restore 是否为还原 + * @return void + */ + private function parseLiteral(&$content, $restore = false) + { + $regex = $this->getRegex($restore ? 'restoreliteral' : 'literal'); + + if (preg_match_all($regex, $content, $matches, PREG_SET_ORDER)) { + if (!$restore) { + $count = count($this->literal); + + // 替换literal标签 + foreach ($matches as $match) { + $this->literal[] = substr($match[0], strlen($match[1]), -strlen($match[2])); + $content = str_replace($match[0], "", $content); + $count++; + } + } else { + // 还原literal标签 + foreach ($matches as $match) { + $content = str_replace($match[0], $this->literal[$match[1]], $content); + } + + // 清空literal记录 + $this->literal = []; + } + + unset($matches); + } + } + + /** + * 获取模板中的block标签 + * @access private + * @param string $content 模板内容 + * @param boolean $sort 是否排序 + * @return array + */ + private function parseBlock(&$content, $sort = false) + { + $regex = $this->getRegex('block'); + $result = []; + + if (preg_match_all($regex, $content, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { + $right = $keys = []; + + foreach ($matches as $match) { + if (empty($match['name'][0])) { + if (count($right) > 0) { + $tag = array_pop($right); + $start = $tag['offset'] + strlen($tag['tag']); + $length = $match[0][1] - $start; + + $result[$tag['name']] = [ + 'begin' => $tag['tag'], + 'content' => substr($content, $start, $length), + 'end' => $match[0][0], + 'parent' => count($right) ? end($right)['name'] : '', + ]; + + $keys[$tag['name']] = $match[0][1]; + } + } else { + // 标签头压入栈 + $right[] = [ + 'name' => $match[2][0], + 'offset' => $match[0][1], + 'tag' => $match[0][0], + ]; + } + } + + unset($right, $matches); + + if ($sort) { + // 按block标签结束符在模板中的位置排序 + array_multisort($keys, $result); + } + } + + return $result; + } + + /** + * 搜索模板页面中包含的TagLib库 + * 并返回列表 + * @access private + * @param string $content 模板内容 + * @return array|null + */ + private function getIncludeTagLib(&$content) + { + // 搜索是否有TagLib标签 + if (preg_match($this->getRegex('taglib'), $content, $matches)) { + // 替换TagLib标签 + $content = str_replace($matches[0], '', $content); + + return explode(',', $matches['name']); + } + + return; + } + + /** + * TagLib库解析 + * @access public + * @param string $tagLib 要解析的标签库 + * @param string $content 要解析的模板内容 + * @param boolean $hide 是否隐藏标签库前缀 + * @return void + */ + public function parseTagLib($tagLib, &$content, $hide = false) + { + if (false !== strpos($tagLib, '\\')) { + // 支持指定标签库的命名空间 + $className = $tagLib; + $tagLib = substr($tagLib, strrpos($tagLib, '\\') + 1); + } else { + $className = '\\think\\template\\taglib\\' . ucwords($tagLib); + } + + $tLib = new $className($this); + + $tLib->parseTag($content, $hide ? '' : $tagLib); + + return; + } + + /** + * 分析标签属性 + * @access public + * @param string $str 属性字符串 + * @param string $name 不为空时返回指定的属性名 + * @return array + */ + public function parseAttr($str, $name = null) + { + $regex = '/\s+(?>(?P[\w-]+)\s*)=(?>\s*)([\"\'])(?P(?:(?!\\2).)*)\\2/is'; + $array = []; + + if (preg_match_all($regex, $str, $matches, PREG_SET_ORDER)) { + foreach ($matches as $match) { + $array[$match['name']] = $match['value']; + } + unset($matches); + } + + if (!empty($name) && isset($array[$name])) { + return $array[$name]; + } else { + return $array; + } + } + + /** + * 模板标签解析 + * 格式: {TagName:args [|content] } + * @access private + * @param string $content 要解析的模板内容 + * @return void + */ + private function parseTag(&$content) + { + $regex = $this->getRegex('tag'); + + if (preg_match_all($regex, $content, $matches, PREG_SET_ORDER)) { + foreach ($matches as $match) { + $str = stripslashes($match[1]); + $flag = substr($str, 0, 1); + + switch ($flag) { + case '$': + // 解析模板变量 格式 {$varName} + // 是否带有?号 + if (false !== $pos = strpos($str, '?')) { + $array = preg_split('/([!=]={1,2}|(?<]={0,1})/', substr($str, 0, $pos), 2, PREG_SPLIT_DELIM_CAPTURE); + $name = $array[0]; + + $this->parseVar($name); + //$this->parseVarFunction($name); + + $str = trim(substr($str, $pos + 1)); + $this->parseVar($str); + $first = substr($str, 0, 1); + + if (strpos($name, ')')) { + // $name为对象或是自动识别,或者含有函数 + if (isset($array[1])) { + $this->parseVar($array[2]); + $name .= $array[1] . $array[2]; + } + + switch ($first) { + case '?': + $this->parseVarFunction($name); + $str = ''; + break; + case '=': + $str = ''; + break; + default: + $str = ''; + } + } else { + if (isset($array[1])) { + $express = true; + $this->parseVar($array[2]); + $express = $name . $array[1] . $array[2]; + } else { + $express = false; + } + + if (in_array($first, ['?', '=', ':'])) { + $str = trim(substr($str, 1)); + if ('$' == substr($str, 0, 1)) { + $str = $this->parseVarFunction($str); + } + } + + // $name为数组 + switch ($first) { + case '?': + // {$varname??'xxx'} $varname有定义则输出$varname,否则输出xxx + $str = 'parseVarFunction($name) . ' : ' . $str . '; ?>'; + break; + case '=': + // {$varname?='xxx'} $varname为真时才输出xxx + $str = ''; + break; + case ':': + // {$varname?:'xxx'} $varname为真时输出$varname,否则输出xxx + $str = 'parseVarFunction($name) . ' : ' . $str . '; ?>'; + break; + default: + if (strpos($str, ':')) { + // {$varname ? 'a' : 'b'} $varname为真时输出a,否则输出b + $array = explode(':', $str, 2); + + $array[0] = '$' == substr(trim($array[0]), 0, 1) ? $this->parseVarFunction($array[0]) : $array[0]; + $array[1] = '$' == substr(trim($array[1]), 0, 1) ? $this->parseVarFunction($array[1]) : $array[1]; + + $str = implode(' : ', $array); + } + $str = ''; + } + } + } else { + $this->parseVar($str); + $this->parseVarFunction($str); + $str = ''; + } + break; + case ':': + // 输出某个函数的结果 + $str = substr($str, 1); + $this->parseVar($str); + $str = ''; + break; + case '~': + // 执行某个函数 + $str = substr($str, 1); + $this->parseVar($str); + $str = ''; + break; + case '-': + case '+': + // 输出计算 + $this->parseVar($str); + $str = ''; + break; + case '/': + // 注释标签 + $flag2 = substr($str, 1, 1); + if ('/' == $flag2 || ('*' == $flag2 && substr(rtrim($str), -2) == '*/')) { + $str = ''; + } + break; + default: + // 未识别的标签直接返回 + $str = $this->config['tpl_begin'] . $str . $this->config['tpl_end']; + break; + } + + $content = str_replace($match[0], $str, $content); + } + + unset($matches); + } + } + + /** + * 模板变量解析,支持使用函数 + * 格式: {$varname|function1|function2=arg1,arg2} + * @access public + * @param string $varStr 变量数据 + * @return void + */ + public function parseVar(&$varStr) + { + $varStr = trim($varStr); + + if (preg_match_all('/\$[a-zA-Z_](?>\w*)(?:[:\.][0-9a-zA-Z_](?>\w*))+/', $varStr, $matches, PREG_OFFSET_CAPTURE)) { + static $_varParseList = []; + + while ($matches[0]) { + $match = array_pop($matches[0]); + + //如果已经解析过该变量字串,则直接返回变量值 + if (isset($_varParseList[$match[0]])) { + $parseStr = $_varParseList[$match[0]]; + } else { + if (strpos($match[0], '.')) { + $vars = explode('.', $match[0]); + $first = array_shift($vars); + + if ('$Think' == $first) { + // 所有以Think.打头的以特殊变量对待 无需模板赋值就可以输出 + $parseStr = $this->parseThinkVar($vars); + } elseif ('$Request' == $first) { + // 获取Request请求对象参数 + $method = array_shift($vars); + if (!empty($vars)) { + $params = implode('.', $vars); + if ('true' != $params) { + $params = '\'' . $params . '\''; + } + } else { + $params = ''; + } + + $parseStr = 'app(\'request\')->' . $method . '(' . $params . ')'; + } else { + switch ($this->config['tpl_var_identify']) { + case 'array': // 识别为数组 + $parseStr = $first . '[\'' . implode('\'][\'', $vars) . '\']'; + break; + case 'obj': // 识别为对象 + $parseStr = $first . '->' . implode('->', $vars); + break; + default: // 自动判断数组或对象 + $parseStr = '(is_array(' . $first . ')?' . $first . '[\'' . implode('\'][\'', $vars) . '\']:' . $first . '->' . implode('->', $vars) . ')'; + } + } + } else { + $parseStr = str_replace(':', '->', $match[0]); + } + + $_varParseList[$match[0]] = $parseStr; + } + + $varStr = substr_replace($varStr, $parseStr, $match[1], strlen($match[0])); + } + unset($matches); + } + } + + /** + * 对模板中使用了函数的变量进行解析 + * 格式 {$varname|function1|function2=arg1,arg2} + * @access public + * @param string $varStr 变量字符串 + * @param bool $autoescape 自动转义 + * @return void + */ + public function parseVarFunction(&$varStr, $autoescape = true) + { + if (!$autoescape && false === strpos($varStr, '|')) { + return $varStr; + } elseif ($autoescape && !preg_match('/\|(\s)?raw(\||\s)?/i', $varStr)) { + $varStr .= '|' . $this->config['default_filter']; + } + + static $_varFunctionList = []; + + $_key = md5($varStr); + + //如果已经解析过该变量字串,则直接返回变量值 + if (isset($_varFunctionList[$_key])) { + $varStr = $_varFunctionList[$_key]; + } else { + $varArray = explode('|', $varStr); + + // 取得变量名称 + $name = trim(array_shift($varArray)); + + // 对变量使用函数 + $length = count($varArray); + + // 取得模板禁止使用函数列表 + $template_deny_funs = explode(',', $this->config['tpl_deny_func_list']); + + for ($i = 0; $i < $length; $i++) { + $args = explode('=', $varArray[$i], 2); + + // 模板函数过滤 + $fun = trim($args[0]); + if (in_array($fun, $template_deny_funs)) { + continue; + } + + switch (strtolower($fun)) { + case 'raw': + continue; + case 'date': + $name = 'date(' . $args[1] . ',!is_numeric(' . $name . ')? strtotime(' . $name . ') : ' . $name . ')'; + break; + case 'first': + $name = 'current(' . $name . ')'; + break; + case 'last': + $name = 'end(' . $name . ')'; + break; + case 'upper': + $name = 'strtoupper(' . $name . ')'; + break; + case 'lower': + $name = 'strtolower(' . $name . ')'; + break; + case 'format': + $name = 'sprintf(' . $args[1] . ',' . $name . ')'; + break; + case 'default': // 特殊模板函数 + if (false === strpos($name, '(')) { + $name = '(isset(' . $name . ') && (' . $name . ' !== \'\')?' . $name . ':' . $args[1] . ')'; + } else { + $name = '(' . $name . ' ?: ' . $args[1] . ')'; + } + break; + default: // 通用模板函数 + if (isset($args[1])) { + if (strstr($args[1], '###')) { + $args[1] = str_replace('###', $name, $args[1]); + $name = "$fun($args[1])"; + } else { + $name = "$fun($name,$args[1])"; + } + } else { + if (!empty($args[0])) { + $name = "$fun($name)"; + } + } + } + } + + $_varFunctionList[$_key] = $name; + $varStr = $name; + } + return $varStr; + } + + /** + * 特殊模板变量解析 + * 格式 以 $Think. 打头的变量属于特殊模板变量 + * @access public + * @param array $vars 变量数组 + * @return string + */ + public function parseThinkVar($vars) + { + $type = strtoupper(trim(array_shift($vars))); + $param = implode('.', $vars); + + if ($vars) { + switch ($type) { + case 'SERVER': + $parseStr = 'app(\'request\')->server(\'' . $param . '\')'; + break; + case 'GET': + $parseStr = 'app(\'request\')->get(\'' . $param . '\')'; + break; + case 'POST': + $parseStr = 'app(\'request\')->post(\'' . $param . '\')'; + break; + case 'COOKIE': + $parseStr = 'app(\'cookie\')->get(\'' . $param . '\')'; + break; + case 'SESSION': + $parseStr = 'app(\'session\')->get(\'' . $param . '\')'; + break; + case 'ENV': + $parseStr = 'app(\'request\')->env(\'' . $param . '\')'; + break; + case 'REQUEST': + $parseStr = 'app(\'request\')->request(\'' . $param . '\')'; + break; + case 'CONST': + $parseStr = strtoupper($param); + break; + case 'LANG': + $parseStr = 'app(\'lang\')->get(\'' . $param . '\')'; + break; + case 'CONFIG': + $parseStr = 'app(\'config\')->get(\'' . $param . '\')'; + break; + default: + $parseStr = '\'\''; + break; + } + } else { + switch ($type) { + case 'NOW': + $parseStr = "date('Y-m-d g:i a',time())"; + break; + case 'VERSION': + $parseStr = 'app()->version()'; + break; + case 'LDELIM': + $parseStr = '\'' . ltrim($this->config['tpl_begin'], '\\') . '\''; + break; + case 'RDELIM': + $parseStr = '\'' . ltrim($this->config['tpl_end'], '\\') . '\''; + break; + default: + if (defined($type)) { + $parseStr = $type; + } else { + $parseStr = ''; + } + } + } + + return $parseStr; + } + + /** + * 分析加载的模板文件并读取内容 支持多个模板文件读取 + * @access private + * @param string $templateName 模板文件名 + * @return string + */ + private function parseTemplateName($templateName) + { + $array = explode(',', $templateName); + $parseStr = ''; + + foreach ($array as $templateName) { + if (empty($templateName)) { + continue; + } + + if (0 === strpos($templateName, '$')) { + //支持加载变量文件名 + $templateName = $this->get(substr($templateName, 1)); + } + + $template = $this->parseTemplateFile($templateName); + + if ($template) { + // 获取模板文件内容 + $parseStr .= file_get_contents($template); + } + } + + return $parseStr; + } + + /** + * 解析模板文件名 + * @access private + * @param string $template 文件名 + * @return string|false + */ + private function parseTemplateFile($template) + { + if ('' == pathinfo($template, PATHINFO_EXTENSION)) { + if (strpos($template, '@')) { + list($module, $template) = explode('@', $template); + } + + if (0 !== strpos($template, '/')) { + $template = str_replace(['/', ':'], $this->config['view_depr'], $template); + } else { + $template = str_replace(['/', ':'], $this->config['view_depr'], substr($template, 1)); + } + + if ($this->config['view_base']) { + $module = isset($module) ? $module : Container::get('request')->module(); + $path = $this->config['view_base'] . ($module ? $module . DIRECTORY_SEPARATOR : ''); + } else { + $path = isset($module) ? Container::get('app')->getAppPath() . $module . DIRECTORY_SEPARATOR . basename($this->config['view_path']) . DIRECTORY_SEPARATOR : $this->config['view_path']; + } + + $template = $path . $template . '.' . ltrim($this->config['view_suffix'], '.'); + } + + if (is_file($template)) { + // 记录模板文件的更新时间 + $this->includeFile[$template] = filemtime($template); + + return $template; + } else { + throw new TemplateNotFoundException('template not exists:' . $template, $template); + } + } + + /** + * 按标签生成正则 + * @access private + * @param string $tagName 标签名 + * @return string + */ + private function getRegex($tagName) + { + $regex = ''; + if ('tag' == $tagName) { + $begin = $this->config['tpl_begin']; + $end = $this->config['tpl_end']; + + if (strlen(ltrim($begin, '\\')) == 1 && strlen(ltrim($end, '\\')) == 1) { + $regex = $begin . '((?:[\$]{1,2}[a-wA-w_]|[\:\~][\$a-wA-w_]|[+]{2}[\$][a-wA-w_]|[-]{2}[\$][a-wA-w_]|\/[\*\/])(?>[^' . $end . ']*))' . $end; + } else { + $regex = $begin . '((?:[\$]{1,2}[a-wA-w_]|[\:\~][\$a-wA-w_]|[+]{2}[\$][a-wA-w_]|[-]{2}[\$][a-wA-w_]|\/[\*\/])(?>(?:(?!' . $end . ').)*))' . $end; + } + } else { + $begin = $this->config['taglib_begin']; + $end = $this->config['taglib_end']; + $single = strlen(ltrim($begin, '\\')) == 1 && strlen(ltrim($end, '\\')) == 1 ? true : false; + + switch ($tagName) { + case 'block': + if ($single) { + $regex = $begin . '(?:' . $tagName . '\b(?>(?:(?!name=).)*)\bname=([\'\"])(?P[\$\w\-\/\.]+)\\1(?>[^' . $end . ']*)|\/' . $tagName . ')' . $end; + } else { + $regex = $begin . '(?:' . $tagName . '\b(?>(?:(?!name=).)*)\bname=([\'\"])(?P[\$\w\-\/\.]+)\\1(?>(?:(?!' . $end . ').)*)|\/' . $tagName . ')' . $end; + } + break; + case 'literal': + if ($single) { + $regex = '(' . $begin . $tagName . '\b(?>[^' . $end . ']*)' . $end . ')'; + $regex .= '(?:(?>[^' . $begin . ']*)(?>(?!' . $begin . '(?>' . $tagName . '\b[^' . $end . ']*|\/' . $tagName . ')' . $end . ')' . $begin . '[^' . $begin . ']*)*)'; + $regex .= '(' . $begin . '\/' . $tagName . $end . ')'; + } else { + $regex = '(' . $begin . $tagName . '\b(?>(?:(?!' . $end . ').)*)' . $end . ')'; + $regex .= '(?:(?>(?:(?!' . $begin . ').)*)(?>(?!' . $begin . '(?>' . $tagName . '\b(?>(?:(?!' . $end . ').)*)|\/' . $tagName . ')' . $end . ')' . $begin . '(?>(?:(?!' . $begin . ').)*))*)'; + $regex .= '(' . $begin . '\/' . $tagName . $end . ')'; + } + break; + case 'restoreliteral': + $regex = ''; + break; + case 'include': + $name = 'file'; + case 'taglib': + case 'layout': + case 'extend': + if (empty($name)) { + $name = 'name'; + } + if ($single) { + $regex = $begin . $tagName . '\b(?>(?:(?!' . $name . '=).)*)\b' . $name . '=([\'\"])(?P[\$\w\-\/\.\:@,\\\\]+)\\1(?>[^' . $end . ']*)' . $end; + } else { + $regex = $begin . $tagName . '\b(?>(?:(?!' . $name . '=).)*)\b' . $name . '=([\'\"])(?P[\$\w\-\/\.\:@,\\\\]+)\\1(?>(?:(?!' . $end . ').)*)' . $end; + } + break; + } + } + + return '/' . $regex . '/is'; + } +} diff --git a/tp5/thinkphp/library/think/Url.php b/tp5/thinkphp/library/think/Url.php new file mode 100644 index 0000000..e7cf75d --- /dev/null +++ b/tp5/thinkphp/library/think/Url.php @@ -0,0 +1,356 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +class Url +{ + /** + * ROOT地址 + * @var string + */ + protected $root; + + /** + * 绑定检查 + * @var bool + */ + protected $bindCheck; + + /** + * 应用对象 + * @var App + */ + protected $app; + + public function __construct(App $app) + { + $this->app = $app; + + if (is_file($app->getRuntimePath() . 'route.php')) { + // 读取路由映射文件 + $app['route']->setName(include $app->getRuntimePath() . 'route.php'); + } + } + + /** + * URL生成 支持路由反射 + * @access public + * @param string $url 路由地址 + * @param string|array $vars 参数(支持数组和字符串)a=val&b=val2... ['a'=>'val1', 'b'=>'val2'] + * @param string|bool $suffix 伪静态后缀,默认为true表示获取配置值 + * @param boolean|string $domain 是否显示域名 或者直接传入域名 + * @return string + */ + public function build($url = '', $vars = '', $suffix = true, $domain = false) + { + // 解析URL + if (0 === strpos($url, '[') && $pos = strpos($url, ']')) { + // [name] 表示使用路由命名标识生成URL + $name = substr($url, 1, $pos - 1); + $url = 'name' . substr($url, $pos + 1); + } + + if (false === strpos($url, '://') && 0 !== strpos($url, '/')) { + $info = parse_url($url); + $url = !empty($info['path']) ? $info['path'] : ''; + + if (isset($info['fragment'])) { + // 解析锚点 + $anchor = $info['fragment']; + + if (false !== strpos($anchor, '?')) { + // 解析参数 + list($anchor, $info['query']) = explode('?', $anchor, 2); + } + + if (false !== strpos($anchor, '@')) { + // 解析域名 + list($anchor, $domain) = explode('@', $anchor, 2); + } + } elseif (strpos($url, '@') && false === strpos($url, '\\')) { + // 解析域名 + list($url, $domain) = explode('@', $url, 2); + } + } + + // 解析参数 + if (is_string($vars)) { + // aaa=1&bbb=2 转换成数组 + parse_str($vars, $vars); + } + + if ($url) { + $rule = $this->app['route']->getName(isset($name) ? $name : $url . (isset($info['query']) ? '?' . $info['query'] : '')); + + if (is_null($rule) && isset($info['query'])) { + $rule = $this->app['route']->getName($url); + // 解析地址里面参数 合并到vars + parse_str($info['query'], $params); + $vars = array_merge($params, $vars); + unset($info['query']); + } + } + + if (!empty($rule) && $match = $this->getRuleUrl($rule, $vars)) { + // 匹配路由命名标识 + $url = $match[0]; + + if (!empty($match[1])) { + $host = $this->app['config']->get('app_host') ?: $this->app['request']->host(); + if ($domain || $match[1] != $host) { + $domain = $match[1]; + } + } + + if (!is_null($match[2])) { + $suffix = $match[2]; + } + } elseif (!empty($rule) && isset($name)) { + throw new \InvalidArgumentException('route name not exists:' . $name); + } else { + // 检查别名路由 + $alias = $this->app['route']->getAlias(); + $matchAlias = false; + + if ($alias) { + // 别名路由解析 + foreach ($alias as $key => $val) { + if (is_array($val)) { + $val = $val[0]; + } + + if (0 === strpos($url, $val)) { + $url = $key . substr($url, strlen($val)); + $matchAlias = true; + break; + } + } + } + + if (!$matchAlias) { + // 路由标识不存在 直接解析 + $url = $this->parseUrl($url); + } + + if (isset($info['query'])) { + // 解析地址里面参数 合并到vars + parse_str($info['query'], $params); + $vars = array_merge($params, $vars); + } + } + + // 检测URL绑定 + if (!$this->bindCheck) { + $bind = $this->app['route']->getBind(); + + if ($bind && 0 === strpos($url, $bind)) { + $url = substr($url, strlen($bind) + 1); + } + + } + // 还原URL分隔符 + $depr = $this->app['config']->get('pathinfo_depr'); + $url = str_replace('/', $depr, $url); + + // URL后缀 + if ('/' == substr($url, -1) || '' == $url) { + $suffix = ''; + } else { + $suffix = $this->parseSuffix($suffix); + } + + // 锚点 + $anchor = !empty($anchor) ? '#' . $anchor : ''; + + // 参数组装 + if (!empty($vars)) { + // 添加参数 + if ($this->app['config']->get('url_common_param')) { + $vars = http_build_query($vars); + $url .= $suffix . '?' . $vars . $anchor; + } else { + $paramType = $this->app['config']->get('url_param_type'); + + foreach ($vars as $var => $val) { + if ('' !== trim($val)) { + if ($paramType) { + $url .= $depr . urlencode($val); + } else { + $url .= $depr . $var . $depr . urlencode($val); + } + } + } + + $url .= $suffix . $anchor; + } + } else { + $url .= $suffix . $anchor; + } + + // 检测域名 + $domain = $this->parseDomain($url, $domain); + + // URL组装 + $url = $domain . rtrim($this->root ?: $this->app['request']->root(), '/') . '/' . ltrim($url, '/'); + + $this->bindCheck = false; + + return $url; + } + + // 直接解析URL地址 + protected function parseUrl($url) + { + $request = $this->app['request']; + + if (0 === strpos($url, '/')) { + // 直接作为路由地址解析 + $url = substr($url, 1); + } elseif (false !== strpos($url, '\\')) { + // 解析到类 + $url = ltrim(str_replace('\\', '/', $url), '/'); + } elseif (0 === strpos($url, '@')) { + // 解析到控制器 + $url = substr($url, 1); + } else { + // 解析到 模块/控制器/操作 + $module = $request->module(); + $module = $module ? $module . '/' : ''; + $controller = $request->controller(); + + if ('' == $url) { + $action = $request->action(); + } else { + $path = explode('/', $url); + $action = array_pop($path); + $controller = empty($path) ? $controller : array_pop($path); + $module = empty($path) ? $module : array_pop($path) . '/'; + } + + if ($this->app['config']->get('url_convert')) { + $action = strtolower($action); + $controller = Loader::parseName($controller); + } + + $url = $module . $controller . '/' . $action; + } + + return $url; + } + + // 检测域名 + protected function parseDomain(&$url, $domain) + { + if (!$domain) { + return ''; + } + + if (true === $domain) { + + // 自动判断域名 + $domain = $this->app['config']->get('app_host') ?: $this->app['request']->host(); + $rootDomain = $this->app['config']->get('url_domain_root'); + + $domains = $this->app['route']->getDomains(); + + if ($domains) { + $route_domain = array_keys($domains); + foreach ($route_domain as $domain_prefix) { + if (0 === strpos($domain_prefix, '*.') && strpos($domain, ltrim($domain_prefix, '*.')) !== false) { + foreach ($domains as $key => $rule) { + $rule = is_array($rule) ? $rule[0] : $rule; + if (is_string($rule) && false === strpos($key, '*') && 0 === strpos($url, $rule)) { + $url = ltrim($url, $rule); + $domain = $key; + + // 生成对应子域名 + if (!empty($rootDomain)) { + $domain .= $rootDomain; + } + break; + } elseif (false !== strpos($key, '*')) { + if (!empty($rootDomain)) { + $domain .= $rootDomain; + } + + break; + } + } + } + } + } + } + + if (false !== strpos($domain, '://')) { + $scheme = ''; + } else { + $scheme = $this->app['request']->isSsl() || $this->app['config']->get('is_https') ? 'https://' : 'http://'; + + } + + return $scheme . $domain; + } + + // 解析URL后缀 + protected function parseSuffix($suffix) + { + if ($suffix) { + $suffix = true === $suffix ? $this->app['config']->get('url_html_suffix') : $suffix; + + if ($pos = strpos($suffix, '|')) { + $suffix = substr($suffix, 0, $pos); + } + } + + return (empty($suffix) || 0 === strpos($suffix, '.')) ? $suffix : '.' . $suffix; + } + + // 匹配路由地址 + public function getRuleUrl($rule, &$vars = []) + { + foreach ($rule as $item) { + list($url, $pattern, $domain, $suffix) = $item; + if (empty($pattern)) { + return [rtrim($url, '$'), $domain, $suffix]; + } + + $type = $this->app['config']->get('url_common_param'); + + foreach ($pattern as $key => $val) { + if (isset($vars[$key])) { + $url = str_replace(['[:' . $key . ']', '[:' . $key . '$]', '<' . $key . '?>$', '<' . $key . '?>', ':' . $key . '$', ':' . $key . '', '<' . $key . '>$', '<' . $key . '>'], $type ? $vars[$key] : urlencode($vars[$key]), $url); + unset($vars[$key]); + + $result = [$url, $domain, $suffix]; + } elseif (2 == $val) { + $url = str_replace(['/[:' . $key . ']', '/[:' . $key . '$]', '[:' . $key . ']', '[:' . $key . '$]', '<' . $key . '?>$', '<' . $key . '?>'], '', $url); + $result = [$url, $domain, $suffix]; + } else { + break; + } + } + + if (isset($result)) { + return $result; + } + } + + return false; + } + + // 指定当前生成URL地址的root + public function root($root) + { + $this->root = $root; + $this->app['request']->root($root); + } +} diff --git a/tp5/thinkphp/library/think/Validate.php b/tp5/thinkphp/library/think/Validate.php new file mode 100644 index 0000000..e078c88 --- /dev/null +++ b/tp5/thinkphp/library/think/Validate.php @@ -0,0 +1,1485 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +use think\exception\ClassNotFoundException; +use think\validate\ValidateRule; + +class Validate +{ + + /** + * 自定义验证类型 + * @var array + */ + protected static $type = []; + + /** + * 验证类型别名 + * @var array + */ + protected $alias = [ + '>' => 'gt', '>=' => 'egt', '<' => 'lt', '<=' => 'elt', '=' => 'eq', 'same' => 'eq', + ]; + + /** + * 当前验证规则 + * @var array + */ + protected $rule = []; + + /** + * 验证提示信息 + * @var array + */ + protected $message = []; + + /** + * 验证字段描述 + * @var array + */ + protected $field = []; + + /** + * 默认规则提示 + * @var array + */ + protected static $typeMsg = [ + 'require' => ':attribute require', + 'must' => ':attribute must', + 'number' => ':attribute must be numeric', + 'integer' => ':attribute must be integer', + 'float' => ':attribute must be float', + 'boolean' => ':attribute must be bool', + 'email' => ':attribute not a valid email address', + 'mobile' => ':attribute not a valid mobile', + 'array' => ':attribute must be a array', + 'accepted' => ':attribute must be yes,on or 1', + 'date' => ':attribute not a valid datetime', + 'file' => ':attribute not a valid file', + 'image' => ':attribute not a valid image', + 'alpha' => ':attribute must be alpha', + 'alphaNum' => ':attribute must be alpha-numeric', + 'alphaDash' => ':attribute must be alpha-numeric, dash, underscore', + 'activeUrl' => ':attribute not a valid domain or ip', + 'chs' => ':attribute must be chinese', + 'chsAlpha' => ':attribute must be chinese or alpha', + 'chsAlphaNum' => ':attribute must be chinese,alpha-numeric', + 'chsDash' => ':attribute must be chinese,alpha-numeric,underscore, dash', + 'url' => ':attribute not a valid url', + 'ip' => ':attribute not a valid ip', + 'dateFormat' => ':attribute must be dateFormat of :rule', + 'in' => ':attribute must be in :rule', + 'notIn' => ':attribute be notin :rule', + 'between' => ':attribute must between :1 - :2', + 'notBetween' => ':attribute not between :1 - :2', + 'length' => 'size of :attribute must be :rule', + 'max' => 'max size of :attribute must be :rule', + 'min' => 'min size of :attribute must be :rule', + 'after' => ':attribute cannot be less than :rule', + 'before' => ':attribute cannot exceed :rule', + 'expire' => ':attribute not within :rule', + 'allowIp' => 'access IP is not allowed', + 'denyIp' => 'access IP denied', + 'confirm' => ':attribute out of accord with :2', + 'different' => ':attribute cannot be same with :2', + 'egt' => ':attribute must greater than or equal :rule', + 'gt' => ':attribute must greater than :rule', + 'elt' => ':attribute must less than or equal :rule', + 'lt' => ':attribute must less than :rule', + 'eq' => ':attribute must equal :rule', + 'unique' => ':attribute has exists', + 'regex' => ':attribute not conform to the rules', + 'method' => 'invalid Request method', + 'token' => 'invalid token', + 'fileSize' => 'filesize not match', + 'fileExt' => 'extensions to upload is not allowed', + 'fileMime' => 'mimetype to upload is not allowed', + ]; + + /** + * 当前验证场景 + * @var array + */ + protected $currentScene = null; + + /** + * 内置正则验证规则 + * @var array + */ + protected $regex = [ + 'alpha' => '/^[A-Za-z]+$/', + 'alphaNum' => '/^[A-Za-z0-9]+$/', + 'alphaDash' => '/^[A-Za-z0-9\-\_]+$/', + 'chs' => '/^[\x{4e00}-\x{9fa5}]+$/u', + 'chsAlpha' => '/^[\x{4e00}-\x{9fa5}a-zA-Z]+$/u', + 'chsAlphaNum' => '/^[\x{4e00}-\x{9fa5}a-zA-Z0-9]+$/u', + 'chsDash' => '/^[\x{4e00}-\x{9fa5}a-zA-Z0-9\_\-]+$/u', + 'mobile' => '/^1[3-9][0-9]\d{8}$/', + 'idCard' => '/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/', + 'zip' => '/\d{6}/', + ]; + + /** + * Filter_var 规则 + * @var array + */ + protected $filter = [ + 'email' => FILTER_VALIDATE_EMAIL, + 'ip' => [FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6], + 'integer' => FILTER_VALIDATE_INT, + 'url' => FILTER_VALIDATE_URL, + 'macAddr' => FILTER_VALIDATE_MAC, + 'float' => FILTER_VALIDATE_FLOAT, + ]; + + /** + * 验证场景定义 + * @var array + */ + protected $scene = []; + + /** + * 验证失败错误信息 + * @var array + */ + protected $error = []; + + /** + * 是否批量验证 + * @var bool + */ + protected $batch = false; + + /** + * 场景需要验证的规则 + * @var array + */ + protected $only = []; + + /** + * 场景需要移除的验证规则 + * @var array + */ + protected $remove = []; + + /** + * 场景需要追加的验证规则 + * @var array + */ + protected $append = []; + + /** + * 架构函数 + * @access public + * @param array $rules 验证规则 + * @param array $message 验证提示信息 + * @param array $field 验证字段描述信息 + */ + public function __construct(array $rules = [], array $message = [], array $field = []) + { + $this->rule = array_merge($this->rule, $rules); + $this->message = array_merge($this->message, $message); + $this->field = array_merge($this->field, $field); + } + + /** + * 创建一个验证器类 + * @access public + * @param array $rules 验证规则 + * @param array $message 验证提示信息 + * @param array $field 验证字段描述信息 + */ + public static function make(array $rules = [], array $message = [], array $field = []) + { + return new self($rules, $message, $field); + } + + /** + * 添加字段验证规则 + * @access protected + * @param string|array $name 字段名称或者规则数组 + * @param mixed $rule 验证规则或者字段描述信息 + * @return $this + */ + public function rule($name, $rule = '') + { + if (is_array($name)) { + $this->rule = array_merge($this->rule, $name); + if (is_array($rule)) { + $this->field = array_merge($this->field, $rule); + } + } else { + $this->rule[$name] = $rule; + } + + return $this; + } + + /** + * 注册扩展验证(类型)规则 + * @access public + * @param string $type 验证规则类型 + * @param mixed $callback callback方法(或闭包) + * @return void + */ + public static function extend($type, $callback = null) + { + if (is_array($type)) { + self::$type = array_merge(self::$type, $type); + } else { + self::$type[$type] = $callback; + } + } + + /** + * 设置验证规则的默认提示信息 + * @access public + * @param string|array $type 验证规则类型名称或者数组 + * @param string $msg 验证提示信息 + * @return void + */ + public static function setTypeMsg($type, $msg = null) + { + if (is_array($type)) { + self::$typeMsg = array_merge(self::$typeMsg, $type); + } else { + self::$typeMsg[$type] = $msg; + } + } + + /** + * 设置提示信息 + * @access public + * @param string|array $name 字段名称 + * @param string $message 提示信息 + * @return Validate + */ + public function message($name, $message = '') + { + if (is_array($name)) { + $this->message = array_merge($this->message, $name); + } else { + $this->message[$name] = $message; + } + + return $this; + } + + /** + * 设置验证场景 + * @access public + * @param string $name 场景名 + * @return $this + */ + public function scene($name) + { + // 设置当前场景 + $this->currentScene = $name; + + return $this; + } + + /** + * 判断是否存在某个验证场景 + * @access public + * @param string $name 场景名 + * @return bool + */ + public function hasScene($name) + { + return isset($this->scene[$name]) || method_exists($this, 'scene' . $name); + } + + /** + * 设置批量验证 + * @access public + * @param bool $batch 是否批量验证 + * @return $this + */ + public function batch($batch = true) + { + $this->batch = $batch; + + return $this; + } + + /** + * 指定需要验证的字段列表 + * @access public + * @param array $fields 字段名 + * @return $this + */ + public function only($fields) + { + $this->only = $fields; + + return $this; + } + + /** + * 移除某个字段的验证规则 + * @access public + * @param string|array $field 字段名 + * @param mixed $rule 验证规则 true 移除所有规则 + * @return $this + */ + public function remove($field, $rule = true) + { + if (is_array($field)) { + foreach ($field as $key => $rule) { + if (is_int($key)) { + $this->remove($rule); + } else { + $this->remove($key, $rule); + } + } + } else { + if (is_string($rule)) { + $rule = explode('|', $rule); + } + + $this->remove[$field] = $rule; + } + + return $this; + } + + /** + * 追加某个字段的验证规则 + * @access public + * @param string|array $field 字段名 + * @param mixed $rule 验证规则 + * @return $this + */ + public function append($field, $rule = null) + { + if (is_array($field)) { + foreach ($field as $key => $rule) { + $this->append($key, $rule); + } + } else { + if (is_string($rule)) { + $rule = explode('|', $rule); + } + + $this->append[$field] = $rule; + } + + return $this; + } + + /** + * 数据自动验证 + * @access public + * @param array $data 数据 + * @param mixed $rules 验证规则 + * @param string $scene 验证场景 + * @return bool + */ + public function check($data, $rules = [], $scene = '') + { + $this->error = []; + + if (empty($rules)) { + // 读取验证规则 + $rules = $this->rule; + } + + // 获取场景定义 + $this->getScene($scene); + + foreach ($this->append as $key => $rule) { + if (!isset($rules[$key])) { + $rules[$key] = $rule; + } + } + + foreach ($rules as $key => $rule) { + // field => 'rule1|rule2...' field => ['rule1','rule2',...] + if (strpos($key, '|')) { + // 字段|描述 用于指定属性名称 + list($key, $title) = explode('|', $key); + } else { + $title = isset($this->field[$key]) ? $this->field[$key] : $key; + } + + // 场景检测 + if (!empty($this->only) && !in_array($key, $this->only)) { + continue; + } + + // 获取数据 支持二维数组 + $value = $this->getDataValue($data, $key); + + // 字段验证 + if ($rule instanceof \Closure) { + $result = call_user_func_array($rule, [$value, $data]); + } elseif ($rule instanceof ValidateRule) { + // 验证因子 + $result = $this->checkItem($key, $value, $rule->getRule(), $data, $rule->getTitle() ?: $title, $rule->getMsg()); + } else { + $result = $this->checkItem($key, $value, $rule, $data, $title); + } + + if (true !== $result) { + // 没有返回true 则表示验证失败 + if (!empty($this->batch)) { + // 批量验证 + if (is_array($result)) { + $this->error = array_merge($this->error, $result); + } else { + $this->error[$key] = $result; + } + } else { + $this->error = $result; + return false; + } + } + } + + return !empty($this->error) ? false : true; + } + + /** + * 根据验证规则验证数据 + * @access public + * @param mixed $value 字段值 + * @param mixed $rules 验证规则 + * @return bool + */ + public function checkRule($value, $rules) + { + if ($rules instanceof \Closure) { + return call_user_func_array($rules, [$value]); + } elseif ($rules instanceof ValidateRule) { + $rules = $rules->getRule(); + } elseif (is_string($rules)) { + $rules = explode('|', $rules); + } + + foreach ($rules as $key => $rule) { + if ($rule instanceof \Closure) { + $result = call_user_func_array($rule, [$value]); + } else { + // 判断验证类型 + list($type, $rule) = $this->getValidateType($key, $rule); + + $callback = isset(self::$type[$type]) ? self::$type[$type] : [$this, $type]; + + $result = call_user_func_array($callback, [$value, $rule]); + } + + if (true !== $result) { + return $result; + } + } + + return true; + } + + /** + * 验证单个字段规则 + * @access protected + * @param string $field 字段名 + * @param mixed $value 字段值 + * @param mixed $rules 验证规则 + * @param array $data 数据 + * @param string $title 字段描述 + * @param array $msg 提示信息 + * @return mixed + */ + protected function checkItem($field, $value, $rules, $data, $title = '', $msg = []) + { + if (isset($this->remove[$field]) && true === $this->remove[$field] && empty($this->append[$field])) { + // 字段已经移除 无需验证 + return true; + } + + // 支持多规则验证 require|in:a,b,c|... 或者 ['require','in'=>'a,b,c',...] + if (is_string($rules)) { + $rules = explode('|', $rules); + } + + if (isset($this->append[$field])) { + // 追加额外的验证规则 + $rules = array_merge($rules, $this->append[$field]); + } + + $i = 0; + foreach ($rules as $key => $rule) { + if ($rule instanceof \Closure) { + $result = call_user_func_array($rule, [$value, $data]); + $info = is_numeric($key) ? '' : $key; + } else { + // 判断验证类型 + list($type, $rule, $info) = $this->getValidateType($key, $rule); + + if (isset($this->append[$field]) && in_array($info, $this->append[$field])) { + + } elseif (isset($this->remove[$field]) && in_array($info, $this->remove[$field])) { + // 规则已经移除 + $i++; + continue; + } + + if ('must' == $info || 0 === strpos($info, 'require') || (!is_null($value) && '' !== $value)) { + // 验证类型 + $callback = isset(self::$type[$type]) ? self::$type[$type] : [$this, $type]; + // 验证数据 + $result = call_user_func_array($callback, [$value, $rule, $data, $field, $title]); + } else { + $result = true; + } + } + + if (false === $result) { + // 验证失败 返回错误信息 + if (!empty($msg[$i])) { + $message = $msg[$i]; + if (is_string($message) && strpos($message, '{%') === 0) { + $message = Lang::get(substr($message, 2, -1)); + } + } else { + $message = $this->getRuleMsg($field, $title, $info, $rule); + } + + return $message; + } elseif (true !== $result) { + // 返回自定义错误信息 + if (is_string($result) && false !== strpos($result, ':')) { + $result = str_replace( + [':attribute', ':rule'], + [$title, (string) $rule], + $result); + } + + return $result; + } + $i++; + } + + return $result; + } + + /** + * 获取当前验证类型及规则 + * @access public + * @param mixed $key + * @param mixed $rule + * @return array + */ + protected function getValidateType($key, $rule) + { + // 判断验证类型 + if (!is_numeric($key)) { + return [$key, $rule, $key]; + } + + if (strpos($rule, ':')) { + list($type, $rule) = explode(':', $rule, 2); + if (isset($this->alias[$type])) { + // 判断别名 + $type = $this->alias[$type]; + } + $info = $type; + } elseif (method_exists($this, $rule)) { + $type = $rule; + $info = $rule; + $rule = ''; + } else { + $type = 'is'; + $info = $rule; + } + + return [$type, $rule, $info]; + } + + /** + * 验证是否和某个字段的值一致 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @param array $data 数据 + * @param string $field 字段名 + * @return bool + */ + public function confirm($value, $rule, $data = [], $field = '') + { + if ('' == $rule) { + if (strpos($field, '_confirm')) { + $rule = strstr($field, '_confirm', true); + } else { + $rule = $field . '_confirm'; + } + } + + return $this->getDataValue($data, $rule) === $value; + } + + /** + * 验证是否和某个字段的值是否不同 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @param array $data 数据 + * @return bool + */ + public function different($value, $rule, $data = []) + { + return $this->getDataValue($data, $rule) != $value; + } + + /** + * 验证是否大于等于某个值 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @param array $data 数据 + * @return bool + */ + public function egt($value, $rule, $data = []) + { + return $value >= $this->getDataValue($data, $rule); + } + + /** + * 验证是否大于某个值 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @param array $data 数据 + * @return bool + */ + public function gt($value, $rule, $data) + { + return $value > $this->getDataValue($data, $rule); + } + + /** + * 验证是否小于等于某个值 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @param array $data 数据 + * @return bool + */ + public function elt($value, $rule, $data = []) + { + return $value <= $this->getDataValue($data, $rule); + } + + /** + * 验证是否小于某个值 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @param array $data 数据 + * @return bool + */ + public function lt($value, $rule, $data = []) + { + return $value < $this->getDataValue($data, $rule); + } + + /** + * 验证是否等于某个值 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @return bool + */ + public function eq($value, $rule) + { + return $value == $rule; + } + + /** + * 必须验证 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @return bool + */ + public function must($value, $rule = null) + { + return !empty($value) || '0' == $value; + } + + /** + * 验证字段值是否为有效格式 + * @access public + * @param mixed $value 字段值 + * @param string $rule 验证规则 + * @param array $data 验证数据 + * @return bool + */ + public function is($value, $rule, $data = []) + { + switch (Loader::parseName($rule, 1, false)) { + case 'require': + // 必须 + $result = !empty($value) || '0' == $value; + break; + case 'accepted': + // 接受 + $result = in_array($value, ['1', 'on', 'yes']); + break; + case 'date': + // 是否是一个有效日期 + $result = false !== strtotime($value); + break; + case 'activeUrl': + // 是否为有效的网址 + $result = checkdnsrr($value); + break; + case 'boolean': + case 'bool': + // 是否为布尔值 + $result = in_array($value, [true, false, 0, 1, '0', '1'], true); + break; + case 'number': + $result = is_numeric($value); + break; + case 'array': + // 是否为数组 + $result = is_array($value); + break; + case 'file': + $result = $value instanceof File; + break; + case 'image': + $result = $value instanceof File && in_array($this->getImageType($value->getRealPath()), [1, 2, 3, 6]); + break; + case 'token': + $result = $this->token($value, '__token__', $data); + break; + default: + if (isset(self::$type[$rule])) { + // 注册的验证规则 + $result = call_user_func_array(self::$type[$rule], [$value]); + } elseif (isset($this->filter[$rule])) { + // Filter_var验证规则 + $result = $this->filter($value, $this->filter[$rule]); + } else { + // 正则验证 + $result = $this->regex($value, $rule); + } + } + + return $result; + } + + // 判断图像类型 + protected function getImageType($image) + { + if (function_exists('exif_imagetype')) { + return exif_imagetype($image); + } else { + try { + $info = getimagesize($image); + return $info ? $info[2] : false; + } catch (\Exception $e) { + return false; + } + } + } + + /** + * 验证是否为合格的域名或者IP 支持A,MX,NS,SOA,PTR,CNAME,AAAA,A6, SRV,NAPTR,TXT 或者 ANY类型 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @return bool + */ + public function activeUrl($value, $rule = 'MX') + { + if (!in_array($rule, ['A', 'MX', 'NS', 'SOA', 'PTR', 'CNAME', 'AAAA', 'A6', 'SRV', 'NAPTR', 'TXT', 'ANY'])) { + $rule = 'MX'; + } + + return checkdnsrr($value, $rule); + } + + /** + * 验证是否有效IP + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 ipv4 ipv6 + * @return bool + */ + public function ip($value, $rule = 'ipv4') + { + if (!in_array($rule, ['ipv4', 'ipv6'])) { + $rule = 'ipv4'; + } + + return $this->filter($value, [FILTER_VALIDATE_IP, 'ipv6' == $rule ? FILTER_FLAG_IPV6 : FILTER_FLAG_IPV4]); + } + + /** + * 验证上传文件后缀 + * @access public + * @param mixed $file 上传文件 + * @param mixed $rule 验证规则 + * @return bool + */ + public function fileExt($file, $rule) + { + if (is_array($file)) { + foreach ($file as $item) { + if (!($item instanceof File) || !$item->checkExt($rule)) { + return false; + } + } + return true; + } elseif ($file instanceof File) { + return $file->checkExt($rule); + } else { + return false; + } + } + + /** + * 验证上传文件类型 + * @access public + * @param mixed $file 上传文件 + * @param mixed $rule 验证规则 + * @return bool + */ + public function fileMime($file, $rule) + { + if (is_array($file)) { + foreach ($file as $item) { + if (!($item instanceof File) || !$item->checkMime($rule)) { + return false; + } + } + return true; + } elseif ($file instanceof File) { + return $file->checkMime($rule); + } else { + return false; + } + } + + /** + * 验证上传文件大小 + * @access public + * @param mixed $file 上传文件 + * @param mixed $rule 验证规则 + * @return bool + */ + public function fileSize($file, $rule) + { + if (is_array($file)) { + foreach ($file as $item) { + if (!($item instanceof File) || !$item->checkSize($rule)) { + return false; + } + } + return true; + } elseif ($file instanceof File) { + return $file->checkSize($rule); + } else { + return false; + } + } + + /** + * 验证图片的宽高及类型 + * @access public + * @param mixed $file 上传文件 + * @param mixed $rule 验证规则 + * @return bool + */ + public function image($file, $rule) + { + if (!($file instanceof File)) { + return false; + } + + if ($rule) { + $rule = explode(',', $rule); + + list($width, $height, $type) = getimagesize($file->getRealPath()); + + if (isset($rule[2])) { + $imageType = strtolower($rule[2]); + + if ('jpeg' == $imageType) { + $imageType = 'jpg'; + } + + if (image_type_to_extension($type, false) != $imageType) { + return false; + } + } + + list($w, $h) = $rule; + + return $w == $width && $h == $height; + } else { + return in_array($this->getImageType($file->getRealPath()), [1, 2, 3, 6]); + } + } + + /** + * 验证请求类型 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @return bool + */ + public function method($value, $rule) + { + $method = Container::get('request')->method(); + return strtoupper($rule) == $method; + } + + /** + * 验证时间和日期是否符合指定格式 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @return bool + */ + public function dateFormat($value, $rule) + { + $info = date_parse_from_format($rule, $value); + return 0 == $info['warning_count'] && 0 == $info['error_count']; + } + + /** + * 验证是否唯一 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 格式:数据表,字段名,排除ID,主键名 + * @param array $data 数据 + * @param string $field 验证字段名 + * @return bool + */ + public function unique($value, $rule, $data, $field) + { + if (is_string($rule)) { + $rule = explode(',', $rule); + } + + if (false !== strpos($rule[0], '\\')) { + // 指定模型类 + $db = new $rule[0]; + } else { + try { + $db = Container::get('app')->model($rule[0]); + } catch (ClassNotFoundException $e) { + $db = Db::name($rule[0]); + } + } + + $key = isset($rule[1]) ? $rule[1] : $field; + + if (strpos($key, '^')) { + // 支持多个字段验证 + $fields = explode('^', $key); + foreach ($fields as $key) { + $map[] = [$key, '=', $data[$key]]; + } + } else { + $map[] = [$key, '=', $data[$field]]; + } + + $pk = !empty($rule[3]) ? $rule[3] : $db->getPk(); + + if (is_string($pk)) { + if (isset($rule[2])) { + $map[] = [$pk, '<>', $rule[2]]; + } elseif (isset($data[$pk])) { + $map[] = [$pk, '<>', $data[$pk]]; + } + } + + if ($db->where($map)->field($pk)->find()) { + return false; + } + return true; + } + + /** + * 使用行为类验证 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @param array $data 数据 + * @return mixed + */ + public function behavior($value, $rule, $data) + { + return Container::get('hook')->exec($rule, $data); + } + + /** + * 使用filter_var方式验证 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @return bool + */ + public function filter($value, $rule) + { + if (is_string($rule) && strpos($rule, ',')) { + list($rule, $param) = explode(',', $rule); + } elseif (is_array($rule)) { + $param = isset($rule[1]) ? $rule[1] : null; + $rule = $rule[0]; + } else { + $param = null; + } + + return false !== filter_var($value, is_int($rule) ? $rule : filter_id($rule), $param); + } + + /** + * 验证某个字段等于某个值的时候必须 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @param array $data 数据 + * @return bool + */ + public function requireIf($value, $rule, $data) + { + list($field, $val) = explode(',', $rule); + + if ($this->getDataValue($data, $field) == $val) { + return !empty($value) || '0' == $value; + } else { + return true; + } + } + + /** + * 通过回调方法验证某个字段是否必须 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @param array $data 数据 + * @return bool + */ + public function requireCallback($value, $rule, $data) + { + $result = call_user_func_array($rule, [$value, $data]); + + if ($result) { + return !empty($value) || '0' == $value; + } else { + return true; + } + } + + /** + * 验证某个字段有值的情况下必须 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @param array $data 数据 + * @return bool + */ + public function requireWith($value, $rule, $data) + { + $val = $this->getDataValue($data, $rule); + + if (!empty($val)) { + return !empty($value) || '0' == $value; + } else { + return true; + } + } + + /** + * 验证是否在范围内 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @return bool + */ + public function in($value, $rule) + { + return in_array($value, is_array($rule) ? $rule : explode(',', $rule)); + } + + /** + * 验证是否不在某个范围 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @return bool + */ + public function notIn($value, $rule) + { + return !in_array($value, is_array($rule) ? $rule : explode(',', $rule)); + } + + /** + * between验证数据 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @return bool + */ + public function between($value, $rule) + { + if (is_string($rule)) { + $rule = explode(',', $rule); + } + list($min, $max) = $rule; + + return $value >= $min && $value <= $max; + } + + /** + * 使用notbetween验证数据 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @return bool + */ + public function notBetween($value, $rule) + { + if (is_string($rule)) { + $rule = explode(',', $rule); + } + list($min, $max) = $rule; + + return $value < $min || $value > $max; + } + + /** + * 验证数据长度 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @return bool + */ + public function length($value, $rule) + { + if (is_array($value)) { + $length = count($value); + } elseif ($value instanceof File) { + $length = $value->getSize(); + } else { + $length = mb_strlen((string) $value); + } + + if (strpos($rule, ',')) { + // 长度区间 + list($min, $max) = explode(',', $rule); + return $length >= $min && $length <= $max; + } else { + // 指定长度 + return $length == $rule; + } + } + + /** + * 验证数据最大长度 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @return bool + */ + public function max($value, $rule) + { + if (is_array($value)) { + $length = count($value); + } elseif ($value instanceof File) { + $length = $value->getSize(); + } else { + $length = mb_strlen((string) $value); + } + + return $length <= $rule; + } + + /** + * 验证数据最小长度 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @return bool + */ + public function min($value, $rule) + { + if (is_array($value)) { + $length = count($value); + } elseif ($value instanceof File) { + $length = $value->getSize(); + } else { + $length = mb_strlen((string) $value); + } + + return $length >= $rule; + } + + /** + * 验证日期 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @return bool + */ + public function after($value, $rule) + { + return strtotime($value) >= strtotime($rule); + } + + /** + * 验证日期 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @return bool + */ + public function before($value, $rule) + { + return strtotime($value) <= strtotime($rule); + } + + /** + * 验证有效期 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @return bool + */ + public function expire($value, $rule) + { + if (is_string($rule)) { + $rule = explode(',', $rule); + } + + list($start, $end) = $rule; + + if (!is_numeric($start)) { + $start = strtotime($start); + } + + if (!is_numeric($end)) { + $end = strtotime($end); + } + + return $_SERVER['REQUEST_TIME'] >= $start && $_SERVER['REQUEST_TIME'] <= $end; + } + + /** + * 验证IP许可 + * @access public + * @param string $value 字段值 + * @param mixed $rule 验证规则 + * @return mixed + */ + public function allowIp($value, $rule) + { + return in_array($value, is_array($rule) ? $rule : explode(',', $rule)); + } + + /** + * 验证IP禁用 + * @access public + * @param string $value 字段值 + * @param mixed $rule 验证规则 + * @return mixed + */ + public function denyIp($value, $rule) + { + return !in_array($value, is_array($rule) ? $rule : explode(',', $rule)); + } + + /** + * 使用正则验证数据 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 正则规则或者预定义正则名 + * @return bool + */ + public function regex($value, $rule) + { + if (isset($this->regex[$rule])) { + $rule = $this->regex[$rule]; + } + + if (0 !== strpos($rule, '/') && !preg_match('/\/[imsU]{0,4}$/', $rule)) { + // 不是正则表达式则两端补上/ + $rule = '/^' . $rule . '$/'; + } + + return 1 === preg_match($rule, (string) $value); + } + + /** + * 验证表单令牌 + * @access public + * @param mixed $value 字段值 + * @param mixed $rule 验证规则 + * @param array $data 数据 + * @return bool + */ + public function token($value, $rule, $data) + { + $rule = !empty($rule) ? $rule : '__token__'; + $session = Container::get('session'); + + if (!isset($data[$rule]) || !$session->has($rule)) { + // 令牌数据无效 + return false; + } + + // 令牌验证 + if (isset($data[$rule]) && $session->get($rule) === $data[$rule]) { + // 防止重复提交 + $session->delete($rule); // 验证完成销毁session + return true; + } + + // 开启TOKEN重置 + $session->delete($rule); + + return false; + } + + // 获取错误信息 + public function getError() + { + return $this->error; + } + + /** + * 获取数据值 + * @access protected + * @param array $data 数据 + * @param string $key 数据标识 支持二维 + * @return mixed + */ + protected function getDataValue($data, $key) + { + if (is_numeric($key)) { + $value = $key; + } elseif (strpos($key, '.')) { + // 支持二维数组验证 + list($name1, $name2) = explode('.', $key); + $value = isset($data[$name1][$name2]) ? $data[$name1][$name2] : null; + } else { + $value = isset($data[$key]) ? $data[$key] : null; + } + + return $value; + } + + /** + * 获取验证规则的错误提示信息 + * @access protected + * @param string $attribute 字段英文名 + * @param string $title 字段描述名 + * @param string $type 验证规则名称 + * @param mixed $rule 验证规则数据 + * @return string + */ + protected function getRuleMsg($attribute, $title, $type, $rule) + { + $lang = Container::get('lang'); + + if (isset($this->message[$attribute . '.' . $type])) { + $msg = $this->message[$attribute . '.' . $type]; + } elseif (isset($this->message[$attribute][$type])) { + $msg = $this->message[$attribute][$type]; + } elseif (isset($this->message[$attribute])) { + $msg = $this->message[$attribute]; + } elseif (isset(self::$typeMsg[$type])) { + $msg = self::$typeMsg[$type]; + } elseif (0 === strpos($type, 'require')) { + $msg = self::$typeMsg['require']; + } else { + $msg = $title . $lang->get('not conform to the rules'); + } + + if (is_string($msg) && 0 === strpos($msg, '{%')) { + $msg = $lang->get(substr($msg, 2, -1)); + } elseif ($lang->has($msg)) { + $msg = $lang->get($msg); + } + + if (is_string($msg) && is_scalar($rule) && false !== strpos($msg, ':')) { + // 变量替换 + if (is_string($rule) && strpos($rule, ',')) { + $array = array_pad(explode(',', $rule), 3, ''); + } else { + $array = array_pad([], 3, ''); + } + $msg = str_replace( + [':attribute', ':rule', ':1', ':2', ':3'], + [$title, (string) $rule, $array[0], $array[1], $array[2]], + $msg); + } + + return $msg; + } + + /** + * 获取数据验证的场景 + * @access protected + * @param string $scene 验证场景 + * @return array + */ + protected function getScene($scene = '') + { + if (empty($scene)) { + // 读取指定场景 + $scene = $this->currentScene; + } + + $this->only = $this->append = $this->remove = []; + + if (empty($scene)) { + return; + } + + if (method_exists($this, 'scene' . $scene)) { + call_user_func([$this, 'scene' . $scene]); + } elseif (isset($this->scene[$scene])) { + // 如果设置了验证适用场景 + $scene = $this->scene[$scene]; + + if (is_string($scene)) { + $scene = explode(',', $scene); + } + + $this->only = $scene; + } + } + + /** + * 动态方法 直接调用is方法进行验证 + * @access public + * @param string $method 方法名 + * @param array $args 调用参数 + * @return bool + */ + public function __call($method, $args) + { + if ('is' == strtolower(substr($method, 0, 2))) { + $method = substr($method, 2); + } + + array_push($args, lcfirst($method)); + + return call_user_func_array([$this, 'is'], $args); + } +} diff --git a/tp5/thinkphp/library/think/View.php b/tp5/thinkphp/library/think/View.php new file mode 100644 index 0000000..6127235 --- /dev/null +++ b/tp5/thinkphp/library/think/View.php @@ -0,0 +1,236 @@ + +// +---------------------------------------------------------------------- + +namespace think; + +class View +{ + /** + * 模板引擎实例 + * @var object + */ + public $engine; + + /** + * 模板变量 + * @var array + */ + protected $data = []; + + /** + * 内容过滤 + * @var mixed + */ + protected $filter; + + /** + * 全局模板变量 + * @var array + */ + protected static $var = []; + + /** + * 初始化 + * @access public + * @param mixed $engine 模板引擎参数 + * @return $this + */ + public function init($engine = []) + { + // 初始化模板引擎 + $this->engine($engine); + + return $this; + } + + /** + * 模板变量静态赋值 + * @access public + * @param mixed $name 变量名 + * @param mixed $value 变量值 + * @return $this + */ + public function share($name, $value = '') + { + if (is_array($name)) { + self::$var = array_merge(self::$var, $name); + } else { + self::$var[$name] = $value; + } + + return $this; + } + + /** + * 模板变量赋值 + * @access public + * @param mixed $name 变量名 + * @param mixed $value 变量值 + * @return $this + */ + public function assign($name, $value = '') + { + if (is_array($name)) { + $this->data = array_merge($this->data, $name); + } else { + $this->data[$name] = $value; + } + + return $this; + } + + /** + * 设置当前模板解析的引擎 + * @access public + * @param array|string $options 引擎参数 + * @return $this + */ + public function engine($options = []) + { + if (is_string($options)) { + $type = $options; + $options = []; + } else { + $type = !empty($options['type']) ? $options['type'] : 'Think'; + } + + $class = false !== strpos($type, '\\') ? $type : '\\think\\view\\driver\\' . ucfirst($type); + + if (isset($options['type'])) { + unset($options['type']); + } + + $this->engine = new $class($options); + + return $this; + } + + /** + * 配置模板引擎 + * @access public + * @param string|array $name 参数名 + * @param mixed $value 参数值 + * @return $this + */ + public function config($name, $value = null) + { + $this->engine->config($name, $value); + + return $this; + } + + /** + * 检查模板是否存在 + * @access public + * @param string|array $name 参数名 + * @return bool + */ + public function exists($name) + { + return $this->engine->exists($name); + } + + /** + * 视图过滤 + * @access public + * @param Callable $filter 过滤方法或闭包 + * @return $this + */ + public function filter($filter) + { + $this->filter = $filter; + return $this; + } + + /** + * 解析和获取模板内容 用于输出 + * @access public + * @param string $template 模板文件名或者内容 + * @param array $vars 模板输出变量 + * @param array $config 模板参数 + * @param bool $renderContent 是否渲染内容 + * @return string + * @throws \Exception + */ + public function fetch($template = '', $vars = [], $config = [], $renderContent = false) + { + // 模板变量 + $vars = array_merge(self::$var, $this->data, $vars); + + // 页面缓存 + ob_start(); + ob_implicit_flush(0); + + // 渲染输出 + try { + $method = $renderContent ? 'display' : 'fetch'; + $this->engine->$method($template, $vars, $config); + } catch (\Exception $e) { + ob_end_clean(); + throw $e; + } + + // 获取并清空缓存 + $content = ob_get_clean(); + + if ($this->filter) { + $content = call_user_func_array($this->filter, [$content]); + } + + return $content; + } + + /** + * 渲染内容输出 + * @access public + * @param string $content 内容 + * @param array $vars 模板输出变量 + * @param array $config 模板参数 + * @return mixed + */ + public function display($content, $vars = [], $config = []) + { + return $this->fetch($content, $vars, $config, true); + } + + /** + * 模板变量赋值 + * @access public + * @param string $name 变量名 + * @param mixed $value 变量值 + */ + public function __set($name, $value) + { + $this->data[$name] = $value; + } + + /** + * 取得模板显示变量的值 + * @access protected + * @param string $name 模板变量 + * @return mixed + */ + public function __get($name) + { + return $this->data[$name]; + } + + /** + * 检测模板变量是否设置 + * @access public + * @param string $name 模板变量名 + * @return bool + */ + public function __isset($name) + { + return isset($this->data[$name]); + } +} diff --git a/tp5/thinkphp/library/think/cache/Driver.php b/tp5/thinkphp/library/think/cache/Driver.php new file mode 100644 index 0000000..f0ec7ba --- /dev/null +++ b/tp5/thinkphp/library/think/cache/Driver.php @@ -0,0 +1,353 @@ + +// +---------------------------------------------------------------------- + +namespace think\cache; + +use think\Container; + +/** + * 缓存基础类 + */ +abstract class Driver +{ + /** + * 驱动句柄 + * @var object + */ + protected $handler = null; + + /** + * 缓存读取次数 + * @var integer + */ + protected $readTimes = 0; + + /** + * 缓存写入次数 + * @var integer + */ + protected $writeTimes = 0; + + /** + * 缓存参数 + * @var array + */ + protected $options = []; + + /** + * 缓存标签 + * @var string + */ + protected $tag; + + /** + * 序列化方法 + * @var array + */ + protected static $serialize = ['serialize', 'unserialize', 'think_serialize:', 16]; + + /** + * 判断缓存是否存在 + * @access public + * @param string $name 缓存变量名 + * @return bool + */ + abstract public function has($name); + + /** + * 读取缓存 + * @access public + * @param string $name 缓存变量名 + * @param mixed $default 默认值 + * @return mixed + */ + abstract public function get($name, $default = false); + + /** + * 写入缓存 + * @access public + * @param string $name 缓存变量名 + * @param mixed $value 存储数据 + * @param int $expire 有效时间 0为永久 + * @return boolean + */ + abstract public function set($name, $value, $expire = null); + + /** + * 自增缓存(针对数值缓存) + * @access public + * @param string $name 缓存变量名 + * @param int $step 步长 + * @return false|int + */ + abstract public function inc($name, $step = 1); + + /** + * 自减缓存(针对数值缓存) + * @access public + * @param string $name 缓存变量名 + * @param int $step 步长 + * @return false|int + */ + abstract public function dec($name, $step = 1); + + /** + * 删除缓存 + * @access public + * @param string $name 缓存变量名 + * @return boolean + */ + abstract public function rm($name); + + /** + * 清除缓存 + * @access public + * @param string $tag 标签名 + * @return boolean + */ + abstract public function clear($tag = null); + + /** + * 获取有效期 + * @access protected + * @param integer|\DateTime $expire 有效期 + * @return integer + */ + protected function getExpireTime($expire) + { + if ($expire instanceof \DateTime) { + $expire = $expire->getTimestamp() - time(); + } + + return $expire; + } + + /** + * 获取实际的缓存标识 + * @access protected + * @param string $name 缓存名 + * @return string + */ + protected function getCacheKey($name) + { + return $this->options['prefix'] . $name; + } + + /** + * 读取缓存并删除 + * @access public + * @param string $name 缓存变量名 + * @return mixed + */ + public function pull($name) + { + $result = $this->get($name, false); + + if ($result) { + $this->rm($name); + return $result; + } else { + return; + } + } + + /** + * 如果不存在则写入缓存 + * @access public + * @param string $name 缓存变量名 + * @param mixed $value 存储数据 + * @param int $expire 有效时间 0为永久 + * @return mixed + */ + public function remember($name, $value, $expire = null) + { + if (!$this->has($name)) { + $time = time(); + while ($time + 5 > time() && $this->has($name . '_lock')) { + // 存在锁定则等待 + usleep(200000); + } + + try { + // 锁定 + $this->set($name . '_lock', true); + + if ($value instanceof \Closure) { + // 获取缓存数据 + $value = Container::getInstance()->invokeFunction($value); + } + + // 缓存数据 + $this->set($name, $value, $expire); + + // 解锁 + $this->rm($name . '_lock'); + } catch (\Exception $e) { + $this->rm($name . '_lock'); + throw $e; + } catch (\throwable $e) { + $this->rm($name . '_lock'); + throw $e; + } + } else { + $value = $this->get($name); + } + + return $value; + } + + /** + * 缓存标签 + * @access public + * @param string $name 标签名 + * @param string|array $keys 缓存标识 + * @param bool $overlay 是否覆盖 + * @return $this + */ + public function tag($name, $keys = null, $overlay = false) + { + if (is_null($name)) { + + } elseif (is_null($keys)) { + $this->tag = $name; + } else { + $key = 'tag_' . md5($name); + + if (is_string($keys)) { + $keys = explode(',', $keys); + } + + $keys = array_map([$this, 'getCacheKey'], $keys); + + if ($overlay) { + $value = $keys; + } else { + $value = array_unique(array_merge($this->getTagItem($name), $keys)); + } + + $this->set($key, implode(',', $value), 0); + } + + return $this; + } + + /** + * 更新标签 + * @access protected + * @param string $name 缓存标识 + * @return void + */ + protected function setTagItem($name) + { + if ($this->tag) { + $key = 'tag_' . md5($this->tag); + $prev = $this->tag; + $this->tag = null; + + if ($this->has($key)) { + $value = explode(',', $this->get($key)); + $value[] = $name; + $value = implode(',', array_unique($value)); + } else { + $value = $name; + } + + $this->set($key, $value, 0); + $this->tag = $prev; + } + } + + /** + * 获取标签包含的缓存标识 + * @access protected + * @param string $tag 缓存标签 + * @return array + */ + protected function getTagItem($tag) + { + $key = 'tag_' . md5($tag); + $value = $this->get($key); + + if ($value) { + return array_filter(explode(',', $value)); + } else { + return []; + } + } + + /** + * 序列化数据 + * @access protected + * @param mixed $data + * @return string + */ + protected function serialize($data) + { + if (is_scalar($data) || !$this->options['serialize']) { + return $data; + } + + $serialize = self::$serialize[0]; + + return self::$serialize[2] . $serialize($data); + } + + /** + * 反序列化数据 + * @access protected + * @param string $data + * @return mixed + */ + protected function unserialize($data) + { + if ($this->options['serialize'] && 0 === strpos($data, self::$serialize[2])) { + $unserialize = self::$serialize[1]; + + return $unserialize(substr($data, self::$serialize[3])); + } else { + return $data; + } + } + + /** + * 注册序列化机制 + * @access public + * @param callable $serialize 序列化方法 + * @param callable $unserialize 反序列化方法 + * @param string $prefix 序列化前缀标识 + * @return $this + */ + public static function registerSerialize($serialize, $unserialize, $prefix = 'think_serialize:') + { + self::$serialize = [$serialize, $unserialize, $prefix, strlen($prefix)]; + } + + /** + * 返回句柄对象,可执行其它高级方法 + * + * @access public + * @return object + */ + public function handler() + { + return $this->handler; + } + + public function getReadTimes() + { + return $this->readTimes; + } + + public function getWriteTimes() + { + return $this->writeTimes; + } +} diff --git a/tp5/thinkphp/library/think/cache/driver/File.php b/tp5/thinkphp/library/think/cache/driver/File.php new file mode 100644 index 0000000..d4c5203 --- /dev/null +++ b/tp5/thinkphp/library/think/cache/driver/File.php @@ -0,0 +1,298 @@ + +// +---------------------------------------------------------------------- + +namespace think\cache\driver; + +use think\cache\Driver; +use think\Container; + +/** + * 文件类型缓存类 + * @author liu21st + */ +class File extends Driver +{ + protected $options = [ + 'expire' => 0, + 'cache_subdir' => true, + 'prefix' => '', + 'path' => '', + 'hash_type' => 'md5', + 'data_compress' => false, + 'serialize' => true, + ]; + + protected $expire; + + /** + * 架构函数 + * @param array $options + */ + public function __construct($options = []) + { + if (!empty($options)) { + $this->options = array_merge($this->options, $options); + } + + if (empty($this->options['path'])) { + $this->options['path'] = Container::get('app')->getRuntimePath() . 'cache/'; + } elseif (substr($this->options['path'], -1) != DIRECTORY_SEPARATOR) { + $this->options['path'] .= DIRECTORY_SEPARATOR; + } + + $this->init(); + } + + /** + * 初始化检查 + * @access private + * @return boolean + */ + private function init() + { + // 创建项目缓存目录 + if (!is_dir($this->options['path'])) { + if (mkdir($this->options['path'], 0755, true)) { + return true; + } + } + + return false; + } + + /** + * 取得变量的存储文件名 + * @access protected + * @param string $name 缓存变量名 + * @param bool $auto 是否自动创建目录 + * @return string + */ + protected function getCacheKey($name, $auto = false) + { + $name = hash($this->options['hash_type'], $name); + + if ($this->options['cache_subdir']) { + // 使用子目录 + $name = substr($name, 0, 2) . DIRECTORY_SEPARATOR . substr($name, 2); + } + + if ($this->options['prefix']) { + $name = $this->options['prefix'] . DIRECTORY_SEPARATOR . $name; + } + + $filename = $this->options['path'] . $name . '.php'; + $dir = dirname($filename); + + if ($auto && !is_dir($dir)) { + mkdir($dir, 0755, true); + } + + return $filename; + } + + /** + * 判断缓存是否存在 + * @access public + * @param string $name 缓存变量名 + * @return bool + */ + public function has($name) + { + return $this->get($name) ? true : false; + } + + /** + * 读取缓存 + * @access public + * @param string $name 缓存变量名 + * @param mixed $default 默认值 + * @return mixed + */ + public function get($name, $default = false) + { + $this->readTimes++; + + $filename = $this->getCacheKey($name); + + if (!is_file($filename)) { + return $default; + } + + $content = file_get_contents($filename); + $this->expire = null; + + if (false !== $content) { + $expire = (int) substr($content, 8, 12); + if (0 != $expire && time() > filemtime($filename) + $expire) { + //缓存过期删除缓存文件 + $this->unlink($filename); + return $default; + } + + $this->expire = $expire; + $content = substr($content, 32); + + if ($this->options['data_compress'] && function_exists('gzcompress')) { + //启用数据压缩 + $content = gzuncompress($content); + } + return $this->unserialize($content); + } else { + return $default; + } + } + + /** + * 写入缓存 + * @access public + * @param string $name 缓存变量名 + * @param mixed $value 存储数据 + * @param int|\DateTime $expire 有效时间 0为永久 + * @return boolean + */ + public function set($name, $value, $expire = null) + { + $this->writeTimes++; + + if (is_null($expire)) { + $expire = $this->options['expire']; + } + + $expire = $this->getExpireTime($expire); + $filename = $this->getCacheKey($name, true); + + if ($this->tag && !is_file($filename)) { + $first = true; + } + + $data = $this->serialize($value); + + if ($this->options['data_compress'] && function_exists('gzcompress')) { + //数据压缩 + $data = gzcompress($data, 3); + } + + $data = "\n" . $data; + $result = file_put_contents($filename, $data); + + if ($result) { + isset($first) && $this->setTagItem($filename); + clearstatcache(); + return true; + } else { + return false; + } + } + + /** + * 自增缓存(针对数值缓存) + * @access public + * @param string $name 缓存变量名 + * @param int $step 步长 + * @return false|int + */ + public function inc($name, $step = 1) + { + if ($this->has($name)) { + $value = $this->get($name) + $step; + $expire = $this->expire; + } else { + $value = $step; + $expire = 0; + } + + return $this->set($name, $value, $expire) ? $value : false; + } + + /** + * 自减缓存(针对数值缓存) + * @access public + * @param string $name 缓存变量名 + * @param int $step 步长 + * @return false|int + */ + public function dec($name, $step = 1) + { + if ($this->has($name)) { + $value = $this->get($name) - $step; + $expire = $this->expire; + } else { + $value = -$step; + $expire = 0; + } + + return $this->set($name, $value, $expire) ? $value : false; + } + + /** + * 删除缓存 + * @access public + * @param string $name 缓存变量名 + * @return boolean + */ + public function rm($name) + { + $this->writeTimes++; + + return $this->unlink($this->getCacheKey($name)); + } + + /** + * 清除缓存 + * @access public + * @param string $tag 标签名 + * @return boolean + */ + public function clear($tag = null) + { + if ($tag) { + // 指定标签清除 + $keys = $this->getTagItem($tag); + foreach ($keys as $key) { + $this->unlink($key); + } + $this->rm('tag_' . md5($tag)); + return true; + } + + $this->writeTimes++; + + $files = (array) glob($this->options['path'] . ($this->options['prefix'] ? $this->options['prefix'] . DIRECTORY_SEPARATOR : '') . '*'); + + foreach ($files as $path) { + if (is_dir($path)) { + $matches = glob($path . '/*.php'); + if (is_array($matches)) { + array_map('unlink', $matches); + } + rmdir($path); + } else { + unlink($path); + } + } + + return true; + } + + /** + * 判断文件是否存在后,删除 + * @access private + * @param string $path + * @return bool + * @author byron sampson + * @return boolean + */ + private function unlink($path) + { + return is_file($path) && unlink($path); + } + +} diff --git a/tp5/thinkphp/library/think/cache/driver/Lite.php b/tp5/thinkphp/library/think/cache/driver/Lite.php new file mode 100644 index 0000000..544663c --- /dev/null +++ b/tp5/thinkphp/library/think/cache/driver/Lite.php @@ -0,0 +1,209 @@ + +// +---------------------------------------------------------------------- + +namespace think\cache\driver; + +use think\cache\Driver; + +/** + * 文件类型缓存类 + * @author liu21st + */ +class Lite extends Driver +{ + protected $options = [ + 'prefix' => '', + 'path' => '', + 'expire' => 0, // 等于 10*365*24*3600(10年) + ]; + + /** + * 架构函数 + * @access public + * + * @param array $options + */ + public function __construct($options = []) + { + if (!empty($options)) { + $this->options = array_merge($this->options, $options); + } + + if (substr($this->options['path'], -1) != DIRECTORY_SEPARATOR) { + $this->options['path'] .= DIRECTORY_SEPARATOR; + } + + } + + /** + * 取得变量的存储文件名 + * @access protected + * @param string $name 缓存变量名 + * @return string + */ + protected function getCacheKey($name) + { + return $this->options['path'] . $this->options['prefix'] . md5($name) . '.php'; + } + + /** + * 判断缓存是否存在 + * @access public + * @param string $name 缓存变量名 + * @return mixed + */ + public function has($name) + { + return $this->get($name) ? true : false; + } + + /** + * 读取缓存 + * @access public + * @param string $name 缓存变量名 + * @param mixed $default 默认值 + * @return mixed + */ + public function get($name, $default = false) + { + $this->readTimes++; + + $filename = $this->getCacheKey($name); + + if (is_file($filename)) { + // 判断是否过期 + $mtime = filemtime($filename); + + if ($mtime < time()) { + // 清除已经过期的文件 + unlink($filename); + return $default; + } + + return include $filename; + } else { + return $default; + } + } + + /** + * 写入缓存 + * @access public + * @param string $name 缓存变量名 + * @param mixed $value 存储数据 + * @param int|\DateTime $expire 有效时间 0为永久 + * @return bool + */ + public function set($name, $value, $expire = null) + { + $this->writeTimes++; + + if (is_null($expire)) { + $expire = $this->options['expire']; + } + + if ($expire instanceof \DateTime) { + $expire = $expire->getTimestamp(); + } else { + $expire = 0 === $expire ? 10 * 365 * 24 * 3600 : $expire; + $expire = time() + $expire; + } + + $filename = $this->getCacheKey($name); + + if ($this->tag && !is_file($filename)) { + $first = true; + } + + $ret = file_put_contents($filename, ("setTagItem($filename); + touch($filename, $expire); + } + + return $ret; + } + + /** + * 自增缓存(针对数值缓存) + * @access public + * @param string $name 缓存变量名 + * @param int $step 步长 + * @return false|int + */ + public function inc($name, $step = 1) + { + if ($this->has($name)) { + $value = $this->get($name) + $step; + } else { + $value = $step; + } + + return $this->set($name, $value, 0) ? $value : false; + } + + /** + * 自减缓存(针对数值缓存) + * @access public + * @param string $name 缓存变量名 + * @param int $step 步长 + * @return false|int + */ + public function dec($name, $step = 1) + { + if ($this->has($name)) { + $value = $this->get($name) - $step; + } else { + $value = -$step; + } + + return $this->set($name, $value, 0) ? $value : false; + } + + /** + * 删除缓存 + * @access public + * @param string $name 缓存变量名 + * @return boolean + */ + public function rm($name) + { + $this->writeTimes++; + + return unlink($this->getCacheKey($name)); + } + + /** + * 清除缓存 + * @access public + * @param string $tag 标签名 + * @return bool + */ + public function clear($tag = null) + { + if ($tag) { + // 指定标签清除 + $keys = $this->getTagItem($tag); + foreach ($keys as $key) { + unlink($key); + } + + $this->rm('tag_' . md5($tag)); + return true; + } + + $this->writeTimes++; + + array_map("unlink", glob($this->options['path'] . ($this->options['prefix'] ? $this->options['prefix'] . DIRECTORY_SEPARATOR : '') . '*.php')); + } +} diff --git a/tp5/thinkphp/library/think/cache/driver/Memcache.php b/tp5/thinkphp/library/think/cache/driver/Memcache.php new file mode 100644 index 0000000..ea2c0e2 --- /dev/null +++ b/tp5/thinkphp/library/think/cache/driver/Memcache.php @@ -0,0 +1,203 @@ + +// +---------------------------------------------------------------------- + +namespace think\cache\driver; + +use think\cache\Driver; + +class Memcache extends Driver +{ + protected $options = [ + 'host' => '127.0.0.1', + 'port' => 11211, + 'expire' => 0, + 'timeout' => 0, // 超时时间(单位:毫秒) + 'persistent' => true, + 'prefix' => '', + 'serialize' => true, + ]; + + /** + * 架构函数 + * @access public + * @param array $options 缓存参数 + * @throws \BadFunctionCallException + */ + public function __construct($options = []) + { + if (!extension_loaded('memcache')) { + throw new \BadFunctionCallException('not support: memcache'); + } + + if (!empty($options)) { + $this->options = array_merge($this->options, $options); + } + + $this->handler = new \Memcache; + + // 支持集群 + $hosts = explode(',', $this->options['host']); + $ports = explode(',', $this->options['port']); + + if (empty($ports[0])) { + $ports[0] = 11211; + } + + // 建立连接 + foreach ((array) $hosts as $i => $host) { + $port = isset($ports[$i]) ? $ports[$i] : $ports[0]; + $this->options['timeout'] > 0 ? + $this->handler->addServer($host, $port, $this->options['persistent'], 1, $this->options['timeout']) : + $this->handler->addServer($host, $port, $this->options['persistent'], 1); + } + } + + /** + * 判断缓存 + * @access public + * @param string $name 缓存变量名 + * @return bool + */ + public function has($name) + { + $key = $this->getCacheKey($name); + + return $this->handler->get($key) ? true : false; + } + + /** + * 读取缓存 + * @access public + * @param string $name 缓存变量名 + * @param mixed $default 默认值 + * @return mixed + */ + public function get($name, $default = false) + { + $this->readTimes++; + + $result = $this->handler->get($this->getCacheKey($name)); + + return false !== $result ? $this->unserialize($result) : $default; + } + + /** + * 写入缓存 + * @access public + * @param string $name 缓存变量名 + * @param mixed $value 存储数据 + * @param int|DateTime $expire 有效时间(秒) + * @return bool + */ + public function set($name, $value, $expire = null) + { + $this->writeTimes++; + + if (is_null($expire)) { + $expire = $this->options['expire']; + } + + if ($this->tag && !$this->has($name)) { + $first = true; + } + + $key = $this->getCacheKey($name); + $expire = $this->getExpireTime($expire); + $value = $this->serialize($value); + + if ($this->handler->set($key, $value, 0, $expire)) { + isset($first) && $this->setTagItem($key); + return true; + } + + return false; + } + + /** + * 自增缓存(针对数值缓存) + * @access public + * @param string $name 缓存变量名 + * @param int $step 步长 + * @return false|int + */ + public function inc($name, $step = 1) + { + $this->writeTimes++; + + $key = $this->getCacheKey($name); + + if ($this->handler->get($key)) { + return $this->handler->increment($key, $step); + } + + return $this->handler->set($key, $step); + } + + /** + * 自减缓存(针对数值缓存) + * @access public + * @param string $name 缓存变量名 + * @param int $step 步长 + * @return false|int + */ + public function dec($name, $step = 1) + { + $this->writeTimes++; + + $key = $this->getCacheKey($name); + $value = $this->handler->get($key) - $step; + $res = $this->handler->set($key, $value); + + return !$res ? false : $value; + } + + /** + * 删除缓存 + * @access public + * @param string $name 缓存变量名 + * @param bool|false $ttl + * @return bool + */ + public function rm($name, $ttl = false) + { + $this->writeTimes++; + + $key = $this->getCacheKey($name); + + return false === $ttl ? + $this->handler->delete($key) : + $this->handler->delete($key, $ttl); + } + + /** + * 清除缓存 + * @access public + * @param string $tag 标签名 + * @return bool + */ + public function clear($tag = null) + { + if ($tag) { + // 指定标签清除 + $keys = $this->getTagItem($tag); + foreach ($keys as $key) { + $this->handler->delete($key); + } + + $this->rm('tag_' . md5($tag)); + return true; + } + + $this->writeTimes++; + + return $this->handler->flush(); + } +} diff --git a/tp5/thinkphp/library/think/cache/driver/Memcached.php b/tp5/thinkphp/library/think/cache/driver/Memcached.php new file mode 100644 index 0000000..d04fac0 --- /dev/null +++ b/tp5/thinkphp/library/think/cache/driver/Memcached.php @@ -0,0 +1,216 @@ + +// +---------------------------------------------------------------------- + +namespace think\cache\driver; + +use think\cache\Driver; + +class Memcached extends Driver +{ + protected $options = [ + 'host' => '127.0.0.1', + 'port' => 11211, + 'expire' => 0, + 'timeout' => 0, // 超时时间(单位:毫秒) + 'prefix' => '', + 'username' => '', //账号 + 'password' => '', //密码 + 'option' => [], + 'serialize' => true, + ]; + + /** + * 架构函数 + * @access public + * @param array $options 缓存参数 + */ + public function __construct($options = []) + { + if (!extension_loaded('memcached')) { + throw new \BadFunctionCallException('not support: memcached'); + } + + if (!empty($options)) { + $this->options = array_merge($this->options, $options); + } + + $this->handler = new \Memcached; + + if (!empty($this->options['option'])) { + $this->handler->setOptions($this->options['option']); + } + + // 设置连接超时时间(单位:毫秒) + if ($this->options['timeout'] > 0) { + $this->handler->setOption(\Memcached::OPT_CONNECT_TIMEOUT, $this->options['timeout']); + } + + // 支持集群 + $hosts = explode(',', $this->options['host']); + $ports = explode(',', $this->options['port']); + if (empty($ports[0])) { + $ports[0] = 11211; + } + + // 建立连接 + $servers = []; + foreach ((array) $hosts as $i => $host) { + $servers[] = [$host, (isset($ports[$i]) ? $ports[$i] : $ports[0]), 1]; + } + + $this->handler->addServers($servers); + + if ('' != $this->options['username']) { + $this->handler->setOption(\Memcached::OPT_BINARY_PROTOCOL, true); + $this->handler->setSaslAuthData($this->options['username'], $this->options['password']); + } + } + + /** + * 判断缓存 + * @access public + * @param string $name 缓存变量名 + * @return bool + */ + public function has($name) + { + $key = $this->getCacheKey($name); + + return $this->handler->get($key) ? true : false; + } + + /** + * 读取缓存 + * @access public + * @param string $name 缓存变量名 + * @param mixed $default 默认值 + * @return mixed + */ + public function get($name, $default = false) + { + $this->readTimes++; + + $result = $this->handler->get($this->getCacheKey($name)); + + return false !== $result ? $this->unserialize($result) : $default; + } + + /** + * 写入缓存 + * @access public + * @param string $name 缓存变量名 + * @param mixed $value 存储数据 + * @param integer|\DateTime $expire 有效时间(秒) + * @return bool + */ + public function set($name, $value, $expire = null) + { + $this->writeTimes++; + + if (is_null($expire)) { + $expire = $this->options['expire']; + } + + if ($this->tag && !$this->has($name)) { + $first = true; + } + + $key = $this->getCacheKey($name); + $expire = $this->getExpireTime($expire); + $value = $this->serialize($value); + + if ($this->handler->set($key, $value, $expire)) { + isset($first) && $this->setTagItem($key); + return true; + } + + return false; + } + + /** + * 自增缓存(针对数值缓存) + * @access public + * @param string $name 缓存变量名 + * @param int $step 步长 + * @return false|int + */ + public function inc($name, $step = 1) + { + $this->writeTimes++; + + $key = $this->getCacheKey($name); + + if ($this->handler->get($key)) { + return $this->handler->increment($key, $step); + } + + return $this->handler->set($key, $step); + } + + /** + * 自减缓存(针对数值缓存) + * @access public + * @param string $name 缓存变量名 + * @param int $step 步长 + * @return false|int + */ + public function dec($name, $step = 1) + { + $this->writeTimes++; + + $key = $this->getCacheKey($name); + $value = $this->handler->get($key) - $step; + $res = $this->handler->set($key, $value); + + return !$res ? false : $value; + } + + /** + * 删除缓存 + * @access public + * @param string $name 缓存变量名 + * @param bool|false $ttl + * @return bool + */ + public function rm($name, $ttl = false) + { + $this->writeTimes++; + + $key = $this->getCacheKey($name); + + return false === $ttl ? + $this->handler->delete($key) : + $this->handler->delete($key, $ttl); + } + + /** + * 清除缓存 + * @access public + * @param string $tag 标签名 + * @return bool + */ + public function clear($tag = null) + { + if ($tag) { + // 指定标签清除 + $keys = $this->getTagItem($tag); + + $this->handler->deleteMulti($keys); + $this->rm('tag_' . md5($tag)); + + return true; + } + + $this->writeTimes++; + + return $this->handler->flush(); + } +} diff --git a/tp5/thinkphp/library/think/cache/driver/Redis.php b/tp5/thinkphp/library/think/cache/driver/Redis.php new file mode 100644 index 0000000..ad4de7a --- /dev/null +++ b/tp5/thinkphp/library/think/cache/driver/Redis.php @@ -0,0 +1,206 @@ + +// +---------------------------------------------------------------------- + +namespace think\cache\driver; + +use think\cache\Driver; + +/** + * Redis缓存驱动,适合单机部署、有前端代理实现高可用的场景,性能最好 + * 有需要在业务层实现读写分离、或者使用RedisCluster的需求,请使用Redisd驱动 + * + * 要求安装phpredis扩展:https://github.com/nicolasff/phpredis + * @author 尘缘 <130775@qq.com> + */ +class Redis extends Driver +{ + protected $options = [ + 'host' => '127.0.0.1', + 'port' => 6379, + 'password' => '', + 'select' => 0, + 'timeout' => 0, + 'expire' => 0, + 'persistent' => false, + 'prefix' => '', + 'serialize' => true, + ]; + + /** + * 架构函数 + * @access public + * @param array $options 缓存参数 + */ + public function __construct($options = []) + { + if (!extension_loaded('redis')) { + throw new \BadFunctionCallException('not support: redis'); + } + + if (!empty($options)) { + $this->options = array_merge($this->options, $options); + } + + $this->handler = new \Redis; + + if ($this->options['persistent']) { + $this->handler->pconnect($this->options['host'], $this->options['port'], $this->options['timeout'], 'persistent_id_' . $this->options['select']); + } else { + $this->handler->connect($this->options['host'], $this->options['port'], $this->options['timeout']); + } + + if ('' != $this->options['password']) { + $this->handler->auth($this->options['password']); + } + + if (0 != $this->options['select']) { + $this->handler->select($this->options['select']); + } + } + + /** + * 判断缓存 + * @access public + * @param string $name 缓存变量名 + * @return bool + */ + public function has($name) + { + return $this->handler->get($this->getCacheKey($name)) ? true : false; + } + + /** + * 读取缓存 + * @access public + * @param string $name 缓存变量名 + * @param mixed $default 默认值 + * @return mixed + */ + public function get($name, $default = false) + { + $this->readTimes++; + + $value = $this->handler->get($this->getCacheKey($name)); + + if (is_null($value) || false === $value) { + return $default; + } + + return $this->unserialize($value); + } + + /** + * 写入缓存 + * @access public + * @param string $name 缓存变量名 + * @param mixed $value 存储数据 + * @param integer|\DateTime $expire 有效时间(秒) + * @return boolean + */ + public function set($name, $value, $expire = null) + { + $this->writeTimes++; + + if (is_null($expire)) { + $expire = $this->options['expire']; + } + + if ($this->tag && !$this->has($name)) { + $first = true; + } + + $key = $this->getCacheKey($name); + $expire = $this->getExpireTime($expire); + + $value = $this->serialize($value); + + if ($expire) { + $result = $this->handler->setex($key, $expire, $value); + } else { + $result = $this->handler->set($key, $value); + } + + isset($first) && $this->setTagItem($key); + + return $result; + } + + /** + * 自增缓存(针对数值缓存) + * @access public + * @param string $name 缓存变量名 + * @param int $step 步长 + * @return false|int + */ + public function inc($name, $step = 1) + { + $this->writeTimes++; + + $key = $this->getCacheKey($name); + + return $this->handler->incrby($key, $step); + } + + /** + * 自减缓存(针对数值缓存) + * @access public + * @param string $name 缓存变量名 + * @param int $step 步长 + * @return false|int + */ + public function dec($name, $step = 1) + { + $this->writeTimes++; + + $key = $this->getCacheKey($name); + + return $this->handler->decrby($key, $step); + } + + /** + * 删除缓存 + * @access public + * @param string $name 缓存变量名 + * @return boolean + */ + public function rm($name) + { + $this->writeTimes++; + + return $this->handler->delete($this->getCacheKey($name)); + } + + /** + * 清除缓存 + * @access public + * @param string $tag 标签名 + * @return boolean + */ + public function clear($tag = null) + { + if ($tag) { + // 指定标签清除 + $keys = $this->getTagItem($tag); + + foreach ($keys as $key) { + $this->handler->delete($key); + } + + $this->rm('tag_' . md5($tag)); + return true; + } + + $this->writeTimes++; + + return $this->handler->flushDB(); + } + +} diff --git a/tp5/thinkphp/library/think/cache/driver/Sqlite.php b/tp5/thinkphp/library/think/cache/driver/Sqlite.php new file mode 100644 index 0000000..7e78ec1 --- /dev/null +++ b/tp5/thinkphp/library/think/cache/driver/Sqlite.php @@ -0,0 +1,233 @@ + +// +---------------------------------------------------------------------- + +namespace think\cache\driver; + +use think\cache\Driver; + +/** + * Sqlite缓存驱动 + * @author liu21st + */ +class Sqlite extends Driver +{ + protected $options = [ + 'db' => ':memory:', + 'table' => 'sharedmemory', + 'prefix' => '', + 'expire' => 0, + 'persistent' => false, + 'serialize' => true, + ]; + + /** + * 架构函数 + * @access public + * @param array $options 缓存参数 + * @throws \BadFunctionCallException + */ + public function __construct($options = []) + { + if (!extension_loaded('sqlite')) { + throw new \BadFunctionCallException('not support: sqlite'); + } + + if (!empty($options)) { + $this->options = array_merge($this->options, $options); + } + + $func = $this->options['persistent'] ? 'sqlite_popen' : 'sqlite_open'; + + $this->handler = $func($this->options['db']); + } + + /** + * 获取实际的缓存标识 + * @access public + * @param string $name 缓存名 + * @return string + */ + protected function getCacheKey($name) + { + return $this->options['prefix'] . sqlite_escape_string($name); + } + + /** + * 判断缓存 + * @access public + * @param string $name 缓存变量名 + * @return bool + */ + public function has($name) + { + $name = $this->getCacheKey($name); + + $sql = 'SELECT value FROM ' . $this->options['table'] . ' WHERE var=\'' . $name . '\' AND (expire=0 OR expire >' . time() . ') LIMIT 1'; + $result = sqlite_query($this->handler, $sql); + + return sqlite_num_rows($result); + } + + /** + * 读取缓存 + * @access public + * @param string $name 缓存变量名 + * @param mixed $default 默认值 + * @return mixed + */ + public function get($name, $default = false) + { + $this->readTimes++; + + $name = $this->getCacheKey($name); + + $sql = 'SELECT value FROM ' . $this->options['table'] . ' WHERE var=\'' . $name . '\' AND (expire=0 OR expire >' . time() . ') LIMIT 1'; + + $result = sqlite_query($this->handler, $sql); + + if (sqlite_num_rows($result)) { + $content = sqlite_fetch_single($result); + if (function_exists('gzcompress')) { + //启用数据压缩 + $content = gzuncompress($content); + } + + return $this->unserialize($content); + } + + return $default; + } + + /** + * 写入缓存 + * @access public + * @param string $name 缓存变量名 + * @param mixed $value 存储数据 + * @param integer|\DateTime $expire 有效时间(秒) + * @return boolean + */ + public function set($name, $value, $expire = null) + { + $this->writeTimes++; + + $name = $this->getCacheKey($name); + + $value = sqlite_escape_string($this->serialize($value)); + + if (is_null($expire)) { + $expire = $this->options['expire']; + } + + if ($expire instanceof \DateTime) { + $expire = $expire->getTimestamp(); + } else { + $expire = (0 == $expire) ? 0 : (time() + $expire); //缓存有效期为0表示永久缓存 + } + + if (function_exists('gzcompress')) { + //数据压缩 + $value = gzcompress($value, 3); + } + + if ($this->tag) { + $tag = $this->tag; + $this->tag = null; + } else { + $tag = ''; + } + + $sql = 'REPLACE INTO ' . $this->options['table'] . ' (var, value, expire, tag) VALUES (\'' . $name . '\', \'' . $value . '\', \'' . $expire . '\', \'' . $tag . '\')'; + + if (sqlite_query($this->handler, $sql)) { + return true; + } + + return false; + } + + /** + * 自增缓存(针对数值缓存) + * @access public + * @param string $name 缓存变量名 + * @param int $step 步长 + * @return false|int + */ + public function inc($name, $step = 1) + { + if ($this->has($name)) { + $value = $this->get($name) + $step; + } else { + $value = $step; + } + + return $this->set($name, $value, 0) ? $value : false; + } + + /** + * 自减缓存(针对数值缓存) + * @access public + * @param string $name 缓存变量名 + * @param int $step 步长 + * @return false|int + */ + public function dec($name, $step = 1) + { + if ($this->has($name)) { + $value = $this->get($name) - $step; + } else { + $value = -$step; + } + + return $this->set($name, $value, 0) ? $value : false; + } + + /** + * 删除缓存 + * @access public + * @param string $name 缓存变量名 + * @return boolean + */ + public function rm($name) + { + $this->writeTimes++; + + $name = $this->getCacheKey($name); + + $sql = 'DELETE FROM ' . $this->options['table'] . ' WHERE var=\'' . $name . '\''; + sqlite_query($this->handler, $sql); + + return true; + } + + /** + * 清除缓存 + * @access public + * @param string $tag 标签名 + * @return boolean + */ + public function clear($tag = null) + { + if ($tag) { + $name = sqlite_escape_string($tag); + $sql = 'DELETE FROM ' . $this->options['table'] . ' WHERE tag=\'' . $name . '\''; + sqlite_query($this->handler, $sql); + return true; + } + + $this->writeTimes++; + + $sql = 'DELETE FROM ' . $this->options['table']; + + sqlite_query($this->handler, $sql); + + return true; + } +} diff --git a/tp5/thinkphp/library/think/cache/driver/Wincache.php b/tp5/thinkphp/library/think/cache/driver/Wincache.php new file mode 100644 index 0000000..10966e7 --- /dev/null +++ b/tp5/thinkphp/library/think/cache/driver/Wincache.php @@ -0,0 +1,174 @@ + +// +---------------------------------------------------------------------- + +namespace think\cache\driver; + +use think\cache\Driver; + +/** + * Wincache缓存驱动 + * @author liu21st + */ +class Wincache extends Driver +{ + protected $options = [ + 'prefix' => '', + 'expire' => 0, + 'serialize' => true, + ]; + + /** + * 架构函数 + * @access public + * @param array $options 缓存参数 + * @throws \BadFunctionCallException + */ + public function __construct($options = []) + { + if (!function_exists('wincache_ucache_info')) { + throw new \BadFunctionCallException('not support: WinCache'); + } + + if (!empty($options)) { + $this->options = array_merge($this->options, $options); + } + } + + /** + * 判断缓存 + * @access public + * @param string $name 缓存变量名 + * @return bool + */ + public function has($name) + { + $this->readTimes++; + + $key = $this->getCacheKey($name); + + return wincache_ucache_exists($key); + } + + /** + * 读取缓存 + * @access public + * @param string $name 缓存变量名 + * @param mixed $default 默认值 + * @return mixed + */ + public function get($name, $default = false) + { + $this->readTimes++; + + $key = $this->getCacheKey($name); + + return wincache_ucache_exists($key) ? $this->unserialize(wincache_ucache_get($key)) : $default; + } + + /** + * 写入缓存 + * @access public + * @param string $name 缓存变量名 + * @param mixed $value 存储数据 + * @param integer|\DateTime $expire 有效时间(秒) + * @return boolean + */ + public function set($name, $value, $expire = null) + { + $this->writeTimes++; + + if (is_null($expire)) { + $expire = $this->options['expire']; + } + + $key = $this->getCacheKey($name); + $expire = $this->getExpireTime($expire); + $value = $this->serialize($value); + + if ($this->tag && !$this->has($name)) { + $first = true; + } + + if (wincache_ucache_set($key, $value, $expire)) { + isset($first) && $this->setTagItem($key); + return true; + } + + return false; + } + + /** + * 自增缓存(针对数值缓存) + * @access public + * @param string $name 缓存变量名 + * @param int $step 步长 + * @return false|int + */ + public function inc($name, $step = 1) + { + $this->writeTimes++; + + $key = $this->getCacheKey($name); + + return wincache_ucache_inc($key, $step); + } + + /** + * 自减缓存(针对数值缓存) + * @access public + * @param string $name 缓存变量名 + * @param int $step 步长 + * @return false|int + */ + public function dec($name, $step = 1) + { + $this->writeTimes++; + + $key = $this->getCacheKey($name); + + return wincache_ucache_dec($key, $step); + } + + /** + * 删除缓存 + * @access public + * @param string $name 缓存变量名 + * @return boolean + */ + public function rm($name) + { + $this->writeTimes++; + + return wincache_ucache_delete($this->getCacheKey($name)); + } + + /** + * 清除缓存 + * @access public + * @param string $tag 标签名 + * @return boolean + */ + public function clear($tag = null) + { + if ($tag) { + $keys = $this->getTagItem($tag); + foreach ($keys as $key) { + wincache_ucache_delete($key); + } + $this->rm('tag_' . md5($tag)); + return true; + } else { + $this->writeTimes++; + return wincache_ucache_clear(); + } + } + +} diff --git a/tp5/thinkphp/library/think/cache/driver/Xcache.php b/tp5/thinkphp/library/think/cache/driver/Xcache.php new file mode 100644 index 0000000..6d1bf3f --- /dev/null +++ b/tp5/thinkphp/library/think/cache/driver/Xcache.php @@ -0,0 +1,177 @@ + +// +---------------------------------------------------------------------- + +namespace think\cache\driver; + +use think\cache\Driver; + +/** + * Xcache缓存驱动 + * @author liu21st + */ +class Xcache extends Driver +{ + protected $options = [ + 'prefix' => '', + 'expire' => 0, + 'serialize' => true, + ]; + + /** + * 架构函数 + * @access public + * @param array $options 缓存参数 + * @throws \BadFunctionCallException + */ + public function __construct($options = []) + { + if (!function_exists('xcache_info')) { + throw new \BadFunctionCallException('not support: Xcache'); + } + + if (!empty($options)) { + $this->options = array_merge($this->options, $options); + } + } + + /** + * 判断缓存 + * @access public + * @param string $name 缓存变量名 + * @return bool + */ + public function has($name) + { + $key = $this->getCacheKey($name); + + return xcache_isset($key); + } + + /** + * 读取缓存 + * @access public + * @param string $name 缓存变量名 + * @param mixed $default 默认值 + * @return mixed + */ + public function get($name, $default = false) + { + $this->readTimes++; + + $key = $this->getCacheKey($name); + + return xcache_isset($key) ? $this->unserialize(xcache_get($key)) : $default; + } + + /** + * 写入缓存 + * @access public + * @param string $name 缓存变量名 + * @param mixed $value 存储数据 + * @param integer|\DateTime $expire 有效时间(秒) + * @return boolean + */ + public function set($name, $value, $expire = null) + { + $this->writeTimes++; + + if (is_null($expire)) { + $expire = $this->options['expire']; + } + + if ($this->tag && !$this->has($name)) { + $first = true; + } + + $key = $this->getCacheKey($name); + $expire = $this->getExpireTime($expire); + $value = $this->serialize($value); + + if (xcache_set($key, $value, $expire)) { + isset($first) && $this->setTagItem($key); + return true; + } + + return false; + } + + /** + * 自增缓存(针对数值缓存) + * @access public + * @param string $name 缓存变量名 + * @param int $step 步长 + * @return false|int + */ + public function inc($name, $step = 1) + { + $this->writeTimes++; + + $key = $this->getCacheKey($name); + + return xcache_inc($key, $step); + } + + /** + * 自减缓存(针对数值缓存) + * @access public + * @param string $name 缓存变量名 + * @param int $step 步长 + * @return false|int + */ + public function dec($name, $step = 1) + { + $this->writeTimes++; + + $key = $this->getCacheKey($name); + + return xcache_dec($key, $step); + } + + /** + * 删除缓存 + * @access public + * @param string $name 缓存变量名 + * @return boolean + */ + public function rm($name) + { + $this->writeTimes++; + + return xcache_unset($this->getCacheKey($name)); + } + + /** + * 清除缓存 + * @access public + * @param string $tag 标签名 + * @return boolean + */ + public function clear($tag = null) + { + if ($tag) { + // 指定标签清除 + $keys = $this->getTagItem($tag); + foreach ($keys as $key) { + xcache_unset($key); + } + $this->rm('tag_' . md5($tag)); + return true; + } + + $this->writeTimes++; + + if (function_exists('xcache_unset_by_prefix')) { + return xcache_unset_by_prefix($this->options['prefix']); + } else { + return false; + } + } +} diff --git a/tp5/thinkphp/library/think/config/driver/Ini.php b/tp5/thinkphp/library/think/config/driver/Ini.php new file mode 100644 index 0000000..bcd12b6 --- /dev/null +++ b/tp5/thinkphp/library/think/config/driver/Ini.php @@ -0,0 +1,24 @@ + +// +---------------------------------------------------------------------- + +namespace think\config\driver; + +class Ini +{ + public function parse($config) + { + if (is_file($config)) { + return parse_ini_file($config, true); + } else { + return parse_ini_string($config, true); + } + } +} diff --git a/tp5/thinkphp/library/think/config/driver/Json.php b/tp5/thinkphp/library/think/config/driver/Json.php new file mode 100644 index 0000000..808bfff --- /dev/null +++ b/tp5/thinkphp/library/think/config/driver/Json.php @@ -0,0 +1,26 @@ + +// +---------------------------------------------------------------------- + +namespace think\config\driver; + +class Json +{ + public function parse($config) + { + if (is_file($config)) { + $config = file_get_contents($config); + } + + $result = json_decode($config, true); + + return $result; + } +} diff --git a/tp5/thinkphp/library/think/config/driver/Xml.php b/tp5/thinkphp/library/think/config/driver/Xml.php new file mode 100644 index 0000000..b149b57 --- /dev/null +++ b/tp5/thinkphp/library/think/config/driver/Xml.php @@ -0,0 +1,33 @@ + +// +---------------------------------------------------------------------- + +namespace think\config\driver; + +class Xml +{ + public function parse($config) + { + if (is_file($config)) { + $content = simplexml_load_file($config); + } else { + $content = simplexml_load_string($config); + } + + $result = (array) $content; + foreach ($result as $key => $val) { + if (is_object($val)) { + $result[$key] = (array) $val; + } + } + + return $result; + } +} diff --git a/tp5/thinkphp/library/think/console/Command.php b/tp5/thinkphp/library/think/console/Command.php new file mode 100644 index 0000000..d0caad2 --- /dev/null +++ b/tp5/thinkphp/library/think/console/Command.php @@ -0,0 +1,470 @@ + +// +---------------------------------------------------------------------- + +namespace think\console; + +use think\Console; +use think\console\input\Argument; +use think\console\input\Definition; +use think\console\input\Option; + +class Command +{ + + /** @var Console */ + private $console; + private $name; + private $aliases = []; + private $definition; + private $help; + private $description; + private $ignoreValidationErrors = false; + private $consoleDefinitionMerged = false; + private $consoleDefinitionMergedWithArgs = false; + private $code; + private $synopsis = []; + private $usages = []; + + /** @var Input */ + protected $input; + + /** @var Output */ + protected $output; + + /** + * 构造方法 + * @param string|null $name 命令名称,如果没有设置则比如在 configure() 里设置 + * @throws \LogicException + * @api + */ + public function __construct($name = null) + { + $this->definition = new Definition(); + + if (null !== $name) { + $this->setName($name); + } + + $this->configure(); + + if (!$this->name) { + throw new \LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_class($this))); + } + } + + /** + * 忽略验证错误 + */ + public function ignoreValidationErrors() + { + $this->ignoreValidationErrors = true; + } + + /** + * 设置控制台 + * @param Console $console + */ + public function setConsole(Console $console = null) + { + $this->console = $console; + } + + /** + * 获取控制台 + * @return Console + * @api + */ + public function getConsole() + { + return $this->console; + } + + /** + * 是否有效 + * @return bool + */ + public function isEnabled() + { + return true; + } + + /** + * 配置指令 + */ + protected function configure() + { + } + + /** + * 执行指令 + * @param Input $input + * @param Output $output + * @return null|int + * @throws \LogicException + * @see setCode() + */ + protected function execute(Input $input, Output $output) + { + throw new \LogicException('You must override the execute() method in the concrete command class.'); + } + + /** + * 用户验证 + * @param Input $input + * @param Output $output + */ + protected function interact(Input $input, Output $output) + { + } + + /** + * 初始化 + * @param Input $input An InputInterface instance + * @param Output $output An OutputInterface instance + */ + protected function initialize(Input $input, Output $output) + { + } + + /** + * 执行 + * @param Input $input + * @param Output $output + * @return int + * @throws \Exception + * @see setCode() + * @see execute() + */ + public function run(Input $input, Output $output) + { + $this->input = $input; + $this->output = $output; + + $this->getSynopsis(true); + $this->getSynopsis(false); + + $this->mergeConsoleDefinition(); + + try { + $input->bind($this->definition); + } catch (\Exception $e) { + if (!$this->ignoreValidationErrors) { + throw $e; + } + } + + $this->initialize($input, $output); + + if ($input->isInteractive()) { + $this->interact($input, $output); + } + + $input->validate(); + + if ($this->code) { + $statusCode = call_user_func($this->code, $input, $output); + } else { + $statusCode = $this->execute($input, $output); + } + + return is_numeric($statusCode) ? (int) $statusCode : 0; + } + + /** + * 设置执行代码 + * @param callable $code callable(InputInterface $input, OutputInterface $output) + * @return Command + * @throws \InvalidArgumentException + * @see execute() + */ + public function setCode(callable $code) + { + if (!is_callable($code)) { + throw new \InvalidArgumentException('Invalid callable provided to Command::setCode.'); + } + + if (PHP_VERSION_ID >= 50400 && $code instanceof \Closure) { + $r = new \ReflectionFunction($code); + if (null === $r->getClosureThis()) { + $code = \Closure::bind($code, $this); + } + } + + $this->code = $code; + + return $this; + } + + /** + * 合并参数定义 + * @param bool $mergeArgs + */ + public function mergeConsoleDefinition($mergeArgs = true) + { + if (null === $this->console + || (true === $this->consoleDefinitionMerged + && ($this->consoleDefinitionMergedWithArgs || !$mergeArgs)) + ) { + return; + } + + if ($mergeArgs) { + $currentArguments = $this->definition->getArguments(); + $this->definition->setArguments($this->console->getDefinition()->getArguments()); + $this->definition->addArguments($currentArguments); + } + + $this->definition->addOptions($this->console->getDefinition()->getOptions()); + + $this->consoleDefinitionMerged = true; + if ($mergeArgs) { + $this->consoleDefinitionMergedWithArgs = true; + } + } + + /** + * 设置参数定义 + * @param array|Definition $definition + * @return Command + * @api + */ + public function setDefinition($definition) + { + if ($definition instanceof Definition) { + $this->definition = $definition; + } else { + $this->definition->setDefinition($definition); + } + + $this->consoleDefinitionMerged = false; + + return $this; + } + + /** + * 获取参数定义 + * @return Definition + * @api + */ + public function getDefinition() + { + return $this->definition; + } + + /** + * 获取当前指令的参数定义 + * @return Definition + */ + public function getNativeDefinition() + { + return $this->getDefinition(); + } + + /** + * 添加参数 + * @param string $name 名称 + * @param int $mode 类型 + * @param string $description 描述 + * @param mixed $default 默认值 + * @return Command + */ + public function addArgument($name, $mode = null, $description = '', $default = null) + { + $this->definition->addArgument(new Argument($name, $mode, $description, $default)); + + return $this; + } + + /** + * 添加选项 + * @param string $name 选项名称 + * @param string $shortcut 别名 + * @param int $mode 类型 + * @param string $description 描述 + * @param mixed $default 默认值 + * @return Command + */ + public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null) + { + $this->definition->addOption(new Option($name, $shortcut, $mode, $description, $default)); + + return $this; + } + + /** + * 设置指令名称 + * @param string $name + * @return Command + * @throws \InvalidArgumentException + */ + public function setName($name) + { + $this->validateName($name); + + $this->name = $name; + + return $this; + } + + /** + * 获取指令名称 + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * 设置描述 + * @param string $description + * @return Command + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * 获取描述 + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * 设置帮助信息 + * @param string $help + * @return Command + */ + public function setHelp($help) + { + $this->help = $help; + + return $this; + } + + /** + * 获取帮助信息 + * @return string + */ + public function getHelp() + { + return $this->help; + } + + /** + * 描述信息 + * @return string + */ + public function getProcessedHelp() + { + $name = $this->name; + + $placeholders = [ + '%command.name%', + '%command.full_name%', + ]; + $replacements = [ + $name, + $_SERVER['PHP_SELF'] . ' ' . $name, + ]; + + return str_replace($placeholders, $replacements, $this->getHelp()); + } + + /** + * 设置别名 + * @param string[] $aliases + * @return Command + * @throws \InvalidArgumentException + */ + public function setAliases($aliases) + { + if (!is_array($aliases) && !$aliases instanceof \Traversable) { + throw new \InvalidArgumentException('$aliases must be an array or an instance of \Traversable'); + } + + foreach ($aliases as $alias) { + $this->validateName($alias); + } + + $this->aliases = $aliases; + + return $this; + } + + /** + * 获取别名 + * @return array + */ + public function getAliases() + { + return $this->aliases; + } + + /** + * 获取简介 + * @param bool $short 是否简单的 + * @return string + */ + public function getSynopsis($short = false) + { + $key = $short ? 'short' : 'long'; + + if (!isset($this->synopsis[$key])) { + $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short))); + } + + return $this->synopsis[$key]; + } + + /** + * 添加用法介绍 + * @param string $usage + * @return $this + */ + public function addUsage($usage) + { + if (0 !== strpos($usage, $this->name)) { + $usage = sprintf('%s %s', $this->name, $usage); + } + + $this->usages[] = $usage; + + return $this; + } + + /** + * 获取用法介绍 + * @return array + */ + public function getUsages() + { + return $this->usages; + } + + /** + * 验证指令名称 + * @param string $name + * @throws \InvalidArgumentException + */ + private function validateName($name) + { + if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) { + throw new \InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name)); + } + } +} diff --git a/tp5/thinkphp/library/think/console/Input.php b/tp5/thinkphp/library/think/console/Input.php new file mode 100644 index 0000000..2482dfd --- /dev/null +++ b/tp5/thinkphp/library/think/console/Input.php @@ -0,0 +1,464 @@ + +// +---------------------------------------------------------------------- + +namespace think\console; + +use think\console\input\Argument; +use think\console\input\Definition; +use think\console\input\Option; + +class Input +{ + + /** + * @var Definition + */ + protected $definition; + + /** + * @var Option[] + */ + protected $options = []; + + /** + * @var Argument[] + */ + protected $arguments = []; + + protected $interactive = true; + + private $tokens; + private $parsed; + + public function __construct($argv = null) + { + if (null === $argv) { + $argv = $_SERVER['argv']; + // 去除命令名 + array_shift($argv); + } + + $this->tokens = $argv; + + $this->definition = new Definition(); + } + + protected function setTokens(array $tokens) + { + $this->tokens = $tokens; + } + + /** + * 绑定实例 + * @param Definition $definition A InputDefinition instance + */ + public function bind(Definition $definition) + { + $this->arguments = []; + $this->options = []; + $this->definition = $definition; + + $this->parse(); + } + + /** + * 解析参数 + */ + protected function parse() + { + $parseOptions = true; + $this->parsed = $this->tokens; + while (null !== $token = array_shift($this->parsed)) { + if ($parseOptions && '' == $token) { + $this->parseArgument($token); + } elseif ($parseOptions && '--' == $token) { + $parseOptions = false; + } elseif ($parseOptions && 0 === strpos($token, '--')) { + $this->parseLongOption($token); + } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) { + $this->parseShortOption($token); + } else { + $this->parseArgument($token); + } + } + } + + /** + * 解析短选项 + * @param string $token 当前的指令. + */ + private function parseShortOption($token) + { + $name = substr($token, 1); + + if (strlen($name) > 1) { + if ($this->definition->hasShortcut($name[0]) + && $this->definition->getOptionForShortcut($name[0])->acceptValue() + ) { + $this->addShortOption($name[0], substr($name, 1)); + } else { + $this->parseShortOptionSet($name); + } + } else { + $this->addShortOption($name, null); + } + } + + /** + * 解析短选项 + * @param string $name 当前指令 + * @throws \RuntimeException + */ + private function parseShortOptionSet($name) + { + $len = strlen($name); + for ($i = 0; $i < $len; ++$i) { + if (!$this->definition->hasShortcut($name[$i])) { + throw new \RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i])); + } + + $option = $this->definition->getOptionForShortcut($name[$i]); + if ($option->acceptValue()) { + $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1)); + + break; + } else { + $this->addLongOption($option->getName(), null); + } + } + } + + /** + * 解析完整选项 + * @param string $token 当前指令 + */ + private function parseLongOption($token) + { + $name = substr($token, 2); + + if (false !== $pos = strpos($name, '=')) { + $this->addLongOption(substr($name, 0, $pos), substr($name, $pos + 1)); + } else { + $this->addLongOption($name, null); + } + } + + /** + * 解析参数 + * @param string $token 当前指令 + * @throws \RuntimeException + */ + private function parseArgument($token) + { + $c = count($this->arguments); + + if ($this->definition->hasArgument($c)) { + $arg = $this->definition->getArgument($c); + + $this->arguments[$arg->getName()] = $arg->isArray() ? [$token] : $token; + + } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) { + $arg = $this->definition->getArgument($c - 1); + + $this->arguments[$arg->getName()][] = $token; + } else { + throw new \RuntimeException('Too many arguments.'); + } + } + + /** + * 添加一个短选项的值 + * @param string $shortcut 短名称 + * @param mixed $value 值 + * @throws \RuntimeException + */ + private function addShortOption($shortcut, $value) + { + if (!$this->definition->hasShortcut($shortcut)) { + throw new \RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut)); + } + + $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value); + } + + /** + * 添加一个完整选项的值 + * @param string $name 选项名 + * @param mixed $value 值 + * @throws \RuntimeException + */ + private function addLongOption($name, $value) + { + if (!$this->definition->hasOption($name)) { + throw new \RuntimeException(sprintf('The "--%s" option does not exist.', $name)); + } + + $option = $this->definition->getOption($name); + + if (false === $value) { + $value = null; + } + + if (null !== $value && !$option->acceptValue()) { + throw new \RuntimeException(sprintf('The "--%s" option does not accept a value.', $name, $value)); + } + + if (null === $value && $option->acceptValue() && count($this->parsed)) { + $next = array_shift($this->parsed); + if (isset($next[0]) && '-' !== $next[0]) { + $value = $next; + } elseif (empty($next)) { + $value = ''; + } else { + array_unshift($this->parsed, $next); + } + } + + if (null === $value) { + if ($option->isValueRequired()) { + throw new \RuntimeException(sprintf('The "--%s" option requires a value.', $name)); + } + + if (!$option->isArray()) { + $value = $option->isValueOptional() ? $option->getDefault() : true; + } + } + + if ($option->isArray()) { + $this->options[$name][] = $value; + } else { + $this->options[$name] = $value; + } + } + + /** + * 获取第一个参数 + * @return string|null + */ + public function getFirstArgument() + { + foreach ($this->tokens as $token) { + if ($token && '-' === $token[0]) { + continue; + } + + return $token; + } + return; + } + + /** + * 检查原始参数是否包含某个值 + * @param string|array $values 需要检查的值 + * @return bool + */ + public function hasParameterOption($values) + { + $values = (array) $values; + + foreach ($this->tokens as $token) { + foreach ($values as $value) { + if ($token === $value || 0 === strpos($token, $value . '=')) { + return true; + } + } + } + + return false; + } + + /** + * 获取原始选项的值 + * @param string|array $values 需要检查的值 + * @param mixed $default 默认值 + * @return mixed The option value + */ + public function getParameterOption($values, $default = false) + { + $values = (array) $values; + $tokens = $this->tokens; + + while (0 < count($tokens)) { + $token = array_shift($tokens); + + foreach ($values as $value) { + if ($token === $value || 0 === strpos($token, $value . '=')) { + if (false !== $pos = strpos($token, '=')) { + return substr($token, $pos + 1); + } + + return array_shift($tokens); + } + } + } + + return $default; + } + + /** + * 验证输入 + * @throws \RuntimeException + */ + public function validate() + { + if (count($this->arguments) < $this->definition->getArgumentRequiredCount()) { + throw new \RuntimeException('Not enough arguments.'); + } + } + + /** + * 检查输入是否是交互的 + * @return bool + */ + public function isInteractive() + { + return $this->interactive; + } + + /** + * 设置输入的交互 + * @param bool + */ + public function setInteractive($interactive) + { + $this->interactive = (bool) $interactive; + } + + /** + * 获取所有的参数 + * @return Argument[] + */ + public function getArguments() + { + return array_merge($this->definition->getArgumentDefaults(), $this->arguments); + } + + /** + * 根据名称获取参数 + * @param string $name 参数名 + * @return mixed + * @throws \InvalidArgumentException + */ + public function getArgument($name) + { + if (!$this->definition->hasArgument($name)) { + throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); + } + + return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name) + ->getDefault(); + } + + /** + * 设置参数的值 + * @param string $name 参数名 + * @param string $value 值 + * @throws \InvalidArgumentException + */ + public function setArgument($name, $value) + { + if (!$this->definition->hasArgument($name)) { + throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); + } + + $this->arguments[$name] = $value; + } + + /** + * 检查是否存在某个参数 + * @param string|int $name 参数名或位置 + * @return bool + */ + public function hasArgument($name) + { + return $this->definition->hasArgument($name); + } + + /** + * 获取所有的选项 + * @return Option[] + */ + public function getOptions() + { + return array_merge($this->definition->getOptionDefaults(), $this->options); + } + + /** + * 获取选项值 + * @param string $name 选项名称 + * @return mixed + * @throws \InvalidArgumentException + */ + public function getOption($name) + { + if (!$this->definition->hasOption($name)) { + throw new \InvalidArgumentException(sprintf('The "%s" option does not exist.', $name)); + } + + return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault(); + } + + /** + * 设置选项值 + * @param string $name 选项名 + * @param string|bool $value 值 + * @throws \InvalidArgumentException + */ + public function setOption($name, $value) + { + if (!$this->definition->hasOption($name)) { + throw new \InvalidArgumentException(sprintf('The "%s" option does not exist.', $name)); + } + + $this->options[$name] = $value; + } + + /** + * 是否有某个选项 + * @param string $name 选项名 + * @return bool + */ + public function hasOption($name) + { + return $this->definition->hasOption($name) && isset($this->options[$name]); + } + + /** + * 转义指令 + * @param string $token + * @return string + */ + public function escapeToken($token) + { + return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token); + } + + /** + * 返回传递给命令的参数的字符串 + * @return string + */ + public function __toString() + { + $tokens = array_map(function ($token) { + if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) { + return $match[1] . $this->escapeToken($match[2]); + } + + if ($token && '-' !== $token[0]) { + return $this->escapeToken($token); + } + + return $token; + }, $this->tokens); + + return implode(' ', $tokens); + } +} diff --git a/tp5/thinkphp/library/think/console/LICENSE b/tp5/thinkphp/library/think/console/LICENSE new file mode 100644 index 0000000..0abe056 --- /dev/null +++ b/tp5/thinkphp/library/think/console/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2016 Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/tp5/thinkphp/library/think/console/Output.php b/tp5/thinkphp/library/think/console/Output.php new file mode 100644 index 0000000..65dc9fb --- /dev/null +++ b/tp5/thinkphp/library/think/console/Output.php @@ -0,0 +1,222 @@ + +// +---------------------------------------------------------------------- + +namespace think\console; + +use Exception; +use think\console\output\Ask; +use think\console\output\Descriptor; +use think\console\output\driver\Buffer; +use think\console\output\driver\Console; +use think\console\output\driver\Nothing; +use think\console\output\Question; +use think\console\output\question\Choice; +use think\console\output\question\Confirmation; + +/** + * Class Output + * @package think\console + * + * @see \think\console\output\driver\Console::setDecorated + * @method void setDecorated($decorated) + * + * @see \think\console\output\driver\Buffer::fetch + * @method string fetch() + * + * @method void info($message) + * @method void error($message) + * @method void comment($message) + * @method void warning($message) + * @method void highlight($message) + * @method void question($message) + */ +class Output +{ + const VERBOSITY_QUIET = 0; + const VERBOSITY_NORMAL = 1; + const VERBOSITY_VERBOSE = 2; + const VERBOSITY_VERY_VERBOSE = 3; + const VERBOSITY_DEBUG = 4; + + const OUTPUT_NORMAL = 0; + const OUTPUT_RAW = 1; + const OUTPUT_PLAIN = 2; + + private $verbosity = self::VERBOSITY_NORMAL; + + /** @var Buffer|Console|Nothing */ + private $handle = null; + + protected $styles = [ + 'info', + 'error', + 'comment', + 'question', + 'highlight', + 'warning' + ]; + + public function __construct($driver = 'console') + { + $class = '\\think\\console\\output\\driver\\' . ucwords($driver); + + $this->handle = new $class($this); + } + + public function ask(Input $input, $question, $default = null, $validator = null) + { + $question = new Question($question, $default); + $question->setValidator($validator); + + return $this->askQuestion($input, $question); + } + + public function askHidden(Input $input, $question, $validator = null) + { + $question = new Question($question); + + $question->setHidden(true); + $question->setValidator($validator); + + return $this->askQuestion($input, $question); + } + + public function confirm(Input $input, $question, $default = true) + { + return $this->askQuestion($input, new Confirmation($question, $default)); + } + + /** + * {@inheritdoc} + */ + public function choice(Input $input, $question, array $choices, $default = null) + { + if (null !== $default) { + $values = array_flip($choices); + $default = $values[$default]; + } + + return $this->askQuestion($input, new Choice($question, $choices, $default)); + } + + protected function askQuestion(Input $input, Question $question) + { + $ask = new Ask($input, $this, $question); + $answer = $ask->run(); + + if ($input->isInteractive()) { + $this->newLine(); + } + + return $answer; + } + + protected function block($style, $message) + { + $this->writeln("<{$style}>{$message}"); + } + + /** + * 输出空行 + * @param int $count + */ + public function newLine($count = 1) + { + $this->write(str_repeat(PHP_EOL, $count)); + } + + /** + * 输出信息并换行 + * @param string $messages + * @param int $type + */ + public function writeln($messages, $type = self::OUTPUT_NORMAL) + { + $this->write($messages, true, $type); + } + + /** + * 输出信息 + * @param string $messages + * @param bool $newline + * @param int $type + */ + public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL) + { + $this->handle->write($messages, $newline, $type); + } + + public function renderException(\Exception $e) + { + $this->handle->renderException($e); + } + + /** + * {@inheritdoc} + */ + public function setVerbosity($level) + { + $this->verbosity = (int) $level; + } + + /** + * {@inheritdoc} + */ + public function getVerbosity() + { + return $this->verbosity; + } + + public function isQuiet() + { + return self::VERBOSITY_QUIET === $this->verbosity; + } + + public function isVerbose() + { + return self::VERBOSITY_VERBOSE <= $this->verbosity; + } + + public function isVeryVerbose() + { + return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity; + } + + public function isDebug() + { + return self::VERBOSITY_DEBUG <= $this->verbosity; + } + + public function describe($object, array $options = []) + { + $descriptor = new Descriptor(); + $options = array_merge([ + 'raw_text' => false, + ], $options); + + $descriptor->describe($this, $object, $options); + } + + public function __call($method, $args) + { + if (in_array($method, $this->styles)) { + array_unshift($args, $method); + return call_user_func_array([$this, 'block'], $args); + } + + if ($this->handle && method_exists($this->handle, $method)) { + return call_user_func_array([$this->handle, $method], $args); + } else { + throw new Exception('method not exists:' . __CLASS__ . '->' . $method); + } + } + +} diff --git a/tp5/thinkphp/library/think/console/bin/README.md b/tp5/thinkphp/library/think/console/bin/README.md new file mode 100644 index 0000000..9acc52f --- /dev/null +++ b/tp5/thinkphp/library/think/console/bin/README.md @@ -0,0 +1 @@ +console 工具使用 hiddeninput.exe 在 windows 上隐藏密码输入,该二进制文件由第三方提供,相关源码和其他细节可以在 [Hidden Input](https://github.com/Seldaek/hidden-input) 找到。 diff --git a/tp5/thinkphp/library/think/console/bin/hiddeninput.exe b/tp5/thinkphp/library/think/console/bin/hiddeninput.exe new file mode 100644 index 0000000..c8cf65e Binary files /dev/null and b/tp5/thinkphp/library/think/console/bin/hiddeninput.exe differ diff --git a/tp5/thinkphp/library/think/console/command/Build.php b/tp5/thinkphp/library/think/console/command/Build.php new file mode 100644 index 0000000..2b83199 --- /dev/null +++ b/tp5/thinkphp/library/think/console/command/Build.php @@ -0,0 +1,60 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\command; + +use think\console\Command; +use think\console\Input; +use think\console\input\Option; +use think\console\Output; +use think\facade\App; +use think\facade\Build as AppBuild; + +class Build extends Command +{ + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('build') + ->setDefinition([ + new Option('config', null, Option::VALUE_OPTIONAL, "build.php path"), + new Option('module', null, Option::VALUE_OPTIONAL, "module name"), + ]) + ->setDescription('Build Application Dirs'); + } + + protected function execute(Input $input, Output $output) + { + if ($input->hasOption('module')) { + AppBuild::module($input->getOption('module')); + $output->writeln("Successed"); + return; + } + + if ($input->hasOption('config')) { + $build = include $input->getOption('config'); + } else { + $build = include App::getAppPath() . 'build.php'; + } + + if (empty($build)) { + $output->writeln("Build Config Is Empty"); + return; + } + + AppBuild::run($build); + $output->writeln("Successed"); + + } +} diff --git a/tp5/thinkphp/library/think/console/command/Clear.php b/tp5/thinkphp/library/think/console/command/Clear.php new file mode 100644 index 0000000..4ca0c4f --- /dev/null +++ b/tp5/thinkphp/library/think/console/command/Clear.php @@ -0,0 +1,45 @@ + +// +---------------------------------------------------------------------- +namespace think\console\command; + +use think\console\Command; +use think\console\Input; +use think\console\input\Option; +use think\console\Output; +use think\facade\App; + +class Clear extends Command +{ + protected function configure() + { + // 指令配置 + $this + ->setName('clear') + ->addOption('path', 'd', Option::VALUE_OPTIONAL, 'path to clear', null) + ->setDescription('Clear runtime file'); + } + + protected function execute(Input $input, Output $output) + { + $path = $input->getOption('path') ?: App::getRuntimePath(); + $files = scandir($path); + if ($files) { + foreach ($files as $file) { + if ('.' != $file && '..' != $file && is_dir($path . $file)) { + array_map('unlink', glob($path . $file . '/*.*')); + } elseif ('.gitignore' != $file && is_file($path . $file)) { + unlink($path . $file); + } + } + } + $output->writeln("Clear Successed"); + } +} diff --git a/tp5/thinkphp/library/think/console/command/Help.php b/tp5/thinkphp/library/think/console/command/Help.php new file mode 100644 index 0000000..bae2c65 --- /dev/null +++ b/tp5/thinkphp/library/think/console/command/Help.php @@ -0,0 +1,69 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\command; + +use think\console\Command; +use think\console\Input; +use think\console\input\Argument as InputArgument; +use think\console\input\Option as InputOption; +use think\console\Output; + +class Help extends Command +{ + + private $command; + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->ignoreValidationErrors(); + + $this->setName('help')->setDefinition([ + new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'), + new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'), + ])->setDescription('Displays help for a command')->setHelp(<<%command.name% command displays help for a given command: + + php %command.full_name% list + +To display the list of available commands, please use the list command. +EOF + ); + } + + /** + * Sets the command. + * @param Command $command The command to set + */ + public function setCommand(Command $command) + { + $this->command = $command; + } + + /** + * {@inheritdoc} + */ + protected function execute(Input $input, Output $output) + { + if (null === $this->command) { + $this->command = $this->getConsole()->find($input->getArgument('command_name')); + } + + $output->describe($this->command, [ + 'raw_text' => $input->getOption('raw'), + ]); + + $this->command = null; + } +} diff --git a/tp5/thinkphp/library/think/console/command/Lists.php b/tp5/thinkphp/library/think/console/command/Lists.php new file mode 100644 index 0000000..084ddaa --- /dev/null +++ b/tp5/thinkphp/library/think/console/command/Lists.php @@ -0,0 +1,74 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\command; + +use think\console\Command; +use think\console\Input; +use think\console\Output; +use think\console\input\Argument as InputArgument; +use think\console\input\Option as InputOption; +use think\console\input\Definition as InputDefinition; + +class Lists extends Command +{ + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('list')->setDefinition($this->createDefinition())->setDescription('Lists commands')->setHelp(<<%command.name% command lists all commands: + + php %command.full_name% + +You can also display the commands for a specific namespace: + + php %command.full_name% test + +It's also possible to get raw list of commands (useful for embedding command runner): + + php %command.full_name% --raw +EOF + ); + } + + /** + * {@inheritdoc} + */ + public function getNativeDefinition() + { + return $this->createDefinition(); + } + + /** + * {@inheritdoc} + */ + protected function execute(Input $input, Output $output) + { + $output->describe($this->getConsole(), [ + 'raw_text' => $input->getOption('raw'), + 'namespace' => $input->getArgument('namespace'), + ]); + } + + /** + * {@inheritdoc} + */ + private function createDefinition() + { + return new InputDefinition([ + new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'), + new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list') + ]); + } +} diff --git a/tp5/thinkphp/library/think/console/command/Make.php b/tp5/thinkphp/library/think/console/command/Make.php new file mode 100644 index 0000000..3bdfc6b --- /dev/null +++ b/tp5/thinkphp/library/think/console/command/Make.php @@ -0,0 +1,111 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\command; + +use think\console\Command; +use think\console\Input; +use think\console\input\Argument; +use think\console\Output; +use think\facade\App; +use think\facade\Config; +use think\facade\Env; + +abstract class Make extends Command +{ + + protected $type; + + abstract protected function getStub(); + + protected function configure() + { + $this->addArgument('name', Argument::REQUIRED, "The name of the class"); + } + + protected function execute(Input $input, Output $output) + { + + $name = trim($input->getArgument('name')); + + $classname = $this->getClassName($name); + + $pathname = $this->getPathName($classname); + + if (is_file($pathname)) { + $output->writeln('' . $this->type . ' already exists!'); + return false; + } + + if (!is_dir(dirname($pathname))) { + mkdir(strtolower(dirname($pathname)), 0755, true); + } + + file_put_contents($pathname, $this->buildClass($classname)); + + $output->writeln('' . $this->type . ' created successfully.'); + + } + + protected function buildClass($name) + { + $stub = file_get_contents($this->getStub()); + + $namespace = trim(implode('\\', array_slice(explode('\\', $name), 0, -1)), '\\'); + + $class = str_replace($namespace . '\\', '', $name); + + return str_replace(['{%className%}', '{%namespace%}', '{%app_namespace%}'], [ + $class, + $namespace, + App::getNamespace(), + ], $stub); + + } + + protected function getPathName($name) + { + $name = str_replace(App::getNamespace() . '\\', '', $name); + + return Env::get('app_path') . ltrim(str_replace('\\', '/', $name), '/') . '.php'; + } + + protected function getClassName($name) + { + $appNamespace = App::getNamespace(); + + if (strpos($name, $appNamespace . '\\') !== false) { + return $name; + } + + if (Config::get('app_multi_module')) { + if (strpos($name, '/')) { + list($module, $name) = explode('/', $name, 2); + } else { + $module = 'common'; + } + } else { + $module = null; + } + + if (strpos($name, '/') !== false) { + $name = str_replace('/', '\\', $name); + } + + return $this->getNamespace($appNamespace, $module) . '\\' . $name; + } + + protected function getNamespace($appNamespace, $module) + { + return $module ? ($appNamespace . '\\' . $module) : $appNamespace; + } + +} diff --git a/tp5/thinkphp/library/think/console/command/make/Controller.php b/tp5/thinkphp/library/think/console/command/make/Controller.php new file mode 100644 index 0000000..d702bd1 --- /dev/null +++ b/tp5/thinkphp/library/think/console/command/make/Controller.php @@ -0,0 +1,50 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\command\make; + +use think\console\command\Make; +use think\console\input\Option; +use think\facade\Config; + +class Controller extends Make +{ + + protected $type = "Controller"; + + protected function configure() + { + parent::configure(); + $this->setName('make:controller') + ->addOption('plain', null, Option::VALUE_NONE, 'Generate an empty controller class.') + ->setDescription('Create a new resource controller class'); + } + + protected function getStub() + { + if ($this->input->getOption('plain')) { + return __DIR__ . '/stubs/controller.plain.stub'; + } + + return __DIR__ . '/stubs/controller.stub'; + } + + protected function getClassName($name) + { + return parent::getClassName($name) . (Config::get('controller_suffix') ? ucfirst(Config::get('url_controller_layer')) : ''); + } + + protected function getNamespace($appNamespace, $module) + { + return parent::getNamespace($appNamespace, $module) . '\controller'; + } + +} diff --git a/tp5/thinkphp/library/think/console/command/make/Model.php b/tp5/thinkphp/library/think/console/command/make/Model.php new file mode 100644 index 0000000..d4e9b5d --- /dev/null +++ b/tp5/thinkphp/library/think/console/command/make/Model.php @@ -0,0 +1,36 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\command\make; + +use think\console\command\Make; + +class Model extends Make +{ + protected $type = "Model"; + + protected function configure() + { + parent::configure(); + $this->setName('make:model') + ->setDescription('Create a new model class'); + } + + protected function getStub() + { + return __DIR__ . '/stubs/model.stub'; + } + + protected function getNamespace($appNamespace, $module) + { + return parent::getNamespace($appNamespace, $module) . '\model'; + } +} diff --git a/tp5/thinkphp/library/think/console/command/make/stubs/controller.plain.stub b/tp5/thinkphp/library/think/console/command/make/stubs/controller.plain.stub new file mode 100644 index 0000000..b7539dc --- /dev/null +++ b/tp5/thinkphp/library/think/console/command/make/stubs/controller.plain.stub @@ -0,0 +1,10 @@ + +// +---------------------------------------------------------------------- +namespace think\console\command\optimize; + +use think\console\Command; +use think\console\Input; +use think\console\Output; +use think\Container; + +class Autoload extends Command +{ + + protected function configure() + { + $this->setName('optimize:autoload') + ->setDescription('Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'); + } + + protected function execute(Input $input, Output $output) + { + + $classmapFile = <<getNamespace() . '\\' => realpath(rtrim($app->getAppPath())), + 'think\\' => $app->getAppPath() . 'library/think', + 'traits\\' => $app->getAppPath() . 'library/traits', + '' => realpath(rtrim($app->getRootPath() . 'extend')), + ]; + + krsort($namespacesToScan); + $classMap = []; + foreach ($namespacesToScan as $namespace => $dir) { + + if (!is_dir($dir)) { + continue; + } + + $namespaceFilter = '' === $namespace ? null : $namespace; + $classMap = $this->addClassMapCode($dir, $namespaceFilter, $classMap); + } + + ksort($classMap); + foreach ($classMap as $class => $code) { + $classmapFile .= ' ' . var_export($class, true) . ' => ' . $code; + } + $classmapFile .= "];\n"; + $runtimePath = $app->getRuntimePath(); + if (!is_dir($runtimePath)) { + @mkdir($runtimePath, 0755, true); + } + + file_put_contents($runtimePath . 'classmap.php', $classmapFile); + + $output->writeln('Succeed!'); + } + + protected function addClassMapCode($dir, $namespace, $classMap) + { + foreach ($this->createMap($dir, $namespace) as $class => $path) { + + $pathCode = $this->getPathCode($path) . ",\n"; + + if (!isset($classMap[$class])) { + $classMap[$class] = $pathCode; + } elseif ($classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class] . ' ' . $path, '\\', '/'))) { + $this->output->writeln( + 'Warning: Ambiguous class resolution, "' . $class . '"' . + ' was found in both "' . str_replace(["',\n"], [ + '', + ], $classMap[$class]) . '" and "' . $path . '", the first will be used.' + ); + } + } + return $classMap; + } + + protected function getPathCode($path) + { + $baseDir = ''; + $app = Container::get('app'); + $appPath = $this->normalizePath(realpath($app->getAppPath())); + $libPath = $this->normalizePath(realpath($app->getThinkPath() . 'library')); + $extendPath = $this->normalizePath(realpath($app->getRootPath() . 'extend')); + $path = $this->normalizePath($path); + + if (strpos($path, $libPath . '/') === 0) { + $path = substr($path, strlen($app->getThinkPath() . 'library')); + $baseDir = "'" . $libPath . "/'"; + } elseif (strpos($path, $appPath . '/') === 0) { + $path = substr($path, strlen($appPath) + 1); + $baseDir = "'" . $appPath . "/'"; + } elseif (strpos($path, $extendPath . '/') === 0) { + $path = substr($path, strlen($extendPath) + 1); + $baseDir = "'" . $extendPath . "/'"; + } + + if (false !== $path) { + $baseDir .= " . "; + } + + return $baseDir . ((false !== $path) ? var_export($path, true) : ""); + } + + protected function normalizePath($path) + { + $parts = []; + $path = strtr($path, '\\', '/'); + $prefix = ''; + $absolute = false; + + if (preg_match('{^([0-9a-z]+:(?://(?:[a-z]:)?)?)}i', $path, $match)) { + $prefix = $match[1]; + $path = substr($path, strlen($prefix)); + } + + if (substr($path, 0, 1) === '/') { + $absolute = true; + $path = substr($path, 1); + } + + $up = false; + foreach (explode('/', $path) as $chunk) { + if ('..' === $chunk && ($absolute || $up)) { + array_pop($parts); + $up = !(empty($parts) || '..' === end($parts)); + } elseif ('.' !== $chunk && '' !== $chunk) { + $parts[] = $chunk; + $up = '..' !== $chunk; + } + } + + return $prefix . ($absolute ? '/' : '') . implode('/', $parts); + } + + protected function createMap($path, $namespace = null) + { + if (is_string($path)) { + if (is_file($path)) { + $path = [new \SplFileInfo($path)]; + } elseif (is_dir($path)) { + + $objects = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path), \RecursiveIteratorIterator::SELF_FIRST); + + $path = []; + + /** @var \SplFileInfo $object */ + foreach ($objects as $object) { + if ($object->isFile() && $object->getExtension() == 'php') { + $path[] = $object; + } + } + } else { + throw new \RuntimeException( + 'Could not scan for classes inside "' . $path . + '" which does not appear to be a file nor a folder' + ); + } + } + + $map = []; + + /** @var \SplFileInfo $file */ + foreach ($path as $file) { + $filePath = $file->getRealPath(); + + if (pathinfo($filePath, PATHINFO_EXTENSION) != 'php') { + continue; + } + + $classes = $this->findClasses($filePath); + + foreach ($classes as $class) { + if (null !== $namespace && 0 !== strpos($class, $namespace)) { + continue; + } + + if (!isset($map[$class])) { + $map[$class] = $filePath; + } elseif ($map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class] . ' ' . $filePath, '\\', '/'))) { + $this->output->writeln( + 'Warning: Ambiguous class resolution, "' . $class . '"' . + ' was found in both "' . $map[$class] . '" and "' . $filePath . '", the first will be used.' + ); + } + } + } + + return $map; + } + + protected function findClasses($path) + { + $extraTypes = '|trait'; + + $contents = @php_strip_whitespace($path); + if (!$contents) { + if (!file_exists($path)) { + $message = 'File at "%s" does not exist, check your classmap definitions'; + } elseif (!is_readable($path)) { + $message = 'File at "%s" is not readable, check its permissions'; + } elseif ('' === trim(file_get_contents($path))) { + return []; + } else { + $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted'; + } + $error = error_get_last(); + if (isset($error['message'])) { + $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message']; + } + throw new \RuntimeException(sprintf($message, $path)); + } + + if (!preg_match('{\b(?:class|interface' . $extraTypes . ')\s}i', $contents)) { + return []; + } + + // strip heredocs/nowdocs + $contents = preg_replace('{<<<\s*(\'?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)\\2(?=\r\n|\n|\r|;)}s', 'null', $contents); + // strip strings + $contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents); + // strip leading non-php code if needed + if (substr($contents, 0, 2) !== '.+<\?}s', '?>'); + if (false !== $pos && false === strpos(substr($contents, $pos), '])(?Pclass|interface' . $extraTypes . ') \s++ (?P[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+) + | \b(?])(?Pnamespace) (?P\s++[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\s*+\\\\\s*+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+)? \s*+ [\{;] + ) + }ix', $contents, $matches); + + $classes = []; + $namespace = ''; + + for ($i = 0, $len = count($matches['type']); $i < $len; $i++) { + if (!empty($matches['ns'][$i])) { + $namespace = str_replace([' ', "\t", "\r", "\n"], '', $matches['nsname'][$i]) . '\\'; + } else { + $name = $matches['name'][$i]; + if (':' === $name[0]) { + $name = 'xhp' . substr(str_replace(['-', ':'], ['_', '__'], $name), 1); + } elseif ('enum' === $matches['type'][$i]) { + $name = rtrim($name, ':'); + } + $classes[] = ltrim($namespace . $name, '\\'); + } + } + + return $classes; + } + +} diff --git a/tp5/thinkphp/library/think/console/command/optimize/Config.php b/tp5/thinkphp/library/think/console/command/optimize/Config.php new file mode 100644 index 0000000..da45dc9 --- /dev/null +++ b/tp5/thinkphp/library/think/console/command/optimize/Config.php @@ -0,0 +1,97 @@ + +// +---------------------------------------------------------------------- +namespace think\console\command\optimize; + +use think\console\Command; +use think\console\Input; +use think\console\input\Argument; +use think\console\Output; +use think\Container; +use think\facade\App; + +class Config extends Command +{ + /** @var Output */ + protected $output; + + protected function configure() + { + $this->setName('optimize:config') + ->addArgument('module', Argument::OPTIONAL, 'Build module config cache .') + ->setDescription('Build config and common file cache.'); + } + + protected function execute(Input $input, Output $output) + { + if ($input->getArgument('module')) { + $module = $input->getArgument('module') . DIRECTORY_SEPARATOR; + } else { + $module = ''; + } + + $content = 'buildCacheContent($module); + $runtimePath = App::getRuntimePath(); + if (!is_dir($runtimePath . $module)) { + @mkdir($runtimePath . $module, 0755, true); + } + + file_put_contents($runtimePath . $module . 'init.php', $content); + + $output->writeln('Succeed!'); + } + + protected function buildCacheContent($module) + { + $content = '// This cache file is automatically generated at:' . date('Y-m-d H:i:s') . PHP_EOL; + $path = realpath(App::getAppPath() . $module) . DIRECTORY_SEPARATOR; + if ($module) { + $configPath = is_dir($path . 'config') ? $path . 'config' : App::getConfigPath() . $module; + } else { + $configPath = App::getConfigPath(); + } + $ext = App::getConfigExt(); + $config = Container::get('config'); + + $files = is_dir($configPath) ? scandir($configPath) : []; + + foreach ($files as $file) { + if ('.' . pathinfo($file, PATHINFO_EXTENSION) === $ext) { + $filename = $configPath . DIRECTORY_SEPARATOR . $file; + $config->load($filename, pathinfo($file, PATHINFO_FILENAME)); + } + } + + // 加载行为扩展文件 + if (is_file($path . 'tags.php')) { + $content .= PHP_EOL . '\think\facade\Hook::import(' . (var_export(include $path . 'tags.php' ?: [], true)) . ');' . PHP_EOL; + } + + // 加载公共文件 + if (is_file($path . 'common.php')) { + $common = substr(php_strip_whitespace($path . 'common.php'), 6); + if ($common) { + $content .= PHP_EOL . $common . PHP_EOL; + } + } + + if ('' == $module) { + $content .= PHP_EOL . substr(php_strip_whitespace(App::getThinkPath() . 'helper.php'), 6) . PHP_EOL; + } + + if (is_file($path . 'provider.php')) { + $content .= PHP_EOL . '\think\Container::getInstance()->bind(' . var_export(include $path . 'provider.php' ?: [], true) . ');' . PHP_EOL; + } + + $content .= PHP_EOL . '\think\facade\Config::set(' . var_export($config->get(), true) . ');' . PHP_EOL; + + return $content; + } +} diff --git a/tp5/thinkphp/library/think/console/command/optimize/Route.php b/tp5/thinkphp/library/think/console/command/optimize/Route.php new file mode 100644 index 0000000..0b18858 --- /dev/null +++ b/tp5/thinkphp/library/think/console/command/optimize/Route.php @@ -0,0 +1,64 @@ + +// +---------------------------------------------------------------------- +namespace think\console\command\optimize; + +use think\console\Command; +use think\console\Input; +use think\console\Output; +use think\Container; + +class Route extends Command +{ + /** @var Output */ + protected $output; + + protected function configure() + { + $this->setName('optimize:route') + ->setDescription('Build route cache.'); + } + + protected function execute(Input $input, Output $output) + { + file_put_contents(Container::get('app')->getRuntimePath() . 'route.php', $this->buildRouteCache()); + $output->writeln('Succeed!'); + } + + protected function buildRouteCache() + { + Container::get('route')->setName([]); + Container::get('config')->set('url_lazy_route', false); + // 路由检测 + $path = Container::get('app')->getRoutePath(); + + $files = is_dir($path) ? scandir($path) : []; + + foreach ($files as $file) { + if (strpos($file, '.php')) { + $filename = $path . DIRECTORY_SEPARATOR . $file; + // 导入路由配置 + $rules = include $filename; + if (is_array($rules)) { + Container::get('route')->import($rules); + } + } + } + + if (Container::get('config')->get('route_annotation')) { + include Container::get('build')->buildRoute(); + } + + $content = 'getName(), true) . ';'; + return $content; + } + +} diff --git a/tp5/thinkphp/library/think/console/command/optimize/Schema.php b/tp5/thinkphp/library/think/console/command/optimize/Schema.php new file mode 100644 index 0000000..1799701 --- /dev/null +++ b/tp5/thinkphp/library/think/console/command/optimize/Schema.php @@ -0,0 +1,121 @@ + +// +---------------------------------------------------------------------- +namespace think\console\command\optimize; + +use think\console\Command; +use think\console\Input; +use think\console\input\Option; +use think\console\Output; +use think\Db; +use think\facade\App; + +class Schema extends Command +{ + /** @var Output */ + protected $output; + + protected function configure() + { + $this->setName('optimize:schema') + ->addOption('db', null, Option::VALUE_REQUIRED, 'db name .') + ->addOption('table', null, Option::VALUE_REQUIRED, 'table name .') + ->addOption('module', null, Option::VALUE_REQUIRED, 'module name .') + ->setDescription('Build database schema cache.'); + } + + protected function execute(Input $input, Output $output) + { + if (!is_dir(App::getRuntimePath() . 'schema')) { + @mkdir(App::getRuntimePath() . 'schema', 0755, true); + } + + if ($input->hasOption('module')) { + $module = $input->getOption('module'); + // 读取模型 + $path = App::getAppPath() . $module . DIRECTORY_SEPARATOR . 'model'; + $list = is_dir($path) ? scandir($path) : []; + $namespace = App::getNamespace(); + + foreach ($list as $file) { + if (0 === strpos($file, '.')) { + continue; + } + $class = '\\' . $namespace . '\\' . $module . '\\model\\' . pathinfo($file, PATHINFO_FILENAME); + $this->buildModelSchema($class); + } + + $output->writeln('Succeed!'); + return; + } elseif ($input->hasOption('table')) { + $table = $input->getOption('table'); + if (!strpos($table, '.')) { + $dbName = Db::getConfig('database'); + } + + $tables[] = $table; + } elseif ($input->hasOption('db')) { + $dbName = $input->getOption('db'); + $tables = Db::getConnection()->getTables($dbName); + } elseif (!\think\facade\Config::get('app_multi_module')) { + $namespace = App::getNamespace(); + $path = App::getAppPath() . 'model'; + $list = is_dir($path) ? scandir($path) : []; + + foreach ($list as $file) { + if (0 === strpos($file, '.')) { + continue; + } + $class = '\\' . $namespace . '\\model\\' . pathinfo($file, PATHINFO_FILENAME); + $this->buildModelSchema($class); + } + + $output->writeln('Succeed!'); + return; + } else { + $tables = Db::getConnection()->getTables(); + } + + $db = isset($dbName) ? $dbName . '.' : ''; + $this->buildDataBaseSchema($tables, $db); + + $output->writeln('Succeed!'); + } + + protected function buildModelSchema($class) + { + $reflect = new \ReflectionClass($class); + if (!$reflect->isAbstract() && $reflect->isSubclassOf('\think\Model')) { + $table = $class::getTable(); + $dbName = $class::getConfig('database'); + $content = 'getFields($table); + $content .= var_export($info, true) . ';'; + + file_put_contents(App::getRuntimePath() . 'schema/' . $dbName . '.' . $table . '.php', $content); + } + } + + protected function buildDataBaseSchema($tables, $db) + { + if ('' == $db) { + $dbName = Db::getConfig('database') . '.'; + } else { + $dbName = $db; + } + + foreach ($tables as $table) { + $content = 'getFields($db . $table); + $content .= var_export($info, true) . ';'; + file_put_contents(App::getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR . $dbName . $table . '.php', $content); + } + } +} diff --git a/tp5/thinkphp/library/think/console/input/Argument.php b/tp5/thinkphp/library/think/console/input/Argument.php new file mode 100644 index 0000000..16223bb --- /dev/null +++ b/tp5/thinkphp/library/think/console/input/Argument.php @@ -0,0 +1,115 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\input; + +class Argument +{ + + const REQUIRED = 1; + const OPTIONAL = 2; + const IS_ARRAY = 4; + + private $name; + private $mode; + private $default; + private $description; + + /** + * 构造方法 + * @param string $name 参数名 + * @param int $mode 参数类型: self::REQUIRED 或者 self::OPTIONAL + * @param string $description 描述 + * @param mixed $default 默认值 (仅 self::OPTIONAL 类型有效) + * @throws \InvalidArgumentException + */ + public function __construct($name, $mode = null, $description = '', $default = null) + { + if (null === $mode) { + $mode = self::OPTIONAL; + } elseif (!is_int($mode) || $mode > 7 || $mode < 1) { + throw new \InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode)); + } + + $this->name = $name; + $this->mode = $mode; + $this->description = $description; + + $this->setDefault($default); + } + + /** + * 获取参数名 + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * 是否必须 + * @return bool + */ + public function isRequired() + { + return self::REQUIRED === (self::REQUIRED & $this->mode); + } + + /** + * 该参数是否接受数组 + * @return bool + */ + public function isArray() + { + return self::IS_ARRAY === (self::IS_ARRAY & $this->mode); + } + + /** + * 设置默认值 + * @param mixed $default 默认值 + * @throws \LogicException + */ + public function setDefault($default = null) + { + if (self::REQUIRED === $this->mode && null !== $default) { + throw new \LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.'); + } + + if ($this->isArray()) { + if (null === $default) { + $default = []; + } elseif (!is_array($default)) { + throw new \LogicException('A default value for an array argument must be an array.'); + } + } + + $this->default = $default; + } + + /** + * 获取默认值 + * @return mixed + */ + public function getDefault() + { + return $this->default; + } + + /** + * 获取描述 + * @return string + */ + public function getDescription() + { + return $this->description; + } +} diff --git a/tp5/thinkphp/library/think/console/input/Definition.php b/tp5/thinkphp/library/think/console/input/Definition.php new file mode 100644 index 0000000..c71977e --- /dev/null +++ b/tp5/thinkphp/library/think/console/input/Definition.php @@ -0,0 +1,375 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\input; + +class Definition +{ + + /** + * @var Argument[] + */ + private $arguments; + + private $requiredCount; + private $hasAnArrayArgument = false; + private $hasOptional; + + /** + * @var Option[] + */ + private $options; + private $shortcuts; + + /** + * 构造方法 + * @param array $definition + * @api + */ + public function __construct(array $definition = []) + { + $this->setDefinition($definition); + } + + /** + * 设置指令的定义 + * @param array $definition 定义的数组 + */ + public function setDefinition(array $definition) + { + $arguments = []; + $options = []; + foreach ($definition as $item) { + if ($item instanceof Option) { + $options[] = $item; + } else { + $arguments[] = $item; + } + } + + $this->setArguments($arguments); + $this->setOptions($options); + } + + /** + * 设置参数 + * @param Argument[] $arguments 参数数组 + */ + public function setArguments($arguments = []) + { + $this->arguments = []; + $this->requiredCount = 0; + $this->hasOptional = false; + $this->hasAnArrayArgument = false; + $this->addArguments($arguments); + } + + /** + * 添加参数 + * @param Argument[] $arguments 参数数组 + * @api + */ + public function addArguments($arguments = []) + { + if (null !== $arguments) { + foreach ($arguments as $argument) { + $this->addArgument($argument); + } + } + } + + /** + * 添加一个参数 + * @param Argument $argument 参数 + * @throws \LogicException + */ + public function addArgument(Argument $argument) + { + if (isset($this->arguments[$argument->getName()])) { + throw new \LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName())); + } + + if ($this->hasAnArrayArgument) { + throw new \LogicException('Cannot add an argument after an array argument.'); + } + + if ($argument->isRequired() && $this->hasOptional) { + throw new \LogicException('Cannot add a required argument after an optional one.'); + } + + if ($argument->isArray()) { + $this->hasAnArrayArgument = true; + } + + if ($argument->isRequired()) { + ++$this->requiredCount; + } else { + $this->hasOptional = true; + } + + $this->arguments[$argument->getName()] = $argument; + } + + /** + * 根据名称或者位置获取参数 + * @param string|int $name 参数名或者位置 + * @return Argument 参数 + * @throws \InvalidArgumentException + */ + public function getArgument($name) + { + if (!$this->hasArgument($name)) { + throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); + } + + $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments; + + return $arguments[$name]; + } + + /** + * 根据名称或位置检查是否具有某个参数 + * @param string|int $name 参数名或者位置 + * @return bool + * @api + */ + public function hasArgument($name) + { + $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments; + + return isset($arguments[$name]); + } + + /** + * 获取所有的参数 + * @return Argument[] 参数数组 + */ + public function getArguments() + { + return $this->arguments; + } + + /** + * 获取参数数量 + * @return int + */ + public function getArgumentCount() + { + return $this->hasAnArrayArgument ? PHP_INT_MAX : count($this->arguments); + } + + /** + * 获取必填的参数的数量 + * @return int + */ + public function getArgumentRequiredCount() + { + return $this->requiredCount; + } + + /** + * 获取参数默认值 + * @return array + */ + public function getArgumentDefaults() + { + $values = []; + foreach ($this->arguments as $argument) { + $values[$argument->getName()] = $argument->getDefault(); + } + + return $values; + } + + /** + * 设置选项 + * @param Option[] $options 选项数组 + */ + public function setOptions($options = []) + { + $this->options = []; + $this->shortcuts = []; + $this->addOptions($options); + } + + /** + * 添加选项 + * @param Option[] $options 选项数组 + * @api + */ + public function addOptions($options = []) + { + foreach ($options as $option) { + $this->addOption($option); + } + } + + /** + * 添加一个选项 + * @param Option $option 选项 + * @throws \LogicException + * @api + */ + public function addOption(Option $option) + { + if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) { + throw new \LogicException(sprintf('An option named "%s" already exists.', $option->getName())); + } + + if ($option->getShortcut()) { + foreach (explode('|', $option->getShortcut()) as $shortcut) { + if (isset($this->shortcuts[$shortcut]) + && !$option->equals($this->options[$this->shortcuts[$shortcut]]) + ) { + throw new \LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut)); + } + } + } + + $this->options[$option->getName()] = $option; + if ($option->getShortcut()) { + foreach (explode('|', $option->getShortcut()) as $shortcut) { + $this->shortcuts[$shortcut] = $option->getName(); + } + } + } + + /** + * 根据名称获取选项 + * @param string $name 选项名 + * @return Option + * @throws \InvalidArgumentException + * @api + */ + public function getOption($name) + { + if (!$this->hasOption($name)) { + throw new \InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name)); + } + + return $this->options[$name]; + } + + /** + * 根据名称检查是否有这个选项 + * @param string $name 选项名 + * @return bool + * @api + */ + public function hasOption($name) + { + return isset($this->options[$name]); + } + + /** + * 获取所有选项 + * @return Option[] + * @api + */ + public function getOptions() + { + return $this->options; + } + + /** + * 根据名称检查某个选项是否有短名称 + * @param string $name 短名称 + * @return bool + */ + public function hasShortcut($name) + { + return isset($this->shortcuts[$name]); + } + + /** + * 根据短名称获取选项 + * @param string $shortcut 短名称 + * @return Option + */ + public function getOptionForShortcut($shortcut) + { + return $this->getOption($this->shortcutToName($shortcut)); + } + + /** + * 获取所有选项的默认值 + * @return array + */ + public function getOptionDefaults() + { + $values = []; + foreach ($this->options as $option) { + $values[$option->getName()] = $option->getDefault(); + } + + return $values; + } + + /** + * 根据短名称获取选项名 + * @param string $shortcut 短名称 + * @return string + * @throws \InvalidArgumentException + */ + private function shortcutToName($shortcut) + { + if (!isset($this->shortcuts[$shortcut])) { + throw new \InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut)); + } + + return $this->shortcuts[$shortcut]; + } + + /** + * 获取该指令的介绍 + * @param bool $short 是否简洁介绍 + * @return string + */ + public function getSynopsis($short = false) + { + $elements = []; + + if ($short && $this->getOptions()) { + $elements[] = '[options]'; + } elseif (!$short) { + foreach ($this->getOptions() as $option) { + $value = ''; + if ($option->acceptValue()) { + $value = sprintf(' %s%s%s', $option->isValueOptional() ? '[' : '', strtoupper($option->getName()), $option->isValueOptional() ? ']' : ''); + } + + $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : ''; + $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value); + } + } + + if (count($elements) && $this->getArguments()) { + $elements[] = '[--]'; + } + + foreach ($this->getArguments() as $argument) { + $element = '<' . $argument->getName() . '>'; + if (!$argument->isRequired()) { + $element = '[' . $element . ']'; + } elseif ($argument->isArray()) { + $element .= ' (' . $element . ')'; + } + + if ($argument->isArray()) { + $element .= '...'; + } + + $elements[] = $element; + } + + return implode(' ', $elements); + } +} diff --git a/tp5/thinkphp/library/think/console/input/Option.php b/tp5/thinkphp/library/think/console/input/Option.php new file mode 100644 index 0000000..e5707c9 --- /dev/null +++ b/tp5/thinkphp/library/think/console/input/Option.php @@ -0,0 +1,190 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\input; + +class Option +{ + + const VALUE_NONE = 1; + const VALUE_REQUIRED = 2; + const VALUE_OPTIONAL = 4; + const VALUE_IS_ARRAY = 8; + + private $name; + private $shortcut; + private $mode; + private $default; + private $description; + + /** + * 构造方法 + * @param string $name 选项名 + * @param string|array $shortcut 短名称,多个用|隔开或者使用数组 + * @param int $mode 选项类型(可选类型为 self::VALUE_*) + * @param string $description 描述 + * @param mixed $default 默认值 (类型为 self::VALUE_REQUIRED 或者 self::VALUE_NONE 的时候必须为null) + * @throws \InvalidArgumentException + */ + public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null) + { + if (0 === strpos($name, '--')) { + $name = substr($name, 2); + } + + if (empty($name)) { + throw new \InvalidArgumentException('An option name cannot be empty.'); + } + + if (empty($shortcut)) { + $shortcut = null; + } + + if (null !== $shortcut) { + if (is_array($shortcut)) { + $shortcut = implode('|', $shortcut); + } + $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-')); + $shortcuts = array_filter($shortcuts); + $shortcut = implode('|', $shortcuts); + + if (empty($shortcut)) { + throw new \InvalidArgumentException('An option shortcut cannot be empty.'); + } + } + + if (null === $mode) { + $mode = self::VALUE_NONE; + } elseif (!is_int($mode) || $mode > 15 || $mode < 1) { + throw new \InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode)); + } + + $this->name = $name; + $this->shortcut = $shortcut; + $this->mode = $mode; + $this->description = $description; + + if ($this->isArray() && !$this->acceptValue()) { + throw new \InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.'); + } + + $this->setDefault($default); + } + + /** + * 获取短名称 + * @return string + */ + public function getShortcut() + { + return $this->shortcut; + } + + /** + * 获取选项名 + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * 是否可以设置值 + * @return bool 类型不是 self::VALUE_NONE 的时候返回true,其他均返回false + */ + public function acceptValue() + { + return $this->isValueRequired() || $this->isValueOptional(); + } + + /** + * 是否必须 + * @return bool 类型是 self::VALUE_REQUIRED 的时候返回true,其他均返回false + */ + public function isValueRequired() + { + return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode); + } + + /** + * 是否可选 + * @return bool 类型是 self::VALUE_OPTIONAL 的时候返回true,其他均返回false + */ + public function isValueOptional() + { + return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode); + } + + /** + * 选项值是否接受数组 + * @return bool 类型是 self::VALUE_IS_ARRAY 的时候返回true,其他均返回false + */ + public function isArray() + { + return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode); + } + + /** + * 设置默认值 + * @param mixed $default 默认值 + * @throws \LogicException + */ + public function setDefault($default = null) + { + if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) { + throw new \LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.'); + } + + if ($this->isArray()) { + if (null === $default) { + $default = []; + } elseif (!is_array($default)) { + throw new \LogicException('A default value for an array option must be an array.'); + } + } + + $this->default = $this->acceptValue() ? $default : false; + } + + /** + * 获取默认值 + * @return mixed + */ + public function getDefault() + { + return $this->default; + } + + /** + * 获取描述文字 + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * 检查所给选项是否是当前这个 + * @param Option $option + * @return bool + */ + public function equals(Option $option) + { + return $option->getName() === $this->getName() + && $option->getShortcut() === $this->getShortcut() + && $option->getDefault() === $this->getDefault() + && $option->isArray() === $this->isArray() + && $option->isValueRequired() === $this->isValueRequired() + && $option->isValueOptional() === $this->isValueOptional(); + } +} diff --git a/tp5/thinkphp/library/think/console/output/Ask.php b/tp5/thinkphp/library/think/console/output/Ask.php new file mode 100644 index 0000000..3933eb2 --- /dev/null +++ b/tp5/thinkphp/library/think/console/output/Ask.php @@ -0,0 +1,340 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\output; + +use think\console\Input; +use think\console\Output; +use think\console\output\question\Choice; +use think\console\output\question\Confirmation; + +class Ask +{ + private static $stty; + + private static $shell; + + /** @var Input */ + protected $input; + + /** @var Output */ + protected $output; + + /** @var Question */ + protected $question; + + public function __construct(Input $input, Output $output, Question $question) + { + $this->input = $input; + $this->output = $output; + $this->question = $question; + } + + public function run() + { + if (!$this->input->isInteractive()) { + return $this->question->getDefault(); + } + + if (!$this->question->getValidator()) { + return $this->doAsk(); + } + + $that = $this; + + $interviewer = function () use ($that) { + return $that->doAsk(); + }; + + return $this->validateAttempts($interviewer); + } + + protected function doAsk() + { + $this->writePrompt(); + + $inputStream = STDIN; + $autocomplete = $this->question->getAutocompleterValues(); + + if (null === $autocomplete || !$this->hasSttyAvailable()) { + $ret = false; + if ($this->question->isHidden()) { + try { + $ret = trim($this->getHiddenResponse($inputStream)); + } catch (\RuntimeException $e) { + if (!$this->question->isHiddenFallback()) { + throw $e; + } + } + } + + if (false === $ret) { + $ret = fgets($inputStream, 4096); + if (false === $ret) { + throw new \RuntimeException('Aborted'); + } + $ret = trim($ret); + } + } else { + $ret = trim($this->autocomplete($inputStream)); + } + + $ret = strlen($ret) > 0 ? $ret : $this->question->getDefault(); + + if ($normalizer = $this->question->getNormalizer()) { + return $normalizer($ret); + } + + return $ret; + } + + private function autocomplete($inputStream) + { + $autocomplete = $this->question->getAutocompleterValues(); + $ret = ''; + + $i = 0; + $ofs = -1; + $matches = $autocomplete; + $numMatches = count($matches); + + $sttyMode = shell_exec('stty -g'); + + shell_exec('stty -icanon -echo'); + + while (!feof($inputStream)) { + $c = fread($inputStream, 1); + + if ("\177" === $c) { + if (0 === $numMatches && 0 !== $i) { + --$i; + $this->output->write("\033[1D"); + } + + if ($i === 0) { + $ofs = -1; + $matches = $autocomplete; + $numMatches = count($matches); + } else { + $numMatches = 0; + } + + $ret = substr($ret, 0, $i); + } elseif ("\033" === $c) { + $c .= fread($inputStream, 2); + + if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) { + if ('A' === $c[2] && -1 === $ofs) { + $ofs = 0; + } + + if (0 === $numMatches) { + continue; + } + + $ofs += ('A' === $c[2]) ? -1 : 1; + $ofs = ($numMatches + $ofs) % $numMatches; + } + } elseif (ord($c) < 32) { + if ("\t" === $c || "\n" === $c) { + if ($numMatches > 0 && -1 !== $ofs) { + $ret = $matches[$ofs]; + $this->output->write(substr($ret, $i)); + $i = strlen($ret); + } + + if ("\n" === $c) { + $this->output->write($c); + break; + } + + $numMatches = 0; + } + + continue; + } else { + $this->output->write($c); + $ret .= $c; + ++$i; + + $numMatches = 0; + $ofs = 0; + + foreach ($autocomplete as $value) { + if (0 === strpos($value, $ret) && $i !== strlen($value)) { + $matches[$numMatches++] = $value; + } + } + } + + $this->output->write("\033[K"); + + if ($numMatches > 0 && -1 !== $ofs) { + $this->output->write("\0337"); + $this->output->highlight(substr($matches[$ofs], $i)); + $this->output->write("\0338"); + } + } + + shell_exec(sprintf('stty %s', $sttyMode)); + + return $ret; + } + + protected function getHiddenResponse($inputStream) + { + if ('\\' === DIRECTORY_SEPARATOR) { + $exe = __DIR__ . '/../bin/hiddeninput.exe'; + + $value = rtrim(shell_exec($exe)); + $this->output->writeln(''); + + if (isset($tmpExe)) { + unlink($tmpExe); + } + + return $value; + } + + if ($this->hasSttyAvailable()) { + $sttyMode = shell_exec('stty -g'); + + shell_exec('stty -echo'); + $value = fgets($inputStream, 4096); + shell_exec(sprintf('stty %s', $sttyMode)); + + if (false === $value) { + throw new \RuntimeException('Aborted'); + } + + $value = trim($value); + $this->output->writeln(''); + + return $value; + } + + if (false !== $shell = $this->getShell()) { + $readCmd = $shell === 'csh' ? 'set mypassword = $<' : 'read -r mypassword'; + $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd); + $value = rtrim(shell_exec($command)); + $this->output->writeln(''); + + return $value; + } + + throw new \RuntimeException('Unable to hide the response.'); + } + + protected function validateAttempts($interviewer) + { + /** @var \Exception $error */ + $error = null; + $attempts = $this->question->getMaxAttempts(); + while (null === $attempts || $attempts--) { + if (null !== $error) { + $this->output->error($error->getMessage()); + } + + try { + return call_user_func($this->question->getValidator(), $interviewer()); + } catch (\Exception $error) { + } + } + + throw $error; + } + + /** + * 显示问题的提示信息 + */ + protected function writePrompt() + { + $text = $this->question->getQuestion(); + $default = $this->question->getDefault(); + + switch (true) { + case null === $default: + $text = sprintf(' %s:', $text); + + break; + + case $this->question instanceof Confirmation: + $text = sprintf(' %s (yes/no) [%s]:', $text, $default ? 'yes' : 'no'); + + break; + + case $this->question instanceof Choice && $this->question->isMultiselect(): + $choices = $this->question->getChoices(); + $default = explode(',', $default); + + foreach ($default as $key => $value) { + $default[$key] = $choices[trim($value)]; + } + + $text = sprintf(' %s [%s]:', $text, implode(', ', $default)); + + break; + + case $this->question instanceof Choice: + $choices = $this->question->getChoices(); + $text = sprintf(' %s [%s]:', $text, $choices[$default]); + + break; + + default: + $text = sprintf(' %s [%s]:', $text, $default); + } + + $this->output->writeln($text); + + if ($this->question instanceof Choice) { + $width = max(array_map('strlen', array_keys($this->question->getChoices()))); + + foreach ($this->question->getChoices() as $key => $value) { + $this->output->writeln(sprintf(" [%-${width}s] %s", $key, $value)); + } + } + + $this->output->write(' > '); + } + + private function getShell() + { + if (null !== self::$shell) { + return self::$shell; + } + + self::$shell = false; + + if (file_exists('/usr/bin/env')) { + $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null"; + foreach (['bash', 'zsh', 'ksh', 'csh'] as $sh) { + if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) { + self::$shell = $sh; + break; + } + } + } + + return self::$shell; + } + + private function hasSttyAvailable() + { + if (null !== self::$stty) { + return self::$stty; + } + + exec('stty 2>&1', $output, $exitcode); + + return self::$stty = $exitcode === 0; + } +} diff --git a/tp5/thinkphp/library/think/console/output/Descriptor.php b/tp5/thinkphp/library/think/console/output/Descriptor.php new file mode 100644 index 0000000..6d98d53 --- /dev/null +++ b/tp5/thinkphp/library/think/console/output/Descriptor.php @@ -0,0 +1,319 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\output; + +use think\Console; +use think\console\Command; +use think\console\input\Argument as InputArgument; +use think\console\input\Definition as InputDefinition; +use think\console\input\Option as InputOption; +use think\console\Output; +use think\console\output\descriptor\Console as ConsoleDescription; + +class Descriptor +{ + + /** + * @var Output + */ + protected $output; + + /** + * {@inheritdoc} + */ + public function describe(Output $output, $object, array $options = []) + { + $this->output = $output; + + switch (true) { + case $object instanceof InputArgument: + $this->describeInputArgument($object, $options); + break; + case $object instanceof InputOption: + $this->describeInputOption($object, $options); + break; + case $object instanceof InputDefinition: + $this->describeInputDefinition($object, $options); + break; + case $object instanceof Command: + $this->describeCommand($object, $options); + break; + case $object instanceof Console: + $this->describeConsole($object, $options); + break; + default: + throw new \InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_class($object))); + } + } + + /** + * 输出内容 + * @param string $content + * @param bool $decorated + */ + protected function write($content, $decorated = false) + { + $this->output->write($content, false, $decorated ? Output::OUTPUT_NORMAL : Output::OUTPUT_RAW); + } + + /** + * 描述参数 + * @param InputArgument $argument + * @param array $options + * @return string|mixed + */ + protected function describeInputArgument(InputArgument $argument, array $options = []) + { + if (null !== $argument->getDefault() + && (!is_array($argument->getDefault()) + || count($argument->getDefault())) + ) { + $default = sprintf(' [default: %s]', $this->formatDefaultValue($argument->getDefault())); + } else { + $default = ''; + } + + $totalWidth = isset($options['total_width']) ? $options['total_width'] : strlen($argument->getName()); + $spacingWidth = $totalWidth - strlen($argument->getName()) + 2; + + $this->writeText(sprintf(" %s%s%s%s", $argument->getName(), str_repeat(' ', $spacingWidth), // + 17 = 2 spaces + + + 2 spaces + preg_replace('/\s*\R\s*/', PHP_EOL . str_repeat(' ', $totalWidth + 17), $argument->getDescription()), $default), $options); + } + + /** + * 描述选项 + * @param InputOption $option + * @param array $options + * @return string|mixed + */ + protected function describeInputOption(InputOption $option, array $options = []) + { + if ($option->acceptValue() && null !== $option->getDefault() + && (!is_array($option->getDefault()) + || count($option->getDefault())) + ) { + $default = sprintf(' [default: %s]', $this->formatDefaultValue($option->getDefault())); + } else { + $default = ''; + } + + $value = ''; + if ($option->acceptValue()) { + $value = '=' . strtoupper($option->getName()); + + if ($option->isValueOptional()) { + $value = '[' . $value . ']'; + } + } + + $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions([$option]); + $synopsis = sprintf('%s%s', $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ', sprintf('--%s%s', $option->getName(), $value)); + + $spacingWidth = $totalWidth - strlen($synopsis) + 2; + + $this->writeText(sprintf(" %s%s%s%s%s", $synopsis, str_repeat(' ', $spacingWidth), // + 17 = 2 spaces + + + 2 spaces + preg_replace('/\s*\R\s*/', "\n" . str_repeat(' ', $totalWidth + 17), $option->getDescription()), $default, $option->isArray() ? ' (multiple values allowed)' : ''), $options); + } + + /** + * 描述输入 + * @param InputDefinition $definition + * @param array $options + * @return string|mixed + */ + protected function describeInputDefinition(InputDefinition $definition, array $options = []) + { + $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions()); + foreach ($definition->getArguments() as $argument) { + $totalWidth = max($totalWidth, strlen($argument->getName())); + } + + if ($definition->getArguments()) { + $this->writeText('Arguments:', $options); + $this->writeText("\n"); + foreach ($definition->getArguments() as $argument) { + $this->describeInputArgument($argument, array_merge($options, ['total_width' => $totalWidth])); + $this->writeText("\n"); + } + } + + if ($definition->getArguments() && $definition->getOptions()) { + $this->writeText("\n"); + } + + if ($definition->getOptions()) { + $laterOptions = []; + + $this->writeText('Options:', $options); + foreach ($definition->getOptions() as $option) { + if (strlen($option->getShortcut()) > 1) { + $laterOptions[] = $option; + continue; + } + $this->writeText("\n"); + $this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth])); + } + foreach ($laterOptions as $option) { + $this->writeText("\n"); + $this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth])); + } + } + } + + /** + * 描述指令 + * @param Command $command + * @param array $options + * @return string|mixed + */ + protected function describeCommand(Command $command, array $options = []) + { + $command->getSynopsis(true); + $command->getSynopsis(false); + $command->mergeConsoleDefinition(false); + + $this->writeText('Usage:', $options); + foreach (array_merge([$command->getSynopsis(true)], $command->getAliases(), $command->getUsages()) as $usage) { + $this->writeText("\n"); + $this->writeText(' ' . $usage, $options); + } + $this->writeText("\n"); + + $definition = $command->getNativeDefinition(); + if ($definition->getOptions() || $definition->getArguments()) { + $this->writeText("\n"); + $this->describeInputDefinition($definition, $options); + $this->writeText("\n"); + } + + if ($help = $command->getProcessedHelp()) { + $this->writeText("\n"); + $this->writeText('Help:', $options); + $this->writeText("\n"); + $this->writeText(' ' . str_replace("\n", "\n ", $help), $options); + $this->writeText("\n"); + } + } + + /** + * 描述控制台 + * @param Console $console + * @param array $options + * @return string|mixed + */ + protected function describeConsole(Console $console, array $options = []) + { + $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null; + $description = new ConsoleDescription($console, $describedNamespace); + + if (isset($options['raw_text']) && $options['raw_text']) { + $width = $this->getColumnWidth($description->getCommands()); + + foreach ($description->getCommands() as $command) { + $this->writeText(sprintf("%-${width}s %s", $command->getName(), $command->getDescription()), $options); + $this->writeText("\n"); + } + } else { + if ('' != $help = $console->getHelp()) { + $this->writeText("$help\n\n", $options); + } + + $this->writeText("Usage:\n", $options); + $this->writeText(" command [options] [arguments]\n\n", $options); + + $this->describeInputDefinition(new InputDefinition($console->getDefinition()->getOptions()), $options); + + $this->writeText("\n"); + $this->writeText("\n"); + + $width = $this->getColumnWidth($description->getCommands()); + + if ($describedNamespace) { + $this->writeText(sprintf('Available commands for the "%s" namespace:', $describedNamespace), $options); + } else { + $this->writeText('Available commands:', $options); + } + + // add commands by namespace + foreach ($description->getNamespaces() as $namespace) { + if (!$describedNamespace && ConsoleDescription::GLOBAL_NAMESPACE !== $namespace['id']) { + $this->writeText("\n"); + $this->writeText(' ' . $namespace['id'] . '', $options); + } + + foreach ($namespace['commands'] as $name) { + $this->writeText("\n"); + $spacingWidth = $width - strlen($name); + $this->writeText(sprintf(" %s%s%s", $name, str_repeat(' ', $spacingWidth), $description->getCommand($name) + ->getDescription()), $options); + } + } + + $this->writeText("\n"); + } + } + + /** + * {@inheritdoc} + */ + private function writeText($content, array $options = []) + { + $this->write(isset($options['raw_text']) + && $options['raw_text'] ? strip_tags($content) : $content, isset($options['raw_output']) ? !$options['raw_output'] : true); + } + + /** + * 格式化 + * @param mixed $default + * @return string + */ + private function formatDefaultValue($default) + { + return json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); + } + + /** + * @param Command[] $commands + * @return int + */ + private function getColumnWidth(array $commands) + { + $width = 0; + foreach ($commands as $command) { + $width = strlen($command->getName()) > $width ? strlen($command->getName()) : $width; + } + + return $width + 2; + } + + /** + * @param InputOption[] $options + * @return int + */ + private function calculateTotalWidthForOptions($options) + { + $totalWidth = 0; + foreach ($options as $option) { + $nameLength = 4 + strlen($option->getName()) + 2; // - + shortcut + , + whitespace + name + -- + + if ($option->acceptValue()) { + $valueLength = 1 + strlen($option->getName()); // = + value + $valueLength += $option->isValueOptional() ? 2 : 0; // [ + ] + + $nameLength += $valueLength; + } + $totalWidth = max($totalWidth, $nameLength); + } + + return $totalWidth; + } +} diff --git a/tp5/thinkphp/library/think/console/output/Formatter.php b/tp5/thinkphp/library/think/console/output/Formatter.php new file mode 100644 index 0000000..f8bee55 --- /dev/null +++ b/tp5/thinkphp/library/think/console/output/Formatter.php @@ -0,0 +1,198 @@ + +// +---------------------------------------------------------------------- +namespace think\console\output; + +use think\console\output\formatter\Stack as StyleStack; +use think\console\output\formatter\Style; + +class Formatter +{ + + private $decorated = false; + private $styles = []; + private $styleStack; + + /** + * 转义 + * @param string $text + * @return string + */ + public static function escape($text) + { + return preg_replace('/([^\\\\]?)setStyle('error', new Style('white', 'red')); + $this->setStyle('info', new Style('green')); + $this->setStyle('comment', new Style('yellow')); + $this->setStyle('question', new Style('black', 'cyan')); + $this->setStyle('highlight', new Style('red')); + $this->setStyle('warning', new Style('black', 'yellow')); + + $this->styleStack = new StyleStack(); + } + + /** + * 设置外观标识 + * @param bool $decorated 是否美化文字 + */ + public function setDecorated($decorated) + { + $this->decorated = (bool) $decorated; + } + + /** + * 获取外观标识 + * @return bool + */ + public function isDecorated() + { + return $this->decorated; + } + + /** + * 添加一个新样式 + * @param string $name 样式名 + * @param Style $style 样式实例 + */ + public function setStyle($name, Style $style) + { + $this->styles[strtolower($name)] = $style; + } + + /** + * 是否有这个样式 + * @param string $name + * @return bool + */ + public function hasStyle($name) + { + return isset($this->styles[strtolower($name)]); + } + + /** + * 获取样式 + * @param string $name + * @return Style + * @throws \InvalidArgumentException + */ + public function getStyle($name) + { + if (!$this->hasStyle($name)) { + throw new \InvalidArgumentException(sprintf('Undefined style: %s', $name)); + } + + return $this->styles[strtolower($name)]; + } + + /** + * 使用所给的样式格式化文字 + * @param string $message 文字 + * @return string + */ + public function format($message) + { + $offset = 0; + $output = ''; + $tagRegex = '[a-z][a-z0-9_=;-]*'; + preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#isx", $message, $matches, PREG_OFFSET_CAPTURE); + foreach ($matches[0] as $i => $match) { + $pos = $match[1]; + $text = $match[0]; + + if (0 != $pos && '\\' == $message[$pos - 1]) { + continue; + } + + $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset)); + $offset = $pos + strlen($text); + + if ($open = '/' != $text[1]) { + $tag = $matches[1][$i][0]; + } else { + $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : ''; + } + + if (!$open && !$tag) { + // + $this->styleStack->pop(); + } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) { + $output .= $this->applyCurrentStyle($text); + } elseif ($open) { + $this->styleStack->push($style); + } else { + $this->styleStack->pop($style); + } + } + + $output .= $this->applyCurrentStyle(substr($message, $offset)); + + return str_replace('\\<', '<', $output); + } + + /** + * @return StyleStack + */ + public function getStyleStack() + { + return $this->styleStack; + } + + /** + * 根据字符串创建新的样式实例 + * @param string $string + * @return Style|bool + */ + private function createStyleFromString($string) + { + if (isset($this->styles[$string])) { + return $this->styles[$string]; + } + + if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) { + return false; + } + + $style = new Style(); + foreach ($matches as $match) { + array_shift($match); + + if ('fg' == $match[0]) { + $style->setForeground($match[1]); + } elseif ('bg' == $match[0]) { + $style->setBackground($match[1]); + } else { + try { + $style->setOption($match[1]); + } catch (\InvalidArgumentException $e) { + return false; + } + } + } + + return $style; + } + + /** + * 从堆栈应用样式到文字 + * @param string $text 文字 + * @return string + */ + private function applyCurrentStyle($text) + { + return $this->isDecorated() && strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text; + } +} diff --git a/tp5/thinkphp/library/think/console/output/Question.php b/tp5/thinkphp/library/think/console/output/Question.php new file mode 100644 index 0000000..03975f2 --- /dev/null +++ b/tp5/thinkphp/library/think/console/output/Question.php @@ -0,0 +1,211 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\output; + +class Question +{ + + private $question; + private $attempts; + private $hidden = false; + private $hiddenFallback = true; + private $autocompleterValues; + private $validator; + private $default; + private $normalizer; + + /** + * 构造方法 + * @param string $question 问题 + * @param mixed $default 默认答案 + */ + public function __construct($question, $default = null) + { + $this->question = $question; + $this->default = $default; + } + + /** + * 获取问题 + * @return string + */ + public function getQuestion() + { + return $this->question; + } + + /** + * 获取默认答案 + * @return mixed + */ + public function getDefault() + { + return $this->default; + } + + /** + * 是否隐藏答案 + * @return bool + */ + public function isHidden() + { + return $this->hidden; + } + + /** + * 隐藏答案 + * @param bool $hidden + * @return Question + */ + public function setHidden($hidden) + { + if ($this->autocompleterValues) { + throw new \LogicException('A hidden question cannot use the autocompleter.'); + } + + $this->hidden = (bool) $hidden; + + return $this; + } + + /** + * 不能被隐藏是否撤销 + * @return bool + */ + public function isHiddenFallback() + { + return $this->hiddenFallback; + } + + /** + * 设置不能被隐藏的时候的操作 + * @param bool $fallback + * @return Question + */ + public function setHiddenFallback($fallback) + { + $this->hiddenFallback = (bool) $fallback; + + return $this; + } + + /** + * 获取自动完成 + * @return null|array|\Traversable + */ + public function getAutocompleterValues() + { + return $this->autocompleterValues; + } + + /** + * 设置自动完成的值 + * @param null|array|\Traversable $values + * @return Question + * @throws \InvalidArgumentException + * @throws \LogicException + */ + public function setAutocompleterValues($values) + { + if (is_array($values) && $this->isAssoc($values)) { + $values = array_merge(array_keys($values), array_values($values)); + } + + if (null !== $values && !is_array($values)) { + if (!$values instanceof \Traversable || $values instanceof \Countable) { + throw new \InvalidArgumentException('Autocompleter values can be either an array, `null` or an object implementing both `Countable` and `Traversable` interfaces.'); + } + } + + if ($this->hidden) { + throw new \LogicException('A hidden question cannot use the autocompleter.'); + } + + $this->autocompleterValues = $values; + + return $this; + } + + /** + * 设置答案的验证器 + * @param null|callable $validator + * @return Question The current instance + */ + public function setValidator($validator) + { + $this->validator = $validator; + + return $this; + } + + /** + * 获取验证器 + * @return null|callable + */ + public function getValidator() + { + return $this->validator; + } + + /** + * 设置最大重试次数 + * @param null|int $attempts + * @return Question + * @throws \InvalidArgumentException + */ + public function setMaxAttempts($attempts) + { + if (null !== $attempts && $attempts < 1) { + throw new \InvalidArgumentException('Maximum number of attempts must be a positive value.'); + } + + $this->attempts = $attempts; + + return $this; + } + + /** + * 获取最大重试次数 + * @return null|int + */ + public function getMaxAttempts() + { + return $this->attempts; + } + + /** + * 设置响应的回调 + * @param string|\Closure $normalizer + * @return Question + */ + public function setNormalizer($normalizer) + { + $this->normalizer = $normalizer; + + return $this; + } + + /** + * 获取响应回调 + * The normalizer can ba a callable (a string), a closure or a class implementing __invoke. + * @return string|\Closure + */ + public function getNormalizer() + { + return $this->normalizer; + } + + protected function isAssoc($array) + { + return (bool) count(array_filter(array_keys($array), 'is_string')); + } +} diff --git a/tp5/thinkphp/library/think/console/output/descriptor/Console.php b/tp5/thinkphp/library/think/console/output/descriptor/Console.php new file mode 100644 index 0000000..4648b68 --- /dev/null +++ b/tp5/thinkphp/library/think/console/output/descriptor/Console.php @@ -0,0 +1,149 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\output\descriptor; + +use think\Console as ThinkConsole; +use think\console\Command; + +class Console +{ + + const GLOBAL_NAMESPACE = '_global'; + + /** + * @var ThinkConsole + */ + private $console; + + /** + * @var null|string + */ + private $namespace; + + /** + * @var array + */ + private $namespaces; + + /** + * @var Command[] + */ + private $commands; + + /** + * @var Command[] + */ + private $aliases; + + /** + * 构造方法 + * @param ThinkConsole $console + * @param string|null $namespace + */ + public function __construct(ThinkConsole $console, $namespace = null) + { + $this->console = $console; + $this->namespace = $namespace; + } + + /** + * @return array + */ + public function getNamespaces() + { + if (null === $this->namespaces) { + $this->inspectConsole(); + } + + return $this->namespaces; + } + + /** + * @return Command[] + */ + public function getCommands() + { + if (null === $this->commands) { + $this->inspectConsole(); + } + + return $this->commands; + } + + /** + * @param string $name + * @return Command + * @throws \InvalidArgumentException + */ + public function getCommand($name) + { + if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) { + throw new \InvalidArgumentException(sprintf('Command %s does not exist.', $name)); + } + + return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name]; + } + + private function inspectConsole() + { + $this->commands = []; + $this->namespaces = []; + + $all = $this->console->all($this->namespace ? $this->console->findNamespace($this->namespace) : null); + foreach ($this->sortCommands($all) as $namespace => $commands) { + $names = []; + + /** @var Command $command */ + foreach ($commands as $name => $command) { + if (!$command->getName()) { + continue; + } + + if ($command->getName() === $name) { + $this->commands[$name] = $command; + } else { + $this->aliases[$name] = $command; + } + + $names[] = $name; + } + + $this->namespaces[$namespace] = ['id' => $namespace, 'commands' => $names]; + } + } + + /** + * @param array $commands + * @return array + */ + private function sortCommands(array $commands) + { + $namespacedCommands = []; + foreach ($commands as $name => $command) { + $key = $this->console->extractNamespace($name, 1); + if (!$key) { + $key = self::GLOBAL_NAMESPACE; + } + + $namespacedCommands[$key][$name] = $command; + } + ksort($namespacedCommands); + + foreach ($namespacedCommands as &$commandsSet) { + ksort($commandsSet); + } + // unset reference to keep scope clear + unset($commandsSet); + + return $namespacedCommands; + } +} diff --git a/tp5/thinkphp/library/think/console/output/driver/Buffer.php b/tp5/thinkphp/library/think/console/output/driver/Buffer.php new file mode 100644 index 0000000..c77a2ec --- /dev/null +++ b/tp5/thinkphp/library/think/console/output/driver/Buffer.php @@ -0,0 +1,52 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\output\driver; + +use think\console\Output; + +class Buffer +{ + /** + * @var string + */ + private $buffer = ''; + + public function __construct(Output $output) + { + // do nothing + } + + public function fetch() + { + $content = $this->buffer; + $this->buffer = ''; + return $content; + } + + public function write($messages, $newline = false, $options = Output::OUTPUT_NORMAL) + { + $messages = (array) $messages; + + foreach ($messages as $message) { + $this->buffer .= $message; + } + if ($newline) { + $this->buffer .= "\n"; + } + } + + public function renderException(\Exception $e) + { + // do nothing + } + +} diff --git a/tp5/thinkphp/library/think/console/output/driver/Console.php b/tp5/thinkphp/library/think/console/output/driver/Console.php new file mode 100644 index 0000000..e041b52 --- /dev/null +++ b/tp5/thinkphp/library/think/console/output/driver/Console.php @@ -0,0 +1,368 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\output\driver; + +use think\console\Output; +use think\console\output\Formatter; + +class Console +{ + + /** @var Resource */ + private $stdout; + + /** @var Formatter */ + private $formatter; + + private $terminalDimensions; + + /** @var Output */ + private $output; + + public function __construct(Output $output) + { + $this->output = $output; + $this->formatter = new Formatter(); + $this->stdout = $this->openOutputStream(); + $decorated = $this->hasColorSupport($this->stdout); + $this->formatter->setDecorated($decorated); + } + + public function setDecorated($decorated) + { + $this->formatter->setDecorated($decorated); + } + + public function write($messages, $newline = false, $type = Output::OUTPUT_NORMAL, $stream = null) + { + if (Output::VERBOSITY_QUIET === $this->output->getVerbosity()) { + return; + } + + $messages = (array) $messages; + + foreach ($messages as $message) { + switch ($type) { + case Output::OUTPUT_NORMAL: + $message = $this->formatter->format($message); + break; + case Output::OUTPUT_RAW: + break; + case Output::OUTPUT_PLAIN: + $message = strip_tags($this->formatter->format($message)); + break; + default: + throw new \InvalidArgumentException(sprintf('Unknown output type given (%s)', $type)); + } + + $this->doWrite($message, $newline, $stream); + } + } + + public function renderException(\Exception $e) + { + $stderr = $this->openErrorStream(); + $decorated = $this->hasColorSupport($stderr); + $this->formatter->setDecorated($decorated); + + do { + $title = sprintf(' [%s] ', get_class($e)); + + $len = $this->stringWidth($title); + + $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX; + + if (defined('HHVM_VERSION') && $width > 1 << 31) { + $width = 1 << 31; + } + $lines = []; + foreach (preg_split('/\r?\n/', $e->getMessage()) as $line) { + foreach ($this->splitStringByWidth($line, $width - 4) as $line) { + + $lineLength = $this->stringWidth(preg_replace('/\[[^m]*m/', '', $line)) + 4; + $lines[] = [$line, $lineLength]; + + $len = max($lineLength, $len); + } + } + + $messages = ['', '']; + $messages[] = $emptyLine = sprintf('%s', str_repeat(' ', $len)); + $messages[] = sprintf('%s%s', $title, str_repeat(' ', max(0, $len - $this->stringWidth($title)))); + foreach ($lines as $line) { + $messages[] = sprintf(' %s %s', $line[0], str_repeat(' ', $len - $line[1])); + } + $messages[] = $emptyLine; + $messages[] = ''; + $messages[] = ''; + + $this->write($messages, true, Output::OUTPUT_NORMAL, $stderr); + + if (Output::VERBOSITY_VERBOSE <= $this->output->getVerbosity()) { + $this->write('Exception trace:', true, Output::OUTPUT_NORMAL, $stderr); + + // exception related properties + $trace = $e->getTrace(); + array_unshift($trace, [ + 'function' => '', + 'file' => $e->getFile() !== null ? $e->getFile() : 'n/a', + 'line' => $e->getLine() !== null ? $e->getLine() : 'n/a', + 'args' => [], + ]); + + for ($i = 0, $count = count($trace); $i < $count; ++$i) { + $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : ''; + $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : ''; + $function = $trace[$i]['function']; + $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a'; + $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a'; + + $this->write(sprintf(' %s%s%s() at %s:%s', $class, $type, $function, $file, $line), true, Output::OUTPUT_NORMAL, $stderr); + } + + $this->write('', true, Output::OUTPUT_NORMAL, $stderr); + $this->write('', true, Output::OUTPUT_NORMAL, $stderr); + } + } while ($e = $e->getPrevious()); + + } + + /** + * 获取终端宽度 + * @return int|null + */ + protected function getTerminalWidth() + { + $dimensions = $this->getTerminalDimensions(); + + return $dimensions[0]; + } + + /** + * 获取终端高度 + * @return int|null + */ + protected function getTerminalHeight() + { + $dimensions = $this->getTerminalDimensions(); + + return $dimensions[1]; + } + + /** + * 获取当前终端的尺寸 + * @return array + */ + public function getTerminalDimensions() + { + if ($this->terminalDimensions) { + return $this->terminalDimensions; + } + + if ('\\' === DIRECTORY_SEPARATOR) { + if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) { + return [(int) $matches[1], (int) $matches[2]]; + } + if (preg_match('/^(\d+)x(\d+)$/', $this->getMode(), $matches)) { + return [(int) $matches[1], (int) $matches[2]]; + } + } + + if ($sttyString = $this->getSttyColumns()) { + if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) { + return [(int) $matches[2], (int) $matches[1]]; + } + if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) { + return [(int) $matches[2], (int) $matches[1]]; + } + } + + return [null, null]; + } + + /** + * 获取stty列数 + * @return string + */ + private function getSttyColumns() + { + if (!function_exists('proc_open')) { + return; + } + + $descriptorspec = [1 => ['pipe', 'w'], 2 => ['pipe', 'w']]; + $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, ['suppress_errors' => true]); + if (is_resource($process)) { + $info = stream_get_contents($pipes[1]); + fclose($pipes[1]); + fclose($pipes[2]); + proc_close($process); + + return $info; + } + return; + } + + /** + * 获取终端模式 + * @return string x 或 null + */ + private function getMode() + { + if (!function_exists('proc_open')) { + return; + } + + $descriptorspec = [1 => ['pipe', 'w'], 2 => ['pipe', 'w']]; + $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, ['suppress_errors' => true]); + if (is_resource($process)) { + $info = stream_get_contents($pipes[1]); + fclose($pipes[1]); + fclose($pipes[2]); + proc_close($process); + + if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) { + return $matches[2] . 'x' . $matches[1]; + } + } + return; + } + + private function stringWidth($string) + { + if (!function_exists('mb_strwidth')) { + return strlen($string); + } + + if (false === $encoding = mb_detect_encoding($string)) { + return strlen($string); + } + + return mb_strwidth($string, $encoding); + } + + private function splitStringByWidth($string, $width) + { + if (!function_exists('mb_strwidth')) { + return str_split($string, $width); + } + + if (false === $encoding = mb_detect_encoding($string)) { + return str_split($string, $width); + } + + $utf8String = mb_convert_encoding($string, 'utf8', $encoding); + $lines = []; + $line = ''; + foreach (preg_split('//u', $utf8String) as $char) { + if (mb_strwidth($line . $char, 'utf8') <= $width) { + $line .= $char; + continue; + } + $lines[] = str_pad($line, $width); + $line = $char; + } + if (strlen($line)) { + $lines[] = count($lines) ? str_pad($line, $width) : $line; + } + + mb_convert_variables($encoding, 'utf8', $lines); + + return $lines; + } + + private function isRunningOS400() + { + $checks = [ + function_exists('php_uname') ? php_uname('s') : '', + getenv('OSTYPE'), + PHP_OS, + ]; + return false !== stripos(implode(';', $checks), 'OS400'); + } + + /** + * 当前环境是否支持写入控制台输出到stdout. + * + * @return bool + */ + protected function hasStdoutSupport() + { + return false === $this->isRunningOS400(); + } + + /** + * 当前环境是否支持写入控制台输出到stderr. + * + * @return bool + */ + protected function hasStderrSupport() + { + return false === $this->isRunningOS400(); + } + + /** + * @return resource + */ + private function openOutputStream() + { + if (!$this->hasStdoutSupport()) { + return fopen('php://output', 'w'); + } + return @fopen('php://stdout', 'w') ?: fopen('php://output', 'w'); + } + + /** + * @return resource + */ + private function openErrorStream() + { + return fopen($this->hasStderrSupport() ? 'php://stderr' : 'php://output', 'w'); + } + + /** + * 将消息写入到输出。 + * @param string $message 消息 + * @param bool $newline 是否另起一行 + * @param null $stream + */ + protected function doWrite($message, $newline, $stream = null) + { + if (null === $stream) { + $stream = $this->stdout; + } + if (false === @fwrite($stream, $message . ($newline ? PHP_EOL : ''))) { + throw new \RuntimeException('Unable to write output.'); + } + + fflush($stream); + } + + /** + * 是否支持着色 + * @param $stream + * @return bool + */ + protected function hasColorSupport($stream) + { + if (DIRECTORY_SEPARATOR === '\\') { + return + '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR . '.' . PHP_WINDOWS_VERSION_MINOR . '.' . PHP_WINDOWS_VERSION_BUILD + || false !== getenv('ANSICON') + || 'ON' === getenv('ConEmuANSI') + || 'xterm' === getenv('TERM'); + } + + return function_exists('posix_isatty') && @posix_isatty($stream); + } + +} diff --git a/tp5/thinkphp/library/think/console/output/driver/Nothing.php b/tp5/thinkphp/library/think/console/output/driver/Nothing.php new file mode 100644 index 0000000..9a55f77 --- /dev/null +++ b/tp5/thinkphp/library/think/console/output/driver/Nothing.php @@ -0,0 +1,33 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\output\driver; + +use think\console\Output; + +class Nothing +{ + + public function __construct(Output $output) + { + // do nothing + } + + public function write($messages, $newline = false, $options = Output::OUTPUT_NORMAL) + { + // do nothing + } + + public function renderException(\Exception $e) + { + // do nothing + } +} diff --git a/tp5/thinkphp/library/think/console/output/formatter/Stack.php b/tp5/thinkphp/library/think/console/output/formatter/Stack.php new file mode 100644 index 0000000..4864a3f --- /dev/null +++ b/tp5/thinkphp/library/think/console/output/formatter/Stack.php @@ -0,0 +1,116 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\output\formatter; + +class Stack +{ + + /** + * @var Style[] + */ + private $styles; + + /** + * @var Style + */ + private $emptyStyle; + + /** + * 构造方法 + * @param Style|null $emptyStyle + */ + public function __construct(Style $emptyStyle = null) + { + $this->emptyStyle = $emptyStyle ?: new Style(); + $this->reset(); + } + + /** + * 重置堆栈 + */ + public function reset() + { + $this->styles = []; + } + + /** + * 推一个样式进入堆栈 + * @param Style $style + */ + public function push(Style $style) + { + $this->styles[] = $style; + } + + /** + * 从堆栈中弹出一个样式 + * @param Style|null $style + * @return Style + * @throws \InvalidArgumentException + */ + public function pop(Style $style = null) + { + if (empty($this->styles)) { + return $this->emptyStyle; + } + + if (null === $style) { + return array_pop($this->styles); + } + + /** + * @var int $index + * @var Style $stackedStyle + */ + foreach (array_reverse($this->styles, true) as $index => $stackedStyle) { + if ($style->apply('') === $stackedStyle->apply('')) { + $this->styles = array_slice($this->styles, 0, $index); + + return $stackedStyle; + } + } + + throw new \InvalidArgumentException('Incorrectly nested style tag found.'); + } + + /** + * 计算堆栈的当前样式。 + * @return Style + */ + public function getCurrent() + { + if (empty($this->styles)) { + return $this->emptyStyle; + } + + return $this->styles[count($this->styles) - 1]; + } + + /** + * @param Style $emptyStyle + * @return Stack + */ + public function setEmptyStyle(Style $emptyStyle) + { + $this->emptyStyle = $emptyStyle; + + return $this; + } + + /** + * @return Style + */ + public function getEmptyStyle() + { + return $this->emptyStyle; + } +} diff --git a/tp5/thinkphp/library/think/console/output/formatter/Style.php b/tp5/thinkphp/library/think/console/output/formatter/Style.php new file mode 100644 index 0000000..d9b0999 --- /dev/null +++ b/tp5/thinkphp/library/think/console/output/formatter/Style.php @@ -0,0 +1,189 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\output\formatter; + +class Style +{ + + private static $availableForegroundColors = [ + 'black' => ['set' => 30, 'unset' => 39], + 'red' => ['set' => 31, 'unset' => 39], + 'green' => ['set' => 32, 'unset' => 39], + 'yellow' => ['set' => 33, 'unset' => 39], + 'blue' => ['set' => 34, 'unset' => 39], + 'magenta' => ['set' => 35, 'unset' => 39], + 'cyan' => ['set' => 36, 'unset' => 39], + 'white' => ['set' => 37, 'unset' => 39], + ]; + private static $availableBackgroundColors = [ + 'black' => ['set' => 40, 'unset' => 49], + 'red' => ['set' => 41, 'unset' => 49], + 'green' => ['set' => 42, 'unset' => 49], + 'yellow' => ['set' => 43, 'unset' => 49], + 'blue' => ['set' => 44, 'unset' => 49], + 'magenta' => ['set' => 45, 'unset' => 49], + 'cyan' => ['set' => 46, 'unset' => 49], + 'white' => ['set' => 47, 'unset' => 49], + ]; + private static $availableOptions = [ + 'bold' => ['set' => 1, 'unset' => 22], + 'underscore' => ['set' => 4, 'unset' => 24], + 'blink' => ['set' => 5, 'unset' => 25], + 'reverse' => ['set' => 7, 'unset' => 27], + 'conceal' => ['set' => 8, 'unset' => 28], + ]; + + private $foreground; + private $background; + private $options = []; + + /** + * 初始化输出的样式 + * @param string|null $foreground 字体颜色 + * @param string|null $background 背景色 + * @param array $options 格式 + * @api + */ + public function __construct($foreground = null, $background = null, array $options = []) + { + if (null !== $foreground) { + $this->setForeground($foreground); + } + if (null !== $background) { + $this->setBackground($background); + } + if (count($options)) { + $this->setOptions($options); + } + } + + /** + * 设置字体颜色 + * @param string|null $color 颜色名 + * @throws \InvalidArgumentException + * @api + */ + public function setForeground($color = null) + { + if (null === $color) { + $this->foreground = null; + + return; + } + + if (!isset(static::$availableForegroundColors[$color])) { + throw new \InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableForegroundColors)))); + } + + $this->foreground = static::$availableForegroundColors[$color]; + } + + /** + * 设置背景色 + * @param string|null $color 颜色名 + * @throws \InvalidArgumentException + * @api + */ + public function setBackground($color = null) + { + if (null === $color) { + $this->background = null; + + return; + } + + if (!isset(static::$availableBackgroundColors[$color])) { + throw new \InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableBackgroundColors)))); + } + + $this->background = static::$availableBackgroundColors[$color]; + } + + /** + * 设置字体格式 + * @param string $option 格式名 + * @throws \InvalidArgumentException When the option name isn't defined + * @api + */ + public function setOption($option) + { + if (!isset(static::$availableOptions[$option])) { + throw new \InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions)))); + } + + if (!in_array(static::$availableOptions[$option], $this->options)) { + $this->options[] = static::$availableOptions[$option]; + } + } + + /** + * 重置字体格式 + * @param string $option 格式名 + * @throws \InvalidArgumentException + */ + public function unsetOption($option) + { + if (!isset(static::$availableOptions[$option])) { + throw new \InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions)))); + } + + $pos = array_search(static::$availableOptions[$option], $this->options); + if (false !== $pos) { + unset($this->options[$pos]); + } + } + + /** + * 批量设置字体格式 + * @param array $options + */ + public function setOptions(array $options) + { + $this->options = []; + + foreach ($options as $option) { + $this->setOption($option); + } + } + + /** + * 应用样式到文字 + * @param string $text 文字 + * @return string + */ + public function apply($text) + { + $setCodes = []; + $unsetCodes = []; + + if (null !== $this->foreground) { + $setCodes[] = $this->foreground['set']; + $unsetCodes[] = $this->foreground['unset']; + } + if (null !== $this->background) { + $setCodes[] = $this->background['set']; + $unsetCodes[] = $this->background['unset']; + } + if (count($this->options)) { + foreach ($this->options as $option) { + $setCodes[] = $option['set']; + $unsetCodes[] = $option['unset']; + } + } + + if (0 === count($setCodes)) { + return $text; + } + + return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes)); + } +} diff --git a/tp5/thinkphp/library/think/console/output/question/Choice.php b/tp5/thinkphp/library/think/console/output/question/Choice.php new file mode 100644 index 0000000..f6760e5 --- /dev/null +++ b/tp5/thinkphp/library/think/console/output/question/Choice.php @@ -0,0 +1,163 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\output\question; + +use think\console\output\Question; + +class Choice extends Question +{ + + private $choices; + private $multiselect = false; + private $prompt = ' > '; + private $errorMessage = 'Value "%s" is invalid'; + + /** + * 构造方法 + * @param string $question 问题 + * @param array $choices 选项 + * @param mixed $default 默认答案 + */ + public function __construct($question, array $choices, $default = null) + { + parent::__construct($question, $default); + + $this->choices = $choices; + $this->setValidator($this->getDefaultValidator()); + $this->setAutocompleterValues($choices); + } + + /** + * 可选项 + * @return array + */ + public function getChoices() + { + return $this->choices; + } + + /** + * 设置可否多选 + * @param bool $multiselect + * @return self + */ + public function setMultiselect($multiselect) + { + $this->multiselect = $multiselect; + $this->setValidator($this->getDefaultValidator()); + + return $this; + } + + public function isMultiselect() + { + return $this->multiselect; + } + + /** + * 获取提示 + * @return string + */ + public function getPrompt() + { + return $this->prompt; + } + + /** + * 设置提示 + * @param string $prompt + * @return self + */ + public function setPrompt($prompt) + { + $this->prompt = $prompt; + + return $this; + } + + /** + * 设置错误提示信息 + * @param string $errorMessage + * @return self + */ + public function setErrorMessage($errorMessage) + { + $this->errorMessage = $errorMessage; + $this->setValidator($this->getDefaultValidator()); + + return $this; + } + + /** + * 获取默认的验证方法 + * @return callable + */ + private function getDefaultValidator() + { + $choices = $this->choices; + $errorMessage = $this->errorMessage; + $multiselect = $this->multiselect; + $isAssoc = $this->isAssoc($choices); + + return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) { + // Collapse all spaces. + $selectedChoices = str_replace(' ', '', $selected); + + if ($multiselect) { + // Check for a separated comma values + if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) { + throw new \InvalidArgumentException(sprintf($errorMessage, $selected)); + } + $selectedChoices = explode(',', $selectedChoices); + } else { + $selectedChoices = [$selected]; + } + + $multiselectChoices = []; + foreach ($selectedChoices as $value) { + $results = []; + foreach ($choices as $key => $choice) { + if ($choice === $value) { + $results[] = $key; + } + } + + if (count($results) > 1) { + throw new \InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results))); + } + + $result = array_search($value, $choices); + + if (!$isAssoc) { + if (!empty($result)) { + $result = $choices[$result]; + } elseif (isset($choices[$value])) { + $result = $choices[$value]; + } + } elseif (empty($result) && array_key_exists($value, $choices)) { + $result = $value; + } + + if (empty($result)) { + throw new \InvalidArgumentException(sprintf($errorMessage, $value)); + } + array_push($multiselectChoices, $result); + } + + if ($multiselect) { + return $multiselectChoices; + } + + return current($multiselectChoices); + }; + } +} diff --git a/tp5/thinkphp/library/think/console/output/question/Confirmation.php b/tp5/thinkphp/library/think/console/output/question/Confirmation.php new file mode 100644 index 0000000..6598f9b --- /dev/null +++ b/tp5/thinkphp/library/think/console/output/question/Confirmation.php @@ -0,0 +1,57 @@ + +// +---------------------------------------------------------------------- + +namespace think\console\output\question; + +use think\console\output\Question; + +class Confirmation extends Question +{ + + private $trueAnswerRegex; + + /** + * 构造方法 + * @param string $question 问题 + * @param bool $default 默认答案 + * @param string $trueAnswerRegex 验证正则 + */ + public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i') + { + parent::__construct($question, (bool) $default); + + $this->trueAnswerRegex = $trueAnswerRegex; + $this->setNormalizer($this->getDefaultNormalizer()); + } + + /** + * 获取默认的答案回调 + * @return callable + */ + private function getDefaultNormalizer() + { + $default = $this->getDefault(); + $regex = $this->trueAnswerRegex; + + return function ($answer) use ($default, $regex) { + if (is_bool($answer)) { + return $answer; + } + + $answerIsTrue = (bool) preg_match($regex, $answer); + if (false === $default) { + return $answer && $answerIsTrue; + } + + return !$answer || $answerIsTrue; + }; + } +} diff --git a/tp5/thinkphp/library/think/db/Builder.php b/tp5/thinkphp/library/think/db/Builder.php new file mode 100644 index 0000000..4f98ac9 --- /dev/null +++ b/tp5/thinkphp/library/think/db/Builder.php @@ -0,0 +1,1145 @@ + +// +---------------------------------------------------------------------- + +namespace think\db; + +use PDO; +use think\Exception; + +abstract class Builder +{ + // connection对象实例 + protected $connection; + + // 查询表达式映射 + protected $exp = ['EQ' => '=', 'NEQ' => '<>', 'GT' => '>', 'EGT' => '>=', 'LT' => '<', 'ELT' => '<=', 'NOTLIKE' => 'NOT LIKE', 'NOTIN' => 'NOT IN', 'NOTBETWEEN' => 'NOT BETWEEN', 'NOTEXISTS' => 'NOT EXISTS', 'NOTNULL' => 'NOT NULL', 'NOTBETWEEN TIME' => 'NOT BETWEEN TIME']; + + // 查询表达式解析 + protected $parser = [ + 'parseCompare' => ['=', '<>', '>', '>=', '<', '<='], + 'parseLike' => ['LIKE', 'NOT LIKE'], + 'parseBetween' => ['NOT BETWEEN', 'BETWEEN'], + 'parseIn' => ['NOT IN', 'IN'], + 'parseExp' => ['EXP'], + 'parseNull' => ['NOT NULL', 'NULL'], + 'parseBetweenTime' => ['BETWEEN TIME', 'NOT BETWEEN TIME'], + 'parseTime' => ['< TIME', '> TIME', '<= TIME', '>= TIME'], + 'parseExists' => ['NOT EXISTS', 'EXISTS'], + ]; + + // SQL表达式 + protected $selectSql = 'SELECT%DISTINCT% %FIELD% FROM %TABLE%%FORCE%%JOIN%%WHERE%%GROUP%%HAVING%%UNION%%ORDER%%LIMIT% %LOCK%%COMMENT%'; + + protected $insertSql = '%INSERT% INTO %TABLE% (%FIELD%) VALUES (%DATA%) %COMMENT%'; + + protected $insertAllSql = '%INSERT% INTO %TABLE% (%FIELD%) %DATA% %COMMENT%'; + + protected $updateSql = 'UPDATE %TABLE% SET %SET%%JOIN%%WHERE%%ORDER%%LIMIT% %LOCK%%COMMENT%'; + + protected $deleteSql = 'DELETE FROM %TABLE%%USING%%JOIN%%WHERE%%ORDER%%LIMIT% %LOCK%%COMMENT%'; + + /** + * 架构函数 + * @access public + * @param Connection $connection 数据库连接对象实例 + */ + public function __construct(Connection $connection) + { + $this->connection = $connection; + } + + /** + * 获取当前的连接对象实例 + * @access public + * @return Connection + */ + public function getConnection() + { + return $this->connection; + } + + /** + * 注册查询表达式解析 + * @access public + * @param string $name 解析方法 + * @param array $parser 匹配表达式数据 + * @return $this + */ + public function bindParser($name, $parser) + { + $this->parser[$name] = $parser; + return $this; + } + + /** + * 数据分析 + * @access protected + * @param Query $query 查询对象 + * @param array $data 数据 + * @param array $fields 字段信息 + * @param array $bind 参数绑定 + * @param string $suffix 参数绑定后缀 + * @return array + */ + protected function parseData(Query $query, $data = [], $fields = [], $bind = [], $suffix = '') + { + if (empty($data)) { + return []; + } + + $options = $query->getOptions(); + + // 获取绑定信息 + if (empty($bind)) { + $bind = $this->connection->getFieldsBind($options['table']); + } + + if (empty($fields)) { + if ('*' == $options['field']) { + $fields = array_keys($bind); + } else { + $fields = $options['field']; + } + } + + $result = []; + + foreach ($data as $key => $val) { + $item = $this->parseKey($query, $key); + + if (!is_scalar($val) && (in_array($key, (array) $query->getOptions('json')) || 'json' == $this->connection->getFieldsType($options['table'], $key))) { + $val = json_encode($val); + } elseif (is_object($val) && method_exists($val, '__toString')) { + // 对象数据写入 + $val = $val->__toString(); + } + + if (false !== strpos($key, '->')) { + list($key, $name) = explode('->', $key); + $item = $this->parseKey($query, $key); + $result[$item] = 'json_set(' . $item . ', \'$.' . $name . '\', ' . $this->parseDataBind($query, $key, $val, $bind, $suffix) . ')'; + } elseif (false === strpos($key, '.') && !in_array($key, $fields, true)) { + if ($options['strict']) { + throw new Exception('fields not exists:[' . $key . ']'); + } + } elseif (is_null($val)) { + $result[$item] = 'NULL'; + } elseif (is_array($val) && !empty($val)) { + switch ($val[0]) { + case 'exp': + $result[$item] = $val[1]; + break; + case 'inc': + $result[$item] = $this->parseKey($query, $val[1]) . ' + ' . floatval($val[2]); + break; + case 'dec': + $result[$item] = $this->parseKey($query, $val[1]) . ' - ' . floatval($val[2]); + break; + } + } elseif (is_scalar($val)) { + // 过滤非标量数据 + $result[$item] = $this->parseDataBind($query, $key, $val, $bind, $suffix); + } + } + + return $result; + } + + /** + * 数据绑定处理 + * @access protected + * @param Query $query 查询对象 + * @param string $key 字段名 + * @param mixed $data 数据 + * @param array $bind 绑定数据 + * @param string $suffix 绑定后缀 + * @return string + */ + protected function parseDataBind(Query $query, $key, $data, $bind = [], $suffix = '') + { + // 过滤非标量数据 + if (0 === strpos($data, ':') && $query->isBind(substr($data, 1))) { + return $data; + } else { + $key = str_replace(['.', '->'], '_', $key); + $name = 'data__' . $key . $suffix; + $query->bind($name, $data, isset($bind[$key]) ? $bind[$key] : PDO::PARAM_STR); + return ':' . $name; + } + } + + /** + * 字段名分析 + * @access public + * @param Query $query 查询对象 + * @param string $key 字段名 + * @return string + */ + public function parseKey(Query $query, $key) + { + return $key; + } + + /** + * field分析 + * @access protected + * @param Query $query 查询对象 + * @param mixed $fields 字段名 + * @return string + */ + protected function parseField(Query $query, $fields) + { + if ('*' == $fields || empty($fields)) { + $fieldsStr = '*'; + } elseif (is_array($fields)) { + // 支持 'field1'=>'field2' 这样的字段别名定义 + $array = []; + + foreach ($fields as $key => $field) { + if (!is_numeric($key)) { + $array[] = $this->parseKey($query, $key) . ' AS ' . $this->parseKey($query, $field); + } else { + $array[] = $this->parseKey($query, $field); + } + } + + $fieldsStr = implode(',', $array); + } + + return $fieldsStr; + } + + /** + * table分析 + * @access protected + * @param Query $query 查询对象 + * @param mixed $tables 表名 + * @return string + */ + protected function parseTable(Query $query, $tables) + { + $item = []; + $options = $query->getOptions(); + foreach ((array) $tables as $key => $table) { + if (!is_numeric($key)) { + $key = $this->connection->parseSqlTable($key); + $item[] = $this->parseKey($query, $key) . ' ' . $this->parseKey($query, $table); + } else { + $table = $this->connection->parseSqlTable($table); + + if (isset($options['alias'][$table])) { + $item[] = $this->parseKey($query, $table) . ' ' . $this->parseKey($query, $options['alias'][$table]); + } else { + $item[] = $this->parseKey($query, $table); + } + } + } + + return implode(',', $item); + } + + /** + * where分析 + * @access protected + * @param Query $query 查询对象 + * @param mixed $where 查询条件 + * @return string + */ + protected function parseWhere(Query $query, $where) + { + $options = $query->getOptions(); + $whereStr = $this->buildWhere($query, $where); + + if (!empty($options['soft_delete'])) { + // 附加软删除条件 + list($field, $condition) = $options['soft_delete']; + + $binds = $this->connection->getFieldsBind($options['table']); + $whereStr = $whereStr ? '( ' . $whereStr . ' ) AND ' : ''; + $whereStr = $whereStr . $this->parseWhereItem($query, $field, $condition, '', $binds); + } + + return empty($whereStr) ? '' : ' WHERE ' . $whereStr; + } + + /** + * 生成查询条件SQL + * @access public + * @param Query $query 查询对象 + * @param mixed $where 查询条件 + * @return string + */ + public function buildWhere(Query $query, $where) + { + if (empty($where)) { + $where = []; + } + + $whereStr = ''; + $binds = $this->connection->getFieldsBind($query->getOptions('table')); + + foreach ($where as $logic => $val) { + $str = []; + + foreach ($val as $value) { + if (is_array($value)) { + if (key($value) !== 0) { + throw new Exception('where express error:' . var_export($value, true)); + } + $field = array_shift($value); + } elseif (!($value instanceof \Closure)) { + throw new Exception('where express error:' . var_export($value, true)); + } + + if ($value instanceof \Closure) { + // 使用闭包查询 + $newQuery = $query->newQuery()->setConnection($this->connection); + $value($newQuery); + $whereClause = $this->buildWhere($query, $newQuery->getOptions('where')); + + if (!empty($whereClause)) { + $str[] = ' ' . $logic . ' ( ' . $whereClause . ' )'; + } + } elseif (is_array($field)) { + array_unshift($value, $field); + $str2 = []; + foreach ($value as $item) { + $str2[] = $this->parseWhereItem($query, array_shift($item), $item, $logic, $binds); + } + + $str[] = ' ' . $logic . ' ( ' . implode(' AND ', $str2) . ' )'; + } elseif (strpos($field, '|')) { + // 不同字段使用相同查询条件(OR) + $array = explode('|', $field); + $item = []; + + foreach ($array as $k) { + $item[] = $this->parseWhereItem($query, $k, $value, '', $binds); + } + + $str[] = ' ' . $logic . ' ( ' . implode(' OR ', $item) . ' )'; + } elseif (strpos($field, '&')) { + // 不同字段使用相同查询条件(AND) + $array = explode('&', $field); + $item = []; + + foreach ($array as $k) { + $item[] = $this->parseWhereItem($query, $k, $value, '', $binds); + } + + $str[] = ' ' . $logic . ' ( ' . implode(' AND ', $item) . ' )'; + } else { + // 对字段使用表达式查询 + $field = is_string($field) ? $field : ''; + $str[] = ' ' . $logic . ' ' . $this->parseWhereItem($query, $field, $value, $logic, $binds); + } + } + + $whereStr .= empty($whereStr) ? substr(implode(' ', $str), strlen($logic) + 1) : implode(' ', $str); + } + + return $whereStr; + } + + // where子单元分析 + protected function parseWhereItem(Query $query, $field, $val, $rule = '', $binds = [], $bindName = null) + { + // 字段分析 + $key = $field ? $this->parseKey($query, $field) : ''; + + // 查询规则和条件 + if (!is_array($val)) { + $val = is_null($val) ? ['null', ''] : ['=', $val]; + } + + list($exp, $value) = $val; + + // 对一个字段使用多个查询条件 + if (is_array($exp)) { + $item = array_pop($val); + + // 传入 or 或者 and + if (is_string($item) && in_array($item, ['AND', 'and', 'OR', 'or'])) { + $rule = $item; + } else { + array_push($val, $item); + } + + foreach ($val as $k => $item) { + $bindName = 'where_' . str_replace('.', '_', $field) . '_' . $k; + $str[] = $this->parseWhereItem($query, $field, $item, $rule, $binds, $bindName); + } + + return '( ' . implode(' ' . $rule . ' ', $str) . ' )'; + } + + // 检测操作符 + $exp = strtoupper($exp); + if (isset($this->exp[$exp])) { + $exp = $this->exp[$exp]; + } + + $bindName = $bindName ?: 'where_' . str_replace(['.', '-'], '_', $field); + + if (preg_match('/\W/', $bindName)) { + // 处理带非单词字符的字段名 + $bindName = md5($bindName); + } + + if (is_object($value) && method_exists($value, '__toString')) { + // 对象数据写入 + $value = $value->__toString(); + } + + $bindType = isset($binds[$field]) ? $binds[$field] : PDO::PARAM_STR; + + if (is_scalar($value) && !in_array($exp, ['EXP', 'NOT NULL', 'NULL', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN']) && strpos($exp, 'TIME') === false) { + if (strpos($value, ':') !== 0 || !$query->isBind(substr($value, 1))) { + if ($query->isBind($bindName)) { + $bindName .= '_' . str_replace('.', '_', uniqid('', true)); + } + + $query->bind($bindName, $value, $bindType); + $value = ':' . $bindName; + } + } + + // 解析查询表达式 + foreach ($this->parser as $fun => $parse) { + if (in_array($exp, $parse)) { + $whereStr = $this->$fun($query, $key, $exp, $value, $field, $bindName, $bindType, isset($val[2]) ? $val[2] : 'AND'); + break; + } + } + + if (!isset($whereStr)) { + throw new Exception('where express error:' . $exp); + } + + return $whereStr; + } + + /** + * 模糊查询 + * @access protected + * @param Query $query 查询对象 + * @param string $key + * @param string $exp + * @param mixed $value + * @param string $field + * @param string $bindName + * @param integer $bindType + * @param string $logic + * @return string + */ + protected function parseLike(Query $query, $key, $exp, $value, $field, $bindName, $bindType, $logic) + { + // 模糊匹配 + if (is_array($value)) { + foreach ($value as $k => $item) { + $bindKey = $bindName . '_' . $k; + $bind[$bindKey] = [$item, $bindType]; + $array[] = $key . ' ' . $exp . ' :' . $bindKey; + } + + $query->bind($bind); + + $whereStr = '(' . implode($array, ' ' . strtoupper($logic) . ' ') . ')'; + } else { + $whereStr = $key . ' ' . $exp . ' ' . $value; + } + + return $whereStr; + } + + /** + * 表达式查询 + * @access protected + * @param Query $query 查询对象 + * @param string $key + * @param string $exp + * @param mixed $value + * @param string $field + * @param string $bindName + * @param integer $bindType + * @return string + */ + protected function parseExp(Query $query, $key, $exp, $value, $field, $bindName, $bindType) + { + // 表达式查询 + return '( ' . $key . ' ' . $value . ' )'; + } + + /** + * Null查询 + * @access protected + * @param Query $query 查询对象 + * @param string $key + * @param string $exp + * @param mixed $value + * @param string $field + * @param string $bindName + * @param integer $bindType + * @return string + */ + protected function parseNull(Query $query, $key, $exp, $value, $field, $bindName, $bindType) + { + // NULL 查询 + return $key . ' IS ' . $exp; + } + + /** + * 范围查询 + * @access protected + * @param Query $query 查询对象 + * @param string $key + * @param string $exp + * @param mixed $value + * @param string $field + * @param string $bindName + * @param integer $bindType + * @return string + */ + protected function parseBetween(Query $query, $key, $exp, $value, $field, $bindName, $bindType) + { + // BETWEEN 查询 + $data = is_array($value) ? $value : explode(',', $value); + + if ($query->isBind($bindName . '_between_1')) { + $bindKey1 = $bindName . '_between_1' . uniqid(); + $bindKey2 = $bindName . '_between_2' . uniqid(); + } else { + $bindKey1 = $bindName . '_between_1'; + $bindKey2 = $bindName . '_between_2'; + } + + $bind = [ + $bindKey1 => [$data[0], $bindType], + $bindKey2 => [$data[1], $bindType], + ]; + + $query->bind($bind); + + $between = ':' . $bindKey1 . ' AND :' . $bindKey2; + + return $key . ' ' . $exp . ' ' . $between; + } + + /** + * Exists查询 + * @access protected + * @param Query $query 查询对象 + * @param string $key + * @param string $exp + * @param mixed $value + * @param string $field + * @param string $bindName + * @param integer $bindType + * @return string + */ + protected function parseExists(Query $query, $key, $exp, $value, $field, $bindName, $bindType) + { + // EXISTS 查询 + if ($value instanceof \Closure) { + $value = $this->parseClosure($query, $value, false); + } + + return $exp . ' (' . $value . ')'; + } + + /** + * 时间比较查询 + * @access protected + * @param Query $query 查询对象 + * @param string $key + * @param string $exp + * @param mixed $value + * @param string $field + * @param string $bindName + * @param integer $bindType + * @return string + */ + protected function parseTime(Query $query, $key, $exp, $value, $field, $bindName, $bindType) + { + return $key . ' ' . substr($exp, 0, 2) . ' ' . $this->parseDateTime($query, $value, $field, $bindName, $bindType); + } + + /** + * 大小比较查询 + * @access protected + * @param Query $query 查询对象 + * @param string $key + * @param string $exp + * @param mixed $value + * @param string $field + * @param string $bindName + * @param integer $bindType + * @return string + */ + protected function parseCompare(Query $query, $key, $exp, $value, $field, $bindName, $bindType) + { + if (is_array($value)) { + throw new Exception('where express error:' . $exp . var_export($value, true)); + } + + // 比较运算 + if ($value instanceof \Closure) { + $value = $this->parseClosure($query, $value); + } + + return $key . ' ' . $exp . ' ' . $value; + } + + /** + * 时间范围查询 + * @access protected + * @param Query $query 查询对象 + * @param string $key + * @param string $exp + * @param mixed $value + * @param string $field + * @param string $bindName + * @param integer $bindType + * @return string + */ + protected function parseBetweenTime(Query $query, $key, $exp, $value, $field, $bindName, $bindType) + { + if (is_string($value)) { + $value = explode(',', $value); + } + + return $key . ' ' . substr($exp, 0, -4) + . $this->parseDateTime($query, $value[0], $field, $bindName . '_between_1', $bindType) + . ' AND ' + . $this->parseDateTime($query, $value[1], $field, $bindName . '_between_2', $bindType); + + } + + /** + * IN查询 + * @access protected + * @param Query $query 查询对象 + * @param string $key + * @param string $exp + * @param mixed $value + * @param string $field + * @param string $bindName + * @param integer $bindType + * @return string + */ + protected function parseIn(Query $query, $key, $exp, $value, $field, $bindName, $bindType) + { + // IN 查询 + if ($value instanceof \Closure) { + $value = $this->parseClosure($query, $value, false); + } else { + $value = array_unique(is_array($value) ? $value : explode(',', $value)); + + $bind = []; + $array = []; + $i = 0; + + foreach ($value as $k => $v) { + $i++; + if ($query->isBind($bindName . '_in_' . $i)) { + $bindKey = $bindName . '_in_' . uniqid() . '_' . $i; + } else { + $bindKey = $bindName . '_in_' . $i; + } + $bind[$bindKey] = [$v, $bindType]; + $array[] = ':' . $bindKey; + } + + $zone = implode(',', $array); + $query->bind($bind); + + $value = empty($zone) ? "''" : $zone; + } + + return $key . ' ' . $exp . ' (' . $value . ')'; + } + + /** + * 闭包子查询 + * @access protected + * @param Query $query 查询对象 + * @param \Closure $call + * @param bool $show + * @return string + */ + protected function parseClosure(Query $query, $call, $show = true) + { + $newQuery = $query->newQuery()->setConnection($this->connection); + $call($newQuery); + + return $newQuery->buildSql($show); + } + + /** + * 日期时间条件解析 + * @access protected + * @param Query $query 查询对象 + * @param string $value + * @param string $key + * @param array $options + * @param string $bindName + * @param integer $bindType + * @return string + */ + protected function parseDateTime(Query $query, $value, $key, $bindName = null, $bindType = null) + { + $options = $query->getOptions(); + + // 获取时间字段类型 + if (strpos($key, '.')) { + list($table, $key) = explode('.', $key); + + if (isset($options['alias']) && $pos = array_search($table, $options['alias'])) { + $table = $pos; + } + } else { + $table = $options['table']; + } + + $type = $this->connection->getTableInfo($table, 'type'); + + if (isset($type[$key])) { + $info = $type[$key]; + } + + if (isset($info)) { + if (is_string($value)) { + $value = strtotime($value) ?: $value; + } + + if (preg_match('/(datetime|timestamp)/is', $info)) { + // 日期及时间戳类型 + $value = date('Y-m-d H:i:s', $value); + } elseif (preg_match('/(date)/is', $info)) { + // 日期及时间戳类型 + $value = date('Y-m-d', $value); + } + } + + $bindName = $bindName ?: $key; + + $query->bind($bindName, $value, $bindType); + + return ':' . $bindName; + } + + /** + * limit分析 + * @access protected + * @param Query $query 查询对象 + * @param mixed $limit + * @return string + */ + protected function parseLimit(Query $query, $limit) + { + return (!empty($limit) && false === strpos($limit, '(')) ? ' LIMIT ' . $limit . ' ' : ''; + } + + /** + * join分析 + * @access protected + * @param Query $query 查询对象 + * @param array $join + * @return string + */ + protected function parseJoin(Query $query, $join) + { + $joinStr = ''; + + if (!empty($join)) { + foreach ($join as $item) { + list($table, $type, $on) = $item; + + $condition = []; + + foreach ((array) $on as $val) { + if (strpos($val, '=')) { + list($val1, $val2) = explode('=', $val, 2); + $condition[] = $this->parseKey($query, $val1) . '=' . $this->parseKey($query, $val2); + } else { + $condition[] = $val; + } + } + + $table = $this->parseTable($query, $table); + + $joinStr .= ' ' . $type . ' JOIN ' . $table . ' ON ' . implode(' AND ', $condition); + } + } + + return $joinStr; + } + + /** + * order分析 + * @access protected + * @param Query $query 查询对象 + * @param mixed $order + * @return string + */ + protected function parseOrder(Query $query, $order) + { + if (empty($order)) { + return ''; + } + + if (is_array($order)) { + $array = []; + + foreach ($order as $key => $val) { + if (is_array($val)) { + if (isset($val['sort'])) { + $sort = ' ' . $val['sort']; + unset($val['sort']); + } else { + $sort = ''; + } + + $options = $query->getOptions(); + $bind = $this->connection->getFieldsBind($options['table']); + + foreach ($val as $k => $item) { + $val[$k] = $this->parseDataBind($query, $key, $item, $bind, $k); + } + + $array[] = 'field(' . $this->parseKey($query, $key) . ',' . implode(',', $val) . ')' . $sort; + } elseif (is_numeric($key)) { + if ('[rand]' == $val) { + $array[] = $this->parseRand($query); + } elseif (false === strpos($val, '(')) { + $array[] = $this->parseKey($query, $val); + } else { + $array[] = $val; + } + } else { + $sort = in_array(strtolower(trim($val)), ['asc', 'desc']) ? ' ' . $val : ''; + $array[] = $this->parseKey($query, $key) . ' ' . $sort; + } + } + + $order = implode(',', $array); + } + + return ' ORDER BY ' . $order; + } + + /** + * group分析 + * @access protected + * @param Query $query 查询对象 + * @param mixed $group + * @return string + */ + protected function parseGroup(Query $query, $group) + { + return !empty($group) ? ' GROUP BY ' . $this->parseKey($query, $group) : ''; + } + + /** + * having分析 + * @access protected + * @param Query $query 查询对象 + * @param string $having + * @return string + */ + protected function parseHaving(Query $query, $having) + { + return !empty($having) ? ' HAVING ' . $having : ''; + } + + /** + * comment分析 + * @access protected + * @param Query $query 查询对象 + * @param string $comment + * @return string + */ + protected function parseComment(Query $query, $comment) + { + return !empty($comment) ? ' /* ' . $comment . ' */' : ''; + } + + /** + * distinct分析 + * @access protected + * @param Query $query 查询对象 + * @param mixed $distinct + * @return string + */ + protected function parseDistinct(Query $query, $distinct) + { + return !empty($distinct) ? ' DISTINCT ' : ''; + } + + /** + * union分析 + * @access protected + * @param Query $query 查询对象 + * @param mixed $union + * @return string + */ + protected function parseUnion(Query $query, $union) + { + if (empty($union)) { + return ''; + } + + $type = $union['type']; + unset($union['type']); + + foreach ($union as $u) { + if ($u instanceof \Closure) { + $sql[] = $type . ' ' . $this->parseClosure($query, $u); + } elseif (is_string($u)) { + $sql[] = $type . ' ( ' . $this->connection->parseSqlTable($u) . ' )'; + } + } + + return ' ' . implode(' ', $sql); + } + + /** + * index分析,可在操作链中指定需要强制使用的索引 + * @access protected + * @param Query $query 查询对象 + * @param mixed $index + * @return string + */ + protected function parseForce(Query $query, $index) + { + if (empty($index)) { + return ''; + } + + if (is_array($index)) { + $index = join(",", $index); + } + + return sprintf(" FORCE INDEX ( %s ) ", $index); + } + + /** + * 设置锁机制 + * @access protected + * @param Query $query 查询对象 + * @param bool|string $lock + * @return string + */ + protected function parseLock(Query $query, $lock = false) + { + if (is_bool($lock)) { + return $lock ? ' FOR UPDATE ' : ''; + } elseif (is_string($lock) && !empty($lock)) { + return ' ' . trim($lock) . ' '; + } + } + + /** + * 生成查询SQL + * @access public + * @param Query $query 查询对象 + * @return string + */ + public function select(Query $query) + { + $options = $query->getOptions(); + + return str_replace( + ['%TABLE%', '%DISTINCT%', '%FIELD%', '%JOIN%', '%WHERE%', '%GROUP%', '%HAVING%', '%ORDER%', '%LIMIT%', '%UNION%', '%LOCK%', '%COMMENT%', '%FORCE%'], + [ + $this->parseTable($query, $options['table']), + $this->parseDistinct($query, $options['distinct']), + $this->parseField($query, $options['field']), + $this->parseJoin($query, $options['join']), + $this->parseWhere($query, $options['where']), + $this->parseGroup($query, $options['group']), + $this->parseHaving($query, $options['having']), + $this->parseOrder($query, $options['order']), + $this->parseLimit($query, $options['limit']), + $this->parseUnion($query, $options['union']), + $this->parseLock($query, $options['lock']), + $this->parseComment($query, $options['comment']), + $this->parseForce($query, $options['force']), + ], + $this->selectSql); + } + + /** + * 生成Insert SQL + * @access public + * @param Query $query 查询对象 + * @param bool $replace 是否replace + * @return string + */ + public function insert(Query $query, $replace = false) + { + $options = $query->getOptions(); + + // 分析并处理数据 + $data = $this->parseData($query, $options['data']); + if (empty($data)) { + return 0; + } + + $fields = array_keys($data); + $values = array_values($data); + + return str_replace( + ['%INSERT%', '%TABLE%', '%FIELD%', '%DATA%', '%COMMENT%'], + [ + $replace ? 'REPLACE' : 'INSERT', + $this->parseTable($query, $options['table']), + implode(' , ', $fields), + implode(' , ', $values), + $this->parseComment($query, $options['comment']), + ], + $this->insertSql); + } + + /** + * 生成insertall SQL + * @access public + * @param Query $query 查询对象 + * @param array $dataSet 数据集 + * @param bool $replace 是否replace + * @return string + */ + public function insertAll(Query $query, $dataSet, $replace = false) + { + $options = $query->getOptions(); + + // 获取合法的字段 + if ('*' == $options['field']) { + $allowFields = $this->connection->getTableFields($options['table']); + } else { + $allowFields = $options['field']; + } + + // 获取绑定信息 + $bind = $this->connection->getFieldsBind($options['table']); + + foreach ($dataSet as $k => $data) { + $data = $this->parseData($query, $data, $allowFields, $bind, '_' . $k); + + $values[] = 'SELECT ' . implode(',', array_values($data)); + + if (!isset($insertFields)) { + $insertFields = array_keys($data); + } + } + + $fields = []; + + foreach ($insertFields as $field) { + $fields[] = $this->parseKey($query, $field); + } + + return str_replace( + ['%INSERT%', '%TABLE%', '%FIELD%', '%DATA%', '%COMMENT%'], + [ + $replace ? 'REPLACE' : 'INSERT', + $this->parseTable($query, $options['table']), + implode(' , ', $fields), + implode(' UNION ALL ', $values), + $this->parseComment($query, $options['comment']), + ], + $this->insertAllSql); + } + + /** + * 生成slect insert SQL + * @access public + * @param Query $query 查询对象 + * @param array $fields 数据 + * @param string $table 数据表 + * @return string + */ + public function selectInsert(Query $query, $fields, $table) + { + $options = $query->getOptions(); + + if (is_string($fields)) { + $fields = explode(',', $fields); + } + + foreach ($fields as &$field) { + $field = $this->parseKey($query, $field); + } + + return 'INSERT INTO ' . $this->parseTable($query, $table, $options) . ' (' . implode(',', $fields) . ') ' . $this->select($options); + } + + /** + * 生成update SQL + * @access public + * @param Query $query 查询对象 + * @return string + */ + public function update(Query $query) + { + $options = $query->getOptions(); + + $table = $this->parseTable($query, $options['table']); + $data = $this->parseData($query, $options['data']); + + if (empty($data)) { + return ''; + } + + foreach ($data as $key => $val) { + $set[] = $key . ' = ' . $val; + } + + return str_replace( + ['%TABLE%', '%SET%', '%JOIN%', '%WHERE%', '%ORDER%', '%LIMIT%', '%LOCK%', '%COMMENT%'], + [ + $this->parseTable($query, $options['table']), + implode(' , ', $set), + $this->parseJoin($query, $options['join']), + $this->parseWhere($query, $options['where']), + $this->parseOrder($query, $options['order']), + $this->parseLimit($query, $options['limit']), + $this->parseLock($query, $options['lock']), + $this->parseComment($query, $options['comment']), + ], + $this->updateSql); + } + + /** + * 生成delete SQL + * @access public + * @param Query $query 查询对象 + * @return string + */ + public function delete(Query $query) + { + $options = $query->getOptions(); + + return str_replace( + ['%TABLE%', '%USING%', '%JOIN%', '%WHERE%', '%ORDER%', '%LIMIT%', '%LOCK%', '%COMMENT%'], + [ + $this->parseTable($query, $options['table']), + !empty($options['using']) ? ' USING ' . $this->parseTable($query, $options['using']) . ' ' : '', + $this->parseJoin($query, $options['join']), + $this->parseWhere($query, $options['where']), + $this->parseOrder($query, $options['order']), + $this->parseLimit($query, $options['limit']), + $this->parseLock($query, $options['lock']), + $this->parseComment($query, $options['comment']), + ], + $this->deleteSql); + } +} diff --git a/tp5/thinkphp/library/think/db/Connection.php b/tp5/thinkphp/library/think/db/Connection.php new file mode 100644 index 0000000..c7d3cd4 --- /dev/null +++ b/tp5/thinkphp/library/think/db/Connection.php @@ -0,0 +1,2132 @@ + +// +---------------------------------------------------------------------- + +namespace think\db; + +use InvalidArgumentException; +use PDO; +use PDOStatement; +use think\Container; +use think\Db; +use think\db\exception\BindParamException; +use think\Debug; +use think\Exception; +use think\exception\PDOException; + +abstract class Connection +{ + protected static $instance = []; + /** @var PDOStatement PDO操作实例 */ + protected $PDOStatement; + + /** @var string 当前SQL指令 */ + protected $queryStr = ''; + // 返回或者影响记录数 + protected $numRows = 0; + // 事务指令数 + protected $transTimes = 0; + // 错误信息 + protected $error = ''; + + /** @var PDO[] 数据库连接ID 支持多个连接 */ + protected $links = []; + + /** @var PDO 当前连接ID */ + protected $linkID; + protected $linkRead; + protected $linkWrite; + + // 查询结果类型 + protected $fetchType = PDO::FETCH_ASSOC; + // 字段属性大小写 + protected $attrCase = PDO::CASE_LOWER; + // 监听回调 + protected static $event = []; + + // 数据表信息 + protected static $info = []; + + // 使用Builder类 + protected $builderClassName; + // Builder对象 + protected $builder; + // 数据库连接参数配置 + protected $config = [ + // 数据库类型 + 'type' => '', + // 服务器地址 + 'hostname' => '', + // 数据库名 + 'database' => '', + // 用户名 + 'username' => '', + // 密码 + 'password' => '', + // 端口 + 'hostport' => '', + // 连接dsn + 'dsn' => '', + // 数据库连接参数 + 'params' => [], + // 数据库编码默认采用utf8 + 'charset' => 'utf8', + // 数据库表前缀 + 'prefix' => '', + // 数据库调试模式 + 'debug' => false, + // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) + 'deploy' => 0, + // 数据库读写是否分离 主从式有效 + 'rw_separate' => false, + // 读写分离后 主服务器数量 + 'master_num' => 1, + // 指定从服务器序号 + 'slave_no' => '', + // 是否严格检查字段是否存在 + 'fields_strict' => true, + // 数据集返回类型 + 'resultset_type' => '', + // 自动写入时间戳字段 + 'auto_timestamp' => false, + // 时间字段取出后的默认时间格式 + 'datetime_format' => 'Y-m-d H:i:s', + // 是否需要进行SQL性能分析 + 'sql_explain' => false, + // Builder类 + 'builder' => '', + // Query类 + 'query' => '\\think\\db\\Query', + // 是否需要断线重连 + 'break_reconnect' => false, + ]; + + // PDO连接参数 + protected $params = [ + PDO::ATTR_CASE => PDO::CASE_NATURAL, + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, + PDO::ATTR_STRINGIFY_FETCHES => false, + PDO::ATTR_EMULATE_PREPARES => false, + ]; + + // 绑定参数 + protected $bind = []; + + /** + * 架构函数 读取数据库配置信息 + * @access public + * @param array $config 数据库配置数组 + */ + public function __construct(array $config = []) + { + if (!empty($config)) { + $this->config = array_merge($this->config, $config); + } + + // 创建Builder对象 + $class = $this->getBuilderClass(); + + $this->builder = new $class($this); + + // 执行初始化操作 + $this->initialize(); + } + + /** + * 初始化 + * @access protected + * @return void + */ + protected function initialize() + {} + + /** + * 取得数据库连接类实例 + * @access public + * @param mixed $config 连接配置 + * @param bool|string $name 连接标识 true 强制重新连接 + * @return Connection + * @throws Exception + */ + public static function instance($config = [], $name = false) + { + if (false === $name) { + $name = md5(serialize($config)); + } + + if (true === $name || !isset(self::$instance[$name])) { + // 解析连接参数 支持数组和字符串 + $options = self::parseConfig($config); + + if (empty($options['type'])) { + throw new InvalidArgumentException('Undefined db type'); + } + + $class = false !== strpos($options['type'], '\\') ? $options['type'] : '\\think\\db\\connector\\' . ucwords($options['type']); + // 记录初始化信息 + Container::get('app')->log('[ DB ] INIT ' . $options['type']); + + if (true === $name) { + $name = md5(serialize($config)); + } + + self::$instance[$name] = new $class($options); + } + + return self::$instance[$name]; + } + + /** + * 获取当前连接器类对应的Builder类 + * @access public + * @return string + */ + public function getBuilderClass() + { + if (!empty($this->builderClassName)) { + return $this->builderClassName; + } else { + return $this->getConfig('builder') ?: '\\think\\db\\builder\\' . ucfirst($this->getConfig('type')); + } + } + + /** + * 设置当前的数据库Builder对象 + * @access protected + * @param Builder $builder + * @return void + */ + protected function setBuilder(Builder $builder) + { + $this->builder = $builder; + + return $this; + } + + /** + * 获取当前的builder实例对象 + * @access public + * @return Builder + */ + public function getBuilder() + { + return $this->builder; + } + + /** + * 解析pdo连接的dsn信息 + * @access protected + * @param array $config 连接信息 + * @return string + */ + abstract protected function parseDsn($config); + + /** + * 取得数据表的字段信息 + * @access public + * @param string $tableName + * @return array + */ + abstract public function getFields($tableName); + + /** + * 取得数据库的表信息 + * @access public + * @param string $dbName + * @return array + */ + abstract public function getTables($dbName); + + /** + * SQL性能分析 + * @access protected + * @param string $sql + * @return array + */ + abstract protected function getExplain($sql); + + /** + * 对返数据表字段信息进行大小写转换出来 + * @access public + * @param array $info 字段信息 + * @return array + */ + public function fieldCase($info) + { + // 字段大小写转换 + switch ($this->attrCase) { + case PDO::CASE_LOWER: + $info = array_change_key_case($info); + break; + case PDO::CASE_UPPER: + $info = array_change_key_case($info, CASE_UPPER); + break; + case PDO::CASE_NATURAL: + default: + // 不做转换 + } + + return $info; + } + + /** + * 获取字段绑定类型 + * @access public + * @param string $type 字段类型 + * @return integer + */ + public function getFieldBindType($type) + { + if (0 === strpos($type, 'set') || 0 === strpos($type, 'enum')) { + $bind = PDO::PARAM_STR; + } elseif (preg_match('/(int|double|float|decimal|real|numeric|serial|bit)/is', $type)) { + $bind = PDO::PARAM_INT; + } elseif (preg_match('/bool/is', $type)) { + $bind = PDO::PARAM_BOOL; + } else { + $bind = PDO::PARAM_STR; + } + + return $bind; + } + + /** + * 将SQL语句中的__TABLE_NAME__字符串替换成带前缀的表名(小写) + * @access public + * @param string $sql sql语句 + * @return string + */ + public function parseSqlTable($sql) + { + if (false !== strpos($sql, '__')) { + $prefix = $this->getConfig('prefix'); + $sql = preg_replace_callback("/__([A-Z0-9_-]+)__/sU", function ($match) use ($prefix) { + return $prefix . strtolower($match[1]); + }, $sql); + } + + return $sql; + } + + /** + * 获取数据表信息 + * @access public + * @param mixed $tableName 数据表名 留空自动获取 + * @param string $fetch 获取信息类型 包括 fields type bind pk + * @return mixed + */ + public function getTableInfo($tableName, $fetch = '') + { + if (is_array($tableName)) { + $tableName = key($tableName) ?: current($tableName); + } + + if (strpos($tableName, ',')) { + // 多表不获取字段信息 + return false; + } else { + $tableName = $this->parseSqlTable($tableName); + } + + // 修正子查询作为表名的问题 + if (strpos($tableName, ')')) { + return []; + } + + list($tableName) = explode(' ', $tableName); + + if (!strpos($tableName, '.')) { + $schema = $this->getConfig('database') . '.' . $tableName; + } else { + $schema = $tableName; + } + + if (!isset(self::$info[$schema])) { + // 读取缓存 + $cacheFile = Container::get('app')->getRuntimePath() . 'schema/' . $schema . '.php'; + if (!$this->config['debug'] && is_file($cacheFile)) { + $info = include $cacheFile; + } else { + $info = $this->getFields($tableName); + } + + $fields = array_keys($info); + $bind = $type = []; + + foreach ($info as $key => $val) { + // 记录字段类型 + $type[$key] = $val['type']; + $bind[$key] = $this->getFieldBindType($val['type']); + if (!empty($val['primary'])) { + $pk[] = $key; + } + } + + if (isset($pk)) { + // 设置主键 + $pk = count($pk) > 1 ? $pk : $pk[0]; + } else { + $pk = null; + } + + self::$info[$schema] = ['fields' => $fields, 'type' => $type, 'bind' => $bind, 'pk' => $pk]; + } + + return $fetch ? self::$info[$schema][$fetch] : self::$info[$schema]; + } + + /** + * 获取数据表的主键 + * @access public + * @param string $tableName 数据表名 + * @return string|array + */ + public function getPk($tableName) + { + return $this->getTableInfo($tableName, 'pk'); + } + + /** + * 获取数据表字段信息 + * @access public + * @param string $tableName 数据表名 + * @return array + */ + public function getTableFields($tableName) + { + return $this->getTableInfo($tableName, 'fields'); + } + + /** + * 获取数据表字段类型 + * @access public + * @param string $tableName 数据表名 + * @param string $field 字段名 + * @return array|string + */ + public function getFieldsType($tableName, $field = null) + { + $result = $this->getTableInfo($tableName, 'type'); + + if ($field && isset($result[$field])) { + return $result[$field]; + } + + return $result; + } + + /** + * 获取数据表绑定信息 + * @access public + * @param string $tableName 数据表名 + * @return array + */ + public function getFieldsBind($tableName) + { + return $this->getTableInfo($tableName, 'bind'); + } + + /** + * 获取数据库的配置参数 + * @access public + * @param string $config 配置名称 + * @return mixed + */ + public function getConfig($config = '') + { + return $config ? $this->config[$config] : $this->config; + } + + /** + * 设置数据库的配置参数 + * @access public + * @param string|array $config 配置名称 + * @param mixed $value 配置值 + * @return void + */ + public function setConfig($config, $value = '') + { + if (is_array($config)) { + $this->config = array_merge($this->config, $config); + } else { + $this->config[$config] = $value; + } + } + + /** + * 连接数据库方法 + * @access public + * @param array $config 连接参数 + * @param integer $linkNum 连接序号 + * @param array|bool $autoConnection 是否自动连接主数据库(用于分布式) + * @return PDO + * @throws Exception + */ + public function connect(array $config = [], $linkNum = 0, $autoConnection = false) + { + if (!isset($this->links[$linkNum])) { + if (!$config) { + $config = $this->config; + } else { + $config = array_merge($this->config, $config); + } + + // 连接参数 + if (isset($config['params']) && is_array($config['params'])) { + $params = $config['params'] + $this->params; + } else { + $params = $this->params; + } + + // 记录当前字段属性大小写设置 + $this->attrCase = $params[PDO::ATTR_CASE]; + + try { + if (empty($config['dsn'])) { + $config['dsn'] = $this->parseDsn($config); + } + + if ($config['debug']) { + $startTime = microtime(true); + } + + $this->links[$linkNum] = new PDO($config['dsn'], $config['username'], $config['password'], $params); + + if ($config['debug']) { + // 记录数据库连接信息 + $this->log('[ DB ] CONNECT:[ UseTime:' . number_format(microtime(true) - $startTime, 6) . 's ] ' . $config['dsn']); + } + } catch (\PDOException $e) { + if ($autoConnection) { + $this->log($e->getMessage(), 'error'); + return $this->connect($autoConnection, $linkNum); + } else { + throw $e; + } + } + } + + return $this->links[$linkNum]; + } + + /** + * 释放查询结果 + * @access public + */ + public function free() + { + $this->PDOStatement = null; + } + + /** + * 获取PDO对象 + * @access public + * @return \PDO|false + */ + public function getPdo() + { + if (!$this->linkID) { + return false; + } else { + return $this->linkID; + } + } + + /** + * 执行查询 使用生成器返回数据 + * @access public + * @param string $sql sql指令 + * @param array $bind 参数绑定 + * @param bool $master 是否在主服务器读操作 + * @param Model $model 模型对象实例 + * @param array $condition 查询条件 + * @param mixed $relation 关联查询 + * @return \Generator + */ + public function getCursor($sql, $bind = [], $master = false, $model = null, $condition = null, $relation = null) + { + $this->initConnect($master); + + // 记录SQL语句 + $this->queryStr = $sql; + + $this->bind = $bind; + + // 释放前次的查询结果 + if (!empty($this->PDOStatement)) { + $this->free(); + } + + Db::$queryTimes++; + + // 调试开始 + $this->debug(true); + + // 预处理 + if (empty($this->PDOStatement)) { + $this->PDOStatement = $this->linkID->prepare($sql); + } + + // 是否为存储过程调用 + $procedure = in_array(strtolower(substr(trim($sql), 0, 4)), ['call', 'exec']); + + // 参数绑定 + if ($procedure) { + $this->bindParam($bind); + } else { + $this->bindValue($bind); + } + + // 执行查询 + $this->PDOStatement->execute(); + + // 调试结束 + $this->debug(false); + + // 返回结果集 + while ($result = $this->PDOStatement->fetch($this->fetchType)) { + if ($model) { + $instance = $model->newInstance($result, $condition); + + if ($relation) { + $instance->relationQuery($relation); + } + + yield $instance; + } else { + yield $result; + } + } + } + + /** + * 执行查询 返回数据集 + * @access public + * @param string $sql sql指令 + * @param array $bind 参数绑定 + * @param bool $master 是否在主服务器读操作 + * @param bool $pdo 是否返回PDO对象 + * @return array + * @throws BindParamException + * @throws \PDOException + * @throws \Exception + * @throws \Throwable + */ + public function query($sql, $bind = [], $master = false, $pdo = false) + { + $this->initConnect($master); + + if (!$this->linkID) { + return false; + } + + // 记录SQL语句 + $this->queryStr = $sql; + + $this->bind = $bind; + + Db::$queryTimes++; + + try { + // 调试开始 + $this->debug(true); + + // 释放前次的查询结果 + if (!empty($this->PDOStatement)) { + $this->free(); + } + + // 预处理 + if (empty($this->PDOStatement)) { + $this->PDOStatement = $this->linkID->prepare($sql); + } + + // 是否为存储过程调用 + $procedure = in_array(strtolower(substr(trim($sql), 0, 4)), ['call', 'exec']); + + // 参数绑定 + if ($procedure) { + $this->bindParam($bind); + } else { + $this->bindValue($bind); + } + + // 执行查询 + $this->PDOStatement->execute(); + + // 调试结束 + $this->debug(false); + + // 返回结果集 + return $this->getResult($pdo, $procedure); + } catch (\PDOException $e) { + if ($this->isBreak($e)) { + return $this->close()->query($sql, $bind, $master, $pdo); + } + + throw new PDOException($e, $this->config, $this->getLastsql()); + } catch (\Throwable $e) { + if ($this->isBreak($e)) { + return $this->close()->query($sql, $bind, $master, $pdo); + } + + throw $e; + } catch (\Exception $e) { + if ($this->isBreak($e)) { + return $this->close()->query($sql, $bind, $master, $pdo); + } + + throw $e; + } + } + + /** + * 执行语句 + * @access public + * @param string $sql sql指令 + * @param array $bind 参数绑定 + * @return int + * @throws BindParamException + * @throws \PDOException + * @throws \Exception + * @throws \Throwable + */ + public function execute($sql, $bind = []) + { + $this->initConnect(true); + + if (!$this->linkID) { + return false; + } + + // 记录SQL语句 + $this->queryStr = $sql; + + $this->bind = $bind; + + Db::$executeTimes++; + try { + // 调试开始 + $this->debug(true); + + //释放前次的查询结果 + if (!empty($this->PDOStatement) && $this->PDOStatement->queryString != $sql) { + $this->free(); + } + + // 预处理 + if (empty($this->PDOStatement)) { + $this->PDOStatement = $this->linkID->prepare($sql); + } + + // 是否为存储过程调用 + $procedure = in_array(strtolower(substr(trim($sql), 0, 4)), ['call', 'exec']); + + // 参数绑定 + if ($procedure) { + $this->bindParam($bind); + } else { + $this->bindValue($bind); + } + + // 执行语句 + $this->PDOStatement->execute(); + + // 调试结束 + $this->debug(false); + + $this->numRows = $this->PDOStatement->rowCount(); + + return $this->numRows; + } catch (\PDOException $e) { + if ($this->isBreak($e)) { + return $this->close()->execute($sql, $bind); + } + + throw new PDOException($e, $this->config, $this->getLastsql()); + } catch (\Throwable $e) { + if ($this->isBreak($e)) { + return $this->close()->execute($sql, $bind); + } + + throw $e; + } catch (\Exception $e) { + if ($this->isBreak($e)) { + return $this->close()->execute($sql, $bind); + } + + throw $e; + } + } + + /** + * 查找单条记录 + * @access public + * @param Query $query 查询对象 + * @return array|null|\PDOStatement|string + * @throws DbException + * @throws ModelNotFoundException + * @throws DataNotFoundException + */ + public function find(Query $query) + { + // 分析查询表达式 + $options = $query->getOptions(); + $pk = $query->getPk($options); + + if (!empty($options['cache']) && true === $options['cache']['key'] && is_string($pk) && isset($options['where']['AND'][$pk])) { + $key = $this->getCacheKey($options['where']['AND'][$pk], $options); + } + + $data = $options['data']; + $result = false; + + if (empty($options['fetch_sql']) && !empty($options['cache'])) { + // 判断查询缓存 + $cache = $options['cache']; + + if (is_string($cache['key'])) { + $key = $cache['key']; + } elseif (!isset($key)) { + $key = $this->getCacheKey($data, $options, $query->getBind(false)); + } + + $result = Container::get('cache')->get($key); + } + + if (false === $result) { + if (is_string($pk)) { + if (!is_array($data)) { + if (isset($key) && strpos($key, '|')) { + list($a, $val) = explode('|', $key); + $item[$pk] = $val; + } else { + $item[$pk] = $data; + } + $data = $item; + } + } + $query->setOption('data', $data); + $query->setOption('limit', 1); + + // 生成查询SQL + $sql = $this->builder->select($query); + + $bind = $query->getBind(); + + if (!empty($options['fetch_sql'])) { + // 获取实际执行的SQL语句 + return $this->getRealSql($sql, $bind); + } + + // 事件回调 + if ($result = $query->trigger('before_find')) { + } else { + // 执行查询 + $resultSet = $this->query($sql, $bind, $options['master'], $options['fetch_pdo']); + + if ($resultSet instanceof \PDOStatement) { + // 返回PDOStatement对象 + return $resultSet; + } + + $result = isset($resultSet[0]) ? $resultSet[0] : null; + } + + if (isset($cache) && $result) { + // 缓存数据 + $this->cacheData($key, $result, $cache); + } + } + + return $result; + } + + /** + * 使用游标查询记录 + * @access public + * @param Query $query 查询对象 + * @return \Generator + */ + public function cursor(Query $query) + { + // 分析查询表达式 + $options = $query->getOptions(); + + // 生成查询SQL + $sql = $this->builder->select($query); + + $bind = $query->getBind(); + + $condition = isset($options['where']['AND']) ? $options['where']['AND'] : null; + $relation = isset($options['relaltion']) ? $options['relation'] : null; + + // 执行查询操作 + return $this->getCursor($sql, $bind, $options['master'], $query->getModel(), $condition, $relation); + } + + /** + * 查找记录 + * @access public + * @param Query $query 查询对象 + * @return array|\PDOStatement|string + * @throws DbException + * @throws ModelNotFoundException + * @throws DataNotFoundException + */ + public function select(Query $query) + { + // 分析查询表达式 + $options = $query->getOptions(); + $resultSet = false; + + if (empty($options['fetch_sql']) && !empty($options['cache'])) { + // 判断查询缓存 + $cache = $options['cache']; + $key = is_string($cache['key']) ? $cache['key'] : md5(serialize($options) . serialize($query->getBind(false))); + $resultSet = Container::get('cache')->get($key); + } + + if (false === $resultSet) { + // 生成查询SQL + $sql = $this->builder->select($query); + + $bind = $query->getBind(); + + if (!empty($options['fetch_sql'])) { + // 获取实际执行的SQL语句 + return $this->getRealSql($sql, $bind); + } + + if ($resultSet = $query->trigger('before_select')) { + } else { + // 执行查询操作 + $resultSet = $this->query($sql, $bind, $options['master'], $options['fetch_pdo']); + + if ($resultSet instanceof \PDOStatement) { + // 返回PDOStatement对象 + return $resultSet; + } + } + + if (isset($cache) && false !== $resultSet) { + // 缓存数据集 + $this->cacheData($key, $resultSet, $cache); + } + } + + return $resultSet; + } + + /** + * 插入记录 + * @access public + * @param Query $query 查询对象 + * @param boolean $replace 是否replace + * @param boolean $getLastInsID 返回自增主键 + * @param string $sequence 自增序列名 + * @return integer|string + */ + public function insert(Query $query, $replace = false, $getLastInsID = false, $sequence = null) + { + // 分析查询表达式 + $options = $query->getOptions(); + + // 生成SQL语句 + $sql = $this->builder->insert($query, $replace); + + $bind = $query->getBind(); + + if (!empty($options['fetch_sql'])) { + // 获取实际执行的SQL语句 + return $this->getRealSql($sql, $bind); + } + + // 执行操作 + $result = $this->execute($sql, $bind); + + if ($result) { + $sequence = $sequence ?: (isset($options['sequence']) ? $options['sequence'] : null); + $lastInsId = $this->getLastInsID($sequence); + + $data = $options['data']; + + if ($lastInsId) { + $pk = $query->getPk($options); + if (is_string($pk)) { + $data[$pk] = $lastInsId; + } + } + + $query->setOption('data', $data); + + $query->trigger('after_insert'); + + if ($getLastInsID) { + return $lastInsId; + } + } + + return $result; + } + + /** + * 批量插入记录 + * @access public + * @param Query $query 查询对象 + * @param mixed $dataSet 数据集 + * @param bool $replace 是否replace + * @param integer $limit 每次写入数据限制 + * @return integer|string + * @throws \Exception + * @throws \Throwable + */ + public function insertAll(Query $query, $dataSet = [], $replace = false, $limit = null) + { + if (!is_array(reset($dataSet))) { + return false; + } + + $options = $query->getOptions(); + + if ($limit) { + // 分批写入 自动启动事务支持 + $this->startTrans(); + + try { + $array = array_chunk($dataSet, $limit, true); + $count = 0; + + foreach ($array as $item) { + $sql = $this->builder->insertAll($query, $item, $replace); + $bind = $query->getBind(); + if (!empty($options['fetch_sql'])) { + $fetchSql[] = $this->getRealSql($sql, $bind); + } else { + $count += $this->execute($sql, $bind); + } + } + + // 提交事务 + $this->commit(); + } catch (\Exception $e) { + $this->rollback(); + throw $e; + } catch (\Throwable $e) { + $this->rollback(); + throw $e; + } + + return isset($fetchSql) ? implode(';', $fetchSql) : $count; + } + + $sql = $this->builder->insertAll($query, $dataSet, $replace); + $bind = $query->getBind(); + + if (!empty($options['fetch_sql'])) { + // 获取实际执行的SQL语句 + return $this->getRealSql($sql, $bind); + } else { + // 执行操作 + return $this->execute($sql, $bind); + } + } + + /** + * 通过Select方式插入记录 + * @access public + * @param Query $query 查询对象 + * @param string $fields 要插入的数据表字段名 + * @param string $table 要插入的数据表名 + * @return integer|string + * @throws PDOException + */ + public function selectInsert(Query $query, $fields, $table) + { + // 分析查询表达式 + $options = $query->getOptions(); + + // 生成SQL语句 + $table = $this->parseSqlTable($table); + + $sql = $this->builder->selectInsert($query, $fields, $table); + + $bind = $query->getBind(); + + if (!empty($options['fetch_sql'])) { + // 获取实际执行的SQL语句 + return $this->getRealSql($sql, $bind); + } else { + // 执行操作 + return $this->execute($sql, $bind); + } + } + + /** + * 更新记录 + * @access public + * @param Query $query 查询对象 + * @return integer|string + * @throws Exception + * @throws PDOException + */ + public function update(Query $query) + { + $options = $query->getOptions(); + + if (isset($options['cache']) && is_string($options['cache']['key'])) { + $key = $options['cache']['key']; + } + + $pk = $query->getPk($options); + $data = $options['data']; + + if (empty($options['where'])) { + // 如果存在主键数据 则自动作为更新条件 + if (is_string($pk) && isset($data[$pk])) { + $where[$pk] = [$pk, '=', $data[$pk]]; + if (!isset($key)) { + $key = $this->getCacheKey($data[$pk], $options); + } + unset($data[$pk]); + } elseif (is_array($pk)) { + // 增加复合主键支持 + foreach ($pk as $field) { + if (isset($data[$field])) { + $where[$field] = [$field, '=', $data[$field]]; + } else { + // 如果缺少复合主键数据则不执行 + throw new Exception('miss complex primary data'); + } + unset($data[$field]); + } + } + + if (!isset($where)) { + // 如果没有任何更新条件则不执行 + throw new Exception('miss update condition'); + } else { + $options['where']['AND'] = $where; + $query->setOption('where', ['AND' => $where]); + } + } elseif (!isset($key) && is_string($pk) && isset($options['where']['AND'][$pk])) { + $key = $this->getCacheKey($options['where']['AND'][$pk], $options); + } + + // 更新数据 + $query->setOption('data', $data); + + // 生成UPDATE SQL语句 + $sql = $this->builder->update($query); + $bind = $query->getBind(); + + if (!empty($options['fetch_sql'])) { + // 获取实际执行的SQL语句 + return $this->getRealSql($sql, $bind); + } else { + // 检测缓存 + $cache = Container::get('cache'); + + if (isset($key) && $cache->get($key)) { + // 删除缓存 + $cache->rm($key); + } elseif (!empty($options['cache']['tag'])) { + $cache->clear($options['cache']['tag']); + } + + // 执行操作 + $result = '' == $sql ? 0 : $this->execute($sql, $bind); + + if ($result) { + if (is_string($pk) && isset($where[$pk])) { + $data[$pk] = $where[$pk]; + } elseif (is_string($pk) && isset($key) && strpos($key, '|')) { + list($a, $val) = explode('|', $key); + $data[$pk] = $val; + } + + $query->setOption('data', $data); + $query->trigger('after_update'); + } + + return $result; + } + } + + /** + * 删除记录 + * @access public + * @param Query $query 查询对象 + * @return int + * @throws Exception + * @throws PDOException + */ + public function delete(Query $query) + { + // 分析查询表达式 + $options = $query->getOptions(); + $pk = $query->getPk($options); + $data = $options['data']; + + if (isset($options['cache']) && is_string($options['cache']['key'])) { + $key = $options['cache']['key']; + } elseif (!is_null($data) && true !== $data && !is_array($data)) { + $key = $this->getCacheKey($data, $options); + } elseif (is_string($pk) && isset($options['where']['AND'][$pk])) { + $key = $this->getCacheKey($options['where']['AND'][$pk], $options); + } + + if (true !== $data && empty($options['where'])) { + // 如果条件为空 不进行删除操作 除非设置 1=1 + throw new Exception('delete without condition'); + } + + // 生成删除SQL语句 + $sql = $this->builder->delete($query); + + $bind = $query->getBind(); + + if (!empty($options['fetch_sql'])) { + // 获取实际执行的SQL语句 + return $this->getRealSql($sql, $bind); + } + + // 检测缓存 + $cache = Container::get('cache'); + + if (isset($key) && $cache->get($key)) { + // 删除缓存 + $cache->rm($key); + } elseif (!empty($options['cache']['tag'])) { + $cache->clear($options['cache']['tag']); + } + + // 执行操作 + $result = $this->execute($sql, $bind); + + if ($result) { + if (!is_array($data) && is_string($pk) && isset($key) && strpos($key, '|')) { + list($a, $val) = explode('|', $key); + $item[$pk] = $val; + $data = $item; + } + + $options['data'] = $data; + + $query->trigger('after_delete'); + } + + return $result; + } + + /** + * 得到某个字段的值 + * @access public + * @param Query $query 查询对象 + * @param string $field 字段名 + * @param bool $default 默认值 + * @return mixed + */ + public function value(Query $query, $field, $default = null) + { + $options = $query->getOptions(); + + $result = false; + if (empty($options['fetch_sql']) && !empty($options['cache'])) { + // 判断查询缓存 + $cache = $options['cache']; + + $key = is_string($cache['key']) ? $cache['key'] : md5($field . serialize($options) . serialize($query->getBind(false))); + $result = Container::get('cache')->get($key); + } + + if (false === $result) { + if (isset($options['field'])) { + $query->removeOption('field'); + } + + if (is_string($field)) { + $field = array_map('trim', explode(',', $field)); + } + + $query->setOption('field', $field); + $query->setOption('limit', 1); + // 生成查询SQL + $sql = $this->builder->select($query); + + $bind = $query->getBind(); + + if (!empty($options['fetch_sql'])) { + // 获取实际执行的SQL语句 + return $this->getRealSql($sql, $bind); + } + + // 执行查询操作 + $pdo = $this->query($sql, $bind, $options['master'], true); + + if (is_string($pdo)) { + // 返回SQL语句 + return $pdo; + } + + $result = $pdo->fetchColumn(); + + if (isset($cache) && false !== $result) { + // 缓存数据 + $this->cacheData($key, $result, $cache); + } + } + + return false !== $result ? $result : $default; + } + + /** + * 得到某个字段的值 + * @access public + * @param Query $query 查询对象 + * @param string $aggregate 聚合方法 + * @param string $field 字段名 + * @return mixed + */ + public function aggregate(Query $query, $aggregate, $field) + { + $field = $aggregate . '(' . $this->builder->parseKey($query, $field) . ') AS tp_' . strtolower($aggregate); + + return $this->value($query, $field, 0); + } + + /** + * 得到某个列的数组 + * @access public + * @param Query $query 查询对象 + * @param string $field 字段名 多个字段用逗号分隔 + * @param string $key 索引 + * @return array + */ + public function column(Query $query, $field, $key = '') + { + $options = $query->getOptions(); + + $result = false; + + if (empty($options['fetch_sql']) && !empty($options['cache'])) { + // 判断查询缓存 + $cache = $options['cache']; + + $guid = is_string($cache['key']) ? $cache['key'] : md5($field . serialize($options) . serialize($query->getBind(false))); + $result = Container::get('cache')->get($guid); + } + + if (false === $result) { + if (isset($options['field'])) { + $query->removeOption('field'); + } + + if (is_null($field)) { + $field = '*'; + } elseif ($key && '*' != $field) { + $field = $key . ',' . $field; + } + + if (is_string($field)) { + $field = array_map('trim', explode(',', $field)); + } + + $query->setOption('field', $field); + + // 生成查询SQL + $sql = $this->builder->select($query); + + $bind = $query->getBind(); + + if (!empty($options['fetch_sql'])) { + // 获取实际执行的SQL语句 + return $this->getRealSql($sql, $bind); + } + + // 执行查询操作 + $pdo = $this->query($sql, $bind, $options['master'], true); + + if (1 == $pdo->columnCount()) { + $result = $pdo->fetchAll(PDO::FETCH_COLUMN); + } else { + $resultSet = $pdo->fetchAll(PDO::FETCH_ASSOC); + + if ('*' == $field && $key) { + $result = array_column($resultSet, null, $key); + } elseif ($resultSet) { + $fields = array_keys($resultSet[0]); + $count = count($fields); + $key1 = array_shift($fields); + $key2 = $fields ? array_shift($fields) : ''; + $key = $key ?: $key1; + + if (strpos($key, '.')) { + list($alias, $key) = explode('.', $key); + } + + if (2 == $count) { + $column = $key2; + } elseif (1 == $count) { + $column = $key1; + } else { + $column = null; + } + + $result = array_column($resultSet, $column, $key); + } else { + $result = []; + } + } + + if (isset($cache) && isset($guid)) { + // 缓存数据 + $this->cacheData($guid, $result, $cache); + } + } + + return $result; + } + + /** + * 执行查询但只返回PDOStatement对象 + * @access public + * @return \PDOStatement|string + */ + public function pdo(Query $query) + { + // 分析查询表达式 + $options = $query->getOptions(); + + // 生成查询SQL + $sql = $this->builder->select($query); + + $bind = $query->getBind(); + + if (!empty($options['fetch_sql'])) { + // 获取实际执行的SQL语句 + return $this->getRealSql($sql, $bind); + } + + // 执行查询操作 + return $this->query($sql, $bind, $options['master'], true); + } + + /** + * 根据参数绑定组装最终的SQL语句 便于调试 + * @access public + * @param string $sql 带参数绑定的sql语句 + * @param array $bind 参数绑定列表 + * @return string + */ + public function getRealSql($sql, array $bind = []) + { + if (is_array($sql)) { + $sql = implode(';', $sql); + } + + foreach ($bind as $key => $val) { + $value = is_array($val) ? $val[0] : $val; + $type = is_array($val) ? $val[1] : PDO::PARAM_STR; + + if (PDO::PARAM_STR == $type) { + $value = '\'' . addslashes($value) . '\''; + } elseif (PDO::PARAM_INT == $type) { + $value = (float) $value; + } + + // 判断占位符 + $sql = is_numeric($key) ? + substr_replace($sql, $value, strpos($sql, '?'), 1) : + str_replace( + [':' . $key . ')', ':' . $key . ',', ':' . $key . ' ', ':' . $key . PHP_EOL], + [$value . ')', $value . ',', $value . ' ', $value . PHP_EOL], + $sql . ' '); + } + + return rtrim($sql); + } + + /** + * 参数绑定 + * 支持 ['name'=>'value','id'=>123] 对应命名占位符 + * 或者 ['value',123] 对应问号占位符 + * @access public + * @param array $bind 要绑定的参数列表 + * @return void + * @throws BindParamException + */ + protected function bindValue(array $bind = []) + { + foreach ($bind as $key => $val) { + // 占位符 + $param = is_numeric($key) ? $key + 1 : ':' . $key; + + if (is_array($val)) { + if (PDO::PARAM_INT == $val[1] && '' === $val[0]) { + $val[0] = 0; + } + $result = $this->PDOStatement->bindValue($param, $val[0], $val[1]); + } else { + $result = $this->PDOStatement->bindValue($param, $val); + } + + if (!$result) { + throw new BindParamException( + "Error occurred when binding parameters '{$param}'", + $this->config, + $this->getLastsql(), + $bind + ); + } + } + } + + /** + * 存储过程的输入输出参数绑定 + * @access public + * @param array $bind 要绑定的参数列表 + * @return void + * @throws BindParamException + */ + protected function bindParam($bind) + { + foreach ($bind as $key => $val) { + $param = is_numeric($key) ? $key + 1 : ':' . $key; + + if (is_array($val)) { + array_unshift($val, $param); + $result = call_user_func_array([$this->PDOStatement, 'bindParam'], $val); + } else { + $result = $this->PDOStatement->bindValue($param, $val); + } + + if (!$result) { + $param = array_shift($val); + + throw new BindParamException( + "Error occurred when binding parameters '{$param}'", + $this->config, + $this->getLastsql(), + $bind + ); + } + } + } + + /** + * 获得数据集数组 + * @access protected + * @param bool $pdo 是否返回PDOStatement + * @param bool $procedure 是否存储过程 + * @return array + */ + protected function getResult($pdo = false, $procedure = false) + { + if ($pdo) { + // 返回PDOStatement对象处理 + return $this->PDOStatement; + } + + if ($procedure) { + // 存储过程返回结果 + return $this->procedure(); + } + + $result = $this->PDOStatement->fetchAll($this->fetchType); + + $this->numRows = count($result); + + return $result; + } + + /** + * 获得存储过程数据集 + * @access protected + * @return array + */ + protected function procedure() + { + $item = []; + + do { + $result = $this->getResult(); + if ($result) { + $item[] = $result; + } + } while ($this->PDOStatement->nextRowset()); + + $this->numRows = count($item); + + return $item; + } + + /** + * 执行数据库事务 + * @access public + * @param callable $callback 数据操作方法回调 + * @return mixed + * @throws PDOException + * @throws \Exception + * @throws \Throwable + */ + public function transaction($callback) + { + $this->startTrans(); + + try { + $result = null; + if (is_callable($callback)) { + $result = call_user_func_array($callback, [$this]); + } + + $this->commit(); + return $result; + } catch (\Exception $e) { + $this->rollback(); + throw $e; + } catch (\Throwable $e) { + $this->rollback(); + throw $e; + } + } + + /** + * 启动事务 + * @access public + * @return void + * @throws \PDOException + * @throws \Exception + */ + public function startTrans() + { + $this->initConnect(true); + if (!$this->linkID) { + return false; + } + + ++$this->transTimes; + + try { + if (1 == $this->transTimes) { + $this->linkID->beginTransaction(); + } elseif ($this->transTimes > 1 && $this->supportSavepoint()) { + $this->linkID->exec( + $this->parseSavepoint('trans' . $this->transTimes) + ); + } + } catch (\PDOException $e) { + if ($this->isBreak($e)) { + return $this->close()->startTrans(); + } + throw $e; + } catch (\Exception $e) { + if ($this->isBreak($e)) { + return $this->close()->startTrans(); + } + throw $e; + } + } + + /** + * 用于非自动提交状态下面的查询提交 + * @access public + * @return void + * @throws PDOException + */ + public function commit() + { + $this->initConnect(true); + + if (1 == $this->transTimes) { + $this->linkID->commit(); + } + + --$this->transTimes; + } + + /** + * 事务回滚 + * @access public + * @return void + * @throws PDOException + */ + public function rollback() + { + $this->initConnect(true); + + if (1 == $this->transTimes) { + $this->linkID->rollBack(); + } elseif ($this->transTimes > 1 && $this->supportSavepoint()) { + $this->linkID->exec( + $this->parseSavepointRollBack('trans' . $this->transTimes) + ); + } + + $this->transTimes = max(0, $this->transTimes - 1); + } + + /** + * 是否支持事务嵌套 + * @return bool + */ + protected function supportSavepoint() + { + return false; + } + + /** + * 生成定义保存点的SQL + * @access protected + * @param $name + * @return string + */ + protected function parseSavepoint($name) + { + return 'SAVEPOINT ' . $name; + } + + /** + * 生成回滚到保存点的SQL + * @access protected + * @param $name + * @return string + */ + protected function parseSavepointRollBack($name) + { + return 'ROLLBACK TO SAVEPOINT ' . $name; + } + + /** + * 批处理执行SQL语句 + * 批处理的指令都认为是execute操作 + * @access public + * @param array $sqlArray SQL批处理指令 + * @param array $bind 参数绑定 + * @return boolean + */ + public function batchQuery($sqlArray = [], $bind = []) + { + if (!is_array($sqlArray)) { + return false; + } + + // 自动启动事务支持 + $this->startTrans(); + + try { + foreach ($sqlArray as $sql) { + $this->execute($sql, $bind); + } + // 提交事务 + $this->commit(); + } catch (\Exception $e) { + $this->rollback(); + throw $e; + } + + return true; + } + + /** + * 获得查询次数 + * @access public + * @param boolean $execute 是否包含所有查询 + * @return integer + */ + public function getQueryTimes($execute = false) + { + return $execute ? Db::$queryTimes + Db::$executeTimes : Db::$queryTimes; + } + + /** + * 获得执行次数 + * @access public + * @return integer + */ + public function getExecuteTimes() + { + return Db::$executeTimes; + } + + /** + * 关闭数据库(或者重新连接) + * @access public + * @return $this + */ + public function close() + { + $this->linkID = null; + $this->linkWrite = null; + $this->linkRead = null; + $this->links = []; + + return $this; + } + + /** + * 是否断线 + * @access protected + * @param \PDOException|\Exception $e 异常对象 + * @return bool + */ + protected function isBreak($e) + { + if (!$this->config['break_reconnect']) { + return false; + } + + $info = [ + 'server has gone away', + 'no connection to the server', + 'Lost connection', + 'is dead or not enabled', + 'Error while sending', + 'decryption failed or bad record mac', + 'server closed the connection unexpectedly', + 'SSL connection has been closed unexpectedly', + 'Error writing data to the connection', + 'Resource deadlock avoided', + ]; + + $error = $e->getMessage(); + + foreach ($info as $msg) { + if (false !== stripos($error, $msg)) { + return true; + } + } + return false; + } + + /** + * 获取最近一次查询的sql语句 + * @access public + * @return string + */ + public function getLastSql() + { + return $this->getRealSql($this->queryStr, $this->bind); + } + + /** + * 获取最近插入的ID + * @access public + * @param string $sequence 自增序列名 + * @return string + */ + public function getLastInsID($sequence = null) + { + return $this->linkID->lastInsertId($sequence); + } + + /** + * 获取返回或者影响的记录数 + * @access public + * @return integer + */ + public function getNumRows() + { + return $this->numRows; + } + + /** + * 获取最近的错误信息 + * @access public + * @return string + */ + public function getError() + { + if ($this->PDOStatement) { + $error = $this->PDOStatement->errorInfo(); + $error = $error[1] . ':' . $error[2]; + } else { + $error = ''; + } + + if ('' != $this->queryStr) { + $error .= "\n [ SQL语句 ] : " . $this->getLastsql(); + } + + return $error; + } + + /** + * 数据库调试 记录当前SQL及分析性能 + * @access protected + * @param boolean $start 调试开始标记 true 开始 false 结束 + * @param string $sql 执行的SQL语句 留空自动获取 + * @return void + */ + protected function debug($start, $sql = '') + { + if (!empty($this->config['debug'])) { + // 开启数据库调试模式 + $debug = Container::get('debug'); + + if ($start) { + $debug->remark('queryStartTime', 'time'); + } else { + // 记录操作结束时间 + $debug->remark('queryEndTime', 'time'); + $runtime = $debug->getRangeTime('queryStartTime', 'queryEndTime'); + $sql = $sql ?: $this->getLastsql(); + $result = []; + + // SQL性能分析 + if ($this->config['sql_explain'] && 0 === stripos(trim($sql), 'select')) { + $result = $this->getExplain($sql); + } + + // SQL监听 + $this->triggerSql($sql, $runtime, $result); + } + } + } + + /** + * 监听SQL执行 + * @access public + * @param callable $callback 回调方法 + * @return void + */ + public function listen($callback) + { + self::$event[] = $callback; + } + + /** + * 触发SQL事件 + * @access protected + * @param string $sql SQL语句 + * @param float $runtime SQL运行时间 + * @param mixed $explain SQL分析 + * @return bool + */ + protected function triggerSql($sql, $runtime, $explain = []) + { + if (!empty(self::$event)) { + foreach (self::$event as $callback) { + if (is_callable($callback)) { + call_user_func_array($callback, [$sql, $runtime, $explain]); + } + } + } else { + // 未注册监听则记录到日志中 + $this->log('[ SQL ] ' . $sql . ' [ RunTime:' . $runtime . 's ]'); + + if (!empty($explain)) { + $this->log('[ EXPLAIN : ' . var_export($explain, true) . ' ]'); + } + } + } + + public function log($log, $type = 'sql') + { + $this->config['debug'] && Container::get('log')->record($log, $type); + } + + /** + * 初始化数据库连接 + * @access protected + * @param boolean $master 是否主服务器 + * @return void + */ + protected function initConnect($master = true) + { + if (!empty($this->config['deploy'])) { + // 采用分布式数据库 + if ($master || $this->transTimes) { + if (!$this->linkWrite) { + $this->linkWrite = $this->multiConnect(true); + } + + $this->linkID = $this->linkWrite; + } else { + if (!$this->linkRead) { + $this->linkRead = $this->multiConnect(false); + } + + $this->linkID = $this->linkRead; + } + } elseif (!$this->linkID) { + // 默认单数据库 + $this->linkID = $this->connect(); + } + } + + /** + * 连接分布式服务器 + * @access protected + * @param boolean $master 主服务器 + * @return PDO + */ + protected function multiConnect($master = false) + { + $_config = []; + + // 分布式数据库配置解析 + foreach (['username', 'password', 'hostname', 'hostport', 'database', 'dsn', 'charset'] as $name) { + $_config[$name] = explode(',', $this->config[$name]); + } + + // 主服务器序号 + $m = floor(mt_rand(0, $this->config['master_num'] - 1)); + + if ($this->config['rw_separate']) { + // 主从式采用读写分离 + if ($master) // 主服务器写入 + { + $r = $m; + } elseif (is_numeric($this->config['slave_no'])) { + // 指定服务器读 + $r = $this->config['slave_no']; + } else { + // 读操作连接从服务器 每次随机连接的数据库 + $r = floor(mt_rand($this->config['master_num'], count($_config['hostname']) - 1)); + } + } else { + // 读写操作不区分服务器 每次随机连接的数据库 + $r = floor(mt_rand(0, count($_config['hostname']) - 1)); + } + $dbMaster = false; + + if ($m != $r) { + $dbMaster = []; + foreach (['username', 'password', 'hostname', 'hostport', 'database', 'dsn', 'charset'] as $name) { + $dbMaster[$name] = isset($_config[$name][$m]) ? $_config[$name][$m] : $_config[$name][0]; + } + } + + $dbConfig = []; + + foreach (['username', 'password', 'hostname', 'hostport', 'database', 'dsn', 'charset'] as $name) { + $dbConfig[$name] = isset($_config[$name][$r]) ? $_config[$name][$r] : $_config[$name][0]; + } + + return $this->connect($dbConfig, $r, $r == $m ? false : $dbMaster); + } + + /** + * 析构方法 + * @access public + */ + public function __destruct() + { + // 释放查询 + $this->free(); + + // 关闭连接 + $this->close(); + } + + /** + * 缓存数据 + * @access protected + * @param string $key 缓存标识 + * @param mixed $data 缓存数据 + * @param array $config 缓存参数 + */ + protected function cacheData($key, $data, $config = []) + { + $cache = Container::get('cache'); + + if (isset($config['tag'])) { + $cache->tag($config['tag'])->set($key, $data, $config['expire']); + } else { + $cache->set($key, $data, $config['expire']); + } + } + + /** + * 生成缓存标识 + * @access protected + * @param mixed $value 缓存数据 + * @param array $options 缓存参数 + * @param array $bind 绑定参数 + * @return string + */ + protected function getCacheKey($value, $options, $bind = []) + { + if (is_scalar($value)) { + $data = $value; + } elseif (is_array($value) && isset($value[1], $value[2]) && in_array($value[1], ['=', 'eq'])) { + $data = $value[2]; + } + + if (isset($data)) { + return 'think:' . (is_array($options['table']) ? key($options['table']) : $options['table']) . '|' . $data; + } else { + try { + return md5(serialize($options) . serialize($bind)); + } catch (\Exception $e) { + return; + } + } + } + + /** + * 数据库连接参数解析 + * @access private + * @param mixed $config + * @return array + */ + private static function parseConfig($config) + { + if (empty($config)) { + $config = Container::get('config')->pull('database'); + } elseif (is_string($config) && false === strpos($config, '/')) { + // 支持读取配置参数 + $config = Container::get('config')->get('database.' . $config); + } + + if (is_string($config)) { + return self::parseDsnConfig($config); + } else { + return $config; + } + } + + /** + * DSN解析 + * 格式: mysql://username:passwd@localhost:3306/DbName?param1=val1¶m2=val2#utf8 + * @access private + * @param string $dsnStr + * @return array + */ + private static function parseDsnConfig($dsnStr) + { + $info = parse_url($dsnStr); + + if (!$info) { + return []; + } + + $dsn = [ + 'type' => $info['scheme'], + 'username' => isset($info['user']) ? $info['user'] : '', + 'password' => isset($info['pass']) ? $info['pass'] : '', + 'hostname' => isset($info['host']) ? $info['host'] : '', + 'hostport' => isset($info['port']) ? $info['port'] : '', + 'database' => !empty($info['path']) ? ltrim($info['path'], '/') : '', + 'charset' => isset($info['fragment']) ? $info['fragment'] : 'utf8', + ]; + + if (isset($info['query'])) { + parse_str($info['query'], $dsn['params']); + } else { + $dsn['params'] = []; + } + + return $dsn; + } + +} diff --git a/tp5/thinkphp/library/think/db/Query.php b/tp5/thinkphp/library/think/db/Query.php new file mode 100644 index 0000000..99093ac --- /dev/null +++ b/tp5/thinkphp/library/think/db/Query.php @@ -0,0 +1,2995 @@ + +// +---------------------------------------------------------------------- + +namespace think\db; + +use PDO; +use think\Collection; +use think\Container; +use think\db\exception\BindParamException; +use think\db\exception\DataNotFoundException; +use think\db\exception\ModelNotFoundException; +use think\Exception; +use think\exception\DbException; +use think\exception\PDOException; +use think\Loader; +use think\Model; +use think\model\Relation; +use think\model\relation\OneToOne; +use think\Paginator; + +class Query +{ + /** + * 数据库连接对象列表 + * @var array + */ + protected static $connections = []; + + /** + * 当前数据库连接对象 + * @var Connection + */ + protected $connection; + + /** + * 当前模型对象 + * @var Model + */ + protected $model; + + /** + * 当前数据表名称(不含前缀) + * @var string + */ + protected $name = ''; + + /** + * 当前数据表主键 + * @var string|array + */ + protected $pk; + + /** + * 当前数据表前缀 + * @var string + */ + protected $prefix = ''; + + /** + * 当前查询参数 + * @var array + */ + protected $options = []; + + /** + * 当前参数绑定 + * @var array + */ + protected $bind = []; + + /** + * 事件回调 + * @var array + */ + private static $event = []; + + /** + * 扩展查询方法 + * @var array + */ + private static $extend = []; + + /** + * 日期查询表达式 + * @var array + */ + protected $timeRule = [ + 'today' => ['today', 'tomorrow'], + 'yesterday' => ['yesterday', 'today'], + 'week' => ['this week 00:00:00', 'next week 00:00:00'], + 'last week' => ['last week 00:00:00', 'this week 00:00:00'], + 'month' => ['first Day of this month 00:00:00', 'first Day of next month 00:00:00'], + 'last month' => ['first Day of last month 00:00:00', 'first Day of this month 00:00:00'], + 'year' => ['this year 1/1', 'next year 1/1'], + 'last year' => ['last year 1/1', 'this year 1/1'], + ]; + + /** + * 日期查询快捷定义 + * @var array + */ + protected $timeExp = ['d' => 'today', 'w' => 'week', 'm' => 'month', 'y' => 'year']; + + /** + * 架构函数 + * @access public + */ + public function __construct(Connection $connection = null) + { + if (is_null($connection)) { + $this->connection = Connection::instance(); + } else { + $this->connection = $connection; + } + + $this->prefix = $this->connection->getConfig('prefix'); + } + + /** + * 创建一个新的查询对象 + * @access public + * @return Query + */ + public function newQuery() + { + return new static($this->connection); + } + + /** + * 利用__call方法实现一些特殊的Model方法 + * @access public + * @param string $method 方法名称 + * @param array $args 调用参数 + * @return mixed + * @throws DbException + * @throws Exception + */ + public function __call($method, $args) + { + if (isset(self::$extend[strtolower($method)])) { + // 调用扩展查询方法 + array_unshift($args, $this); + + return Container::getInstance()->invoke(self::$extend[strtolower($method)], $args); + } elseif (strtolower(substr($method, 0, 5)) == 'getby') { + // 根据某个字段获取记录 + $field = Loader::parseName(substr($method, 5)); + return $this->where($field, '=', $args[0])->find(); + } elseif (strtolower(substr($method, 0, 10)) == 'getfieldby') { + // 根据某个字段获取记录的某个值 + $name = Loader::parseName(substr($method, 10)); + return $this->where($name, '=', $args[0])->value($args[1]); + } elseif (strtolower(substr($method, 0, 7)) == 'whereor') { + $name = Loader::parseName(substr($method, 7)); + array_unshift($args, $name); + return call_user_func_array([$this, 'whereOr'], $args); + } elseif (strtolower(substr($method, 0, 5)) == 'where') { + $name = Loader::parseName(substr($method, 5)); + array_unshift($args, $name); + return call_user_func_array([$this, 'where'], $args); + } elseif ($this->model && method_exists($this->model, 'scope' . $method)) { + // 动态调用命名范围 + $method = 'scope' . $method; + array_unshift($args, $this); + + call_user_func_array([$this->model, $method], $args); + return $this; + } else { + throw new Exception('method not exist:' . static::class . '->' . $method); + } + } + + /** + * 扩展查询方法 + * @access public + * @param string|array $method 查询方法名 + * @param callable $callback + * @return void + */ + public static function extend($method, $callback = null) + { + if (is_array($method)) { + foreach ($method as $key => $val) { + self::$extend[strtolower($key)] = $val; + } + } else { + self::$extend[strtolower($method)] = $callback; + } + } + + /** + * 设置当前的数据库Connection对象 + * @access public + * @param Connection $connection + * @return $this + */ + public function setConnection(Connection $connection) + { + $this->connection = $connection; + $this->prefix = $this->connection->getConfig('prefix'); + + return $this; + } + + /** + * 获取当前的数据库Connection对象 + * @access public + * @return Connection + */ + public function getConnection() + { + return $this->connection; + } + + /** + * 指定模型 + * @access public + * @param Model $model 模型对象实例 + * @return $this + */ + public function model(Model $model) + { + $this->model = $model; + return $this; + } + + /** + * 获取当前的模型对象 + * @access public + * @return Model|null + */ + public function getModel() + { + return $this->model ? $this->model->setQuery($this) : null; + } + + /** + * 指定当前数据表名(不含前缀) + * @access public + * @param string $name + * @return $this + */ + public function name($name) + { + $this->name = $name; + return $this; + } + + /** + * 获取当前的数据表名称 + * @access public + * @return string + */ + public function getName() + { + return $this->name ?: $this->model->getName(); + } + + /** + * 得到当前或者指定名称的数据表 + * @access public + * @param string $name + * @return string + */ + public function getTable($name = '') + { + if (empty($name) && isset($this->options['table'])) { + return $this->options['table']; + } + + $name = $name ?: $this->name; + + return $this->prefix . Loader::parseName($name); + } + + /** + * 切换数据库连接 + * @access public + * @param mixed $config 连接配置 + * @param bool|string $name 连接标识 true 强制重新连接 + * @return $this|object + * @throws Exception + */ + public function connect($config = [], $name = false) + { + $this->connection = Connection::instance($config, $name); + $query = $this->connection->getConfig('query'); + + if (__CLASS__ != trim($query, '\\')) { + return new $query($this->connection); + } + + $this->prefix = $this->connection->getConfig('prefix'); + + return $this; + } + + /** + * 执行查询 返回数据集 + * @access public + * @param string $sql sql指令 + * @param array $bind 参数绑定 + * @param boolean $master 是否在主服务器读操作 + * @param bool|string $class 指定返回的数据集对象 + * @return mixed + * @throws BindParamException + * @throws PDOException + */ + public function query($sql, $bind = [], $master = false, $class = false) + { + return $this->connection->query($sql, $bind, $master, $class); + } + + /** + * 执行语句 + * @access public + * @param string $sql sql指令 + * @param array $bind 参数绑定 + * @return int + * @throws BindParamException + * @throws PDOException + */ + public function execute($sql, $bind = []) + { + return $this->connection->execute($sql, $bind); + } + + /** + * 监听SQL执行 + * @access public + * @param callable $callback 回调方法 + * @return void + */ + public function listen($callback) + { + $this->connection->listen($callback); + } + + /** + * 获取最近插入的ID + * @access public + * @param string $sequence 自增序列名 + * @return string + */ + public function getLastInsID($sequence = null) + { + return $this->connection->getLastInsID($sequence); + } + + /** + * 获取最近一次查询的sql语句 + * @access public + * @return string + */ + public function getLastSql() + { + return $this->connection->getLastSql(); + } + + /** + * 执行数据库事务 + * @access public + * @param callable $callback 数据操作方法回调 + * @return mixed + */ + public function transaction($callback) + { + return $this->connection->transaction($callback); + } + + /** + * 启动事务 + * @access public + * @return void + */ + public function startTrans() + { + $this->connection->startTrans(); + } + + /** + * 用于非自动提交状态下面的查询提交 + * @access public + * @return void + * @throws PDOException + */ + public function commit() + { + $this->connection->commit(); + } + + /** + * 事务回滚 + * @access public + * @return void + * @throws PDOException + */ + public function rollback() + { + $this->connection->rollback(); + } + + /** + * 批处理执行SQL语句 + * 批处理的指令都认为是execute操作 + * @access public + * @param array $sql SQL批处理指令 + * @return boolean + */ + public function batchQuery($sql = []) + { + return $this->connection->batchQuery($sql); + } + + /** + * 获取数据库的配置参数 + * @access public + * @param string $name 参数名称 + * @return boolean + */ + public function getConfig($name = '') + { + return $this->connection->getConfig($name); + } + + /** + * 获取数据表字段信息 + * @access public + * @param string $tableName 数据表名 + * @return array + */ + public function getTableFields($tableName = '') + { + if ('' == $tableName) { + $tableName = isset($this->options['table']) ? $this->options['table'] : $this->getTable(); + } + + return $this->connection->getTableFields($tableName); + } + + /** + * 获取数据表字段类型 + * @access public + * @param string $tableName 数据表名 + * @param string $field 字段名 + * @return array|string + */ + public function getFieldsType($tableName = '', $field = null) + { + if ('' == $tableName) { + $tableName = isset($this->options['table']) ? $this->options['table'] : $this->getTable(); + } + + return $this->connection->getFieldsType($tableName, $field); + } + + /** + * 得到分表的的数据表名 + * @access public + * @param array $data 操作的数据 + * @param string $field 分表依据的字段 + * @param array $rule 分表规则 + * @return string + */ + public function getPartitionTableName($data, $field, $rule = []) + { + // 对数据表进行分区 + if ($field && isset($data[$field])) { + $value = $data[$field]; + $type = $rule['type']; + switch ($type) { + case 'id': + // 按照id范围分表 + $step = $rule['expr']; + $seq = floor($value / $step) + 1; + break; + case 'year': + // 按照年份分表 + if (!is_numeric($value)) { + $value = strtotime($value); + } + $seq = date('Y', $value) - $rule['expr'] + 1; + break; + case 'mod': + // 按照id的模数分表 + $seq = ($value % $rule['num']) + 1; + break; + case 'md5': + // 按照md5的序列分表 + $seq = (ord(substr(md5($value), 0, 1)) % $rule['num']) + 1; + break; + default: + if (function_exists($type)) { + // 支持指定函数哈希 + $seq = (ord(substr($type($value), 0, 1)) % $rule['num']) + 1; + } else { + // 按照字段的首字母的值分表 + $seq = (ord($value{0}) % $rule['num']) + 1; + } + } + return $this->getTable() . '_' . $seq; + } else { + // 当设置的分表字段不在查询条件或者数据中 + // 进行联合查询,必须设定 partition['num'] + $tableName = []; + for ($i = 0; $i < $rule['num']; $i++) { + $tableName[] = 'SELECT * FROM ' . $this->getTable() . '_' . ($i + 1); + } + + $tableName = '( ' . implode(" UNION ", $tableName) . ') AS ' . $this->name; + + return $tableName; + } + } + + /** + * 得到某个字段的值 + * @access public + * @param string $field 字段名 + * @param mixed $default 默认值 + * @return mixed + */ + public function value($field, $default = null) + { + $this->parseOptions(); + + $result = $this->connection->value($this, $field, $default); + + if (!empty($this->options['fetch_sql'])) { + return $result; + } + + return $result; + } + + /** + * 得到某个列的数组 + * @access public + * @param string $field 字段名 多个字段用逗号分隔 + * @param string $key 索引 + * @return array + */ + public function column($field, $key = '') + { + $this->parseOptions(); + + return $this->connection->column($this, $field, $key); + } + + /** + * 聚合查询 + * @access public + * @param string $aggregate 聚合方法 + * @param string $field 字段名 + * @param bool $force 强制转为数字类型 + * @return mixed + */ + public function aggregate($aggregate, $field, $force = false) + { + $this->parseOptions(); + + $result = $this->connection->aggregate($this, $aggregate, $field); + + if (!empty($this->options['fetch_sql'])) { + return $result; + } elseif ($force) { + $result += 0; + } + + return $result; + } + + /** + * COUNT查询 + * @access public + * @param string $field 字段名 + * @return integer|string + */ + public function count($field = '*') + { + if (isset($this->options['group'])) { + // 支持GROUP + $options = $this->getOptions(); + $subSql = $this->options($options)->field('count(' . $field . ') AS think_count')->bind($this->bind)->buildSql(); + + $query = $this->newQuery()->table([$subSql => '_group_count_']); + + if (!empty($options['fetch_sql'])) { + $query->fetchSql(true); + } + + return $query->aggregate('COUNT', '*', true); + } + + return $this->aggregate('COUNT', $field, true); + } + + /** + * SUM查询 + * @access public + * @param string $field 字段名 + * @return float|int + */ + public function sum($field) + { + return $this->aggregate('SUM', $field, true); + } + + /** + * MIN查询 + * @access public + * @param string $field 字段名 + * @param bool $force 强制转为数字类型 + * @return mixed + */ + public function min($field, $force = true) + { + return $this->aggregate('MIN', $field, $force); + } + + /** + * MAX查询 + * @access public + * @param string $field 字段名 + * @param bool $force 强制转为数字类型 + * @return mixed + */ + public function max($field, $force = true) + { + return $this->aggregate('MAX', $field, $force); + } + + /** + * AVG查询 + * @access public + * @param string $field 字段名 + * @return float|int + */ + public function avg($field) + { + return $this->aggregate('AVG', $field, true); + } + + /** + * 设置记录的某个字段值 + * 支持使用数据库字段和方法 + * @access public + * @param string|array $field 字段名 + * @param mixed $value 字段值 + * @return integer + */ + public function setField($field, $value = '') + { + if (is_array($field)) { + $data = $field; + } else { + $data[$field] = $value; + } + + return $this->update($data); + } + + /** + * 字段值(延迟)增长 + * @access public + * @param string $field 字段名 + * @param integer $step 增长值 + * @param integer $lazyTime 延时时间(s) + * @return integer|true + * @throws Exception + */ + public function setInc($field, $step = 1, $lazyTime = 0) + { + $condition = !empty($this->options['where']) ? $this->options['where'] : []; + + if (empty($condition)) { + // 没有条件不做任何更新 + throw new Exception('no data to update'); + } + + if ($lazyTime > 0) { + // 延迟写入 + $guid = md5($this->getTable() . '_' . $field . '_' . serialize($condition)); + $step = $this->lazyWrite('inc', $guid, $step, $lazyTime); + + if (false === $step) { + // 清空查询条件 + $this->options = []; + return true; + } + } + + return $this->setField($field, ['inc', $field, $step]); + } + + /** + * 字段值(延迟)减少 + * @access public + * @param string $field 字段名 + * @param integer $step 减少值 + * @param integer $lazyTime 延时时间(s) + * @return integer|true + * @throws Exception + */ + public function setDec($field, $step = 1, $lazyTime = 0) + { + $condition = !empty($this->options['where']) ? $this->options['where'] : []; + + if (empty($condition)) { + // 没有条件不做任何更新 + throw new Exception('no data to update'); + } + + if ($lazyTime > 0) { + // 延迟写入 + $guid = md5($this->getTable() . '_' . $field . '_' . serialize($condition)); + $step = $this->lazyWrite('dec', $guid, $step, $lazyTime); + + if (false === $step) { + // 清空查询条件 + $this->options = []; + return true; + } + + $value = ['inc', $field, $step]; + } else { + $value = ['dec', $field, $step]; + } + + return $this->setField($field, $value); + } + + /** + * 延时更新检查 返回false表示需要延时 + * 否则返回实际写入的数值 + * @access protected + * @param string $type 自增或者自减 + * @param string $guid 写入标识 + * @param integer $step 写入步进值 + * @param integer $lazyTime 延时时间(s) + * @return false|integer + */ + protected function lazyWrite($type, $guid, $step, $lazyTime) + { + $cache = Container::get('cache'); + + if (!$cache->has($guid . '_time')) { + // 计时开始 + $cache->set($guid . '_time', time(), 0); + $cache->$type($guid, $step); + } elseif (time() > $cache->get($guid . '_time') + $lazyTime) { + // 删除缓存 + $value = $cache->$type($guid, $step); + $cache->rm($guid); + $cache->rm($guid . '_time'); + return 0 === $value ? false : $value; + } else { + // 更新缓存 + $cache->$type($guid, $step); + } + + return false; + } + + /** + * 查询SQL组装 join + * @access public + * @param mixed $join 关联的表名 + * @param mixed $condition 条件 + * @param string $type JOIN类型 + * @return $this + */ + public function join($join, $condition = null, $type = 'INNER') + { + if (empty($condition)) { + // 如果为组数,则循环调用join + foreach ($join as $key => $value) { + if (is_array($value) && 2 <= count($value)) { + $this->join($value[0], $value[1], isset($value[2]) ? $value[2] : $type); + } + } + } else { + $table = $this->getJoinTable($join); + + $this->options['join'][] = [$table, strtoupper($type), $condition]; + } + + return $this; + } + + /** + * LEFT JOIN + * @access public + * @param mixed $join 关联的表名 + * @param mixed $condition 条件 + * @return $this + */ + public function leftJoin($join, $condition = null) + { + return $this->join($join, $condition, 'LEFT'); + } + + /** + * RIGHT JOIN + * @access public + * @param mixed $join 关联的表名 + * @param mixed $condition 条件 + * @return $this + */ + public function rightJoin($join, $condition = null) + { + return $this->join($join, $condition, 'RIGHT'); + } + + /** + * FULL JOIN + * @access public + * @param mixed $join 关联的表名 + * @param mixed $condition 条件 + * @return $this + */ + public function fullJoin($join, $condition = null) + { + return $this->join($join, $condition, 'FULL'); + } + + /** + * 获取Join表名及别名 支持 + * ['prefix_table或者子查询'=>'alias'] 'table alias' + * @access protected + * @param array|string $join + * @param string $alias + * @return string + */ + protected function getJoinTable($join, &$alias = null) + { + if (is_array($join)) { + $table = $join; + } else { + $join = trim($join); + + if (false !== strpos($join, '(')) { + // 使用子查询 + $table = $join; + } else { + $prefix = $this->prefix; + if (strpos($join, ' ')) { + // 使用别名 + list($table, $alias) = explode(' ', $join); + } else { + $table = $join; + if (false === strpos($join, '.') && 0 !== strpos($join, '__')) { + $alias = $join; + } + } + + if ($prefix && false === strpos($table, '.') && 0 !== strpos($table, $prefix) && 0 !== strpos($table, '__')) { + $table = $this->getTable($table); + } + } + + if (isset($alias) && $table != $alias) { + $table = [$table => $alias]; + } + } + + return $table; + } + + /** + * 查询SQL组装 union + * @access public + * @param mixed $union + * @param boolean $all + * @return $this + */ + public function union($union, $all = false) + { + $this->options['union']['type'] = $all ? 'UNION ALL' : 'UNION'; + + if (is_array($union)) { + $this->options['union'] = array_merge($this->options['union'], $union); + } else { + $this->options['union'][] = $union; + } + + return $this; + } + + /** + * 查询SQL组装 union all + * @access public + * @param mixed $union + * @return $this + */ + public function unionAll($union) + { + return $this->union($union, true); + } + + /** + * 指定查询字段 支持字段排除和指定数据表 + * @access public + * @param mixed $field + * @param boolean $except 是否排除 + * @param string $tableName 数据表名 + * @param string $prefix 字段前缀 + * @param string $alias 别名前缀 + * @return $this + */ + public function field($field, $except = false, $tableName = '', $prefix = '', $alias = '') + { + if (empty($field)) { + return $this; + } + + if (is_string($field)) { + $field = array_map('trim', explode(',', $field)); + } + + if (true === $field) { + // 获取全部字段 + $fields = $this->getTableFields($tableName); + $field = $fields ?: ['*']; + } elseif ($except) { + // 字段排除 + $fields = $this->getTableFields($tableName); + $field = $fields ? array_diff($fields, $field) : $field; + } + + if ($tableName) { + // 添加统一的前缀 + $prefix = $prefix ?: $tableName; + foreach ($field as $key => $val) { + if (is_numeric($key)) { + $val = $prefix . '.' . $val . ($alias ? ' AS ' . $alias . $val : ''); + } + $field[$key] = $val; + } + } + + if (isset($this->options['field'])) { + $field = array_merge((array) $this->options['field'], $field); + } + + $this->options['field'] = array_unique($field); + + return $this; + } + + /** + * 设置数据排除字段 + * @access public + * @param mixed $field 字段名或者数据 + * @return $this + */ + public function hidden($field) + { + return $this->field($field, true); + } + + /** + * 设置数据 + * @access public + * @param mixed $field 字段名或者数据 + * @param mixed $value 字段值 + * @return $this + */ + public function data($field, $value = null) + { + if (is_array($field)) { + $this->options['data'] = isset($this->options['data']) ? array_merge($this->options['data'], $field) : $field; + } else { + $this->options['data'][$field] = $value; + } + + return $this; + } + + /** + * 字段值增长 + * @access public + * @param string|array $field 字段名 + * @param integer $step 增长值 + * @return $this + */ + public function inc($field, $step = 1) + { + $fields = is_string($field) ? explode(',', $field) : $field; + + foreach ($fields as $field) { + $this->data($field, ['inc', $field, $step]); + } + + return $this; + } + + /** + * 字段值减少 + * @access public + * @param string|array $field 字段名 + * @param integer $step 增长值 + * @return $this + */ + public function dec($field, $step = 1) + { + $fields = is_string($field) ? explode(',', $field) : $field; + + foreach ($fields as $field) { + $this->data($field, ['dec', $field, $step]); + } + + return $this; + } + + /** + * 使用表达式设置数据 + * @access public + * @param string $field 字段名 + * @param string $value 字段值 + * @return $this + */ + public function exp($field, $value) + { + $this->data($field, ['exp', $value]); + return $this; + } + + /** + * 指定JOIN查询字段 + * @access public + * @param string|array $table 数据表 + * @param string|array $field 查询字段 + * @param string|array $on JOIN条件 + * @param string $type JOIN类型 + * @return $this + */ + public function view($join, $field = true, $on = null, $type = 'INNER') + { + $this->options['view'] = true; + + if (is_array($join) && key($join) !== 0) { + foreach ($join as $key => $val) { + $this->view($key, $val[0], isset($val[1]) ? $val[1] : null, isset($val[2]) ? $val[2] : 'INNER'); + } + } else { + $fields = []; + $table = $this->getJoinTable($join, $alias); + + if (true === $field) { + $fields = $alias . '.*'; + } else { + if (is_string($field)) { + $field = explode(',', $field); + } + + foreach ($field as $key => $val) { + if (is_numeric($key)) { + $fields[] = $alias . '.' . $val; + + $this->options['map'][$val] = $alias . '.' . $val; + } else { + if (preg_match('/[,=\.\'\"\(\s]/', $key)) { + $name = $key; + } else { + $name = $alias . '.' . $key; + } + + $fields[] = $name . ' AS ' . $val; + + $this->options['map'][$val] = $name; + } + } + } + + $this->field($fields); + + if ($on) { + $this->join($table, $on, $type); + } else { + $this->table($table); + } + } + + return $this; + } + + /** + * 设置分表规则 + * @access public + * @param array $data 操作的数据 + * @param string $field 分表依据的字段 + * @param array $rule 分表规则 + * @return $this + */ + public function partition($data, $field, $rule = []) + { + $this->options['table'] = $this->getPartitionTableName($data, $field, $rule); + + return $this; + } + + /** + * 指定AND查询条件 + * @access public + * @param mixed $field 查询字段 + * @param mixed $op 查询表达式 + * @param mixed $condition 查询条件 + * @return $this + */ + public function where($field, $op = null, $condition = null) + { + $param = func_get_args(); + array_shift($param); + return $this->parseWhereExp('AND', $field, $op, $condition, $param); + } + + /** + * 指定OR查询条件 + * @access public + * @param mixed $field 查询字段 + * @param mixed $op 查询表达式 + * @param mixed $condition 查询条件 + * @return $this + */ + public function whereOr($field, $op = null, $condition = null) + { + $param = func_get_args(); + array_shift($param); + return $this->parseWhereExp('OR', $field, $op, $condition, $param); + } + + /** + * 指定XOR查询条件 + * @access public + * @param mixed $field 查询字段 + * @param mixed $op 查询表达式 + * @param mixed $condition 查询条件 + * @return $this + */ + public function whereXor($field, $op = null, $condition = null) + { + $param = func_get_args(); + array_shift($param); + return $this->parseWhereExp('XOR', $field, $op, $condition, $param); + } + + /** + * 指定Null查询条件 + * @access public + * @param mixed $field 查询字段 + * @param string $logic 查询逻辑 and or xor + * @return $this + */ + public function whereNull($field, $logic = 'AND') + { + return $this->parseWhereExp($logic, $field, 'null', null); + } + + /** + * 指定NotNull查询条件 + * @access public + * @param mixed $field 查询字段 + * @param string $logic 查询逻辑 and or xor + * @return $this + */ + public function whereNotNull($field, $logic = 'AND') + { + return $this->parseWhereExp($logic, $field, 'notnull', null); + } + + /** + * 指定Exists查询条件 + * @access public + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor + * @return $this + */ + public function whereExists($condition, $logic = 'AND') + { + $this->options['where'][strtoupper($logic)][] = ['', 'exists', $condition]; + return $this; + } + + /** + * 指定NotExists查询条件 + * @access public + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor + * @return $this + */ + public function whereNotExists($condition, $logic = 'AND') + { + $this->options['where'][strtoupper($logic)][] = ['', 'not exists', $condition]; + return $this; + } + + /** + * 指定In查询条件 + * @access public + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor + * @return $this + */ + public function whereIn($field, $condition, $logic = 'AND') + { + return $this->parseWhereExp($logic, $field, 'in', $condition); + } + + /** + * 指定NotIn查询条件 + * @access public + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor + * @return $this + */ + public function whereNotIn($field, $condition, $logic = 'AND') + { + return $this->parseWhereExp($logic, $field, 'not in', $condition); + } + + /** + * 指定Like查询条件 + * @access public + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor + * @return $this + */ + public function whereLike($field, $condition, $logic = 'AND') + { + return $this->parseWhereExp($logic, $field, 'like', $condition); + } + + /** + * 指定NotLike查询条件 + * @access public + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor + * @return $this + */ + public function whereNotLike($field, $condition, $logic = 'AND') + { + return $this->parseWhereExp($logic, $field, 'not like', $condition); + } + + /** + * 指定Between查询条件 + * @access public + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor + * @return $this + */ + public function whereBetween($field, $condition, $logic = 'AND') + { + return $this->parseWhereExp($logic, $field, 'between', $condition); + } + + /** + * 指定NotBetween查询条件 + * @access public + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor + * @return $this + */ + public function whereNotBetween($field, $condition, $logic = 'AND') + { + return $this->parseWhereExp($logic, $field, 'not between', $condition); + } + + /** + * 比较两个字段 + * @access public + * @param string $field1 查询字段 + * @param string $operator 比较操作符 + * @param string $field2 比较字段 + * @param string $logic 查询逻辑 and or xor + * @return $this + */ + public function whereColumn($field1, $operator, $field2 = null, $logic = 'AND') + { + if (is_null($field2)) { + $field2 = $operator; + $operator = '='; + } + + return $this->whereExp($field1, $operator . ' ' . $field2, $logic); + } + + /** + * 设置软删除字段及条件 + * @access public + * @param false|string $field 查询字段 + * @param mixed $condition 查询条件 + * @return $this + */ + public function useSoftDelete($field, $condition = null) + { + if ($field) { + $this->options['soft_delete'] = [$field, $condition ?: ['null', '']]; + } + + return $this; + } + + /** + * 指定Exp查询条件 + * @access public + * @param mixed $field 查询字段 + * @param mixed $condition 查询条件 + * @param string $logic 查询逻辑 and or xor + * @return $this + */ + public function whereExp($field, $condition, $logic = 'AND') + { + return $this->parseWhereExp($logic, $field, 'exp', $condition); + } + + /** + * 分析查询表达式 + * @access public + * @param string $logic 查询逻辑 and or xor + * @param mixed $field 查询字段 + * @param mixed $op 查询表达式 + * @param mixed $condition 查询条件 + * @param array $param 查询参数 + * @return $this + */ + protected function parseWhereExp($logic, $field, $op, $condition, $param = []) + { + if ($field instanceof $this) { + $this->options['where'] = $field->getOptions('where'); + return $this; + } + + $logic = strtoupper($logic); + + if (is_string($field) && !empty($this->options['via']) && !strpos($field, '.')) { + $field = $this->options['via'] . '.' . $field; + } + + if ($field instanceof \Closure) { + $where = is_string($op) ? [$op, $field] : $field; + $field = ''; + } elseif (is_string($field) && preg_match('/[,=\<\'\"\(\s]/', $field)) { + $where = ['', 'exp', $field]; + if (is_array($op)) { + // 参数绑定 + $this->bind($op); + } + } elseif (is_null($op) && is_null($condition)) { + if (is_array($field)) { + if (key($field) !== 0) { + $where = []; + foreach ($field as $key => $val) { + if (is_null($val)) { + $where[$key] = [$key, 'null', '']; + } else { + $where[$key] = !is_scalar($val) ? $val : [$key, '=', $val]; + } + } + } else { + // 数组批量查询 + $where = $field; + } + + if (!empty($where)) { + $this->options['where'][$logic] = isset($this->options['where'][$logic]) ? array_merge($this->options['where'][$logic], $where) : $where; + } + + return $this; + } elseif ($field && is_string($field)) { + // 字符串查询 + $where = [$field, 'null', '']; + } + } elseif (is_array($op)) { + array_unshift($param, $field); + $where = $param; + } elseif (in_array(strtolower($op), ['null', 'notnull', 'not null'])) { + // null查询 + $where = [$field, $op, '']; + } elseif (is_null($condition)) { + // 字段相等查询 + $where = [$field, '=', $op]; + } else { + $where = [$field, $op, $condition, isset($param[2]) ? $param[2] : null]; + + if ('exp' == strtolower($op) && isset($param[2]) && is_array($param[2])) { + // 参数绑定 + $this->bind($param[2]); + } + } + + if (!empty($where)) { + if (isset($this->options['where'][$logic][$field])) { + $this->options['where'][$logic][] = $where; + } else { + $this->options['where'][$logic][$field] = $where; + } + } + + return $this; + } + + /** + * 去除某个查询条件 + * @access public + * @param string $field 查询字段 + * @param string $logic 查询逻辑 and or xor + * @return $this + */ + public function removeWhereField($field, $logic = 'AND') + { + $logic = strtoupper($logic); + + if (isset($this->options['where'][$logic][$field])) { + unset($this->options['where'][$logic][$field]); + } + + return $this; + } + + /** + * 去除查询参数 + * @access public + * @param string|bool $option 参数名 true 表示去除所有参数 + * @return $this + */ + public function removeOption($option = true) + { + if (true === $option) { + $this->options = []; + } elseif (is_string($option) && isset($this->options[$option])) { + unset($this->options[$option]); + } + + return $this; + } + + /** + * 条件查询 + * @access public + * @param mixed $condition 满足条件(支持闭包) + * @param \Closure|array $query 满足条件后执行的查询表达式(闭包或数组) + * @param \Closure|array $otherwise 不满足条件后执行 + * @return $this + */ + public function when($condition, $query, $otherwise = null) + { + if ($condition instanceof \Closure) { + $condition = $condition($this); + } + + if ($condition) { + if ($query instanceof \Closure) { + $query($this, $condition); + } elseif (is_array($query)) { + $this->where($query); + } + } elseif ($otherwise) { + if ($otherwise instanceof \Closure) { + $otherwise($this, $condition); + } elseif (is_array($otherwise)) { + $this->where($otherwise); + } + } + + return $this; + } + + /** + * 指定查询数量 + * @access public + * @param mixed $offset 起始位置 + * @param mixed $length 查询数量 + * @return $this + */ + public function limit($offset, $length = null) + { + if (is_null($length) && strpos($offset, ',')) { + list($offset, $length) = explode(',', $offset); + } + + $this->options['limit'] = intval($offset) . ($length ? ',' . intval($length) : ''); + + return $this; + } + + /** + * 指定分页 + * @access public + * @param mixed $page 页数 + * @param mixed $listRows 每页数量 + * @return $this + */ + public function page($page, $listRows = null) + { + if (is_null($listRows) && strpos($page, ',')) { + list($page, $listRows) = explode(',', $page); + } + + $this->options['page'] = [intval($page), intval($listRows)]; + + return $this; + } + + /** + * 分页查询 + * @access public + * @param int|array $listRows 每页数量 数组表示配置参数 + * @param int|bool $simple 是否简洁模式或者总记录数 + * @param array $config 配置参数 + * page:当前页, + * path:url路径, + * query:url额外参数, + * fragment:url锚点, + * var_page:分页变量, + * list_rows:每页数量 + * type:分页类名 + * @return \think\Paginator + * @throws DbException + */ + public function paginate($listRows = null, $simple = false, $config = []) + { + if (is_int($simple)) { + $total = $simple; + $simple = false; + } + + $paginate = Container::get('config')->pull('paginate'); + + if (is_array($listRows)) { + $config = array_merge($paginate, $listRows); + $listRows = $config['list_rows']; + } else { + $config = array_merge($paginate, $config); + $listRows = $listRows ?: $config['list_rows']; + } + + /** @var Paginator $class */ + $class = false !== strpos($config['type'], '\\') ? $config['type'] : '\\think\\paginator\\driver\\' . ucwords($config['type']); + $page = isset($config['page']) ? (int) $config['page'] : call_user_func([ + $class, + 'getCurrentPage', + ], $config['var_page']); + + $page = $page < 1 ? 1 : $page; + + $config['path'] = isset($config['path']) ? $config['path'] : call_user_func([$class, 'getCurrentPath']); + + if (!isset($total) && !$simple) { + $options = $this->getOptions(); + + unset($this->options['order'], $this->options['limit'], $this->options['page'], $this->options['field']); + + $bind = $this->bind; + $total = $this->count(); + $results = $this->options($options)->bind($bind)->page($page, $listRows)->select(); + } elseif ($simple) { + $results = $this->limit(($page - 1) * $listRows, $listRows + 1)->select(); + $total = null; + } else { + $results = $this->page($page, $listRows)->select(); + } + + return $class::make($results, $listRows, $page, $total, $simple, $config); + } + + /** + * 指定当前操作的数据表 + * @access public + * @param mixed $table 表名 + * @return $this + */ + public function table($table) + { + if (is_string($table)) { + if (strpos($table, ')')) { + // 子查询 + } elseif (strpos($table, ',')) { + $tables = explode(',', $table); + $table = []; + + foreach ($tables as $item) { + list($item, $alias) = explode(' ', trim($item)); + if ($alias) { + $this->alias([$item => $alias]); + $table[$item] = $alias; + } else { + $table[] = $item; + } + } + } elseif (strpos($table, ' ')) { + list($table, $alias) = explode(' ', $table); + + $table = [$table => $alias]; + $this->alias($table); + } + } else { + $tables = $table; + $table = []; + + foreach ($tables as $key => $val) { + if (is_numeric($key)) { + $table[] = $val; + } else { + $this->alias([$key => $val]); + $table[$key] = $val; + } + } + } + $this->options['table'] = $table; + + return $this; + } + + /** + * USING支持 用于多表删除 + * @access public + * @param mixed $using + * @return $this + */ + public function using($using) + { + $this->options['using'] = $using; + return $this; + } + + /** + * 指定排序 order('id','desc') 或者 order(['id'=>'desc','create_time'=>'desc']) + * @access public + * @param string|array $field 排序字段 + * @param string $order 排序 + * @return $this + */ + public function order($field, $order = null) + { + if (!empty($field)) { + if (is_string($field)) { + if (!empty($this->options['via'])) { + $field = $this->options['via'] . '.' . $field; + } + + $field = empty($order) ? $field : [$field => $order]; + } elseif (!empty($this->options['via'])) { + foreach ($field as $key => $val) { + if (is_numeric($key)) { + $field[$key] = $this->options['via'] . '.' . $val; + } else { + $field[$this->options['via'] . '.' . $key] = $val; + unset($field[$key]); + } + } + } + + if (!isset($this->options['order'])) { + $this->options['order'] = []; + } + + if (is_array($field)) { + $this->options['order'] = array_merge($this->options['order'], $field); + } else { + $this->options['order'][] = $field; + } + } + + return $this; + } + + /** + * 指定Field排序 order('id',[1,2,3],'desc') + * @access public + * @param string|array $field 排序字段 + * @param array $values 排序值 + * @param string $order + * @return $this + */ + public function orderField($field, array $values = [], $order = '') + { + $values['sort'] = $order; + + $this->options['order'][$field] = $values; + return $this; + } + + /** + * 随机排序 + * @access public + * @return $this + */ + public function orderRand() + { + $this->options['order'][] = '[rand]'; + return $this; + } + + /** + * 查询缓存 + * @access public + * @param mixed $key 缓存key + * @param integer|\DateTime $expire 缓存有效期 + * @param string $tag 缓存标签 + * @return $this + */ + public function cache($key = true, $expire = null, $tag = null) + { + // 增加快捷调用方式 cache(10) 等同于 cache(true, 10) + if ($key instanceof \DateTime || (is_numeric($key) && is_null($expire))) { + $expire = $key; + $key = true; + } + + if (false !== $key) { + $this->options['cache'] = ['key' => $key, 'expire' => $expire, 'tag' => $tag]; + } + + return $this; + } + + /** + * 指定group查询 + * @access public + * @param string $group GROUP + * @return $this + */ + public function group($group) + { + $this->options['group'] = $group; + return $this; + } + + /** + * 指定having查询 + * @access public + * @param string $having having + * @return $this + */ + public function having($having) + { + $this->options['having'] = $having; + return $this; + } + + /** + * 指定查询lock + * @access public + * @param bool|string $lock 是否lock + * @return $this + */ + public function lock($lock = false) + { + $this->options['lock'] = $lock; + $this->options['master'] = true; + + return $this; + } + + /** + * 指定distinct查询 + * @access public + * @param string $distinct 是否唯一 + * @return $this + */ + public function distinct($distinct) + { + $this->options['distinct'] = $distinct; + return $this; + } + + /** + * 指定数据表别名 + * @access public + * @param array|string $alias 数据表别名 + * @return $this + */ + public function alias($alias) + { + if (is_array($alias)) { + foreach ($alias as $key => $val) { + if (false !== strpos($key, '__')) { + $table = $this->connection->parseSqlTable($key); + } else { + $table = $key; + } + $this->options['alias'][$table] = $val; + } + } else { + if (isset($this->options['table'])) { + $table = is_array($this->options['table']) ? key($this->options['table']) : $this->options['table']; + if (false !== strpos($table, '__')) { + $table = $this->connection->parseSqlTable($table); + } + } else { + $table = $this->getTable(); + } + + $this->options['alias'][$table] = $alias; + } + + return $this; + } + + /** + * 指定强制索引 + * @access public + * @param string $force 索引名称 + * @return $this + */ + public function force($force) + { + $this->options['force'] = $force; + return $this; + } + + /** + * 查询注释 + * @access public + * @param string $comment 注释 + * @return $this + */ + public function comment($comment) + { + $this->options['comment'] = $comment; + return $this; + } + + /** + * 获取执行的SQL语句 + * @access public + * @param boolean $fetch 是否返回sql + * @return $this + */ + public function fetchSql($fetch = true) + { + $this->options['fetch_sql'] = $fetch; + return $this; + } + + /** + * 不主动获取数据集 + * @access public + * @param bool $pdo 是否返回 PDOStatement 对象 + * @return $this + */ + public function fetchPdo($pdo = true) + { + $this->options['fetch_pdo'] = $pdo; + return $this; + } + + /** + * 设置从主服务器读取数据 + * @access public + * @return $this + */ + public function master() + { + $this->options['master'] = true; + return $this; + } + + /** + * 设置是否严格检查字段名 + * @access public + * @param bool $strict 是否严格检查字段 + * @return $this + */ + public function strict($strict = true) + { + $this->options['strict'] = $strict; + return $this; + } + + /** + * 设置查询数据不存在是否抛出异常 + * @access public + * @param bool $fail 数据不存在是否抛出异常 + * @return $this + */ + public function failException($fail = true) + { + $this->options['fail'] = $fail; + return $this; + } + + /** + * 设置自增序列名 + * @access public + * @param string $sequence 自增序列名 + * @return $this + */ + public function sequence($sequence = null) + { + $this->options['sequence'] = $sequence; + return $this; + } + + /** + * 设置JSON字段信息 + * @access public + * @param array $json JSON字段 + * @return $this + */ + public function json(array $json = []) + { + $this->options['json'] = $json; + return $this; + } + + /** + * 添加查询范围 + * @access public + * @param array|string|\Closure $scope 查询范围定义 + * @param array $args 参数 + * @return $this + */ + public function scope($scope, ...$args) + { + // 查询范围的第一个参数始终是当前查询对象 + array_unshift($args, $this); + + if ($scope instanceof \Closure) { + call_user_func_array($scope, $args); + return $this; + } + + if (is_string($scope)) { + $scope = explode(',', $scope); + } + + if ($this->model) { + // 检查模型类的查询范围方法 + foreach ($scope as $name) { + $method = 'scope' . trim($name); + + if (method_exists($this->model, $method)) { + call_user_func_array([$this->model, $method], $args); + } + } + } + + return $this; + } + + /** + * 指定数据表主键 + * @access public + * @param string $pk 主键 + * @return $this + */ + public function pk($pk) + { + $this->pk = $pk; + return $this; + } + + /** + * 查询日期或者时间 + * @access public + * @param string $name 时间表达式 + * @param string|array $rule 时间范围 + * @return $this + */ + public function timeRule($name, $rule) + { + $this->timeRule[$name] = $rule; + return $this; + } + + /** + * 查询日期或者时间 + * @access public + * @param string $field 日期字段名 + * @param string|array $op 比较运算符或者表达式 + * @param string|array $range 比较范围 + * @return $this + */ + public function whereTime($field, $op, $range = null) + { + if (is_null($range)) { + if (is_array($op)) { + $range = $op; + } else { + if (isset($this->timeExp[strtolower($op)])) { + $op = $this->timeExp[strtolower($op)]; + } + + if (isset($this->timeRule[strtolower($op)])) { + $range = $this->timeRule[strtolower($op)]; + } else { + $range = $op; + } + } + + $op = is_array($range) ? 'between' : '>='; + } + + $this->where($field, strtolower($op) . ' time', $range); + + return $this; + } + + /** + * 查询日期或者时间范围 + * @access public + * @param string $field 日期字段名 + * @param string $startTime 开始时间 + * @param string $endTime 结束时间 + * @return $this + */ + public function whereBetweenTime($field, $startTime, $endTime = null) + { + if (is_null($endTime)) { + $time = is_string($startTime) ? strtotime($startTime) : $startTime; + $endTime = strtotime('+1 day', $time); + } + + $this->where($field, 'between time', [$startTime, $endTime]); + + return $this; + } + + /** + * 获取当前数据表的主键 + * @access public + * @param string|array $options 数据表名或者查询参数 + * @return string|array + */ + public function getPk($options = '') + { + if (!empty($this->pk)) { + $pk = $this->pk; + } else { + $pk = $this->connection->getPk(is_array($options) ? $options['table'] : $this->getTable()); + } + + return $pk; + } + + /** + * 参数绑定 + * @access public + * @param mixed $key 参数名 + * @param mixed $value 绑定变量值 + * @param integer $type 绑定类型 + * @return $this + */ + public function bind($key, $value = false, $type = PDO::PARAM_STR) + { + if (is_array($key)) { + $this->bind = array_merge($this->bind, $key); + } else { + $this->bind[$key] = [$value, $type]; + } + + return $this; + } + + /** + * 检测参数是否已经绑定 + * @access public + * @param string $key 参数名 + * @return bool + */ + public function isBind($key) + { + return isset($this->bind[$key]); + } + + /** + * 查询参数赋值 + * @access protected + * @param array $options 表达式参数 + * @return $this + */ + protected function options(array $options) + { + $this->options = $options; + return $this; + } + + /** + * 获取当前的查询参数 + * @access public + * @param string $name 参数名 + * @return mixed + */ + public function getOptions($name = '') + { + if ('' === $name) { + return $this->options; + } else { + return isset($this->options[$name]) ? $this->options[$name] : null; + } + } + + /** + * 设置当前的查询参数 + * @access public + * @param string $option 参数名 + * @param mixed $value 参数值 + * @return $this + */ + public function setOption($option, $value) + { + $this->options[$option] = $value; + return $this; + } + + /** + * 设置关联查询JOIN预查询 + * @access public + * @param string|array $with 关联方法名称 + * @return $this + */ + public function with($with) + { + if (empty($with)) { + return $this; + } + + if (is_string($with)) { + $with = explode(',', $with); + } + + $first = true; + + /** @var Model $class */ + $class = $this->model; + foreach ($with as $key => $relation) { + $subRelation = ''; + $closure = false; + + if ($relation instanceof \Closure) { + // 支持闭包查询过滤关联条件 + $closure = $relation; + $relation = $key; + $with[$key] = $key; + } elseif (is_array($relation)) { + $subRelation = $relation; + $relation = $key; + } elseif (is_string($relation) && strpos($relation, '.')) { + $with[$key] = $relation; + + list($relation, $subRelation) = explode('.', $relation, 2); + } + + /** @var Relation $model */ + $relation = Loader::parseName($relation, 1, false); + $model = $class->$relation(); + + if ($model instanceof OneToOne && 0 == $model->getEagerlyType()) { + $model->removeOption()->eagerly($this, $relation, $subRelation, $closure, $first); + $first = false; + } elseif ($closure) { + $with[$key] = $closure; + } + } + $this->via(); + + if (isset($this->options['with'])) { + $this->options['with'] = array_merge($this->options['with'], $with); + } else { + $this->options['with'] = $with; + } + + return $this; + } + + /** + * 关联统计 + * @access protected + * @param string|array $relation 关联方法名 + * @param string $aggregate 聚合查询方法 + * @param string $field 字段 + * @param bool $subQuery 是否使用子查询 + * @return $this + */ + protected function withAggregate($relation, $aggregate = 'count', $field = '*', $subQuery = true) + { + $relations = is_string($relation) ? explode(',', $relation) : $relation; + + if (!$subQuery) { + $this->options['with_count'][] = [$relations, $aggregate, $field]; + } else { + if (!isset($this->options['field'])) { + $this->field('*'); + } + + foreach ($relations as $key => $relation) { + $closure = false; + if ($relation instanceof \Closure) { + $closure = $relation; + $relation = $key; + } + $relation = Loader::parseName($relation, 1, false); + $count = '(' . $this->model->$relation()->getRelationCountQuery($closure, $aggregate, $field) . ')'; + $this->field([$count => Loader::parseName($relation) . '_' . $aggregate]); + } + } + + return $this; + } + + /** + * 关联统计 + * @access public + * @param string|array $relation 关联方法名 + * @param bool $subQuery 是否使用子查询 + * @return $this + */ + public function withCount($relation, $subQuery = true) + { + return $this->withAggregate($relation, 'count', '*', $subQuery); + } + + /** + * 关联统计Sum + * @access public + * @param string|array $relation 关联方法名 + * @param string $field 字段 + * @param bool $subQuery 是否使用子查询 + * @return $this + */ + public function withSum($relation, $field, $subQuery = true) + { + return $this->withAggregate($relation, 'sum', $field, $subQuery); + } + + /** + * 关联统计Max + * @access public + * @param string|array $relation 关联方法名 + * @param string $field 字段 + * @param bool $subQuery 是否使用子查询 + * @return $this + */ + public function withMax($relation, $field, $subQuery = true) + { + return $this->withAggregate($relation, 'max', $field, $subQuery); + } + + /** + * 关联统计Min + * @access public + * @param string|array $relation 关联方法名 + * @param string $field 字段 + * @param bool $subQuery 是否使用子查询 + * @return $this + */ + public function withMin($relation, $field, $subQuery = true) + { + return $this->withAggregate($relation, 'min', $field, $subQuery); + } + + /** + * 关联统计Avg + * @access public + * @param string|array $relation 关联方法名 + * @param string $field 字段 + * @param bool $subQuery 是否使用子查询 + * @return $this + */ + public function withAvg($relation, $field, $subQuery = true) + { + return $this->withAggregate($relation, 'avg', $field, $subQuery); + } + + /** + * 关联预加载中 获取关联指定字段值 + * example: + * Model::with(['relation' => function($query){ + * $query->withField("id,name"); + * }]) + * + * @access public + * @param string | array $field 指定获取的字段 + * @return $this + */ + public function withField($field) + { + $this->options['with_field'] = $field; + + return $this; + } + + /** + * 设置当前字段添加的表别名 + * @access public + * @param string $via + * @return $this + */ + public function via($via = '') + { + $this->options['via'] = $via; + + return $this; + } + + /** + * 设置关联查询 + * @access public + * @param string|array $relation 关联名称 + * @return $this + */ + public function relation($relation) + { + if (empty($relation)) { + return $this; + } + + if (is_string($relation)) { + $relation = explode(',', $relation); + } + + if (isset($this->options['relation'])) { + $this->options['relation'] = array_merge($this->options['relation'], $relation); + } else { + $this->options['relation'] = $relation; + } + + return $this; + } + + /** + * 插入记录 + * @access public + * @param array $data 数据 + * @param boolean $replace 是否replace + * @param boolean $getLastInsID 返回自增主键 + * @param string $sequence 自增序列名 + * @return integer|string + */ + public function insert(array $data = [], $replace = false, $getLastInsID = false, $sequence = null) + { + $this->parseOptions(); + + $this->options['data'] = array_merge($this->options['data'], $data); + + return $this->connection->insert($this, $replace, $getLastInsID, $sequence); + } + + /** + * 插入记录并获取自增ID + * @access public + * @param array $data 数据 + * @param boolean $replace 是否replace + * @param string $sequence 自增序列名 + * @return integer|string + */ + public function insertGetId(array $data, $replace = false, $sequence = null) + { + return $this->insert($data, $replace, true, $sequence); + } + + /** + * 批量插入记录 + * @access public + * @param array $dataSet 数据集 + * @param boolean $replace 是否replace + * @param integer $limit 每次写入数据限制 + * @return integer|string + */ + public function insertAll(array $dataSet = [], $replace = false, $limit = null) + { + $this->parseOptions(); + + if (empty($dataSet)) { + $dataSet = $this->options['data']; + } + + if (empty($limit) && !empty($this->options['limit'])) { + $limit = $this->options['limit']; + } + + return $this->connection->insertAll($this, $dataSet, $replace, $limit); + } + + /** + * 通过Select方式插入记录 + * @access public + * @param string $fields 要插入的数据表字段名 + * @param string $table 要插入的数据表名 + * @return integer|string + * @throws PDOException + */ + public function selectInsert($fields, $table) + { + $this->parseOptions(); + + return $this->connection->selectInsert($this, $fields, $table); + } + + /** + * 更新记录 + * @access public + * @param mixed $data 数据 + * @return integer|string + * @throws Exception + * @throws PDOException + */ + public function update(array $data = []) + { + $this->parseOptions(); + + $this->options['data'] = array_merge($this->options['data'], $data); + + return $this->connection->update($this); + } + + /** + * 删除记录 + * @access public + * @param mixed $data 表达式 true 表示强制删除 + * @return int + * @throws Exception + * @throws PDOException + */ + public function delete($data = null) + { + $this->parseOptions(); + + if (!is_null($data) && true !== $data) { + // AR模式分析主键条件 + $this->parsePkWhere($data); + } + + if (!empty($this->options['soft_delete'])) { + // 软删除 + list($field, $condition) = $this->options['soft_delete']; + unset($this->options['soft_delete']); + $this->options['data'] = [$field => $condition]; + + return $this->connection->update($this); + } + + $this->options['data'] = $data; + + return $this->connection->delete($this); + } + + /** + * 执行查询但只返回PDOStatement对象 + * @access public + * @return \PDOStatement|string + */ + public function getPdo() + { + $this->parseOptions(); + + return $this->connection->pdo($this); + } + + /** + * 使用游标查找记录 + * @access public + * @param array|string|Query|\Closure $data + * @return \Generator + */ + public function cursor($data = null) + { + if ($data instanceof \Closure) { + $data($this); + $data = null; + } + + $this->parseOptions(); + + if (!is_null($data)) { + // 主键条件分析 + $this->parsePkWhere($data); + } + + $this->options['data'] = $data; + + $connection = clone $this->connection; + + return $connection->cursor($this); + } + + /** + * 查找记录 + * @access public + * @param array|string|Query|\Closure $data + * @return Collection|array|\PDOStatement|string + * @throws DbException + * @throws ModelNotFoundException + * @throws DataNotFoundException + */ + public function select($data = null) + { + if ($data instanceof Query) { + return $data->select(); + } elseif ($data instanceof \Closure) { + $data($this); + $data = null; + } + + $this->parseOptions(); + + if (false === $data) { + // 用于子查询 不查询只返回SQL + $this->options['fetch_sql'] = true; + } elseif (!is_null($data)) { + // 主键条件分析 + $this->parsePkWhere($data); + } + + $this->options['data'] = $data; + + $resultSet = $this->connection->select($this); + + if ($this->options['fetch_sql']) { + return $resultSet; + } + + // 数据列表读取后的处理 + if (!empty($this->model)) { + // 生成模型对象 + if (count($resultSet) > 0) { + foreach ($resultSet as $key => &$result) { + // 数据转换为模型对象 + $this->resultToModel($result, $this->options, true); + } + + if (!empty($this->options['with'])) { + // 预载入 + $result->eagerlyResultSet($resultSet, $this->options['with']); + } + + // 模型数据集转换 + $resultSet = $result->toCollection($resultSet); + } else { + $resultSet = $this->model->toCollection($resultSet); + } + } else { + if (!empty($this->options['json'])) { + foreach ($resultSet as &$result) { + $this->jsonResult($result, $this->options['json'], true); + } + } + + if ('collection' == $this->connection->getConfig('resultset_type')) { + // 返回Collection对象 + $resultSet = new Collection($resultSet); + } + } + + // 返回结果处理 + if (!empty($this->options['fail']) && count($resultSet) == 0) { + $this->throwNotFound($this->options); + } + + return $resultSet; + } + + /** + * 查找单条记录 + * @access public + * @param array|string|Query|\Closure $data + * @return array|null|\PDOStatement|string|Model + * @throws DbException + * @throws ModelNotFoundException + * @throws DataNotFoundException + */ + public function find($data = null) + { + if ($data instanceof Query) { + return $data->find(); + } elseif ($data instanceof \Closure) { + $data($this); + $data = null; + } + + $this->parseOptions(); + + if (!is_null($data)) { + // AR模式分析主键条件 + $this->parsePkWhere($data); + } + + $this->options['data'] = $data; + + $result = $this->connection->find($this); + + if ($this->options['fetch_sql']) { + return $result; + } + + // 数据处理 + if (!empty($result)) { + if (!empty($this->model)) { + // 返回模型对象 + $this->resultToModel($result, $this->options); + } elseif (!empty($this->options['json'])) { + $this->jsonResult($result, $this->options['json'], true); + } + } elseif (!empty($this->options['fail'])) { + $this->throwNotFound($this->options); + } + + return $result; + } + + /** + * JSON字段数据转换 + * @access protected + * @param array $result 查询数据 + * @param array $json JSON字段 + * @param bool $assoc 是否转换为数组 + * @return void + */ + protected function jsonResult(&$result, $json = [], $assoc = false) + { + foreach ($json as $name) { + if (isset($result[$name])) { + $result[$name] = json_decode($result[$name], $assoc); + } + } + } + + /** + * 查询数据转换为模型对象 + * @access protected + * @param array $result 查询数据 + * @param array $options 查询参数 + * @param bool $resultSet 是否为数据集查询 + * @return void + */ + protected function resultToModel(&$result, $options = [], $resultSet = false) + { + if (!empty($options['json'])) { + $this->jsonResult($result, $options['json']); + } + + $condition = (!$resultSet && isset($options['where']['AND'])) ? $options['where']['AND'] : null; + $result = $this->model->newInstance($result, $condition); + + // 关联查询 + if (!empty($options['relation'])) { + $result->relationQuery($options['relation']); + } + + // 预载入查询 + if (!$resultSet && !empty($options['with'])) { + $result->eagerlyResult($result, $options['with']); + } + + // 关联统计 + if (!empty($options['with_count'])) { + foreach ($options['with_count'] as $val) { + $result->relationCount($result, $val[0], $val[1], $val[2]); + } + } + } + + /** + * 查询失败 抛出异常 + * @access protected + * @param array $options 查询参数 + * @throws ModelNotFoundException + * @throws DataNotFoundException + */ + protected function throwNotFound($options = []) + { + if (!empty($this->model)) { + $class = get_class($this->model); + throw new ModelNotFoundException('model data Not Found:' . $class, $class, $options); + } else { + $table = is_array($options['table']) ? key($options['table']) : $options['table']; + throw new DataNotFoundException('table data not Found:' . $table, $table, $options); + } + } + + /** + * 查找多条记录 如果不存在则抛出异常 + * @access public + * @param array|string|Query|\Closure $data + * @return array|\PDOStatement|string|Model + * @throws DbException + * @throws ModelNotFoundException + * @throws DataNotFoundException + */ + public function selectOrFail($data = null) + { + return $this->failException(true)->select($data); + } + + /** + * 查找单条记录 如果不存在则抛出异常 + * @access public + * @param array|string|Query|\Closure $data + * @return array|\PDOStatement|string|Model + * @throws DbException + * @throws ModelNotFoundException + * @throws DataNotFoundException + */ + public function findOrFail($data = null) + { + return $this->failException(true)->find($data); + } + + /** + * 分批数据返回处理 + * @access public + * @param integer $count 每次处理的数据数量 + * @param callable $callback 处理回调方法 + * @param string|array $column 分批处理的字段名 + * @param string $order 字段排序 + * @return boolean + * @throws DbException + */ + public function chunk($count, $callback, $column = null, $order = 'asc') + { + $options = $this->getOptions(); + $column = $column ?: $this->getPk($options); + + if (isset($options['order'])) { + if (Container::get('app')->isDebug()) { + throw new DbException('chunk not support call order'); + } + unset($options['order']); + } + + $bind = $this->bind; + + if (is_array($column)) { + $times = 1; + $query = $this->options($options)->page($times, $count); + } else { + $query = $this->options($options)->limit($count); + + if (strpos($column, '.')) { + list($alias, $key) = explode('.', $column); + } else { + $key = $column; + } + } + + $resultSet = $query->order($column, $order)->select(); + + while (count($resultSet) > 0) { + if ($resultSet instanceof Collection) { + $resultSet = $resultSet->all(); + } + + if (false === call_user_func($callback, $resultSet)) { + return false; + } + + if (isset($times)) { + $times++; + $query = $this->options($options)->page($times, $count); + } else { + $end = end($resultSet); + $lastId = is_array($end) ? $end[$key] : $end->getData($key); + + $query = $this->options($options) + ->limit($count) + ->where($column, 'asc' == strtolower($order) ? '>' : '<', $lastId); + } + + $resultSet = $query->bind($bind)->order($column, $order)->select(); + } + + return true; + } + + /** + * 获取绑定的参数 并清空 + * @access public + * @param bool $clear + * @return array + */ + public function getBind($clear = true) + { + $bind = $this->bind; + if ($clear) { + $this->bind = []; + } + + return $bind; + } + + /** + * 创建子查询SQL + * @access public + * @param bool $sub + * @return string + * @throws DbException + */ + public function buildSql($sub = true) + { + return $sub ? '( ' . $this->select(false) . ' )' : $this->select(false); + } + + /** + * 视图查询处理 + * @access protected + * @param array $options 查询参数 + * @return void + */ + protected function parseView(&$options) + { + foreach (['AND', 'OR'] as $logic) { + if (isset($options['where'][$logic])) { + foreach ($options['where'][$logic] as $key => $val) { + if (array_key_exists($key, $options['map'])) { + array_shift($val); + array_unshift($val, $options['map'][$key]); + $options['where'][$logic][$options['map'][$key]] = $val; + unset($options['where'][$logic][$key]); + } + } + } + } + + if (isset($options['order'])) { + // 视图查询排序处理 + if (is_string($options['order'])) { + $options['order'] = explode(',', $options['order']); + } + foreach ($options['order'] as $key => $val) { + if (is_numeric($key)) { + if (strpos($val, ' ')) { + list($field, $sort) = explode(' ', $val); + if (array_key_exists($field, $options['map'])) { + $options['order'][$options['map'][$field]] = $sort; + unset($options['order'][$key]); + } + } elseif (array_key_exists($val, $options['map'])) { + $options['order'][$options['map'][$val]] = 'asc'; + unset($options['order'][$key]); + } + } elseif (array_key_exists($key, $options['map'])) { + $options['order'][$options['map'][$key]] = $val; + unset($options['order'][$key]); + } + } + } + } + + /** + * 把主键值转换为查询条件 支持复合主键 + * @access public + * @param array|string $data 主键数据 + * @return void + * @throws Exception + */ + public function parsePkWhere($data) + { + $pk = $this->getPk($this->options); + + // 获取当前数据表 + $table = is_array($this->options['table']) ? key($this->options['table']) : $this->options['table']; + + if (!empty($this->options['alias'][$table])) { + $alias = $this->options['alias'][$table]; + } + + if (is_string($pk)) { + $key = isset($alias) ? $alias . '.' . $pk : $pk; + // 根据主键查询 + if (is_array($data)) { + $where[$pk] = isset($data[$pk]) ? [$key, '=', $data[$pk]] : [$key, 'in', $data]; + } else { + $where[$pk] = strpos($data, ',') ? [$key, 'IN', $data] : [$key, '=', $data]; + } + } elseif (is_array($pk) && is_array($data) && !empty($data)) { + // 根据复合主键查询 + foreach ($pk as $key) { + if (isset($data[$key])) { + $attr = isset($alias) ? $alias . '.' . $key : $key; + $where[$key] = [$attr, '=', $data[$key]]; + } else { + throw new Exception('miss complex primary data'); + } + } + } + + if (!empty($where)) { + if (isset($this->options['where']['AND'])) { + $this->options['where']['AND'] = array_merge($this->options['where']['AND'], $where); + } else { + $this->options['where']['AND'] = $where; + } + } + + return; + } + + /** + * 分析表达式(可用于查询或者写入操作) + * @access protected + * @return array + */ + protected function parseOptions() + { + $options = $this->getOptions(); + + // 获取数据表 + if (empty($options['table'])) { + $options['table'] = $this->getTable(); + } + + if (!isset($options['where'])) { + $options['where'] = []; + } elseif (isset($options['view'])) { + // 视图查询条件处理 + $this->parseView($options); + } + + if (!isset($options['field'])) { + $options['field'] = '*'; + } + + foreach (['data', 'order'] as $name) { + if (!isset($options[$name])) { + $options[$name] = []; + } + } + + if (!isset($options['strict'])) { + $options['strict'] = $this->getConfig('fields_strict'); + } + + foreach (['master', 'lock', 'fetch_pdo', 'fetch_sql', 'distinct'] as $name) { + if (!isset($options[$name])) { + $options[$name] = false; + } + } + + foreach (['join', 'union', 'group', 'having', 'limit', 'force', 'comment'] as $name) { + if (!isset($options[$name])) { + $options[$name] = ''; + } + } + + if (isset($options['page'])) { + // 根据页数计算limit + list($page, $listRows) = $options['page']; + $page = $page > 0 ? $page : 1; + $listRows = $listRows > 0 ? $listRows : (is_numeric($options['limit']) ? $options['limit'] : 20); + $offset = $listRows * ($page - 1); + $options['limit'] = $offset . ',' . $listRows; + } + + $this->options = $options; + + return $options; + } + + /** + * 注册回调方法 + * @access public + * @param string $event 事件名 + * @param callable $callback 回调方法 + * @return void + */ + public static function event($event, $callback) + { + self::$event[$event] = $callback; + } + + /** + * 触发事件 + * @access public + * @param string $event 事件名 + * @return bool + */ + public function trigger($event) + { + $result = false; + + if (isset(self::$event[$event])) { + $result = Container::getInstance()->invoke(self::$event[$event], [$this]); + } + + return $result; + } + +} diff --git a/tp5/thinkphp/library/think/db/builder/Mysql.php b/tp5/thinkphp/library/think/db/builder/Mysql.php new file mode 100644 index 0000000..cea8d4a --- /dev/null +++ b/tp5/thinkphp/library/think/db/builder/Mysql.php @@ -0,0 +1,216 @@ + +// +---------------------------------------------------------------------- + +namespace think\db\builder; + +use think\db\Builder; +use think\db\Query; + +/** + * mysql数据库驱动 + */ +class Mysql extends Builder +{ + // 查询表达式解析 + protected $parser = [ + 'parseCompare' => ['=', '<>', '>', '>=', '<', '<='], + 'parseLike' => ['LIKE', 'NOT LIKE'], + 'parseBetween' => ['NOT BETWEEN', 'BETWEEN'], + 'parseIn' => ['NOT IN', 'IN'], + 'parseExp' => ['EXP'], + 'parseRegexp' => ['REGEXP', 'NOT REGEXP'], + 'parseNull' => ['NOT NULL', 'NULL'], + 'parseBetweenTime' => ['BETWEEN TIME', 'NOT BETWEEN TIME'], + 'parseTime' => ['< TIME', '> TIME', '<= TIME', '>= TIME'], + 'parseExists' => ['NOT EXISTS', 'EXISTS'], + ]; + + protected $insertAllSql = '%INSERT% INTO %TABLE% (%FIELD%) VALUES %DATA% %COMMENT%'; + protected $updateSql = 'UPDATE %TABLE% %JOIN% SET %SET% %WHERE% %ORDER%%LIMIT% %LOCK%%COMMENT%'; + + /** + * 生成insertall SQL + * @access public + * @param Query $query 查询对象 + * @param array $dataSet 数据集 + * @param bool $replace 是否replace + * @return string + */ + public function insertAll(Query $query, $dataSet, $replace = false) + { + $options = $query->getOptions(); + + // 获取合法的字段 + if ('*' == $options['field']) { + $allowFields = $this->connection->getTableFields($options['table']); + } else { + $allowFields = $options['field']; + } + + // 获取绑定信息 + $bind = $this->connection->getFieldsBind($options['table']); + + foreach ($dataSet as $k => $data) { + $data = $this->parseData($query, $data, $allowFields, $bind, '_' . $k); + + $values[] = '( ' . implode(',', array_values($data)) . ' )'; + + if (!isset($insertFields)) { + $insertFields = array_keys($data); + } + } + + $fields = []; + foreach ($insertFields as $field) { + $fields[] = $this->parseKey($query, $field); + } + + return str_replace( + ['%INSERT%', '%TABLE%', '%FIELD%', '%DATA%', '%COMMENT%'], + [ + $replace ? 'REPLACE' : 'INSERT', + $this->parseTable($query, $options['table']), + implode(' , ', $fields), + implode(' , ', $values), + $this->parseComment($query, $options['comment']), + ], + $this->insertAllSql); + } + + /** + * 正则查询 + * @access protected + * @param Query $query 查询对象 + * @param string $key + * @param string $exp + * @param mixed $value + * @param string $field + * @return string + */ + protected function parseRegexp(Query $query, $key, $exp, $value, $field) + { + return $key . ' ' . $exp . ' ' . $value; + } + + /** + * 字段和表名处理 + * @access public + * @param Query $query 查询对象 + * @param string $key 字段名 + * @return string + */ + public function parseKey(Query $query, $key) + { + if (is_int($key)) { + return $key; + } + $key = trim($key); + + if (strpos($key, '->') && false === strpos($key, '(')) { + // JSON字段支持 + list($field, $name) = explode('->', $key); + + $key = 'json_extract(' . $this->parseKey($query, $field) . ', \'$.' . $name . '\')'; + } elseif (strpos($key, '.') && !preg_match('/[,\'\"\(\)`\s]/', $key)) { + list($table, $key) = explode('.', $key, 2); + + $alias = $query->getOptions('alias'); + + if ('__TABLE__' == $table) { + $table = $query->getOptions('table'); + $table = is_array($table) ? array_shift($table) : $table; + } + + if (isset($alias[$table])) { + $table = $alias[$table]; + } + } + + if (!preg_match('/[,\'\"\*\(\)`.\s]/', $key)) { + $key = '`' . $key . '`'; + } + + if (isset($table)) { + if (strpos($table, '.')) { + $table = str_replace('.', '`.`', $table); + } + + $key = '`' . $table . '`.' . $key; + } + + return $key; + } + + /** + * field分析 + * @access protected + * @param Query $query 查询对象 + * @param mixed $fields 字段名 + * @return string + */ + protected function parseField(Query $query, $fields) + { + $fieldsStr = parent::parseField($query, $fields); + $options = $query->getOptions(); + + if (!empty($options['point'])) { + $array = []; + foreach ($options['point'] as $key => $field) { + $key = !is_numeric($key) ? $key : $field; + $array[] = 'AsText(' . $this->parseKey($query, $key) . ') AS ' . $this->parseKey($query, $field); + } + $fieldsStr .= ',' . implode(',', $array); + } + + return $fieldsStr; + } + + /** + * 数组数据解析 + * @access protected + * @param array $data + * @return mixed + */ + protected function parseArrayData($data) + { + list($type, $value) = $data; + + switch (strtolower($type)) { + case 'exp': + $result = $value; + break; + case 'point': + $fun = isset($data[2]) ? $data[2] : 'GeomFromText'; + $point = isset($data[3]) ? $data[3] : 'POINT'; + if (is_array($value)) { + $value = implode(' ', $value); + } + $result = $fun . '(\'' . $point . '(' . $value . ')\')'; + break; + default: + $result = false; + } + + return $result; + } + + /** + * 随机排序 + * @access protected + * @param Query $query 查询对象 + * @return string + */ + protected function parseRand(Query $query) + { + return 'rand()'; + } + +} diff --git a/tp5/thinkphp/library/think/db/builder/Pgsql.php b/tp5/thinkphp/library/think/db/builder/Pgsql.php new file mode 100644 index 0000000..4db6932 --- /dev/null +++ b/tp5/thinkphp/library/think/db/builder/Pgsql.php @@ -0,0 +1,97 @@ + +// +---------------------------------------------------------------------- + +namespace think\db\builder; + +use think\db\Builder; +use think\db\Query; + +/** + * Pgsql数据库驱动 + */ +class Pgsql extends Builder +{ + + protected $insertSql = 'INSERT INTO %TABLE% (%FIELD%) VALUES (%DATA%) %COMMENT%'; + protected $insertAllSql = 'INSERT INTO %TABLE% (%FIELD%) %DATA% %COMMENT%'; + + /** + * limit分析 + * @access protected + * @param Query $query 查询对象 + * @param mixed $limit + * @return string + */ + public function parseLimit(Query $query, $limit) + { + $limitStr = ''; + + if (!empty($limit)) { + $limit = explode(',', $limit); + if (count($limit) > 1) { + $limitStr .= ' LIMIT ' . $limit[1] . ' OFFSET ' . $limit[0] . ' '; + } else { + $limitStr .= ' LIMIT ' . $limit[0] . ' '; + } + } + + return $limitStr; + } + + /** + * 字段和表名处理 + * @access public + * @param Query $query 查询对象 + * @param string $key 字段名 + * @return string + */ + public function parseKey(Query $query, $key) + { + $key = trim($key); + + if (strpos($key, '->') && false === strpos($key, '(')) { + // JSON字段支持 + list($field, $name) = explode('->', $key); + $key = $field . '->>\'' . $name . '\''; + } elseif (strpos($key, '.')) { + list($table, $key) = explode('.', $key, 2); + + $alias = $query->getOptions('alias'); + + if ('__TABLE__' == $table) { + $table = $query->getOptions('table'); + $table = is_array($table) ? array_shift($table) : $table; + } + + if (isset($alias[$table])) { + $table = $alias[$table]; + } + } + + if (isset($table)) { + $key = $table . '.' . $key; + } + + return $key; + } + + /** + * 随机排序 + * @access protected + * @param Query $query 查询对象 + * @return string + */ + protected function parseRand(Query $query) + { + return 'RANDOM()'; + } + +} diff --git a/tp5/thinkphp/library/think/db/builder/Sqlite.php b/tp5/thinkphp/library/think/db/builder/Sqlite.php new file mode 100644 index 0000000..141410c --- /dev/null +++ b/tp5/thinkphp/library/think/db/builder/Sqlite.php @@ -0,0 +1,88 @@ + +// +---------------------------------------------------------------------- + +namespace think\db\builder; + +use think\db\Builder; +use think\db\Query; + +/** + * Sqlite数据库驱动 + */ +class Sqlite extends Builder +{ + + /** + * limit + * @access public + * @param Query $query 查询对象 + * @param mixed $limit + * @return string + */ + public function parseLimit(Query $query, $limit) + { + $limitStr = ''; + + if (!empty($limit)) { + $limit = explode(',', $limit); + if (count($limit) > 1) { + $limitStr .= ' LIMIT ' . $limit[1] . ' OFFSET ' . $limit[0] . ' '; + } else { + $limitStr .= ' LIMIT ' . $limit[0] . ' '; + } + } + + return $limitStr; + } + + /** + * 随机排序 + * @access protected + * @param Query $query 查询对象 + * @return string + */ + protected function parseRand(Query $query) + { + return 'RANDOM()'; + } + + /** + * 字段和表名处理 + * @access public + * @param Query $query 查询对象 + * @param string $key 字段名 + * @return string + */ + public function parseKey(Query $query, $key) + { + $key = trim($key); + if (strpos($key, '.')) { + list($table, $key) = explode('.', $key, 2); + + $alias = $query->getOptions('alias'); + + if ('__TABLE__' == $table) { + $table = $query->getOptions('table'); + $table = is_array($table) ? array_shift($table) : $table; + } + + if (isset($alias[$table])) { + $table = $alias[$table]; + } + } + + if (isset($table)) { + $key = $table . '.' . $key; + } + + return $key; + } +} diff --git a/tp5/thinkphp/library/think/db/builder/Sqlsrv.php b/tp5/thinkphp/library/think/db/builder/Sqlsrv.php new file mode 100644 index 0000000..b95e234 --- /dev/null +++ b/tp5/thinkphp/library/think/db/builder/Sqlsrv.php @@ -0,0 +1,141 @@ + +// +---------------------------------------------------------------------- + +namespace think\db\builder; + +use think\db\Builder; +use think\db\Query; + +/** + * Sqlsrv数据库驱动 + */ +class Sqlsrv extends Builder +{ + protected $selectSql = 'SELECT T1.* FROM (SELECT thinkphp.*, ROW_NUMBER() OVER (%ORDER%) AS ROW_NUMBER FROM (SELECT %DISTINCT% %FIELD% FROM %TABLE%%JOIN%%WHERE%%GROUP%%HAVING%) AS thinkphp) AS T1 %LIMIT%%COMMENT%'; + protected $selectInsertSql = 'SELECT %DISTINCT% %FIELD% FROM %TABLE%%JOIN%%WHERE%%GROUP%%HAVING%'; + protected $updateSql = 'UPDATE %TABLE% SET %SET% FROM %TABLE% %JOIN% %WHERE% %LIMIT% %LOCK%%COMMENT%'; + protected $deleteSql = 'DELETE FROM %TABLE% %USING% FROM %TABLE% %JOIN% %WHERE% %LIMIT% %LOCK%%COMMENT%'; + protected $insertSql = 'INSERT INTO %TABLE% (%FIELD%) VALUES (%DATA%) %COMMENT%'; + protected $insertAllSql = 'INSERT INTO %TABLE% (%FIELD%) %DATA% %COMMENT%'; + + /** + * order分析 + * @access protected + * @param Query $query 查询对象 + * @param mixed $order + * @return string + */ + protected function parseOrder(Query $query, $order) + { + if (is_array($order)) { + $array = []; + + foreach ($order as $key => $val) { + if (is_numeric($key)) { + if (false === strpos($val, '(')) { + $array[] = $this->parseKey($query, $val); + } elseif ('[rand]' == $val) { + $array[] = $this->parseRand($query); + } else { + $array[] = $val; + } + } else { + $sort = in_array(strtolower(trim($val)), ['asc', 'desc']) ? ' ' . $val : ''; + $array[] = $this->parseKey($query, $key) . ' ' . $sort; + } + } + + $order = implode(',', $array); + } + + return !empty($order) ? ' ORDER BY ' . $order : ' ORDER BY rand()'; + } + + /** + * 随机排序 + * @access protected + * @param Query $query 查询对象 + * @return string + */ + protected function parseRand(Query $query) + { + return 'rand()'; + } + + /** + * 字段和表名处理 + * @access public + * @param Query $query 查询对象 + * @param string $key 字段名 + * @return string + */ + public function parseKey(Query $query, $key) + { + $key = trim($key); + + if (strpos($key, '.') && !preg_match('/[,\'\"\(\)\[\s]/', $key)) { + list($table, $key) = explode('.', $key, 2); + + $alias = $query->getOptions('alias'); + + if ('__TABLE__' == $table) { + $table = $query->getOptions('table'); + $table = is_array($table) ? array_shift($table) : $table; + } + + if (isset($alias[$table])) { + $table = $alias[$table]; + } + } + + if (!is_numeric($key) && !preg_match('/[,\'\"\*\(\)\[.\s]/', $key)) { + $key = '[' . $key . ']'; + } + + if (isset($table)) { + $key = '[' . $table . '].' . $key; + } + + return $key; + } + + /** + * limit + * @access protected + * @param Query $query 查询对象 + * @param mixed $limit + * @return string + */ + protected function parseLimit(Query $query, $limit) + { + if (empty($limit)) { + return ''; + } + + $limit = explode(',', $limit); + + if (count($limit) > 1) { + $limitStr = '(T1.ROW_NUMBER BETWEEN ' . $limit[0] . ' + 1 AND ' . $limit[0] . ' + ' . $limit[1] . ')'; + } else { + $limitStr = '(T1.ROW_NUMBER BETWEEN 1 AND ' . $limit[0] . ")"; + } + + return 'WHERE ' . $limitStr; + } + + public function selectInsert(Query $query, $fields, $table) + { + $this->selectSql = $this->selectInsertSql; + + return parent::selectInsert($query, $fields, $table); + } + +} diff --git a/tp5/thinkphp/library/think/db/connector/Mysql.php b/tp5/thinkphp/library/think/db/connector/Mysql.php new file mode 100644 index 0000000..331d550 --- /dev/null +++ b/tp5/thinkphp/library/think/db/connector/Mysql.php @@ -0,0 +1,157 @@ + +// +---------------------------------------------------------------------- + +namespace think\db\connector; + +use PDO; +use think\db\Connection; +use think\db\Query; + +/** + * mysql数据库驱动 + */ +class Mysql extends Connection +{ + + protected $builder = '\\think\\db\\builder\\Mysql'; + + /** + * 初始化 + * @access protected + * @return void + */ + protected function initialize() + { + // Point类型支持 + Query::extend('point', function ($query, $field, $value = null, $fun = 'GeomFromText', $type = 'POINT') { + if (!is_null($value)) { + $query->data($field, ['point', $value, $fun, $type]); + } else { + if (is_string($field)) { + $field = explode(',', $field); + } + $query->setOption('point', $field); + } + + return $query; + }); + } + + /** + * 解析pdo连接的dsn信息 + * @access protected + * @param array $config 连接信息 + * @return string + */ + protected function parseDsn($config) + { + if (!empty($config['socket'])) { + $dsn = 'mysql:unix_socket=' . $config['socket']; + } elseif (!empty($config['hostport'])) { + $dsn = 'mysql:host=' . $config['hostname'] . ';port=' . $config['hostport']; + } else { + $dsn = 'mysql:host=' . $config['hostname']; + } + $dsn .= ';dbname=' . $config['database']; + + if (!empty($config['charset'])) { + $dsn .= ';charset=' . $config['charset']; + } + + return $dsn; + } + + /** + * 取得数据表的字段信息 + * @access public + * @param string $tableName + * @return array + */ + public function getFields($tableName) + { + list($tableName) = explode(' ', $tableName); + + if (false === strpos($tableName, '`')) { + if (strpos($tableName, '.')) { + $tableName = str_replace('.', '`.`', $tableName); + } + $tableName = '`' . $tableName . '`'; + } + + $sql = 'SHOW COLUMNS FROM ' . $tableName; + $pdo = $this->query($sql, [], false, true); + $result = $pdo->fetchAll(PDO::FETCH_ASSOC); + $info = []; + + if ($result) { + foreach ($result as $key => $val) { + $val = array_change_key_case($val); + $info[$val['field']] = [ + 'name' => $val['field'], + 'type' => $val['type'], + 'notnull' => (bool) ('' === $val['null']), // not null is empty, null is yes + 'default' => $val['default'], + 'primary' => (strtolower($val['key']) == 'pri'), + 'autoinc' => (strtolower($val['extra']) == 'auto_increment'), + ]; + } + } + + return $this->fieldCase($info); + } + + /** + * 取得数据库的表信息 + * @access public + * @param string $dbName + * @return array + */ + public function getTables($dbName = '') + { + $sql = !empty($dbName) ? 'SHOW TABLES FROM ' . $dbName : 'SHOW TABLES '; + $pdo = $this->query($sql, [], false, true); + $result = $pdo->fetchAll(PDO::FETCH_ASSOC); + $info = []; + + foreach ($result as $key => $val) { + $info[$key] = current($val); + } + + return $info; + } + + /** + * SQL性能分析 + * @access protected + * @param string $sql + * @return array + */ + protected function getExplain($sql) + { + $pdo = $this->linkID->query("EXPLAIN " . $sql); + $result = $pdo->fetch(PDO::FETCH_ASSOC); + $result = array_change_key_case($result); + + if (isset($result['extra'])) { + if (strpos($result['extra'], 'filesort') || strpos($result['extra'], 'temporary')) { + $this->log('SQL:' . $this->queryStr . '[' . $result['extra'] . ']', 'warn'); + } + } + + return $result; + } + + protected function supportSavepoint() + { + return true; + } + +} diff --git a/tp5/thinkphp/library/think/db/connector/Pgsql.php b/tp5/thinkphp/library/think/db/connector/Pgsql.php new file mode 100644 index 0000000..ee9fca0 --- /dev/null +++ b/tp5/thinkphp/library/think/db/connector/Pgsql.php @@ -0,0 +1,116 @@ + +// +---------------------------------------------------------------------- + +namespace think\db\connector; + +use PDO; +use think\db\Connection; + +/** + * Pgsql数据库驱动 + */ +class Pgsql extends Connection +{ + protected $builder = '\\think\\db\\builder\\Pgsql'; + + // PDO连接参数 + protected $params = [ + PDO::ATTR_CASE => PDO::CASE_NATURAL, + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, + PDO::ATTR_STRINGIFY_FETCHES => false, + ]; + + /** + * 解析pdo连接的dsn信息 + * @access protected + * @param array $config 连接信息 + * @return string + */ + protected function parseDsn($config) + { + $dsn = 'pgsql:dbname=' . $config['database'] . ';host=' . $config['hostname']; + + if (!empty($config['hostport'])) { + $dsn .= ';port=' . $config['hostport']; + } + + return $dsn; + } + + /** + * 取得数据表的字段信息 + * @access public + * @param string $tableName + * @return array + */ + public function getFields($tableName) + { + list($tableName) = explode(' ', $tableName); + $sql = 'select fields_name as "field",fields_type as "type",fields_not_null as "null",fields_key_name as "key",fields_default as "default",fields_default as "extra" from table_msg(\'' . $tableName . '\');'; + + $pdo = $this->query($sql, [], false, true); + $result = $pdo->fetchAll(PDO::FETCH_ASSOC); + $info = []; + + if ($result) { + foreach ($result as $key => $val) { + $val = array_change_key_case($val); + $info[$val['field']] = [ + 'name' => $val['field'], + 'type' => $val['type'], + 'notnull' => (bool) ('' !== $val['null']), + 'default' => $val['default'], + 'primary' => !empty($val['key']), + 'autoinc' => (0 === strpos($val['extra'], 'nextval(')), + ]; + } + } + + return $this->fieldCase($info); + } + + /** + * 取得数据库的表信息 + * @access public + * @param string $dbName + * @return array + */ + public function getTables($dbName = '') + { + $sql = "select tablename as Tables_in_test from pg_tables where schemaname ='public'"; + $pdo = $this->query($sql, [], false, true); + $result = $pdo->fetchAll(PDO::FETCH_ASSOC); + $info = []; + + foreach ($result as $key => $val) { + $info[$key] = current($val); + } + + return $info; + } + + /** + * SQL性能分析 + * @access protected + * @param string $sql + * @return array + */ + protected function getExplain($sql) + { + return []; + } + + protected function supportSavepoint() + { + return true; + } +} diff --git a/tp5/thinkphp/library/think/db/connector/Sqlite.php b/tp5/thinkphp/library/think/db/connector/Sqlite.php new file mode 100644 index 0000000..5b9b3fa --- /dev/null +++ b/tp5/thinkphp/library/think/db/connector/Sqlite.php @@ -0,0 +1,108 @@ + +// +---------------------------------------------------------------------- + +namespace think\db\connector; + +use PDO; +use think\db\Connection; + +/** + * Sqlite数据库驱动 + */ +class Sqlite extends Connection +{ + + protected $builder = '\\think\\db\\builder\\Sqlite'; + + /** + * 解析pdo连接的dsn信息 + * @access protected + * @param array $config 连接信息 + * @return string + */ + protected function parseDsn($config) + { + $dsn = 'sqlite:' . $config['database']; + + return $dsn; + } + + /** + * 取得数据表的字段信息 + * @access public + * @param string $tableName + * @return array + */ + public function getFields($tableName) + { + list($tableName) = explode(' ', $tableName); + $sql = 'PRAGMA table_info( ' . $tableName . ' )'; + + $pdo = $this->query($sql, [], false, true); + $result = $pdo->fetchAll(PDO::FETCH_ASSOC); + $info = []; + + if ($result) { + foreach ($result as $key => $val) { + $val = array_change_key_case($val); + $info[$val['name']] = [ + 'name' => $val['name'], + 'type' => $val['type'], + 'notnull' => 1 === $val['notnull'], + 'default' => $val['dflt_value'], + 'primary' => '1' == $val['pk'], + 'autoinc' => '1' == $val['pk'], + ]; + } + } + + return $this->fieldCase($info); + } + + /** + * 取得数据库的表信息 + * @access public + * @param string $dbName + * @return array + */ + public function getTables($dbName = '') + { + $sql = "SELECT name FROM sqlite_master WHERE type='table' " + . "UNION ALL SELECT name FROM sqlite_temp_master " + . "WHERE type='table' ORDER BY name"; + + $pdo = $this->query($sql, [], false, true); + $result = $pdo->fetchAll(PDO::FETCH_ASSOC); + $info = []; + + foreach ($result as $key => $val) { + $info[$key] = current($val); + } + + return $info; + } + + /** + * SQL性能分析 + * @access protected + * @param string $sql + * @return array + */ + protected function getExplain($sql) + { + return []; + } + + protected function supportSavepoint() + { + return true; + } +} diff --git a/tp5/thinkphp/library/think/db/connector/Sqlsrv.php b/tp5/thinkphp/library/think/db/connector/Sqlsrv.php new file mode 100644 index 0000000..4b54170 --- /dev/null +++ b/tp5/thinkphp/library/think/db/connector/Sqlsrv.php @@ -0,0 +1,138 @@ + +// +---------------------------------------------------------------------- + +namespace think\db\connector; + +use PDO; +use think\db\Connection; + +/** + * Sqlsrv数据库驱动 + */ +class Sqlsrv extends Connection +{ + // PDO连接参数 + protected $params = [ + PDO::ATTR_CASE => PDO::CASE_NATURAL, + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, + PDO::ATTR_STRINGIFY_FETCHES => false, + ]; + + protected $builder = '\\think\\db\\builder\\Sqlsrv'; + + /** + * 解析pdo连接的dsn信息 + * @access protected + * @param array $config 连接信息 + * @return string + */ + protected function parseDsn($config) + { + $dsn = 'sqlsrv:Database=' . $config['database'] . ';Server=' . $config['hostname']; + + if (!empty($config['hostport'])) { + $dsn .= ',' . $config['hostport']; + } + + return $dsn; + } + + /** + * 取得数据表的字段信息 + * @access public + * @param string $tableName + * @return array + */ + public function getFields($tableName) + { + list($tableName) = explode(' ', $tableName); + + $sql = "SELECT column_name, data_type, column_default, is_nullable + FROM information_schema.tables AS t + JOIN information_schema.columns AS c + ON t.table_catalog = c.table_catalog + AND t.table_schema = c.table_schema + AND t.table_name = c.table_name + WHERE t.table_name = '$tableName'"; + + $pdo = $this->query($sql, [], false, true); + $result = $pdo->fetchAll(PDO::FETCH_ASSOC); + $info = []; + + if ($result) { + foreach ($result as $key => $val) { + $val = array_change_key_case($val); + $info[$val['column_name']] = [ + 'name' => $val['column_name'], + 'type' => $val['data_type'], + 'notnull' => (bool) ('' === $val['is_nullable']), // not null is empty, null is yes + 'default' => $val['column_default'], + 'primary' => false, + 'autoinc' => false, + ]; + } + } + + $sql = "SELECT column_name FROM information_schema.key_column_usage WHERE table_name='$tableName'"; + + // 调试开始 + $this->debug(true); + + $pdo = $this->linkID->query($sql); + + // 调试结束 + $this->debug(false, $sql); + + $result = $pdo->fetch(PDO::FETCH_ASSOC); + + if ($result) { + $info[$result['column_name']]['primary'] = true; + } + + return $this->fieldCase($info); + } + + /** + * 取得数据表的字段信息 + * @access public + * @param string $dbName + * @return array + */ + public function getTables($dbName = '') + { + $sql = "SELECT TABLE_NAME + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_TYPE = 'BASE TABLE' + "; + + $pdo = $this->query($sql, [], false, true); + $result = $pdo->fetchAll(PDO::FETCH_ASSOC); + $info = []; + + foreach ($result as $key => $val) { + $info[$key] = current($val); + } + + return $info; + } + + /** + * SQL性能分析 + * @access protected + * @param string $sql + * @return array + */ + protected function getExplain($sql) + { + return []; + } +} diff --git a/tp5/thinkphp/library/think/db/connector/pgsql.sql b/tp5/thinkphp/library/think/db/connector/pgsql.sql new file mode 100644 index 0000000..e1a09a3 --- /dev/null +++ b/tp5/thinkphp/library/think/db/connector/pgsql.sql @@ -0,0 +1,117 @@ +CREATE OR REPLACE FUNCTION pgsql_type(a_type varchar) RETURNS varchar AS +$BODY$ +DECLARE + v_type varchar; +BEGIN + IF a_type='int8' THEN + v_type:='bigint'; + ELSIF a_type='int4' THEN + v_type:='integer'; + ELSIF a_type='int2' THEN + v_type:='smallint'; + ELSIF a_type='bpchar' THEN + v_type:='char'; + ELSE + v_type:=a_type; + END IF; + RETURN v_type; +END; +$BODY$ +LANGUAGE PLPGSQL; + +CREATE TYPE "public"."tablestruct" AS ( + "fields_key_name" varchar(100), + "fields_name" VARCHAR(200), + "fields_type" VARCHAR(20), + "fields_length" BIGINT, + "fields_not_null" VARCHAR(10), + "fields_default" VARCHAR(500), + "fields_comment" VARCHAR(1000) +); + +CREATE OR REPLACE FUNCTION "public"."table_msg" (a_schema_name varchar, a_table_name varchar) RETURNS SETOF "public"."tablestruct" AS +$body$ +DECLARE + v_ret tablestruct; + v_oid oid; + v_sql varchar; + v_rec RECORD; + v_key varchar; +BEGIN + SELECT + pg_class.oid INTO v_oid + FROM + pg_class + INNER JOIN pg_namespace ON (pg_class.relnamespace = pg_namespace.oid AND lower(pg_namespace.nspname) = a_schema_name) + WHERE + pg_class.relname=a_table_name; + IF NOT FOUND THEN + RETURN; + END IF; + + v_sql=' + SELECT + pg_attribute.attname AS fields_name, + pg_attribute.attnum AS fields_index, + pgsql_type(pg_type.typname::varchar) AS fields_type, + pg_attribute.atttypmod-4 as fields_length, + CASE WHEN pg_attribute.attnotnull THEN ''not null'' + ELSE '''' + END AS fields_not_null, + pg_attrdef.adsrc AS fields_default, + pg_description.description AS fields_comment + FROM + pg_attribute + INNER JOIN pg_class ON pg_attribute.attrelid = pg_class.oid + INNER JOIN pg_type ON pg_attribute.atttypid = pg_type.oid + LEFT OUTER JOIN pg_attrdef ON pg_attrdef.adrelid = pg_class.oid AND pg_attrdef.adnum = pg_attribute.attnum + LEFT OUTER JOIN pg_description ON pg_description.objoid = pg_class.oid AND pg_description.objsubid = pg_attribute.attnum + WHERE + pg_attribute.attnum > 0 + AND attisdropped <> ''t'' + AND pg_class.oid = ' || v_oid || ' + ORDER BY pg_attribute.attnum' ; + + FOR v_rec IN EXECUTE v_sql LOOP + v_ret.fields_name=v_rec.fields_name; + v_ret.fields_type=v_rec.fields_type; + IF v_rec.fields_length > 0 THEN + v_ret.fields_length:=v_rec.fields_length; + ELSE + v_ret.fields_length:=NULL; + END IF; + v_ret.fields_not_null=v_rec.fields_not_null; + v_ret.fields_default=v_rec.fields_default; + v_ret.fields_comment=v_rec.fields_comment; + SELECT constraint_name INTO v_key FROM information_schema.key_column_usage WHERE table_schema=a_schema_name AND table_name=a_table_name AND column_name=v_rec.fields_name; + IF FOUND THEN + v_ret.fields_key_name=v_key; + ELSE + v_ret.fields_key_name=''; + END IF; + RETURN NEXT v_ret; + END LOOP; + RETURN ; +END; +$body$ +LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER; + +COMMENT ON FUNCTION "public"."table_msg"(a_schema_name varchar, a_table_name varchar) +IS '获得表信息'; + +---重载一个函数 +CREATE OR REPLACE FUNCTION "public"."table_msg" (a_table_name varchar) RETURNS SETOF "public"."tablestruct" AS +$body$ +DECLARE + v_ret tablestruct; +BEGIN + FOR v_ret IN SELECT * FROM table_msg('public',a_table_name) LOOP + RETURN NEXT v_ret; + END LOOP; + RETURN; +END; +$body$ +LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER; + +COMMENT ON FUNCTION "public"."table_msg"(a_table_name varchar) +IS '获得表信息'; \ No newline at end of file diff --git a/tp5/thinkphp/library/think/db/exception/BindParamException.php b/tp5/thinkphp/library/think/db/exception/BindParamException.php new file mode 100644 index 0000000..dce0c7b --- /dev/null +++ b/tp5/thinkphp/library/think/db/exception/BindParamException.php @@ -0,0 +1,36 @@ + +// +---------------------------------------------------------------------- + +namespace think\db\exception; + +use think\exception\DbException; + +/** + * PDO参数绑定异常 + */ +class BindParamException extends DbException +{ + + /** + * BindParamException constructor. + * @access public + * @param string $message + * @param array $config + * @param string $sql + * @param array $bind + * @param int $code + */ + public function __construct($message, $config, $sql, $bind, $code = 10502) + { + $this->setData('Bind Param', $bind); + parent::__construct($message, $config, $sql, $code); + } +} diff --git a/tp5/thinkphp/library/think/db/exception/DataNotFoundException.php b/tp5/thinkphp/library/think/db/exception/DataNotFoundException.php new file mode 100644 index 0000000..883e333 --- /dev/null +++ b/tp5/thinkphp/library/think/db/exception/DataNotFoundException.php @@ -0,0 +1,44 @@ + +// +---------------------------------------------------------------------- + +namespace think\db\exception; + +use think\exception\DbException; + +class DataNotFoundException extends DbException +{ + protected $table; + + /** + * DbException constructor. + * @access public + * @param string $message + * @param string $table + * @param array $config + */ + public function __construct($message, $table = '', array $config = []) + { + $this->message = $message; + $this->table = $table; + + $this->setData('Database Config', $config); + } + + /** + * 获取数据表名 + * @access public + * @return string + */ + public function getTable() + { + return $this->table; + } +} diff --git a/tp5/thinkphp/library/think/db/exception/ModelNotFoundException.php b/tp5/thinkphp/library/think/db/exception/ModelNotFoundException.php new file mode 100644 index 0000000..ae52baf --- /dev/null +++ b/tp5/thinkphp/library/think/db/exception/ModelNotFoundException.php @@ -0,0 +1,45 @@ + +// +---------------------------------------------------------------------- + +namespace think\db\exception; + +use think\exception\DbException; + +class ModelNotFoundException extends DbException +{ + protected $model; + + /** + * 构造方法 + * @access public + * @param string $message + * @param string $model + * @param array $config + */ + public function __construct($message, $model = '', array $config = []) + { + $this->message = $message; + $this->model = $model; + + $this->setData('Database Config', $config); + } + + /** + * 获取模型类名 + * @access public + * @return string + */ + public function getModel() + { + return $this->model; + } + +} diff --git a/tp5/thinkphp/library/think/debug/Console.php b/tp5/thinkphp/library/think/debug/Console.php new file mode 100644 index 0000000..dd063c1 --- /dev/null +++ b/tp5/thinkphp/library/think/debug/Console.php @@ -0,0 +1,156 @@ + +// +---------------------------------------------------------------------- + +namespace think\debug; + +use think\Container; +use think\Db; +use think\Response; + +/** + * 浏览器调试输出 + */ +class Console +{ + protected $config = [ + 'tabs' => ['base' => '基本', 'file' => '文件', 'info' => '流程', 'notice|error' => '错误', 'sql' => 'SQL', 'debug|log' => '调试'], + ]; + + // 实例化并传入参数 + public function __construct($config = []) + { + if (is_array($config)) { + $this->config = array_merge($this->config, $config); + } + } + + /** + * 调试输出接口 + * @access public + * @param Response $response Response对象 + * @param array $log 日志信息 + * @return bool + */ + public function output(Response $response, array $log = []) + { + $request = Container::get('request'); + $contentType = $response->getHeader('Content-Type'); + $accept = $request->header('accept'); + if (strpos($accept, 'application/json') === 0 || $request->isAjax()) { + return false; + } elseif (!empty($contentType) && strpos($contentType, 'html') === false) { + return false; + } + // 获取基本信息 + $runtime = number_format(microtime(true) - Container::get('app')->getBeginTime(), 10); + $reqs = $runtime > 0 ? number_format(1 / $runtime, 2) : '∞'; + $mem = number_format((memory_get_usage() - Container::get('app')->getBeginMem()) / 1024, 2); + + if (isset($_SERVER['HTTP_HOST'])) { + $uri = $_SERVER['SERVER_PROTOCOL'] . ' ' . $_SERVER['REQUEST_METHOD'] . ' : ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + } else { + $uri = 'cmd:' . implode(' ', $_SERVER['argv']); + } + + // 页面Trace信息 + $base = [ + '请求信息' => date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']) . ' ' . $uri, + '运行时间' => number_format($runtime, 6) . 's [ 吞吐率:' . $reqs . 'req/s ] 内存消耗:' . $mem . 'kb 文件加载:' . count(get_included_files()), + '查询信息' => Db::$queryTimes . ' queries ' . Db::$executeTimes . ' writes ', + '缓存信息' => Container::get('cache')->getReadTimes() . ' reads,' . Container::get('cache')->getWriteTimes() . ' writes', + ]; + + if (session_id()) { + $base['会话信息'] = 'SESSION_ID=' . session_id(); + } + + $info = Container::get('debug')->getFile(true); + + // 页面Trace信息 + $trace = []; + foreach ($this->config['tabs'] as $name => $title) { + $name = strtolower($name); + switch ($name) { + case 'base': // 基本信息 + $trace[$title] = $base; + break; + case 'file': // 文件信息 + $trace[$title] = $info; + break; + default: // 调试信息 + if (strpos($name, '|')) { + // 多组信息 + $names = explode('|', $name); + $result = []; + foreach ($names as $name) { + $result = array_merge($result, isset($log[$name]) ? $log[$name] : []); + } + $trace[$title] = $result; + } else { + $trace[$title] = isset($log[$name]) ? $log[$name] : ''; + } + } + } + + //输出到控制台 + $lines = ''; + foreach ($trace as $type => $msg) { + $lines .= $this->console($type, $msg); + } + $js = << +{$lines} + +JS; + return $js; + } + + protected function console($type, $msg) + { + $type = strtolower($type); + $trace_tabs = array_values($this->config['tabs']); + $line[] = ($type == $trace_tabs[0] || '调试' == $type || '错误' == $type) + ? "console.group('{$type}');" + : "console.groupCollapsed('{$type}');"; + + foreach ((array) $msg as $key => $m) { + switch ($type) { + case '调试': + $var_type = gettype($m); + if (in_array($var_type, ['array', 'string'])) { + $line[] = "console.log(" . json_encode($m) . ");"; + } else { + $line[] = "console.log(" . json_encode(var_export($m, 1)) . ");"; + } + break; + case '错误': + $msg = str_replace("\n", '\n', addslashes(is_scalar($m) ? $m : json_encode($m))); + $style = 'color:#F4006B;font-size:14px;'; + $line[] = "console.error(\"%c{$msg}\", \"{$style}\");"; + break; + case 'sql': + $msg = str_replace("\n", '\n', addslashes($m)); + $style = "color:#009bb4;"; + $line[] = "console.log(\"%c{$msg}\", \"{$style}\");"; + break; + default: + $m = is_string($key) ? $key . ' ' . $m : $key + 1 . ' ' . $m; + $msg = json_encode($m); + $line[] = "console.log({$msg});"; + break; + } + } + $line[] = "console.groupEnd();"; + return implode(PHP_EOL, $line); + } + +} diff --git a/tp5/thinkphp/library/think/debug/Html.php b/tp5/thinkphp/library/think/debug/Html.php new file mode 100644 index 0000000..ed4c626 --- /dev/null +++ b/tp5/thinkphp/library/think/debug/Html.php @@ -0,0 +1,106 @@ + +// +---------------------------------------------------------------------- + +namespace think\debug; + +use think\Container; +use think\Db; +use think\Response; + +/** + * 页面Trace调试 + */ +class Html +{ + protected $config = [ + 'file' => '', + 'tabs' => ['base' => '基本', 'file' => '文件', 'info' => '流程', 'notice|error' => '错误', 'sql' => 'SQL', 'debug|log' => '调试'], + ]; + + // 实例化并传入参数 + public function __construct(array $config = []) + { + $this->config = array_merge($this->config, $config); + } + + /** + * 调试输出接口 + * @access public + * @param Response $response Response对象 + * @param array $log 日志信息 + * @return bool + */ + public function output(Response $response, array $log = []) + { + $request = Container::get('request'); + $contentType = $response->getHeader('Content-Type'); + $accept = $request->header('accept'); + if (strpos($accept, 'application/json') === 0 || $request->isAjax()) { + return false; + } elseif (!empty($contentType) && strpos($contentType, 'html') === false) { + return false; + } + // 获取基本信息 + $runtime = number_format(microtime(true) - Container::get('app')->getBeginTime(), 10); + $reqs = $runtime > 0 ? number_format(1 / $runtime, 2) : '∞'; + $mem = number_format((memory_get_usage() - Container::get('app')->getBeginMem()) / 1024, 2); + + // 页面Trace信息 + if (isset($_SERVER['HTTP_HOST'])) { + $uri = $_SERVER['SERVER_PROTOCOL'] . ' ' . $_SERVER['REQUEST_METHOD'] . ' : ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + } else { + $uri = 'cmd:' . implode(' ', $_SERVER['argv']); + } + $base = [ + '请求信息' => date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']) . ' ' . $uri, + '运行时间' => number_format($runtime, 6) . 's [ 吞吐率:' . $reqs . 'req/s ] 内存消耗:' . $mem . 'kb 文件加载:' . count(get_included_files()), + '查询信息' => Db::$queryTimes . ' queries ' . Db::$executeTimes . ' writes ', + '缓存信息' => Container::get('cache')->getReadTimes() . ' reads,' . Container::get('cache')->getWriteTimes() . ' writes', + ]; + + if (session_id()) { + $base['会话信息'] = 'SESSION_ID=' . session_id(); + } + + $info = Container::get('debug')->getFile(true); + + // 页面Trace信息 + $trace = []; + foreach ($this->config['tabs'] as $name => $title) { + $name = strtolower($name); + switch ($name) { + case 'base': // 基本信息 + $trace[$title] = $base; + break; + case 'file': // 文件信息 + $trace[$title] = $info; + break; + default: // 调试信息 + if (strpos($name, '|')) { + // 多组信息 + $names = explode('|', $name); + $result = []; + foreach ($names as $name) { + $result = array_merge($result, isset($log[$name]) ? $log[$name] : []); + } + $trace[$title] = $result; + } else { + $trace[$title] = isset($log[$name]) ? $log[$name] : ''; + } + } + } + // 调用Trace页面模板 + ob_start(); + include $this->config['file']; + return ob_get_clean(); + } + +} diff --git a/tp5/thinkphp/library/think/exception/ClassNotFoundException.php b/tp5/thinkphp/library/think/exception/ClassNotFoundException.php new file mode 100644 index 0000000..eb22e73 --- /dev/null +++ b/tp5/thinkphp/library/think/exception/ClassNotFoundException.php @@ -0,0 +1,32 @@ + +// +---------------------------------------------------------------------- + +namespace think\exception; + +class ClassNotFoundException extends \RuntimeException +{ + protected $class; + public function __construct($message, $class = '') + { + $this->message = $message; + $this->class = $class; + } + + /** + * 获取类名 + * @access public + * @return string + */ + public function getClass() + { + return $this->class; + } +} diff --git a/tp5/thinkphp/library/think/exception/DbException.php b/tp5/thinkphp/library/think/exception/DbException.php new file mode 100644 index 0000000..0f50425 --- /dev/null +++ b/tp5/thinkphp/library/think/exception/DbException.php @@ -0,0 +1,44 @@ + +// +---------------------------------------------------------------------- + +namespace think\exception; + +use think\Exception; + +/** + * Database相关异常处理类 + */ +class DbException extends Exception +{ + /** + * DbException constructor. + * @access public + * @param string $message + * @param array $config + * @param string $sql + * @param int $code + */ + public function __construct($message, array $config, $sql, $code = 10500) + { + $this->message = $message; + $this->code = $code; + + $this->setData('Database Status', [ + 'Error Code' => $code, + 'Error Message' => $message, + 'Error SQL' => $sql, + ]); + + unset($config['username'], $config['password']); + $this->setData('Database Config', $config); + } + +} diff --git a/tp5/thinkphp/library/think/exception/ErrorException.php b/tp5/thinkphp/library/think/exception/ErrorException.php new file mode 100644 index 0000000..3143b8f --- /dev/null +++ b/tp5/thinkphp/library/think/exception/ErrorException.php @@ -0,0 +1,56 @@ + +// +---------------------------------------------------------------------- + +namespace think\exception; + +use think\Exception; + +/** + * ThinkPHP错误异常 + * 主要用于封装 set_error_handler 和 register_shutdown_function 得到的错误 + * 除开从 think\Exception 继承的功能 + * 其他和PHP系统\ErrorException功能基本一样 + */ +class ErrorException extends Exception +{ + /** + * 用于保存错误级别 + * @var integer + */ + protected $severity; + + /** + * 错误异常构造函数 + * @access public + * @param integer $severity 错误级别 + * @param string $message 错误详细信息 + * @param string $file 出错文件路径 + * @param integer $line 出错行号 + */ + public function __construct($severity, $message, $file, $line) + { + $this->severity = $severity; + $this->message = $message; + $this->file = $file; + $this->line = $line; + $this->code = 0; + } + + /** + * 获取错误级别 + * @access public + * @return integer 错误级别 + */ + final public function getSeverity() + { + return $this->severity; + } +} diff --git a/tp5/thinkphp/library/think/exception/Handle.php b/tp5/thinkphp/library/think/exception/Handle.php new file mode 100644 index 0000000..02c85ec --- /dev/null +++ b/tp5/thinkphp/library/think/exception/Handle.php @@ -0,0 +1,306 @@ + +// +---------------------------------------------------------------------- + +namespace think\exception; + +use Exception; +use think\console\Output; +use think\Container; +use think\Response; + +class Handle +{ + protected $render; + protected $ignoreReport = [ + '\\think\\exception\\HttpException', + ]; + + public function setRender($render) + { + $this->render = $render; + } + + /** + * Report or log an exception. + * + * @access public + * @param \Exception $exception + * @return void + */ + public function report(Exception $exception) + { + if (!$this->isIgnoreReport($exception)) { + // 收集异常数据 + if (Container::get('app')->isDebug()) { + $data = [ + 'file' => $exception->getFile(), + 'line' => $exception->getLine(), + 'message' => $this->getMessage($exception), + 'code' => $this->getCode($exception), + ]; + $log = "[{$data['code']}]{$data['message']}[{$data['file']}:{$data['line']}]"; + } else { + $data = [ + 'code' => $this->getCode($exception), + 'message' => $this->getMessage($exception), + ]; + $log = "[{$data['code']}]{$data['message']}"; + } + + if (Container::get('app')->config('log.record_trace')) { + $log .= "\r\n" . $exception->getTraceAsString(); + } + + Container::get('log')->record($log, 'error'); + } + } + + protected function isIgnoreReport(Exception $exception) + { + foreach ($this->ignoreReport as $class) { + if ($exception instanceof $class) { + return true; + } + } + + return false; + } + + /** + * Render an exception into an HTTP response. + * + * @access public + * @param \Exception $e + * @return Response + */ + public function render(Exception $e) + { + if ($this->render && $this->render instanceof \Closure) { + $result = call_user_func_array($this->render, [$e]); + + if ($result) { + return $result; + } + } + + if ($e instanceof HttpException) { + return $this->renderHttpException($e); + } else { + return $this->convertExceptionToResponse($e); + } + } + + /** + * @access public + * @param Output $output + * @param Exception $e + */ + public function renderForConsole(Output $output, Exception $e) + { + if (Container::get('app')->isDebug()) { + $output->setVerbosity(Output::VERBOSITY_DEBUG); + } + + $output->renderException($e); + } + + /** + * @access protected + * @param HttpException $e + * @return Response + */ + protected function renderHttpException(HttpException $e) + { + $status = $e->getStatusCode(); + $template = Container::get('app')->config('http_exception_template'); + + if (!Container::get('app')->isDebug() && !empty($template[$status])) { + return Response::create($template[$status], 'view', $status)->assign(['e' => $e]); + } else { + return $this->convertExceptionToResponse($e); + } + } + + /** + * @access protected + * @param Exception $exception + * @return Response + */ + protected function convertExceptionToResponse(Exception $exception) + { + // 收集异常数据 + if (Container::get('app')->isDebug()) { + // 调试模式,获取详细的错误信息 + $data = [ + 'name' => get_class($exception), + 'file' => $exception->getFile(), + 'line' => $exception->getLine(), + 'message' => $this->getMessage($exception), + 'trace' => $exception->getTrace(), + 'code' => $this->getCode($exception), + 'source' => $this->getSourceCode($exception), + 'datas' => $this->getExtendData($exception), + 'tables' => [ + 'GET Data' => $_GET, + 'POST Data' => $_POST, + 'Files' => $_FILES, + 'Cookies' => $_COOKIE, + 'Session' => isset($_SESSION) ? $_SESSION : [], + 'Server/Request Data' => $_SERVER, + 'Environment Variables' => $_ENV, + 'ThinkPHP Constants' => $this->getConst(), + ], + ]; + } else { + // 部署模式仅显示 Code 和 Message + $data = [ + 'code' => $this->getCode($exception), + 'message' => $this->getMessage($exception), + ]; + + if (!Container::get('app')->config('show_error_msg')) { + // 不显示详细错误信息 + $data['message'] = Container::get('app')->config('error_message'); + } + } + + //保留一层 + while (ob_get_level() > 1) { + ob_end_clean(); + } + + $data['echo'] = ob_get_clean(); + + ob_start(); + extract($data); + include Container::get('app')->config('exception_tmpl'); + + // 获取并清空缓存 + $content = ob_get_clean(); + $response = Response::create($content, 'html'); + + if ($exception instanceof HttpException) { + $statusCode = $exception->getStatusCode(); + $response->header($exception->getHeaders()); + } + + if (!isset($statusCode)) { + $statusCode = 500; + } + $response->code($statusCode); + + return $response; + } + + /** + * 获取错误编码 + * ErrorException则使用错误级别作为错误编码 + * @access protected + * @param \Exception $exception + * @return integer 错误编码 + */ + protected function getCode(Exception $exception) + { + $code = $exception->getCode(); + + if (!$code && $exception instanceof ErrorException) { + $code = $exception->getSeverity(); + } + + return $code; + } + + /** + * 获取错误信息 + * ErrorException则使用错误级别作为错误编码 + * @access protected + * @param \Exception $exception + * @return string 错误信息 + */ + protected function getMessage(Exception $exception) + { + $message = $exception->getMessage(); + + if (PHP_SAPI == 'cli') { + return $message; + } + + $lang = Container::get('lang'); + + if (strpos($message, ':')) { + $name = strstr($message, ':', true); + $message = $lang->has($name) ? $lang->get($name) . strstr($message, ':') : $message; + } elseif (strpos($message, ',')) { + $name = strstr($message, ',', true); + $message = $lang->has($name) ? $lang->get($name) . ':' . substr(strstr($message, ','), 1) : $message; + } elseif ($lang->has($message)) { + $message = $lang->get($message); + } + + return $message; + } + + /** + * 获取出错文件内容 + * 获取错误的前9行和后9行 + * @access protected + * @param \Exception $exception + * @return array 错误文件内容 + */ + protected function getSourceCode(Exception $exception) + { + // 读取前9行和后9行 + $line = $exception->getLine(); + $first = ($line - 9 > 0) ? $line - 9 : 1; + + try { + $contents = file($exception->getFile()); + $source = [ + 'first' => $first, + 'source' => array_slice($contents, $first - 1, 19), + ]; + } catch (Exception $e) { + $source = []; + } + + return $source; + } + + /** + * 获取异常扩展信息 + * 用于非调试模式html返回类型显示 + * @access protected + * @param \Exception $exception + * @return array 异常类定义的扩展数据 + */ + protected function getExtendData(Exception $exception) + { + $data = []; + + if ($exception instanceof \think\Exception) { + $data = $exception->getData(); + } + + return $data; + } + + /** + * 获取常量列表 + * @access private + * @return array 常量列表 + */ + private static function getConst() + { + $const = get_defined_constants(true); + + return isset($const['user']) ? $const['user'] : []; + } +} diff --git a/tp5/thinkphp/library/think/exception/HttpException.php b/tp5/thinkphp/library/think/exception/HttpException.php new file mode 100644 index 0000000..01a27fc --- /dev/null +++ b/tp5/thinkphp/library/think/exception/HttpException.php @@ -0,0 +1,36 @@ + +// +---------------------------------------------------------------------- + +namespace think\exception; + +class HttpException extends \RuntimeException +{ + private $statusCode; + private $headers; + + public function __construct($statusCode, $message = null, \Exception $previous = null, array $headers = [], $code = 0) + { + $this->statusCode = $statusCode; + $this->headers = $headers; + + parent::__construct($message, $code, $previous); + } + + public function getStatusCode() + { + return $this->statusCode; + } + + public function getHeaders() + { + return $this->headers; + } +} diff --git a/tp5/thinkphp/library/think/exception/HttpResponseException.php b/tp5/thinkphp/library/think/exception/HttpResponseException.php new file mode 100644 index 0000000..5297286 --- /dev/null +++ b/tp5/thinkphp/library/think/exception/HttpResponseException.php @@ -0,0 +1,33 @@ + +// +---------------------------------------------------------------------- + +namespace think\exception; + +use think\Response; + +class HttpResponseException extends \RuntimeException +{ + /** + * @var Response + */ + protected $response; + + public function __construct(Response $response) + { + $this->response = $response; + } + + public function getResponse() + { + return $this->response; + } + +} diff --git a/tp5/thinkphp/library/think/exception/PDOException.php b/tp5/thinkphp/library/think/exception/PDOException.php new file mode 100644 index 0000000..25240b6 --- /dev/null +++ b/tp5/thinkphp/library/think/exception/PDOException.php @@ -0,0 +1,40 @@ + +// +---------------------------------------------------------------------- + +namespace think\exception; + +/** + * PDO异常处理类 + * 重新封装了系统的\PDOException类 + */ +class PDOException extends DbException +{ + /** + * PDOException constructor. + * @access public + * @param \PDOException $exception + * @param array $config + * @param string $sql + * @param int $code + */ + public function __construct(\PDOException $exception, array $config, $sql, $code = 10501) + { + $error = $exception->errorInfo; + + $this->setData('PDO Error Info', [ + 'SQLSTATE' => $error[0], + 'Driver Error Code' => isset($error[1]) ? $error[1] : 0, + 'Driver Error Message' => isset($error[2]) ? $error[2] : '', + ]); + + parent::__construct($exception->getMessage(), $config, $sql, $code); + } +} diff --git a/tp5/thinkphp/library/think/exception/RouteNotFoundException.php b/tp5/thinkphp/library/think/exception/RouteNotFoundException.php new file mode 100644 index 0000000..d22e3a6 --- /dev/null +++ b/tp5/thinkphp/library/think/exception/RouteNotFoundException.php @@ -0,0 +1,22 @@ + +// +---------------------------------------------------------------------- + +namespace think\exception; + +class RouteNotFoundException extends HttpException +{ + + public function __construct() + { + parent::__construct(404, 'Route Not Found'); + } + +} diff --git a/tp5/thinkphp/library/think/exception/TemplateNotFoundException.php b/tp5/thinkphp/library/think/exception/TemplateNotFoundException.php new file mode 100644 index 0000000..4202069 --- /dev/null +++ b/tp5/thinkphp/library/think/exception/TemplateNotFoundException.php @@ -0,0 +1,33 @@ + +// +---------------------------------------------------------------------- + +namespace think\exception; + +class TemplateNotFoundException extends \RuntimeException +{ + protected $template; + + public function __construct($message, $template = '') + { + $this->message = $message; + $this->template = $template; + } + + /** + * 获取模板文件 + * @access public + * @return string + */ + public function getTemplate() + { + return $this->template; + } +} diff --git a/tp5/thinkphp/library/think/exception/ThrowableError.php b/tp5/thinkphp/library/think/exception/ThrowableError.php new file mode 100644 index 0000000..87b6b9d --- /dev/null +++ b/tp5/thinkphp/library/think/exception/ThrowableError.php @@ -0,0 +1,47 @@ + +// +---------------------------------------------------------------------- + +namespace think\exception; + +class ThrowableError extends \ErrorException +{ + public function __construct(\Throwable $e) + { + + if ($e instanceof \ParseError) { + $message = 'Parse error: ' . $e->getMessage(); + $severity = E_PARSE; + } elseif ($e instanceof \TypeError) { + $message = 'Type error: ' . $e->getMessage(); + $severity = E_RECOVERABLE_ERROR; + } else { + $message = 'Fatal error: ' . $e->getMessage(); + $severity = E_ERROR; + } + + parent::__construct( + $message, + $e->getCode(), + $severity, + $e->getFile(), + $e->getLine() + ); + + $this->setTrace($e->getTrace()); + } + + protected function setTrace($trace) + { + $traceReflector = new \ReflectionProperty('Exception', 'trace'); + $traceReflector->setAccessible(true); + $traceReflector->setValue($this, $trace); + } +} diff --git a/tp5/thinkphp/library/think/exception/ValidateException.php b/tp5/thinkphp/library/think/exception/ValidateException.php new file mode 100644 index 0000000..b368416 --- /dev/null +++ b/tp5/thinkphp/library/think/exception/ValidateException.php @@ -0,0 +1,33 @@ + +// +---------------------------------------------------------------------- + +namespace think\exception; + +class ValidateException extends \RuntimeException +{ + protected $error; + + public function __construct($error) + { + $this->error = $error; + $this->message = is_array($error) ? implode("\n\r", $error) : $error; + } + + /** + * 获取验证错误信息 + * @access public + * @return array|string + */ + public function getError() + { + return $this->error; + } +} diff --git a/tp5/thinkphp/library/think/facade/App.php b/tp5/thinkphp/library/think/facade/App.php new file mode 100644 index 0000000..37d9951 --- /dev/null +++ b/tp5/thinkphp/library/think/facade/App.php @@ -0,0 +1,54 @@ + +// +---------------------------------------------------------------------- + +namespace think\facade; + +use think\Facade; + +/** + * @see \think\App + * @mixin \think\App + * @method \think\App bind(string $bind) static 绑定模块或者控制器 + * @method void initialize() static 初始化应用 + * @method void init(string $module='') static 初始化模块 + * @method \think\Response run() static 执行应用 + * @method \think\App dispatch(\think\route\Dispatch $dispatch) static 设置当前请求的调度信息 + * @method void log(mixed $log, string $type = 'info') static 记录调试信息 + * @method mixed config(string $name='') static 获取配置参数 + * @method \think\route\Dispatch routeCheck() static URL路由检测(根据PATH_INFO) + * @method \think\App routeMust(bool $must = false) static 设置应用的路由检测机制 + * @method \think\Model model(string $name = '', string $layer = 'model', bool $appendSuffix = false, string $common = 'common') static 实例化模型 + * @method object controller(string $name, string $layer = 'controller', bool $appendSuffix = false, string $empty = '') static 实例化控制器 + * @method \think\Validate validate(string $name = '', string $layer = 'validate', bool $appendSuffix = false, string $common = 'common') static 实例化验证器类 + * @method \think\db\Query db(mixed $config = [], mixed $name = false) static 数据库初始化 + * @method mixed action(string $url, $vars = [], $layer = 'controller', $appendSuffix = false) static 调用模块的操作方法 + * @method string parseClass(string $module, string $layer, string $name, bool $appendSuffix = false) static 解析应用类的类名 + * @method string version() static 获取框架版本 + * @method bool isDebug() static 是否为调试模式 + * @method string getModulePath() static 获取当前模块路径 + * @method void setModulePath(string $path) static 设置当前模块路径 + * @method string getRootPath() static 获取应用根目录 + * @method string getAppPath() static 获取应用类库目录 + * @method string getRuntimePath() static 获取应用运行时目录 + * @method string getThinkPath() static 获取核心框架目录 + * @method string getRoutePath() static 获取路由目录 + * @method string getConfigPath() static 获取应用配置目录 + * @method string getConfigExt() static 获取配置后缀 + * @method string setNamespace(string $namespace) static 设置应用类库命名空间 + * @method string getNamespace() static 获取应用类库命名空间 + * @method string getSuffix() static 是否启用类库后缀 + * @method float getBeginTime() static 获取应用开启时间 + * @method integer getBeginMem() static 获取应用初始内存占用 + * @method \think\Container container() static 获取容器实例 + */ +class App extends Facade +{ +} diff --git a/tp5/thinkphp/library/think/facade/Build.php b/tp5/thinkphp/library/think/facade/Build.php new file mode 100644 index 0000000..4659623 --- /dev/null +++ b/tp5/thinkphp/library/think/facade/Build.php @@ -0,0 +1,24 @@ + +// +---------------------------------------------------------------------- + +namespace think\facade; + +use think\Facade; + +/** + * @see \think\Build + * @mixin \think\Build + * @method void run(array $build = [], string $namespace = 'app', bool $suffix = false) static 根据传入的build资料创建目录和文件 + * @method void module(string $module = '', array $list = [], string $namespace = 'app', bool $suffix = false) static 创建模块 + */ +class Build extends Facade +{ +} diff --git a/tp5/thinkphp/library/think/facade/Cache.php b/tp5/thinkphp/library/think/facade/Cache.php new file mode 100644 index 0000000..3011d6b --- /dev/null +++ b/tp5/thinkphp/library/think/facade/Cache.php @@ -0,0 +1,36 @@ + +// +---------------------------------------------------------------------- + +namespace think\facade; + +use think\Facade; + +/** + * @see \think\Cache + * @mixin \think\Cache + * @method \think\cache\Driver connect(array $options = [], mixed $name = false) static 连接缓存 + * @method \think\cache\Driver init(array $options = []) static 初始化缓存 + * @method \think\cache\Driver store(string $name = '') static 切换缓存类型 + * @method bool has(string $name) static 判断缓存是否存在 + * @method mixed get(string $name, mixed $default = false) static 读取缓存 + * @method mixed pull(string $name) static 读取缓存并删除 + * @method mixed set(string $name, mixed $value, int $expire = null) static 设置缓存 + * @method mixed remember(string $name, mixed $value, int $expire = null) static 如果不存在则写入缓存 + * @method mixed inc(string $name, int $step = 1) static 自增缓存(针对数值缓存) + * @method mixed dec(string $name, int $step = 1) static 自减缓存(针对数值缓存) + * @method bool rm(string $name) static 删除缓存 + * @method bool clear(string $tag = null) static 清除缓存 + * @method mixed tag(string $name, mixed $keys = null, bool $overlay = false) static 缓存标签 + * @method object handler() static 返回句柄对象,可执行其它高级方法 + */ +class Cache extends Facade +{ +} diff --git a/tp5/thinkphp/library/think/facade/Config.php b/tp5/thinkphp/library/think/facade/Config.php new file mode 100644 index 0000000..3332413 --- /dev/null +++ b/tp5/thinkphp/library/think/facade/Config.php @@ -0,0 +1,27 @@ + +// +---------------------------------------------------------------------- + +namespace think\facade; + +use think\Facade; + +/** + * @see \think\Config + * @mixin \think\Config + * @method bool has(string $name) static 检测配置是否存在 + * @method array pull(string $name) static 获取一级配置 + * @method mixed get(string $name) static 获取配置参数 + * @method mixed set(string $name, mixed $value = null) static 设置配置参数 + * @method array reset(string $prefix ='') static 重置配置参数 + */ +class Config extends Facade +{ +} diff --git a/tp5/thinkphp/library/think/facade/Cookie.php b/tp5/thinkphp/library/think/facade/Cookie.php new file mode 100644 index 0000000..18efbde --- /dev/null +++ b/tp5/thinkphp/library/think/facade/Cookie.php @@ -0,0 +1,30 @@ + +// +---------------------------------------------------------------------- + +namespace think\facade; + +use think\Facade; + +/** + * @see \think\Cookie + * @mixin \think\Cookie + * @method void init(array $config = []) static 初始化 + * @method bool has(string $name,string $prefix = null) static 判断Cookie数据 + * @method mixed prefix(string $prefix = '') static 设置或者获取cookie作用域(前缀) + * @method mixed get(string $name,string $prefix = null) static Cookie获取 + * @method mixed set(string $name, mixed $value = null, mixed $option = null) static 设置Cookie + * @method void forever(string $name, mixed $value = null, mixed $option = null) static 永久保存Cookie数据 + * @method void delete(string $name, string $prefix = null) static Cookie删除 + * @method void clear($prefix = null) static Cookie清空 + */ +class Cookie extends Facade +{ +} diff --git a/tp5/thinkphp/library/think/facade/Debug.php b/tp5/thinkphp/library/think/facade/Debug.php new file mode 100644 index 0000000..ac482a4 --- /dev/null +++ b/tp5/thinkphp/library/think/facade/Debug.php @@ -0,0 +1,31 @@ + +// +---------------------------------------------------------------------- + +namespace think\facade; + +use think\Facade; + +/** + * @see \think\Debug + * @mixin \think\Debug + * @method void remark(string $name, mixed $value = '') static 记录时间(微秒)和内存使用情况 + * @method int getRangeTime(string $start, string $end, mixed $dec = 6) static 统计某个区间的时间(微秒)使用情况 + * @method int getUseTime(int $dec = 6) static 统计从开始到统计时的时间(微秒)使用情况 + * @method string getThroughputRate(string $start, string $end, mixed $dec = 6) static 获取当前访问的吞吐率情况 + * @method string getRangeMem(string $start, string $end, mixed $dec = 2) static 记录区间的内存使用情况 + * @method int getUseMem(int $dec = 2) static 统计从开始到统计时的内存使用情况 + * @method string getMemPeak(string $start, string $end, mixed $dec = 2) static 统计区间的内存峰值情况 + * @method mixed getFile(bool $detail = false) static 获取文件加载信息 + * @method mixed dump(mixed $var, bool $echo = true, string $label = null, int $flags = ENT_SUBSTITUTE) static 浏览器友好的变量输出 + */ +class Debug extends Facade +{ +} diff --git a/tp5/thinkphp/library/think/facade/Env.php b/tp5/thinkphp/library/think/facade/Env.php new file mode 100644 index 0000000..d430d68 --- /dev/null +++ b/tp5/thinkphp/library/think/facade/Env.php @@ -0,0 +1,25 @@ + +// +---------------------------------------------------------------------- + +namespace think\facade; + +use think\Facade; + +/** + * @see \think\Env + * @mixin \think\Env + * @method void load(string $file) static 读取环境变量定义文件 + * @method mixed get(string $name = null, mixed $default = null) static 获取环境变量值 + * @method void set(mixed $env, string $value = null) static 设置环境变量值 + */ +class Env extends Facade +{ +} diff --git a/tp5/thinkphp/library/think/facade/Hook.php b/tp5/thinkphp/library/think/facade/Hook.php new file mode 100644 index 0000000..e18f83b --- /dev/null +++ b/tp5/thinkphp/library/think/facade/Hook.php @@ -0,0 +1,28 @@ + +// +---------------------------------------------------------------------- + +namespace think\facade; + +use think\Facade; + +/** + * @see \think\Hook + * @mixin \think\Hook + * @method \think\Hook alias(mixed $name, mixed $behavior = null) static 指定行为标识 + * @method void add(string $tag, mixed $behavior, bool $first = false) static 动态添加行为扩展到某个标签 + * @method void import(array $tags, bool $recursive = true) static 批量导入插件 + * @method array get(string $tag = '') static 获取插件信息 + * @method mixed listen(string $tag, mixed $params = null, bool $once = false) static 监听标签的行为 + * @method mixed exec(mixed $class, mixed $params = null) static 执行行为 + */ +class Hook extends Facade +{ +} diff --git a/tp5/thinkphp/library/think/facade/Lang.php b/tp5/thinkphp/library/think/facade/Lang.php new file mode 100644 index 0000000..3eb5d4a --- /dev/null +++ b/tp5/thinkphp/library/think/facade/Lang.php @@ -0,0 +1,32 @@ + +// +---------------------------------------------------------------------- + +namespace think\facade; + +use think\Facade; + +/** + * @see \think\Lang + * @mixin \think\Lang + * @method mixed range($range = '') static 设定当前的语言 + * @method mixed set(mixed $name, string $value = null, string $range = '') static 设置语言定义 + * @method array load(mixed $file, string $range = '') static 加载语言定义 + * @method mixed get(string $name = null, array $vars = [], string $range = '') static 获取语言定义 + * @method mixed has(string $name, string $range = '') static 获取语言定义 + * @method string detect() static 自动侦测设置获取语言选择 + * @method void saveToCookie(string $lang = null) static 设置当前语言到Cookie + * @method void setLangDetectVar(string $var) static 设置语言自动侦测的变量 + * @method void setLangCookieVar(string $var) static 设置语言的cookie保存变量 + * @method void setAllowLangList(array $list) static 设置允许的语言列表 + */ +class Lang extends Facade +{ +} diff --git a/tp5/thinkphp/library/think/facade/Log.php b/tp5/thinkphp/library/think/facade/Log.php new file mode 100644 index 0000000..3a1fbf8 --- /dev/null +++ b/tp5/thinkphp/library/think/facade/Log.php @@ -0,0 +1,40 @@ + +// +---------------------------------------------------------------------- + +namespace think\facade; + +use think\Facade; + +/** + * @see \think\Log + * @mixin \think\Log + * @method \think\Log init(array $config = []) static 日志初始化 + * @method mixed getLog(string $type = '') static 获取日志信息 + * @method \think\Log record(mixed $msg, string $type = 'info', array $context = []) static 记录日志信息 + * @method \think\Log clear() static 清空日志信息 + * @method \think\Log key(string $key) static 当前日志记录的授权key + * @method bool check(array $config) static 检查日志写入权限 + * @method bool save() static 保存调试信息 + * @method void write(mixed $msg, string $type = 'info', bool $force = false) static 实时写入日志信息 + * @method void log(string $level,mixed $message, array $context = []) static 记录日志信息 + * @method void emergency(mixed $message, array $context = []) static 记录emergency信息 + * @method void alert(mixed $message, array $context = []) static 记录alert信息 + * @method void critical(mixed $message, array $context = []) static 记录critical信息 + * @method void error(mixed $message, array $context = []) static 记录error信息 + * @method void warning(mixed $message, array $context = []) static 记录warning信息 + * @method void notice(mixed $message, array $context = []) static 记录notice信息 + * @method void info(mixed $message, array $context = []) static 记录info信息 + * @method void debug(mixed $message, array $context = []) static 记录debug信息 + * @method void sql(mixed $message, array $context = []) static 记录sql信息 + */ +class Log extends Facade +{ +} diff --git a/tp5/thinkphp/library/think/facade/Request.php b/tp5/thinkphp/library/think/facade/Request.php new file mode 100644 index 0000000..20b6429 --- /dev/null +++ b/tp5/thinkphp/library/think/facade/Request.php @@ -0,0 +1,88 @@ + +// +---------------------------------------------------------------------- + +namespace think\facade; + +use think\Facade; + +/** + * @see \think\Request + * @mixin \think\Request + * @method void hook(mixed $method, mixed $callback = null) static Hook 方法注入 + * @method \think\Request create(string $uri, string $method = 'GET', array $params = [], array $cookie = [], array $files = [], array $server = [], string $content = null) static 创建一个URL请求 + * @method mixed domain(string $domain = null) static 设置或获取当前包含协议的域名 + * @method mixed url(mixed $url = null) static 设置或获取当前完整URL + * @method mixed baseUrl(string $url = null) static 设置或获取当前URL + * @method mixed baseFile(string $file = null) static 设置或获取当前执行的文件 + * @method mixed root(string $url = null) static 设置或获取URL访问根地址 + * @method string rootUrl() static 获取URL访问根目录 + * @method string pathinfo() static 获取当前请求URL的pathinfo信息(含URL后缀) + * @method string path() static 获取当前请求URL的pathinfo信息(不含URL后缀) + * @method string ext() static 当前URL的访问后缀 + * @method float time(bool $float = false) static 获取当前请求的时间 + * @method mixed type() static 当前请求的资源类型 + * @method void mimeType(mixed $type, string $val = '') static 设置资源类型 + * @method string method(bool $method = false) static 当前的请求类型 + * @method bool isGet() static 是否为GET请求 + * @method bool isPost() static 是否为POST请求 + * @method bool isPut() static 是否为PUT请求 + * @method bool isDelete() static 是否为DELTE请求 + * @method bool isHead() static 是否为HEAD请求 + * @method bool isPatch() static 是否为PATCH请求 + * @method bool isOptions() static 是否为OPTIONS请求 + * @method bool isCli() static 是否为cli + * @method bool isCgi() static 是否为cgi + * @method mixed param(mixed $name = '', mixed $default = null, mixed $filter = '') static 获取当前请求的参数 + * @method mixed route(mixed $name = '', mixed $default = null, mixed $filter = '') static 设置获取路由参数 + * @method mixed get(mixed $name = '', mixed $default = null, mixed $filter = '') static 设置获取GET参数 + * @method mixed post(mixed $name = '', mixed $default = null, mixed $filter = '') static 设置获取POST参数 + * @method mixed put(mixed $name = '', mixed $default = null, mixed $filter = '') static 设置获取PUT参数 + * @method mixed delete(mixed $name = '', mixed $default = null, mixed $filter = '') static 设置获取DELETE参数 + * @method mixed patch(mixed $name = '', mixed $default = null, mixed $filter = '') static 设置获取PATCH参数 + * @method mixed request(mixed $name = '', mixed $default = null, mixed $filter = '') static 获取request变量 + * @method mixed session(mixed $name = '', mixed $default = null, mixed $filter = '') static 获取session数据 + * @method mixed cookie(mixed $name = '', mixed $default = null, mixed $filter = '') static 获取cookie参数 + * @method mixed server(mixed $name = '', mixed $default = null, mixed $filter = '') static 获取server参数 + * @method mixed env(mixed $name = '', mixed $default = null, mixed $filter = '') static 获取环境变量 + * @method mixed file(mixed $name = '') static 获取上传的文件信息 + * @method mixed header(mixed $name = '', mixed $default = null) static 设置或者获取当前的Header + * @method mixed input(array $data,mixed $name = '', mixed $default = null, mixed $filter = '') static 获取变量 支持过滤和默认值 + * @method mixed filter(mixed $filter = null) static 设置或获取当前的过滤规则 + * @method mixed has(string $name, string $type = 'param', bool $checkEmpty = false) static 是否存在某个请求参数 + * @method mixed only(mixed $name, string $type = 'param') static 获取指定的参数 + * @method mixed except(mixed $name, string $type = 'param') static 排除指定参数获取 + * @method bool isSsl() static 当前是否ssl + * @method bool isAjax(bool $ajax = false) static 当前是否Ajax请求 + * @method bool isPjax(bool $pjax = false) static 当前是否Pjax请求 + * @method mixed ip(int $type = 0, bool $adv = true) static 获取客户端IP地址 + * @method bool isMobile() static 检测是否使用手机访问 + * @method string scheme() static 当前URL地址中的scheme参数 + * @method string query() static 当前请求URL地址中的query参数 + * @method string host() static 当前请求的host + * @method string port() static 当前请求URL地址中的port参数 + * @method string protocol() static 当前请求 SERVER_PROTOCOL + * @method string remotePort() static 当前请求 REMOTE_PORT + * @method string contentType() static 当前请求 HTTP_CONTENT_TYPE + * @method array routeInfo(array $route = []) static 获取当前请求的路由信息 + * @method array dispatch(array $dispatch = null) static 设置或者获取当前请求的调度信息 + * @method mixed module(string $module = null) static 设置或者获取当前的模块名 + * @method mixed controller(string $controller = null) static 设置或者获取当前的控制器名 + * @method mixed action(string $action = null) static 设置或者获取当前的操作名 + * @method mixed langset(string $lang = null) static 设置或者获取当前的语言 + * @method string getContent() static 设置或者获取当前请求的content + * @method string getInput() static 获取当前请求的php://input + * @method string token(string $name = '__token__', mixed $type = 'md5') static 生成请求令牌 + * @method string cache(string $key, mixed $expire = null, array $except = [], string $tag = null) static 设置当前地址的请求缓存 + * @method string getCache() static 读取请求缓存设置 + */ +class Request extends Facade +{ +} diff --git a/tp5/thinkphp/library/think/facade/Response.php b/tp5/thinkphp/library/think/facade/Response.php new file mode 100644 index 0000000..4a4de71 --- /dev/null +++ b/tp5/thinkphp/library/think/facade/Response.php @@ -0,0 +1,38 @@ + +// +---------------------------------------------------------------------- + +namespace think\facade; + +use think\Facade; + +/** + * @see \think\Response + * @mixin \think\Response + * @method \think\response create(mixed $data = '', string $type = '', int $code = 200, array $header = [], array $options = []) static 创建Response对象 + * @method void send() static 发送数据到客户端 + * @method \think\Response options(mixed $options = []) static 输出的参数 + * @method \think\Response data(mixed $data) static 输出数据设置 + * @method \think\Response header(mixed $name, string $value = null) static 设置响应头 + * @method \think\Response content(mixed $content) static 设置页面输出内容 + * @method \think\Response code(int $code) static 发送HTTP状态 + * @method \think\Response lastModified(string $time) static LastModified + * @method \think\Response expires(string $time) static expires + * @method \think\Response eTag(string $eTag) static eTag + * @method \think\Response cacheControl(string $cache) static 页面缓存控制 + * @method \think\Response contentType(string $contentType, string $charset = 'utf-8') static 页面输出类型 + * @method mixed getHeader(string $name) static 获取头部信息 + * @method mixed getData() static 获取原始数据 + * @method mixed getContent() static 获取输出数据 + * @method int getCode() static 获取状态码 + */ +class Response extends Facade +{ +} diff --git a/tp5/thinkphp/library/think/facade/Route.php b/tp5/thinkphp/library/think/facade/Route.php new file mode 100644 index 0000000..c197183 --- /dev/null +++ b/tp5/thinkphp/library/think/facade/Route.php @@ -0,0 +1,48 @@ + +// +---------------------------------------------------------------------- + +namespace think\facade; + +use think\Facade; + +/** + * @see \think\Route + * @mixin \think\Route + * @method \think\route\Domain domain(mixed $name, mixed $rule = '', array $option = [], array $pattern = []) static 注册域名路由 + * @method \think\Route pattern(mixed $name, string $rule = '') static 注册变量规则 + * @method \think\Route option(mixed $name, mixed $value = '') static 注册路由参数 + * @method \think\Route bind(string $bind) static 设置路由绑定 + * @method mixed getBind(string $bind) static 读取路由绑定 + * @method \think\Route name(string $name) static 设置当前路由标识 + * @method mixed getName(string $name) static 读取路由标识 + * @method void setName(string $name) static 批量导入路由标识 + * @method void import(array $rules, string $type = '*') static 导入配置文件的路由规则 + * @method \think\route\RuleItem rule(string $rule, mixed $route, string $method = '*', array $option = [], array $pattern = []) static 注册路由规则 + * @method void rules(string $rules, string $method = '*', array $option = [], array $pattern = []) static 批量注册路由规则 + * @method \think\route\RuleGroup group(string $name, mixed $route, string $method = '*', array $option = [], array $pattern = []) static 注册路由分组 + * @method \think\route\RuleItem any(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册路由 + * @method \think\route\RuleItem get(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册路由 + * @method \think\route\RuleItem post(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册路由 + * @method \think\route\RuleItem put(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册路由 + * @method \think\route\RuleItem delete(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册路由 + * @method \think\route\RuleItem patch(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册路由 + * @method \think\route\Resource resource(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册资源路由 + * @method \think\Route controller(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册控制器路由 + * @method \think\Route alias(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册别名路由 + * @method \think\Route setMethodPrefix(mixed $method, string $prefix = '') static 设置不同请求类型下面的方法前缀 + * @method \think\Route rest(string $name, array $resource = []) static rest方法定义和修改 + * @method \think\RuleItem miss(string $route, string $method = '*', array $option = []) static 注册未匹配路由规则后的处理 + * @method \think\RuleItem auto(string $route) static 注册一个自动解析的URL路由 + * @method \think\Dispatch check(string $url, string $depr = '/', bool $must = false, bool $completeMatch = false) static 检测URL路由 + */ +class Route extends Facade +{ +} diff --git a/tp5/thinkphp/library/think/facade/Session.php b/tp5/thinkphp/library/think/facade/Session.php new file mode 100644 index 0000000..9aad0b6 --- /dev/null +++ b/tp5/thinkphp/library/think/facade/Session.php @@ -0,0 +1,37 @@ + +// +---------------------------------------------------------------------- + +namespace think\facade; + +use think\Facade; + +/** + * @see \think\Session + * @mixin \think\Session + * @method void init(array $config = []) static session初始化 + * @method bool has(string $name,string $prefix = null) static 判断session数据 + * @method mixed prefix(string $prefix = '') static 设置或者获取session作用域(前缀) + * @method mixed get(string $name,string $prefix = null) static session获取 + * @method mixed pull(string $name,string $prefix = null) static session获取并删除 + * @method void push(string $key, mixed $value) static 添加数据到一个session数组 + * @method void set(string $name, mixed $value , string $prefix = null) static 设置session数据 + * @method void flash(string $name, mixed $value = null) static session设置 下一次请求有效 + * @method void flush() static 清空当前请求的session数据 + * @method void delete(string $name, string $prefix = null) static 删除session数据 + * @method void clear($prefix = null) static 清空session数据 + * @method void start() static 启动session + * @method void destroy() static 销毁session + * @method void pause() static 暂停session + * @method void regenerate(bool $delete = false) static 重新生成session_id + */ +class Session extends Facade +{ +} diff --git a/tp5/thinkphp/library/think/facade/Url.php b/tp5/thinkphp/library/think/facade/Url.php new file mode 100644 index 0000000..db5a16f --- /dev/null +++ b/tp5/thinkphp/library/think/facade/Url.php @@ -0,0 +1,24 @@ + +// +---------------------------------------------------------------------- + +namespace think\facade; + +use think\Facade; + +/** + * @see \think\Url + * @mixin \think\Url + * @method string build(string $url = '', mixed $vars = '', mixed $suffix = true, mixed $domain = false) static URL生成 支持路由反射 + * @method void root(string $root) static 指定当前生成URL地址的root + */ +class Url extends Facade +{ +} diff --git a/tp5/thinkphp/library/think/facade/Validate.php b/tp5/thinkphp/library/think/facade/Validate.php new file mode 100644 index 0000000..423446d --- /dev/null +++ b/tp5/thinkphp/library/think/facade/Validate.php @@ -0,0 +1,65 @@ + +// +---------------------------------------------------------------------- + +namespace think\facade; + +use think\Facade; + +/** + * @see \think\Validate + * @mixin \think\Validate + * @method \think\Validate make(array $rules = [], array $message = [], array $field = []) static 创建一个验证器类 + * @method \think\Validate rule(mixed $name, mixed $rule = '') static 添加字段验证规则 + * @method void extend(string $type, mixed $callback = null) static 注册扩展验证(类型)规则 + * @method void setTypeMsg(mixed $type, string $msg = null) static 设置验证规则的默认提示信息 + * @method \think\Validate message(mixed $name, string $message = '') static 设置提示信息 + * @method \think\Validate scene(string $name) static 设置验证场景 + * @method bool hasScene(string $name) static 判断是否存在某个验证场景 + * @method \think\Validate batch(bool $batch = true) static 设置批量验证 + * @method \think\Validate only(array $fields) static 指定需要验证的字段列表 + * @method \think\Validate remove(mixed $field, mixed $rule = true) static 移除某个字段的验证规则 + * @method \think\Validate append(mixed $field, mixed $rule = null) static 追加某个字段的验证规则 + * @method bool confirm(mixed $value, mixed $rule, array $data = [], string $field = '') static 验证是否和某个字段的值一致 + * @method bool different(mixed $value, mixed $rule, array $data = []) static 验证是否和某个字段的值是否不同 + * @method bool egt(mixed $value, mixed $rule, array $data = []) static 验证是否大于等于某个值 + * @method bool gt(mixed $value, mixed $rule, array $data = []) static 验证是否大于某个值 + * @method bool elt(mixed $value, mixed $rule, array $data = []) static 验证是否小于等于某个值 + * @method bool lt(mixed $value, mixed $rule, array $data = []) static 验证是否小于某个值 + * @method bool eq(mixed $value, mixed $rule) static 验证是否等于某个值 + * @method bool must(mixed $value, mixed $rule) static 必须验证 + * @method bool is(mixed $value, mixed $rule, array $data = []) static 验证字段值是否为有效格式 + * @method bool ip(mixed $value, mixed $rule) static 验证是否有效IP + * @method bool requireIf(mixed $value, mixed $rule) static 验证某个字段等于某个值的时候必须 + * @method bool requireCallback(mixed $value, mixed $rule,array $data) static 通过回调方法验证某个字段是否必须 + * @method bool requireWith(mixed $value, mixed $rule, array $data) static 验证某个字段有值的情况下必须 + * @method bool filter(mixed $value, mixed $rule) static 使用filter_var方式验证 + * @method bool in(mixed $value, mixed $rule) static 验证是否在范围内 + * @method bool notIn(mixed $value, mixed $rule) static 验证是否不在范围内 + * @method bool between(mixed $value, mixed $rule) static between验证数据 + * @method bool notBetween(mixed $value, mixed $rule) static 使用notbetween验证数据 + * @method bool length(mixed $value, mixed $rule) static 验证数据长度 + * @method bool max(mixed $value, mixed $rule) static 验证数据最大长度 + * @method bool min(mixed $value, mixed $rule) static 验证数据最小长度 + * @method bool after(mixed $value, mixed $rule) static 验证日期 + * @method bool before(mixed $value, mixed $rule) static 验证日期 + * @method bool expire(mixed $value, mixed $rule) static 验证有效期 + * @method bool allowIp(mixed $value, mixed $rule) static 验证IP许可 + * @method bool denyIp(mixed $value, mixed $rule) static 验证IP禁用 + * @method bool regex(mixed $value, mixed $rule) static 使用正则验证数据 + * @method bool token(mixed $value, mixed $rule) static 验证表单令牌 + * @method bool dateFormat(mixed $value, mixed $rule) static 验证时间和日期是否符合指定格式 + * @method bool unique(mixed $value, mixed $rule, array $data = [], string $field = '') static 验证是否唯一 + * @method bool check(array $data, mixed $rules = [], string $scene = '') static 数据自动验证 + * @method mixed getError(mixed $value, mixed $rule) static 获取错误信息 + */ +class Validate extends Facade +{ +} diff --git a/tp5/thinkphp/library/think/facade/View.php b/tp5/thinkphp/library/think/facade/View.php new file mode 100644 index 0000000..0309a76 --- /dev/null +++ b/tp5/thinkphp/library/think/facade/View.php @@ -0,0 +1,31 @@ + +// +---------------------------------------------------------------------- + +namespace think\facade; + +use think\Facade; + +/** + * @see \think\View + * @mixin \think\View + * @method \think\View init(mixed $engine = [], array $replace = []) static 初始化 + * @method \think\View share(mixed $name, mixed $value = '') static 模板变量静态赋值 + * @method \think\View assign(mixed $name, mixed $value = '') static 模板变量赋值 + * @method \think\View config(mixed $name, mixed $value = '') static 配置模板引擎 + * @method \think\View exists(mixed $name) static 检查模板是否存在 + * @method \think\View filter(Callable $filter) static 视图内容过滤 + * @method \think\View engine(mixed $engine = []) static 设置当前模板解析的引擎 + * @method string fetch(string $template = '', array $vars = [], array $replace = [], array $config = [], bool $renderContent = false) static 解析和获取模板内容 + * @method string display(string $content = '', array $vars = [], array $replace = [], array $config = []) static 渲染内容输出 + */ +class View extends Facade +{ +} diff --git a/tp5/thinkphp/library/think/http/middleware/Dispatcher.php b/tp5/thinkphp/library/think/http/middleware/Dispatcher.php new file mode 100644 index 0000000..4218915 --- /dev/null +++ b/tp5/thinkphp/library/think/http/middleware/Dispatcher.php @@ -0,0 +1,86 @@ + +// +---------------------------------------------------------------------- + +namespace think\http\middleware; + +use think\Request; +use think\Response; + +class Dispatcher implements DispatcherInterface +{ + protected $queue; + + public function __construct($middlewares = []) + { + $this->queue = (array) $middlewares; + } + + /** + * {@inheritdoc} + */ + public function add($middleware) + { + $this->assertValid($middleware); + $this->queue[] = $middleware; + } + + /** + * {@inheritdoc} + */ + public function insert($middleware) + { + $this->assertValid($middleware); + array_unshift($this->queue, $middleware); + } + + /** + * {@inheritdoc} + */ + public function all() + { + return $this->queue; + } + + /** + * {@inheritdoc} + */ + public function dispatch(Request $request) + { + $requestHandler = $this->resolve(); + return call_user_func($requestHandler, $request); + } + + protected function resolve() + { + return function (Request $request) { + $middleware = array_shift($this->queue); + + if (null !== $middleware) { + $response = call_user_func($middleware, $request, $this->resolve()); + + if (!$response instanceof Response) { + throw new \LogicException('The middleware must return Response instance'); + } + + return $response; + } else { + throw new MissingResponseException('The queue was exhausted, with no response returned'); + } + }; + } + + protected function assertValid($middleware) + { + if (!is_callable($middleware)) { + throw new \InvalidArgumentException('The middleware is invalid'); + } + } +} diff --git a/tp5/thinkphp/library/think/http/middleware/DispatcherInterface.php b/tp5/thinkphp/library/think/http/middleware/DispatcherInterface.php new file mode 100644 index 0000000..1693f60 --- /dev/null +++ b/tp5/thinkphp/library/think/http/middleware/DispatcherInterface.php @@ -0,0 +1,45 @@ + +// +---------------------------------------------------------------------- + +namespace think\http\middleware; + +use think\Request; +use think\Response; + +interface DispatcherInterface +{ + /** + * 在队尾添加 middleware + * @param callable $middleware + * @return DispatcherInterface + */ + public function add($middleware); + + /** + * 在队前插入 middleware + * @param callable $middleware + * @return DispatcherInterface + */ + public function insert($middleware); + + /** + * 获取所有的middleware + * @return array + */ + public function all(); + + /** + * 处理 request 并返回 response + * @param Request $request + * @return Response + */ + public function dispatch(Request $request); +} diff --git a/tp5/thinkphp/library/think/http/middleware/MissingResponseException.php b/tp5/thinkphp/library/think/http/middleware/MissingResponseException.php new file mode 100644 index 0000000..7cdcb33 --- /dev/null +++ b/tp5/thinkphp/library/think/http/middleware/MissingResponseException.php @@ -0,0 +1,15 @@ + +// +---------------------------------------------------------------------- + +namespace think\http\middleware; + +class MissingResponseException extends \InvalidArgumentException +{} diff --git a/tp5/thinkphp/library/think/http/tests/middleware/DispatcherTest.php b/tp5/thinkphp/library/think/http/tests/middleware/DispatcherTest.php new file mode 100644 index 0000000..298cbcc --- /dev/null +++ b/tp5/thinkphp/library/think/http/tests/middleware/DispatcherTest.php @@ -0,0 +1,69 @@ +add(function () { + }); + $this->assertCount(1, $dispatcher->all()); + $this->expectException(\InvalidArgumentException::class); + $dispatcher->add('foo middleware'); + } + + public function testAddAndInsert() + { + $middleware1 = function () {}; + $middleware2 = function () {}; + $dispatcher = new Dispatcher(); + $dispatcher->add($middleware1); + $dispatcher->insert($middleware2); + $this->assertSame([$middleware2, $middleware1], $dispatcher->all()); + } + + public function testDispatch() + { + $middleware1 = function ($request, $next) { + return $next($request); + }; + $middleware2 = function ($request) { + return Response::create('hello world'); + }; + $dispatcher = new Dispatcher([$middleware1, $middleware2]); + $response = $dispatcher->dispatch(new Request()); + $this->assertInstanceOf(Response::class, $response); + $this->assertEquals('hello world', $response->getContent()); + } + + public function testDispatchWithoutResponse() + { + $middleware1 = function ($request, $next) { + return $next($request); + }; + $middleware2 = function ($request, $next) { + return $next($request); + }; + $dispatcher = new Dispatcher([$middleware1, $middleware2]); + $this->expectException(MissingResponseException::class); + $dispatcher->dispatch(new Request()); + } + + public function testDispatchWithBadResponse() + { + $middleware = function ($request, $next) { + return 'invalid response'; + }; + $dispatcher = new Dispatcher($middleware); + $this->expectException(\LogicException::class); + $dispatcher->dispatch(new Request()); + } +} diff --git a/tp5/thinkphp/library/think/log/driver/File.php b/tp5/thinkphp/library/think/log/driver/File.php new file mode 100644 index 0000000..3ec4cd1 --- /dev/null +++ b/tp5/thinkphp/library/think/log/driver/File.php @@ -0,0 +1,143 @@ + +// +---------------------------------------------------------------------- + +namespace think\log\driver; + +use think\Container; + +/** + * 本地化调试输出到文件 + */ +class File +{ + protected $config = [ + 'time_format' => ' c ', + 'single' => false, + 'file_size' => 2097152, + 'path' => '', + 'apart_level' => [], + ]; + + protected $writed = []; + + // 实例化并传入参数 + public function __construct($config = []) + { + if (is_array($config)) { + $this->config = array_merge($this->config, $config); + } + + if (empty($this->config['path'])) { + $this->config['path'] = Container::get('app')->getRuntimePath() . 'log/'; + } + } + + /** + * 日志写入接口 + * @access public + * @param array $log 日志信息 + * @return bool + */ + public function save(array $log = []) + { + if ($this->config['single']) { + $name = is_string($single) ? $single : 'single'; + $destination = $this->config['path'] . $name . '.log'; + } else { + $cli = PHP_SAPI == 'cli' ? '_cli' : ''; + $destination = $this->config['path'] . date('Ym') . '/' . date('d') . $cli . '.log'; + } + + $path = dirname($destination); + !is_dir($path) && mkdir($path, 0755, true); + + $info = ''; + foreach ($log as $type => $val) { + $level = ''; + foreach ($val as $msg) { + if (!is_string($msg)) { + $msg = var_export($msg, true); + } + $level .= '[ ' . $type . ' ] ' . $msg . "\r\n"; + } + + if (in_array($type, $this->config['apart_level'])) { + // 独立记录的日志级别 + if ($this->config['single']) { + $filename = $path . '/' . $name . '_' . $type . '.log'; + } else { + $filename = $path . '/' . date('d') . '_' . $type . $cli . '.log'; + } + + $this->write($level, $filename, true); + } else { + $info .= $level; + } + } + + if ($info) { + return $this->write($info, $destination); + } + + return true; + } + + /** + * 日志写入 + * @access protected + * @param array $message 日志信息 + * @param string $destination 日志文件 + * @param bool $apart 是否独立文件写入 + * @return bool + */ + protected function write($message, $destination, $apart = false) + { + // 检测日志文件大小,超过配置大小则备份日志文件重新生成 + if (is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) { + try { + rename($destination, dirname($destination) . '/' . time() . '-' . basename($destination)); + } catch (\Exception $e) { + } + + $this->writed[$destination] = false; + } + + if (empty($this->writed[$destination]) && PHP_SAPI != 'cli') { + if (Container::get('app')->isDebug() && !$apart) { + // 获取基本信息 + $current_uri = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + $runtime = round(microtime(true) - Container::get('app')->getBeginTime(), 10); + $reqs = $runtime > 0 ? number_format(1 / $runtime, 2) : '∞'; + $time_str = ' [运行时间:' . number_format($runtime, 6) . 's][吞吐率:' . $reqs . 'req/s]'; + $memory_use = number_format((memory_get_usage() - Container::get('app')->getBeginMem()) / 1024, 2); + $memory_str = ' [内存消耗:' . $memory_use . 'kb]'; + $file_load = ' [文件加载:' . count(get_included_files()) . ']'; + $message = '[ info ] ' . $current_uri . $time_str . $memory_str . $file_load . "\r\n" . $message; + } + + $now = date($this->config['time_format']); + $ip = Container::get('request')->ip(); + $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'CLI'; + $uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; + $message = "---------------------------------------------------------------\r\n[{$now}] {$ip} {$method} {$uri}\r\n" . $message; + + $this->writed[$destination] = true; + } + + if (PHP_SAPI == 'cli') { + $now = date($this->config['time_format']); + $message = "[{$now}]" . $message; + } + + return error_log($message, 3, $destination); + } + +} diff --git a/tp5/thinkphp/library/think/log/driver/Socket.php b/tp5/thinkphp/library/think/log/driver/Socket.php new file mode 100644 index 0000000..d3e717f --- /dev/null +++ b/tp5/thinkphp/library/think/log/driver/Socket.php @@ -0,0 +1,274 @@ + +// +---------------------------------------------------------------------- + +namespace think\log\driver; + +use think\Container; + +/** + * github: https://github.com/luofei614/SocketLog + * @author luofei614 + */ +class Socket +{ + public $port = 1116; //SocketLog 服务的http的端口号 + + protected $config = [ + // socket服务器地址 + 'host' => 'localhost', + // 是否显示加载的文件列表 + 'show_included_files' => false, + // 日志强制记录到配置的client_id + 'force_client_ids' => [], + // 限制允许读取日志的client_id + 'allow_client_ids' => [], + ]; + + protected $css = [ + 'sql' => 'color:#009bb4;', + 'sql_warn' => 'color:#009bb4;font-size:14px;', + 'error' => 'color:#f4006b;font-size:14px;', + 'page' => 'color:#40e2ff;background:#171717;', + 'big' => 'font-size:20px;color:red;', + ]; + + protected $allowForceClientIds = []; //配置强制推送且被授权的client_id + + /** + * 架构函数 + * @access public + * @param array $config 缓存参数 + */ + public function __construct(array $config = []) + { + if (!empty($config)) { + $this->config = array_merge($this->config, $config); + } + } + + /** + * 调试输出接口 + * @access public + * @param array $log 日志信息 + * @return bool + */ + public function save(array $log = []) + { + if (!$this->check()) { + return false; + } + + $trace = []; + + if (Container::get('app')->isDebug()) { + $runtime = round(microtime(true) - Container::get('app')->getBeginTime(), 10); + $reqs = $runtime > 0 ? number_format(1 / $runtime, 2) : '∞'; + $time_str = ' [运行时间:' . number_format($runtime, 6) . 's][吞吐率:' . $reqs . 'req/s]'; + $memory_use = number_format((memory_get_usage() - Container::get('app')->getBeginMem()) / 1024, 2); + $memory_str = ' [内存消耗:' . $memory_use . 'kb]'; + $file_load = ' [文件加载:' . count(get_included_files()) . ']'; + + if (isset($_SERVER['HTTP_HOST'])) { + $current_uri = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + } else { + $current_uri = 'cmd:' . implode(' ', $_SERVER['argv']); + } + + // 基本信息 + $trace[] = [ + 'type' => 'group', + 'msg' => $current_uri . $time_str . $memory_str . $file_load, + 'css' => $this->css['page'], + ]; + } + + foreach ($log as $type => $val) { + $trace[] = [ + 'type' => 'groupCollapsed', + 'msg' => '[ ' . $type . ' ]', + 'css' => isset($this->css[$type]) ? $this->css[$type] : '', + ]; + + foreach ($val as $msg) { + if (!is_string($msg)) { + $msg = var_export($msg, true); + } + $trace[] = [ + 'type' => 'log', + 'msg' => $msg, + 'css' => '', + ]; + } + + $trace[] = [ + 'type' => 'groupEnd', + 'msg' => '', + 'css' => '', + ]; + } + + if ($this->config['show_included_files']) { + $trace[] = [ + 'type' => 'groupCollapsed', + 'msg' => '[ file ]', + 'css' => '', + ]; + + $trace[] = [ + 'type' => 'log', + 'msg' => implode("\n", get_included_files()), + 'css' => '', + ]; + + $trace[] = [ + 'type' => 'groupEnd', + 'msg' => '', + 'css' => '', + ]; + } + + $trace[] = [ + 'type' => 'groupEnd', + 'msg' => '', + 'css' => '', + ]; + + $tabid = $this->getClientArg('tabid'); + + if (!$client_id = $this->getClientArg('client_id')) { + $client_id = ''; + } + + if (!empty($this->allowForceClientIds)) { + //强制推送到多个client_id + foreach ($this->allowForceClientIds as $force_client_id) { + $client_id = $force_client_id; + $this->sendToClient($tabid, $client_id, $trace, $force_client_id); + } + } else { + $this->sendToClient($tabid, $client_id, $trace, ''); + } + + return true; + } + + /** + * 发送给指定客户端 + * @access protected + * @author Zjmainstay + * @param $tabid + * @param $client_id + * @param $logs + * @param $force_client_id + */ + protected function sendToClient($tabid, $client_id, $logs, $force_client_id) + { + $logs = [ + 'tabid' => $tabid, + 'client_id' => $client_id, + 'logs' => $logs, + 'force_client_id' => $force_client_id, + ]; + + $msg = @json_encode($logs); + $address = '/' . $client_id; //将client_id作为地址, server端通过地址判断将日志发布给谁 + + $this->send($this->config['host'], $msg, $address); + } + + protected function check() + { + $tabid = $this->getClientArg('tabid'); + + //是否记录日志的检查 + if (!$tabid && !$this->config['force_client_ids']) { + return false; + } + + //用户认证 + $allow_client_ids = $this->config['allow_client_ids']; + + if (!empty($allow_client_ids)) { + //通过数组交集得出授权强制推送的client_id + $this->allowForceClientIds = array_intersect($allow_client_ids, $this->config['force_client_ids']); + if (!$tabid && count($this->allowForceClientIds)) { + return true; + } + + $client_id = $this->getClientArg('client_id'); + if (!in_array($client_id, $allow_client_ids)) { + return false; + } + } else { + $this->allowForceClientIds = $this->config['force_client_ids']; + } + + return true; + } + + protected function getClientArg($name) + { + static $args = []; + + $key = 'HTTP_USER_AGENT'; + + if (isset($_SERVER['HTTP_SOCKETLOG'])) { + $key = 'HTTP_SOCKETLOG'; + } + + if (!isset($_SERVER[$key])) { + return; + } + + if (empty($args)) { + if (!preg_match('/SocketLog\((.*?)\)/', $_SERVER[$key], $match)) { + $args = ['tabid' => null]; + return; + } + parse_str($match[1], $args); + } + + if (isset($args[$name])) { + return $args[$name]; + } + + return; + } + + /** + * @access protected + * @param string $host - $host of socket server + * @param string $message - 发送的消息 + * @param string $address - 地址 + * @return bool + */ + protected function send($host, $message = '', $address = '/') + { + $url = 'http://' . $host . ':' . $this->port . $address; + $ch = curl_init(); + + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $message); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1); + curl_setopt($ch, CURLOPT_TIMEOUT, 10); + + $headers = [ + "Content-Type: application/json;charset=UTF-8", + ]; + + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); //设置header + + return curl_exec($ch); + } + +} diff --git a/tp5/thinkphp/library/think/log/driver/Test.php b/tp5/thinkphp/library/think/log/driver/Test.php new file mode 100644 index 0000000..e67f747 --- /dev/null +++ b/tp5/thinkphp/library/think/log/driver/Test.php @@ -0,0 +1,30 @@ + +// +---------------------------------------------------------------------- + +namespace think\log\driver; + +/** + * 模拟测试输出 + */ +class Test +{ + /** + * 日志写入接口 + * @access public + * @param array $log 日志信息 + * @return bool + */ + public function save(array $log = []) + { + return true; + } + +} diff --git a/tp5/thinkphp/library/think/model/Collection.php b/tp5/thinkphp/library/think/model/Collection.php new file mode 100644 index 0000000..3a9b60f --- /dev/null +++ b/tp5/thinkphp/library/think/model/Collection.php @@ -0,0 +1,96 @@ + +// +---------------------------------------------------------------------- + +namespace think\model; + +use think\Collection as BaseCollection; +use think\Model; + +class Collection extends BaseCollection +{ + /** + * 返回数组中指定的一列 + * @access public + * @param string $column_key + * @param string|null $index_key + * @return array + */ + public function column($column_key, $index_key = null) + { + return array_column($this->toArray(), $column_key, $index_key); + } + + /** + * 延迟预载入关联查询 + * @access public + * @param mixed $relation 关联 + * @return $this + */ + public function load($relation) + { + $item = current($this->items); + $item->eagerlyResultSet($this->items, $relation); + + return $this; + } + + /** + * 设置需要隐藏的输出属性 + * @access public + * @param array $hidden 属性列表 + * @param bool $override 是否覆盖 + * @return $this + */ + public function hidden($hidden = [], $override = false) + { + $this->each(function ($model) use ($hidden, $override) { + /** @var Model $model */ + $model->hidden($hidden, $override); + }); + + return $this; + } + + /** + * 设置需要输出的属性 + * @access public + * @param array $visible + * @param bool $override 是否覆盖 + * @return $this + */ + public function visible($visible = [], $override = false) + { + $this->each(function ($model) use ($visible, $override) { + /** @var Model $model */ + $model->visible($visible, $override); + }); + + return $this; + } + + /** + * 设置需要追加的输出属性 + * @access public + * @param array $append 属性列表 + * @param bool $override 是否覆盖 + * @return $this + */ + public function append($append = [], $override = false) + { + $this->each(function ($model) use ($append, $override) { + /** @var Model $model */ + $model && $model->append($append, $override); + }); + + return $this; + } + +} diff --git a/tp5/thinkphp/library/think/model/Pivot.php b/tp5/thinkphp/library/think/model/Pivot.php new file mode 100644 index 0000000..a3a395e --- /dev/null +++ b/tp5/thinkphp/library/think/model/Pivot.php @@ -0,0 +1,42 @@ + +// +---------------------------------------------------------------------- + +namespace think\model; + +use think\Model; + +class Pivot extends Model +{ + + /** @var Model */ + public $parent; + + protected $autoWriteTimestamp = false; + + /** + * 架构函数 + * @access public + * @param array|object $data 数据 + * @param Model $parent 上级模型 + * @param string $table 中间数据表名 + */ + public function __construct($data = [], Model $parent = null, $table = '') + { + $this->parent = $parent; + + if (is_null($this->name)) { + $this->name = $table; + } + + parent::__construct($data); + } + +} diff --git a/tp5/thinkphp/library/think/model/Relation.php b/tp5/thinkphp/library/think/model/Relation.php new file mode 100644 index 0000000..315fb28 --- /dev/null +++ b/tp5/thinkphp/library/think/model/Relation.php @@ -0,0 +1,151 @@ + +// +---------------------------------------------------------------------- + +namespace think\model; + +use think\db\Query; +use think\Exception; +use think\Model; + +/** + * Class Relation + * @package think\model + * + * @mixin Query + */ +abstract class Relation +{ + // 父模型对象 + protected $parent; + /** @var Model 当前关联的模型类 */ + protected $model; + /** @var Query 关联模型查询对象 */ + protected $query; + // 关联表外键 + protected $foreignKey; + // 关联表主键 + protected $localKey; + // 基础查询 + protected $baseQuery; + // 是否为自关联 + protected $selfRelation; + + /** + * 获取关联的所属模型 + * @access public + * @return Model + */ + public function getParent() + { + return $this->parent; + } + + /** + * 获取当前的关联模型类的实例 + * @access public + * @return Model + */ + public function getModel() + { + return $this->query->getModel(); + } + + /** + * 设置当前关联为自关联 + * @access public + * @param bool $self 是否自关联 + * @return $this + */ + public function selfRelation($self = true) + { + $this->selfRelation = $self; + return $this; + } + + /** + * 当前关联是否为自关联 + * @access public + * @return bool + */ + public function isSelfRelation() + { + return $this->selfRelation; + } + + /** + * 封装关联数据集 + * @access public + * @param array $resultSet 数据集 + * @return mixed + */ + protected function resultSetBuild($resultSet) + { + return (new $this->model)->toCollection($resultSet); + } + + protected function getQueryFields($model) + { + $fields = $this->query->getOptions('field'); + return $this->getRelationQueryFields($fields, $model); + } + + protected function getRelationQueryFields($fields, $model) + { + if ($fields) { + + if (is_string($fields)) { + $fields = explode(',', $fields); + } + + foreach ($fields as &$field) { + if (false === strpos($field, '.')) { + $field = $model . '.' . $field; + } + } + } else { + $fields = $model . '.*'; + } + + return $fields; + } + + protected function getQueryWhere(&$where, $relation) + { + foreach ($where as $key => $val) { + if (is_string($key)) { + $where[] = [false === strpos($key, '.') ? $relation . '.' . $key : $key, '=', $val]; + unset($where[$key]); + } + } + } + + /** + * 执行基础查询(仅执行一次) + * @access protected + * @return void + */ + protected function baseQuery() + {} + + public function __call($method, $args) + { + if ($this->query) { + // 执行基础查询 + $this->baseQuery(); + + $result = call_user_func_array([$this->query->getModel(), $method], $args); + + return $result === $this->query ? $this : $result; + } else { + throw new Exception('method not exists:' . __CLASS__ . '->' . $method); + } + } +} diff --git a/tp5/thinkphp/library/think/model/concern/Attribute.php b/tp5/thinkphp/library/think/model/concern/Attribute.php new file mode 100644 index 0000000..dc10448 --- /dev/null +++ b/tp5/thinkphp/library/think/model/concern/Attribute.php @@ -0,0 +1,556 @@ + +// +---------------------------------------------------------------------- + +namespace think\model\concern; + +use InvalidArgumentException; +use think\Exception; +use think\Loader; +use think\model\Relation; + +trait Attribute +{ + /** + * 数据表主键 复合主键使用数组定义 + * @var string|array + */ + protected $pk = 'id'; + + /** + * 数据表字段信息 留空则自动获取 + * @var array + */ + protected $field = []; + + /** + * JSON数据表字段 + * @var array + */ + protected $json = []; + + /** + * 数据表废弃字段 + * @var array + */ + protected $disuse = []; + + /** + * 数据表只读字段 + * @var array + */ + protected $readonly = []; + + /** + * 数据表字段类型 + * @var array + */ + protected $type = []; + + /** + * 当前模型数据 + * @var array + */ + private $data = []; + + /** + * 原始数据 + * @var array + */ + private $origin = []; + + /** + * 获取模型对象的主键 + * @access public + * @return string|array + */ + public function getPk() + { + return $this->pk; + } + + /** + * 判断一个字段名是否为主键字段 + * @access public + * @param string $key 名称 + * @return bool + */ + protected function isPk($key) + { + $pk = $this->getPk(); + if (is_string($pk) && $pk == $key) { + return true; + } elseif (is_array($pk) && in_array($key, $pk)) { + return true; + } + + return false; + } + + /** + * 设置允许写入的字段 + * @access public + * @param array|string|true $field 允许写入的字段 如果为true只允许写入数据表字段 + * @return $this + */ + public function allowField($field) + { + if (is_string($field)) { + $field = explode(',', $field); + } + + $this->field = $field; + + return $this; + } + + /** + * 设置只读字段 + * @access public + * @param array|string $field 只读字段 + * @return $this + */ + public function readonly($field) + { + if (is_string($field)) { + $field = explode(',', $field); + } + + $this->readonly = $field; + + return $this; + } + + /** + * 设置数据对象值 + * @access public + * @param mixed $data 数据或者属性名 + * @param mixed $value 值 + * @return $this + */ + public function data($data, $value = null) + { + if (is_string($data)) { + $this->data[$data] = $value; + } else { + // 清空数据 + $this->data = []; + + if (is_object($data)) { + $data = get_object_vars($data); + } + + if ($this->disuse) { + // 废弃字段 + foreach ((array) $this->disuse as $key) { + if (array_key_exists($key, $data)) { + unset($data[$key]); + } + } + } + + if (true === $value) { + // 数据对象赋值 + foreach ($data as $key => $value) { + $this->setAttr($key, $value, $data); + } + } elseif (is_array($value)) { + foreach ($value as $name) { + if (isset($data[$name])) { + $this->data[$name] = $data[$name]; + } + } + } else { + $this->data = $data; + } + } + + return $this; + } + + /** + * 批量设置数据对象值 + * @access public + * @param mixed $data 数据 + * @param bool $set 是否需要进行数据处理 + * @return $this + */ + public function appendData($data, $set = false) + { + if ($set) { + // 进行数据处理 + foreach ($data as $key => $value) { + $this->setAttr($key, $value, $data); + } + } else { + if (is_object($data)) { + $data = get_object_vars($data); + } + + $this->data = array_merge($this->data, $data); + } + + return $this; + } + + /** + * 获取对象原始数据 如果不存在指定字段返回null + * @access public + * @param string $name 字段名 留空获取全部 + * @return mixed + */ + public function getOrigin($name = null) + { + if (is_null($name)) { + return $this->origin; + } else { + return array_key_exists($name, $this->origin) ? $this->origin[$name] : null; + } + } + + /** + * 获取对象原始数据 如果不存在指定字段返回false + * @access public + * @param string $name 字段名 留空获取全部 + * @return mixed + * @throws InvalidArgumentException + */ + public function getData($name = null) + { + if (is_null($name)) { + return $this->data; + } elseif (array_key_exists($name, $this->data)) { + return $this->data[$name]; + } elseif (array_key_exists($name, $this->relation)) { + return $this->relation[$name]; + } else { + throw new InvalidArgumentException('property not exists:' . static::class . '->' . $name); + } + } + + /** + * 获取变化的数据 并排除只读数据 + * @access public + * @return array + */ + public function getChangedData() + { + if ($this->force) { + $data = $this->data; + } else { + $data = array_udiff_assoc($this->data, $this->origin, function ($a, $b) { + if ((empty($a) || empty($b)) && $a !== $b) { + return 1; + } + + return is_object($a) || $a != $b ? 1 : 0; + }); + } + + if (!empty($this->readonly)) { + // 只读字段不允许更新 + foreach ($this->readonly as $key => $field) { + if (isset($data[$field])) { + unset($data[$field]); + } + } + } + + return $data; + } + + /** + * 修改器 设置数据对象值 + * @access public + * @param string $name 属性名 + * @param mixed $value 属性值 + * @param array $data 数据 + * @return $this + */ + public function setAttr($name, $value, $data = []) + { + if (is_null($value) && $this->autoWriteTimestamp && in_array($name, [$this->createTime, $this->updateTime])) { + // 自动写入的时间戳字段 + $value = $this->autoWriteTimestamp($name); + } else { + // 检测修改器 + $method = 'set' . Loader::parseName($name, 1) . 'Attr'; + + if (method_exists($this, $method)) { + $value = $this->$method($value, array_merge($this->data, $data)); + } elseif (isset($this->type[$name])) { + // 类型转换 + $value = $this->writeTransform($value, $this->type[$name]); + } + } + + // 设置数据对象属性 + $this->data[$name] = $value; + + return $this; + } + + /** + * 是否需要自动写入时间字段 + * @access public + * @param bool $auto + * @return $this + */ + public function isAutoWriteTimestamp($auto) + { + $this->autoWriteTimestamp = $auto; + + return $this; + } + + /** + * 自动写入时间戳 + * @access protected + * @param string $name 时间戳字段 + * @return mixed + */ + protected function autoWriteTimestamp($name) + { + if (isset($this->type[$name])) { + $type = $this->type[$name]; + + if (strpos($type, ':')) { + list($type, $param) = explode(':', $type, 2); + } + + switch ($type) { + case 'datetime': + case 'date': + $format = !empty($param) ? $param : $this->dateFormat; + $value = $this->formatDateTime(time(), $format); + break; + case 'timestamp': + case 'integer': + default: + $value = time(); + break; + } + } elseif (is_string($this->autoWriteTimestamp) && in_array(strtolower($this->autoWriteTimestamp), [ + 'datetime', + 'date', + 'timestamp', + ])) { + $value = $this->formatDateTime(time(), $this->dateFormat); + } else { + $value = $this->formatDateTime(time(), $this->dateFormat, true); + } + + return $value; + } + + /** + * 数据写入 类型转换 + * @access protected + * @param mixed $value 值 + * @param string|array $type 要转换的类型 + * @return mixed + */ + protected function writeTransform($value, $type) + { + if (is_null($value)) { + return; + } + + if (is_array($type)) { + list($type, $param) = $type; + } elseif (strpos($type, ':')) { + list($type, $param) = explode(':', $type, 2); + } + + switch ($type) { + case 'integer': + $value = (int) $value; + break; + case 'float': + if (empty($param)) { + $value = (float) $value; + } else { + $value = (float) number_format($value, $param, '.', ''); + } + break; + case 'boolean': + $value = (bool) $value; + break; + case 'timestamp': + if (!is_numeric($value)) { + $value = strtotime($value); + } + break; + case 'datetime': + $format = !empty($param) ? $param : $this->dateFormat; + $value = is_numeric($value) ? $value : strtotime($value); + $value = $this->formatDateTime($value, $format); + break; + case 'object': + if (is_object($value)) { + $value = json_encode($value, JSON_FORCE_OBJECT); + } + break; + case 'array': + $value = (array) $value; + case 'json': + $option = !empty($param) ? (int) $param : JSON_UNESCAPED_UNICODE; + $value = json_encode($value, $option); + break; + case 'serialize': + $value = serialize($value); + break; + } + + return $value; + } + + /** + * 获取器 获取数据对象的值 + * @access public + * @param string $name 名称 + * @param array $item 数据 + * @return mixed + * @throws InvalidArgumentException + */ + public function getAttr($name, &$item = null) + { + try { + $notFound = false; + $value = $this->getData($name); + } catch (InvalidArgumentException $e) { + $notFound = true; + $value = null; + } + + // 检测属性获取器 + $method = 'get' . Loader::parseName($name, 1) . 'Attr'; + + if (method_exists($this, $method)) { + if ($notFound && $relation = $this->isRelationAttr($name)) { + $modelRelation = $this->$relation(); + $value = $this->getRelationData($modelRelation); + } + + $value = $this->$method($value, $this->data); + } elseif (isset($this->type[$name])) { + // 类型转换 + $value = $this->readTransform($value, $this->type[$name]); + } elseif (in_array($name, [$this->createTime, $this->updateTime])) { + if (is_string($this->autoWriteTimestamp) && in_array(strtolower($this->autoWriteTimestamp), [ + 'datetime', + 'date', + 'timestamp', + ])) { + $value = $this->formatDateTime(strtotime($value), $this->dateFormat); + } else { + $value = $this->formatDateTime($value, $this->dateFormat); + } + } elseif ($notFound) { + $relation = $this->isRelationAttr($name); + + if ($relation) { + $modelRelation = $this->$relation(); + if ($modelRelation instanceof Relation) { + $value = $this->getRelationData($modelRelation); + + if ($item && method_exists($modelRelation, 'getBindAttr') && $bindAttr = $modelRelation->getBindAttr()) { + + foreach ($bindAttr as $key => $attr) { + $key = is_numeric($key) ? $attr : $key; + + if (isset($item[$key])) { + throw new Exception('bind attr has exists:' . $key); + } else { + $item[$key] = $value ? $value->getAttr($attr) : null; + } + } + return false; + } + + // 保存关联对象值 + $this->relation[$name] = $value; + + return $value; + } + } + throw new InvalidArgumentException('property not exists:' . static::class . '->' . $name); + } + return $value; + } + + /** + * 数据读取 类型转换 + * @access protected + * @param mixed $value 值 + * @param string|array $type 要转换的类型 + * @return mixed + */ + protected function readTransform($value, $type) + { + if (is_null($value)) { + return; + } + + if (is_array($type)) { + list($type, $param) = $type; + } elseif (strpos($type, ':')) { + list($type, $param) = explode(':', $type, 2); + } + + switch ($type) { + case 'integer': + $value = (int) $value; + break; + case 'float': + if (empty($param)) { + $value = (float) $value; + } else { + $value = (float) number_format($value, $param, '.', ''); + } + break; + case 'boolean': + $value = (bool) $value; + break; + case 'timestamp': + if (!is_null($value)) { + $format = !empty($param) ? $param : $this->dateFormat; + $value = $this->formatDateTime($value, $format); + } + break; + case 'datetime': + if (!is_null($value)) { + $format = !empty($param) ? $param : $this->dateFormat; + $value = $this->formatDateTime(strtotime($value), $format); + } + break; + case 'json': + $value = json_decode($value, true); + break; + case 'array': + $value = empty($value) ? [] : json_decode($value, true); + break; + case 'object': + $value = empty($value) ? new \stdClass() : json_decode($value); + break; + case 'serialize': + $value = unserialize($value); + break; + default: + if (false !== strpos($type, '\\')) { + // 对象类型 + $value = new $type($value); + } + } + + return $value; + } + +} diff --git a/tp5/thinkphp/library/think/model/concern/Conversion.php b/tp5/thinkphp/library/think/model/concern/Conversion.php new file mode 100644 index 0000000..697e495 --- /dev/null +++ b/tp5/thinkphp/library/think/model/concern/Conversion.php @@ -0,0 +1,276 @@ + +// +---------------------------------------------------------------------- + +namespace think\model\concern; + +use think\Collection; +use think\Exception; +use think\Loader; +use think\Model; +use think\model\Collection as ModelCollection; + +/** + * 模型数据转换处理 + */ +trait Conversion +{ + /** + * 数据输出显示的属性 + * @var array + */ + protected $visible = []; + + /** + * 数据输出隐藏的属性 + * @var array + */ + protected $hidden = []; + + /** + * 数据输出需要追加的属性 + * @var array + */ + protected $append = []; + + /** + * 数据集对象名 + * @var string + */ + protected $resultSetType; + + /** + * 设置需要附加的输出属性 + * @access public + * @param array $append 属性列表 + * @param bool $override 是否覆盖 + * @return $this + */ + public function append($append = [], $override = false) + { + $this->append = $override ? $append : array_merge($this->append, $append); + + return $this; + } + + /** + * 设置附加关联对象的属性 + * @access public + * @param string $attr 关联属性 + * @param string|array $append 追加属性名 + * @return $this + * @throws Exception + */ + public function appendRelationAttr($attr, $append) + { + if (is_string($append)) { + $append = explode(',', $append); + } + + $relation = Loader::parseName($attr, 1, false); + if (isset($this->relation[$relation])) { + $model = $this->relation[$relation]; + } else { + $model = $this->getRelationData($this->$relation()); + } + + if ($model instanceof Model) { + foreach ($append as $key => $attr) { + $key = is_numeric($key) ? $attr : $key; + if (isset($this->data[$key])) { + throw new Exception('bind attr has exists:' . $key); + } else { + $this->data[$key] = $model->$attr; + } + } + } + + return $this; + } + + /** + * 设置需要隐藏的输出属性 + * @access public + * @param array $hidden 属性列表 + * @param bool $override 是否覆盖 + * @return $this + */ + public function hidden($hidden = [], $override = false) + { + $this->hidden = $override ? $hidden : array_merge($this->hidden, $hidden); + + return $this; + } + + /** + * 设置需要输出的属性 + * @access public + * @param array $visible + * @param bool $override 是否覆盖 + * @return $this + */ + public function visible($visible = [], $override = false) + { + $this->visible = $override ? $visible : array_merge($this->visible, $visible); + + return $this; + } + + /** + * 转换当前模型对象为数组 + * @access public + * @return array + */ + public function toArray() + { + $item = []; + $visible = []; + $hidden = []; + + // 合并关联数据 + $data = array_merge($this->data, $this->relation); + + // 过滤属性 + if (!empty($this->visible)) { + $array = $this->parseAttr($this->visible, $visible); + $data = array_intersect_key($data, array_flip($array)); + } elseif (!empty($this->hidden)) { + $array = $this->parseAttr($this->hidden, $hidden, false); + $data = array_diff_key($data, array_flip($array)); + } + + foreach ($data as $key => $val) { + if ($val instanceof Model || $val instanceof ModelCollection) { + // 关联模型对象 + if (isset($visible[$key])) { + $val->visible($visible[$key]); + } elseif (isset($hidden[$key])) { + $val->hidden($hidden[$key]); + } + // 关联模型对象 + $item[$key] = $val->toArray(); + } else { + // 模型属性 + $item[$key] = $this->getAttr($key); + } + } + + // 追加属性(必须定义获取器) + if (!empty($this->append)) { + foreach ($this->append as $key => $name) { + if (is_array($name)) { + // 追加关联对象属性 + $relation = $this->getAttr($key); + $item[$key] = $relation->append($name)->toArray(); + } elseif (strpos($name, '.')) { + list($key, $attr) = explode('.', $name); + // 追加关联对象属性 + $relation = $this->getAttr($key); + $item[$key] = $relation->append([$attr])->toArray(); + } else { + $value = $this->getAttr($name, $item); + if (false !== $value) { + $item[$name] = $value; + } + } + } + } + + return $item; + } + + /** + * 转换当前模型对象为JSON字符串 + * @access public + * @param integer $options json参数 + * @return string + */ + public function toJson($options = JSON_UNESCAPED_UNICODE) + { + return json_encode($this->toArray(), $options); + } + + /** + * 移除当前模型的关联属性 + * @access public + * @return $this + */ + public function removeRelation() + { + $this->relation = []; + return $this; + } + + public function __toString() + { + return $this->toJson(); + } + + // JsonSerializable + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * 转换数据集为数据集对象 + * @access public + * @param array|Collection $collection 数据集 + * @param string $resultSetType 数据集类 + * @return Collection + */ + public function toCollection($collection, $resultSetType = null) + { + $resultSetType = $resultSetType ?: $this->resultSetType; + + if ($resultSetType && false !== strpos($resultSetType, '\\')) { + $collection = new $resultSetType($collection); + } else { + $collection = new ModelCollection($collection); + } + + return $collection; + } + + /** + * 解析隐藏及显示属性 + * @access protected + * @param array $attrs 属性 + * @param array $result 结果集 + * @param bool $visible + * @return array + */ + protected function parseAttr($attrs, &$result, $visible = true) + { + $array = []; + + foreach ($attrs as $key => $val) { + if (is_array($val)) { + if ($visible) { + $array[] = $key; + } + + $result[$key] = $val; + } elseif (strpos($val, '.')) { + list($key, $name) = explode('.', $val); + + if ($visible) { + $array[] = $key; + } + + $result[$key][] = $name; + } else { + $array[] = $val; + } + } + + return $array; + } +} diff --git a/tp5/thinkphp/library/think/model/concern/ModelEvent.php b/tp5/thinkphp/library/think/model/concern/ModelEvent.php new file mode 100644 index 0000000..1f5bdaf --- /dev/null +++ b/tp5/thinkphp/library/think/model/concern/ModelEvent.php @@ -0,0 +1,157 @@ + +// +---------------------------------------------------------------------- + +namespace think\model\concern; + +use think\Container; + +/** + * 模型事件处理 + */ +trait ModelEvent +{ + /** + * 模型回调 + * @var array + */ + private static $event = []; + + /** + * 注册回调方法 + * @access public + * @param string $event 事件名 + * @param callable $callback 回调方法 + * @param bool $override 是否覆盖 + * @return void + */ + public static function event($event, $callback, $override = false) + { + $class = static::class; + + if ($override) { + self::$event[$class][$event] = []; + } + + self::$event[$class][$event][] = $callback; + } + + /** + * 触发事件 + * @access protected + * @param string $event 事件名 + * @return bool + */ + protected function trigger($event) + { + $class = static::class; + + if (isset(self::$event[$class][$event])) { + foreach (self::$event[$class][$event] as $callback) { + $result = Container::getInstance()->invoke($callback, [$this]); + + if (false === $result) { + return false; + } + } + } + + return true; + } + + /** + * 模型before_insert事件快捷方法 + * @access protected + * @param callable $callback + * @param bool $override + */ + protected static function beforeInsert($callback, $override = false) + { + self::event('before_insert', $callback, $override); + } + + /** + * 模型after_insert事件快捷方法 + * @access protected + * @param callable $callback + * @param bool $override + */ + protected static function afterInsert($callback, $override = false) + { + self::event('after_insert', $callback, $override); + } + + /** + * 模型before_update事件快捷方法 + * @access protected + * @param callable $callback + * @param bool $override + */ + protected static function beforeUpdate($callback, $override = false) + { + self::event('before_update', $callback, $override); + } + + /** + * 模型after_update事件快捷方法 + * @access protected + * @param callable $callback + * @param bool $override + */ + protected static function afterUpdate($callback, $override = false) + { + self::event('after_update', $callback, $override); + } + + /** + * 模型before_write事件快捷方法 + * @access protected + * @param callable $callback + * @param bool $override + */ + protected static function beforeWrite($callback, $override = false) + { + self::event('before_write', $callback, $override); + } + + /** + * 模型after_write事件快捷方法 + * @access protected + * @param callable $callback + * @param bool $override + */ + protected static function afterWrite($callback, $override = false) + { + self::event('after_write', $callback, $override); + } + + /** + * 模型before_delete事件快捷方法 + * @access protected + * @param callable $callback + * @param bool $override + */ + protected static function beforeDelete($callback, $override = false) + { + self::event('before_delete', $callback, $override); + } + + /** + * 模型after_delete事件快捷方法 + * @access protected + * @param callable $callback + * @param bool $override + */ + protected static function afterDelete($callback, $override = false) + { + self::event('after_delete', $callback, $override); + } + +} diff --git a/tp5/thinkphp/library/think/model/concern/RelationShip.php b/tp5/thinkphp/library/think/model/concern/RelationShip.php new file mode 100644 index 0000000..5161195 --- /dev/null +++ b/tp5/thinkphp/library/think/model/concern/RelationShip.php @@ -0,0 +1,643 @@ + +// +---------------------------------------------------------------------- + +namespace think\model\concern; + +use think\Collection; +use think\db\Query; +use think\Loader; +use think\Model; +use think\model\Relation; +use think\model\relation\BelongsTo; +use think\model\relation\BelongsToMany; +use think\model\relation\HasMany; +use think\model\relation\HasManyThrough; +use think\model\relation\HasOne; +use think\model\relation\MorphMany; +use think\model\relation\MorphOne; +use think\model\relation\MorphTo; + +/** + * 模型关联处理 + */ +trait RelationShip +{ + /** + * 父关联模型对象 + * @var object + */ + private $parent; + + /** + * 模型关联数据 + * @var array + */ + private $relation = []; + + /** + * 关联写入定义信息 + * @var array + */ + private $together; + + /** + * 关联自动写入信息 + * @var array + */ + protected $relationWrite; + + /** + * 设置父关联对象 + * @access public + * @param Model $model 模型对象 + * @return $this + */ + public function setParent($model) + { + $this->parent = $model; + + return $this; + } + + /** + * 获取父关联对象 + * @access public + * @return Model + */ + public function getParent() + { + return $this->parent; + } + + /** + * 获取当前模型的关联模型数据 + * @access public + * @param string $name 关联方法名 + * @return mixed + */ + public function getRelation($name = null) + { + if (is_null($name)) { + return $this->relation; + } elseif (array_key_exists($name, $this->relation)) { + return $this->relation[$name]; + } else { + return; + } + } + + /** + * 设置关联数据对象值 + * @access public + * @param string $name 属性名 + * @param mixed $value 属性值 + * @param array $data 数据 + * @return $this + */ + public function setRelation($name, $value, $data = []) + { + // 检测修改器 + $method = 'set' . Loader::parseName($name, 1) . 'Attr'; + + if (method_exists($this, $method)) { + $value = $this->$method($value, array_merge($this->data, $data)); + } + + $this->relation[$name] = $value; + + return $this; + } + + /** + * 关联数据写入 + * @access public + * @param array|string $relation 关联 + * @return $this + */ + public function together($relation) + { + if (is_string($relation)) { + $relation = explode(',', $relation); + } + + $this->together = $relation; + + $this->checkAutoRelationWrite(); + + return $this; + } + + /** + * 根据关联条件查询当前模型 + * @access public + * @param string $relation 关联方法名 + * @param mixed $operator 比较操作符 + * @param integer $count 个数 + * @param string $id 关联表的统计字段 + * @return Query + */ + public static function has($relation, $operator = '>=', $count = 1, $id = '*') + { + $relation = (new static())->$relation(); + + if (is_array($operator) || $operator instanceof \Closure) { + return $relation->hasWhere($operator); + } + + return $relation->has($operator, $count, $id); + } + + /** + * 根据关联条件查询当前模型 + * @access public + * @param string $relation 关联方法名 + * @param mixed $where 查询条件(数组或者闭包) + * @param mixed $fields 字段 + * @return Query + */ + public static function hasWhere($relation, $where = [], $fields = '*') + { + return (new static())->$relation()->hasWhere($where, $fields); + } + + /** + * 查询当前模型的关联数据 + * @access public + * @param string|array $relations 关联名 + * @return $this + */ + public function relationQuery($relations) + { + if (is_string($relations)) { + $relations = explode(',', $relations); + } + + foreach ($relations as $key => $relation) { + $subRelation = ''; + $closure = null; + + if ($relation instanceof \Closure) { + // 支持闭包查询过滤关联条件 + $closure = $relation; + $relation = $key; + } + + if (is_array($relation)) { + $subRelation = $relation; + $relation = $key; + } elseif (strpos($relation, '.')) { + list($relation, $subRelation) = explode('.', $relation, 2); + } + + $method = Loader::parseName($relation, 1, false); + + $this->relation[$relation] = $this->$method()->getRelation($subRelation, $closure); + } + + return $this; + } + + /** + * 预载入关联查询 返回数据集 + * @access public + * @param array $resultSet 数据集 + * @param string $relation 关联名 + * @return array + */ + public function eagerlyResultSet(&$resultSet, $relation) + { + $relations = is_string($relation) ? explode(',', $relation) : $relation; + + foreach ($relations as $key => $relation) { + $subRelation = ''; + $closure = false; + + if ($relation instanceof \Closure) { + $closure = $relation; + $relation = $key; + } + + if (is_array($relation)) { + $subRelation = $relation; + $relation = $key; + } elseif (strpos($relation, '.')) { + list($relation, $subRelation) = explode('.', $relation, 2); + } + + $relation = Loader::parseName($relation, 1, false); + + $this->$relation()->eagerlyResultSet($resultSet, $relation, $subRelation, $closure); + } + } + + /** + * 预载入关联查询 返回模型对象 + * @access public + * @param Model $result 数据对象 + * @param string $relation 关联名 + * @return Model + */ + public function eagerlyResult(&$result, $relation) + { + $relations = is_string($relation) ? explode(',', $relation) : $relation; + + foreach ($relations as $key => $relation) { + $subRelation = ''; + $closure = false; + + if ($relation instanceof \Closure) { + $closure = $relation; + $relation = $key; + } + + if (is_array($relation)) { + $subRelation = $relation; + $relation = $key; + } elseif (strpos($relation, '.')) { + list($relation, $subRelation) = explode('.', $relation, 2); + } + + $relation = Loader::parseName($relation, 1, false); + + $this->$relation()->eagerlyResult($result, $relation, $subRelation, $closure); + } + } + + /** + * 关联统计 + * @access public + * @param Model $result 数据对象 + * @param array $relations 关联名 + * @param string $aggregate 聚合查询方法 + * @param string $field 字段 + * @return void + */ + public function relationCount(&$result, $relations, $aggregate = 'sum', $field = '*') + { + foreach ($relations as $key => $relation) { + $closure = false; + + if ($relation instanceof \Closure) { + $closure = $relation; + $relation = $key; + } elseif (is_string($key)) { + $name = $relation; + $relation = $key; + } + + $relation = Loader::parseName($relation, 1, false); + $count = $this->$relation()->relationCount($result, $closure, $aggregate, $field); + + if (!isset($name)) { + $name = Loader::parseName($relation) . '_' . $aggregate; + } + + $result->setAttr($name, $count); + } + } + + /** + * HAS ONE 关联定义 + * @access public + * @param string $model 模型名 + * @param string $foreignKey 关联外键 + * @param string $localKey 当前主键 + * @return HasOne + */ + public function hasOne($model, $foreignKey = '', $localKey = '') + { + // 记录当前关联信息 + $model = $this->parseModel($model); + $localKey = $localKey ?: $this->getPk(); + $foreignKey = $foreignKey ?: $this->getForeignKey($this->name); + + return new HasOne($this, $model, $foreignKey, $localKey); + } + + /** + * BELONGS TO 关联定义 + * @access public + * @param string $model 模型名 + * @param string $foreignKey 关联外键 + * @param string $localKey 关联主键 + * @return BelongsTo + */ + public function belongsTo($model, $foreignKey = '', $localKey = '') + { + // 记录当前关联信息 + $model = $this->parseModel($model); + $foreignKey = $foreignKey ?: $this->getForeignKey((new $model)->getName()); + $localKey = $localKey ?: (new $model)->getPk(); + $trace = debug_backtrace(false, 2); + $relation = Loader::parseName($trace[1]['function']); + + return new BelongsTo($this, $model, $foreignKey, $localKey, $relation); + } + + /** + * HAS MANY 关联定义 + * @access public + * @param string $model 模型名 + * @param string $foreignKey 关联外键 + * @param string $localKey 当前主键 + * @return HasMany + */ + public function hasMany($model, $foreignKey = '', $localKey = '') + { + // 记录当前关联信息 + $model = $this->parseModel($model); + $localKey = $localKey ?: $this->getPk(); + $foreignKey = $foreignKey ?: $this->getForeignKey($this->name); + + return new HasMany($this, $model, $foreignKey, $localKey); + } + + /** + * HAS MANY 远程关联定义 + * @access public + * @param string $model 模型名 + * @param string $through 中间模型名 + * @param string $foreignKey 关联外键 + * @param string $throughKey 关联外键 + * @param string $localKey 当前主键 + * @return HasManyThrough + */ + public function hasManyThrough($model, $through, $foreignKey = '', $throughKey = '', $localKey = '') + { + // 记录当前关联信息 + $model = $this->parseModel($model); + $through = $this->parseModel($through); + $localKey = $localKey ?: $this->getPk(); + $foreignKey = $foreignKey ?: $this->getForeignKey($this->name); + $throughKey = $throughKey ?: $this->getForeignKey((new $through)->getName()); + + return new HasManyThrough($this, $model, $through, $foreignKey, $throughKey, $localKey); + } + + /** + * BELONGS TO MANY 关联定义 + * @access public + * @param string $model 模型名 + * @param string $table 中间表名 + * @param string $foreignKey 关联外键 + * @param string $localKey 当前模型关联键 + * @return BelongsToMany + */ + public function belongsToMany($model, $table = '', $foreignKey = '', $localKey = '') + { + // 记录当前关联信息 + $model = $this->parseModel($model); + $name = Loader::parseName(basename(str_replace('\\', '/', $model))); + $table = $table ?: Loader::parseName($this->name) . '_' . $name; + $foreignKey = $foreignKey ?: $name . '_id'; + $localKey = $localKey ?: $this->getForeignKey($this->name); + + return new BelongsToMany($this, $model, $table, $foreignKey, $localKey); + } + + /** + * MORPH One 关联定义 + * @access public + * @param string $model 模型名 + * @param string|array $morph 多态字段信息 + * @param string $type 多态类型 + * @return MorphOne + */ + public function morphOne($model, $morph = null, $type = '') + { + // 记录当前关联信息 + $model = $this->parseModel($model); + + if (is_null($morph)) { + $trace = debug_backtrace(false, 2); + $morph = Loader::parseName($trace[1]['function']); + } + + if (is_array($morph)) { + list($morphType, $foreignKey) = $morph; + } else { + $morphType = $morph . '_type'; + $foreignKey = $morph . '_id'; + } + + $type = $type ?: get_class($this); + + return new MorphOne($this, $model, $foreignKey, $morphType, $type); + } + + /** + * MORPH MANY 关联定义 + * @access public + * @param string $model 模型名 + * @param string|array $morph 多态字段信息 + * @param string $type 多态类型 + * @return MorphMany + */ + public function morphMany($model, $morph = null, $type = '') + { + // 记录当前关联信息 + $model = $this->parseModel($model); + + if (is_null($morph)) { + $trace = debug_backtrace(false, 2); + $morph = Loader::parseName($trace[1]['function']); + } + + $type = $type ?: get_class($this); + + if (is_array($morph)) { + list($morphType, $foreignKey) = $morph; + } else { + $morphType = $morph . '_type'; + $foreignKey = $morph . '_id'; + } + + return new MorphMany($this, $model, $foreignKey, $morphType, $type); + } + + /** + * MORPH TO 关联定义 + * @access public + * @param string|array $morph 多态字段信息 + * @param array $alias 多态别名定义 + * @return MorphTo + */ + public function morphTo($morph = null, $alias = []) + { + $trace = debug_backtrace(false, 2); + $relation = Loader::parseName($trace[1]['function']); + + if (is_null($morph)) { + $morph = $relation; + } + + // 记录当前关联信息 + if (is_array($morph)) { + list($morphType, $foreignKey) = $morph; + } else { + $morphType = $morph . '_type'; + $foreignKey = $morph . '_id'; + } + + return new MorphTo($this, $morphType, $foreignKey, $alias, $relation); + } + + /** + * 解析模型的完整命名空间 + * @access protected + * @param string $model 模型名(或者完整类名) + * @return string + */ + protected function parseModel($model) + { + if (false === strpos($model, '\\')) { + $path = explode('\\', static::class); + array_pop($path); + array_push($path, Loader::parseName($model, 1)); + $model = implode('\\', $path); + } + + return $model; + } + + /** + * 获取模型的默认外键名 + * @access protected + * @param string $name 模型名 + * @return string + */ + protected function getForeignKey($name) + { + if (strpos($name, '\\')) { + $name = basename(str_replace('\\', '/', $name)); + } + + return Loader::parseName($name) . '_id'; + } + + /** + * 检查属性是否为关联属性 如果是则返回关联方法名 + * @access protected + * @param string $attr 关联属性名 + * @return string|false + */ + protected function isRelationAttr($attr) + { + $relation = Loader::parseName($attr, 1, false); + + if (method_exists($this, $relation)) { + return $relation; + } + + return false; + } + + /** + * 智能获取关联模型数据 + * @access protected + * @param Relation $modelRelation 模型关联对象 + * @return mixed + */ + protected function getRelationData(Relation $modelRelation) + { + if ($this->parent && !$modelRelation->isSelfRelation() && get_class($this->parent) == get_class($modelRelation->getModel())) { + $value = $this->parent; + } else { + // 获取关联数据 + $value = $modelRelation->getRelation(); + } + + return $value; + } + + /** + * 关联数据自动写入检查 + * @access protected + * @return void + */ + protected function checkAutoRelationWrite() + { + foreach ($this->together as $key => $name) { + if (is_array($name)) { + if (key($name) === 0) { + $this->relationWrite[$key] = []; + // 绑定关联属性 + foreach ((array) $name as $val) { + if (isset($this->data[$val])) { + $this->relationWrite[$key][$val] = $this->data[$val]; + } + } + } else { + // 直接传入关联数据 + $this->relationWrite[$key] = $name; + } + } elseif (isset($this->relation[$name])) { + $this->relationWrite[$name] = $this->relation[$name]; + } elseif (isset($this->data[$name])) { + $this->relationWrite[$name] = $this->data[$name]; + unset($this->data[$name]); + } + } + } + + /** + * 自动关联数据更新(针对一对一关联) + * @access protected + * @return void + */ + protected function autoRelationUpdate() + { + foreach ($this->relationWrite as $name => $val) { + if ($val instanceof Model) { + $val->isUpdate()->save(); + } else { + $model = $this->getRelation($name); + if ($model instanceof Model) { + $model->isUpdate()->save($val); + } + } + } + } + + /** + * 自动关联数据写入(针对一对一关联) + * @access protected + * @return void + */ + protected function autoRelationInsert() + { + foreach ($this->relationWrite as $name => $val) { + $method = Loader::parseName($name, 1, false); + $this->$method()->save($val); + } + } + + /** + * 自动关联数据删除(支持一对一及一对多关联) + * @access protected + * @return void + */ + protected function autoRelationDelete() + { + foreach ($this->relationWrite as $key => $name) { + $name = is_numeric($key) ? $name : $key; + $result = $this->getRelation($name); + + if ($result instanceof Model) { + $result->delete(); + } elseif ($result instanceof Collection) { + foreach ($result as $model) { + $model->delete(); + } + } + } + } +} diff --git a/tp5/thinkphp/library/think/model/concern/SoftDelete.php b/tp5/thinkphp/library/think/model/concern/SoftDelete.php new file mode 100644 index 0000000..16b75b7 --- /dev/null +++ b/tp5/thinkphp/library/think/model/concern/SoftDelete.php @@ -0,0 +1,187 @@ +getDeleteTimeField(); + + if ($field && !empty($this->getOrigin($field))) { + return true; + } + + return false; + } + + /** + * 查询软删除数据 + * @access public + * @return Query + */ + public static function withTrashed() + { + $model = new static(); + + return $model->db(false); + } + + /** + * 只查询软删除数据 + * @access public + * @return Query + */ + public static function onlyTrashed() + { + $model = new static(); + $field = $model->getDeleteTimeField(true); + + if ($field) { + return $model + ->db(false) + ->useSoftDelete($field, ['not null', '']); + } else { + return $model->db(false); + } + } + + /** + * 删除当前的记录 + * @access public + * @param bool $force 是否强制删除 + * @return integer + */ + public function delete($force = false) + { + if (false === $this->trigger('before_delete', $this)) { + return false; + } + + $name = $this->getDeleteTimeField(); + + if ($name && !$force) { + // 软删除 + $this->data($name, $this->autoWriteTimestamp($name)); + + $result = $this->isUpdate()->save(); + } else { + // 读取更新条件 + $where = $this->getWhere(); + + // 删除当前模型数据 + $result = $this->db(false)->where($where)->delete(); + } + + // 关联删除 + if (!empty($this->relationWrite)) { + $this->autoRelationDelete(); + } + + $this->trigger('after_delete', $this); + + // 清空数据 + $this->data = []; + $this->origin = []; + + return $result; + } + + /** + * 删除记录 + * @access public + * @param mixed $data 主键列表 支持闭包查询条件 + * @param bool $force 是否强制删除 + * @return integer 成功删除的记录数 + */ + public static function destroy($data, $force = false) + { + // 包含软删除数据 + $query = self::withTrashed(); + + if (is_array($data) && key($data) !== 0) { + $query->where($data); + $data = null; + } elseif ($data instanceof \Closure) { + call_user_func_array($data, [ & $query]); + $data = null; + } elseif (is_null($data)) { + return 0; + } + + $resultSet = $query->select($data); + $count = 0; + + if ($resultSet) { + foreach ($resultSet as $data) { + $result = $data->delete($force); + $count += $result; + } + } + + return $count; + } + + /** + * 恢复被软删除的记录 + * @access public + * @param array $where 更新条件 + * @return integer + */ + public function restore($where = []) + { + $name = $this->getDeleteTimeField(); + + if (empty($where)) { + $pk = $this->getPk(); + $where[$pk] = [$pk, '=', $this->getData($pk)]; + } + + if ($name) { + // 恢复删除 + return $this->db(false) + ->where($where) + ->useSoftDelete($name, ['not null', '']) + ->update([$name => null]); + } else { + return 0; + } + } + + /** + * 获取软删除字段 + * @access protected + * @param bool $read 是否查询操作 写操作的时候会自动去掉表别名 + * @return string|false + */ + protected function getDeleteTimeField($read = false) + { + $field = property_exists($this, 'deleteTime') && isset($this->deleteTime) ? $this->deleteTime : 'delete_time'; + + if (false === $field) { + return false; + } + + if (!strpos($field, '.')) { + $field = '__TABLE__.' . $field; + } + + if (!$read && strpos($field, '.')) { + $array = explode('.', $field); + $field = array_pop($array); + } + + return $field; + } +} diff --git a/tp5/thinkphp/library/think/model/concern/TimeStamp.php b/tp5/thinkphp/library/think/model/concern/TimeStamp.php new file mode 100644 index 0000000..923b7d4 --- /dev/null +++ b/tp5/thinkphp/library/think/model/concern/TimeStamp.php @@ -0,0 +1,79 @@ + +// +---------------------------------------------------------------------- + +namespace think\model\concern; + +/** + * 自动时间戳 + */ +trait TimeStamp +{ + /** + * 是否需要自动写入时间戳 如果设置为字符串 则表示时间字段的类型 + * @var bool|string + */ + protected $autoWriteTimestamp; + + /** + * 创建时间字段 false表示关闭 + * @var false|string + */ + protected $createTime = 'create_time'; + + /** + * 更新时间字段 false表示关闭 + * @var false|string + */ + protected $updateTime = 'update_time'; + + /** + * 时间字段显示格式 + * @var string + */ + protected $dateFormat; + + /** + * 时间日期字段格式化处理 + * @access protected + * @param mixed $time 时间日期表达式 + * @param mixed $format 日期格式 + * @param bool $timestamp 是否进行时间戳转换 + * @return mixed + */ + protected function formatDateTime($time, $format, $timestamp = false) + { + if (false !== strpos($format, '\\')) { + $time = new $format($time); + } elseif (!$timestamp && false !== $format) { + $time = date($format, $time); + } + + return $time; + } + + /** + * 检查时间字段写入 + * @access protected + * @return void + */ + protected function checkTimeStampWrite() + { + // 自动写入创建时间和更新时间 + if ($this->autoWriteTimestamp) { + if ($this->createTime && !isset($this->data[$this->createTime])) { + $this->data[$this->createTime] = $this->autoWriteTimestamp($this->createTime); + } + if ($this->updateTime && !isset($this->data[$this->updateTime])) { + $this->data[$this->updateTime] = $this->autoWriteTimestamp($this->updateTime); + } + } + } +} diff --git a/tp5/thinkphp/library/think/model/relation/BelongsTo.php b/tp5/thinkphp/library/think/model/relation/BelongsTo.php new file mode 100644 index 0000000..bcbab2a --- /dev/null +++ b/tp5/thinkphp/library/think/model/relation/BelongsTo.php @@ -0,0 +1,224 @@ + +// +---------------------------------------------------------------------- + +namespace think\model\relation; + +use think\Loader; +use think\Model; + +class BelongsTo extends OneToOne +{ + /** + * 架构函数 + * @access public + * @param Model $parent 上级模型对象 + * @param string $model 模型名 + * @param string $foreignKey 关联外键 + * @param string $localKey 关联主键 + * @param string $relation 关联名 + */ + public function __construct(Model $parent, $model, $foreignKey, $localKey, $relation = null) + { + $this->parent = $parent; + $this->model = $model; + $this->foreignKey = $foreignKey; + $this->localKey = $localKey; + $this->joinType = 'INNER'; + $this->query = (new $model)->db(); + $this->relation = $relation; + } + + /** + * 延迟获取关联数据 + * @access public + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包查询条件 + * @return Model + */ + public function getRelation($subRelation = '', $closure = null) + { + if ($closure) { + $closure($this->query); + } + + $foreignKey = $this->foreignKey; + + $relationModel = $this->query + ->where($this->localKey, $this->parent->$foreignKey) + ->relation($subRelation) + ->find(); + + if ($relationModel) { + $relationModel->setParent(clone $this->parent); + } + + return $relationModel; + } + + /** + * 根据关联条件查询当前模型 + * @access public + * @param string $operator 比较操作符 + * @param integer $count 个数 + * @param string $id 关联表的统计字段 + * @return Query + */ + public function has($operator = '>=', $count = 1, $id = '*') + { + return $this->parent; + } + + /** + * 根据关联条件查询当前模型 + * @access public + * @param mixed $where 查询条件(数组或者闭包) + * @param mixed $fields 字段 + * @return Query + */ + public function hasWhere($where = [], $fields = null) + { + $table = $this->query->getTable(); + $model = basename(str_replace('\\', '/', get_class($this->parent))); + $relation = basename(str_replace('\\', '/', $this->model)); + + if (is_array($where)) { + $this->getQueryWhere($where, $relation); + } + + $fields = $this->getRelationQueryFields($fields, $model); + + return $this->parent->db() + ->alias($model) + ->field($fields) + ->join([$table => $relation], $model . '.' . $this->foreignKey . '=' . $relation . '.' . $this->localKey, $this->joinType) + ->where($where); + } + + /** + * 预载入关联查询(数据集) + * @access protected + * @param array $resultSet 数据集 + * @param string $relation 当前关联名 + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包 + * @return void + */ + protected function eagerlySet(&$resultSet, $relation, $subRelation, $closure) + { + $localKey = $this->localKey; + $foreignKey = $this->foreignKey; + + $range = []; + foreach ($resultSet as $result) { + // 获取关联外键列表 + if (isset($result->$foreignKey)) { + $range[] = $result->$foreignKey; + } + } + + if (!empty($range)) { + $data = $this->eagerlyWhere([ + [$localKey, 'in', $range], + ], $localKey, $relation, $subRelation, $closure); + + // 关联属性名 + $attr = Loader::parseName($relation); + + // 关联数据封装 + foreach ($resultSet as $result) { + // 关联模型 + if (!isset($data[$result->$foreignKey])) { + $relationModel = null; + } else { + $relationModel = $data[$result->$foreignKey]; + $relationModel->setParent(clone $result); + $relationModel->isUpdate(true); + } + + if (!empty($this->bindAttr)) { + // 绑定关联属性 + $this->bindAttr($relationModel, $result); + } else { + // 设置关联属性 + $result->setRelation($attr, $relationModel); + } + } + } + } + + /** + * 预载入关联查询(数据) + * @access protected + * @param Model $result 数据对象 + * @param string $relation 当前关联名 + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包 + * @return void + */ + protected function eagerlyOne(&$result, $relation, $subRelation, $closure) + { + $localKey = $this->localKey; + $foreignKey = $this->foreignKey; + + $data = $this->eagerlyWhere([ + [$localKey, '=', $result->$foreignKey], + ], $localKey, $relation, $subRelation, $closure); + + // 关联模型 + if (!isset($data[$result->$foreignKey])) { + $relationModel = null; + } else { + $relationModel = $data[$result->$foreignKey]; + $relationModel->setParent(clone $result); + $relationModel->isUpdate(true); + } + + if (!empty($this->bindAttr)) { + // 绑定关联属性 + $this->bindAttr($relationModel, $result); + } else { + // 设置关联属性 + $result->setRelation(Loader::parseName($relation), $relationModel); + } + } + + /** + * 添加关联数据 + * @access public + * @param Model $model 关联模型对象 + * @return Model + */ + public function associate($model) + { + $foreignKey = $this->foreignKey; + $pk = $model->getPk(); + + $this->parent->setAttr($foreignKey, $model->$pk); + $this->parent->save(); + + return $this->parent->setRelation($this->relation, $model); + } + + /** + * 注销关联数据 + * @access public + * @return Model + */ + public function dissociate() + { + $foreignKey = $this->foreignKey; + + $this->parent->setAttr($foreignKey, null); + $this->parent->save(); + + return $this->parent->setRelation($this->relation, null); + } +} diff --git a/tp5/thinkphp/library/think/model/relation/BelongsToMany.php b/tp5/thinkphp/library/think/model/relation/BelongsToMany.php new file mode 100644 index 0000000..203c198 --- /dev/null +++ b/tp5/thinkphp/library/think/model/relation/BelongsToMany.php @@ -0,0 +1,631 @@ + +// +---------------------------------------------------------------------- + +namespace think\model\relation; + +use think\Collection; +use think\db\Query; +use think\Exception; +use think\Loader; +use think\Model; +use think\model\Pivot; +use think\model\Relation; + +class BelongsToMany extends Relation +{ + // 中间表表名 + protected $middle; + // 中间表模型名称 + protected $pivotName; + // 中间表模型对象 + protected $pivot; + + /** + * 架构函数 + * @access public + * @param Model $parent 上级模型对象 + * @param string $model 模型名 + * @param string $table 中间表名 + * @param string $foreignKey 关联模型外键 + * @param string $localKey 当前模型关联键 + */ + public function __construct(Model $parent, $model, $table, $foreignKey, $localKey) + { + $this->parent = $parent; + $this->model = $model; + $this->foreignKey = $foreignKey; + $this->localKey = $localKey; + + if (false !== strpos($table, '\\')) { + $this->pivotName = $table; + $this->middle = basename(str_replace('\\', '/', $table)); + } else { + $this->middle = $table; + } + + $this->query = (new $model)->db(); + $this->pivot = $this->newPivot(); + } + + /** + * 设置中间表模型 + * @access public + * @param $pivot + * @return $this + */ + public function pivot($pivot) + { + $this->pivotName = $pivot; + return $this; + } + + /** + * 实例化中间表模型 + * @access public + * @param $data + * @return Pivot + * @throws Exception + */ + protected function newPivot($data = []) + { + $class = $this->pivotName ?: '\\think\\model\\Pivot'; + $pivot = new $class($data, $this->parent, $this->middle); + if ($pivot instanceof Pivot) { + return $pivot; + } else { + throw new Exception('pivot model must extends: \think\model\Pivot'); + } + } + + /** + * 合成中间表模型 + * @access protected + * @param array|Collection|Paginator $models + */ + protected function hydratePivot($models) + { + foreach ($models as $model) { + $pivot = []; + + foreach ($model->getData() as $key => $val) { + if (strpos($key, '__')) { + list($name, $attr) = explode('__', $key, 2); + + if ('pivot' == $name) { + $pivot[$attr] = $val; + unset($model->$key); + } + } + } + + $model->setRelation('pivot', $this->newPivot($pivot)); + } + } + + /** + * 创建关联查询Query对象 + * @access protected + * @return Query + */ + protected function buildQuery() + { + $foreignKey = $this->foreignKey; + $localKey = $this->localKey; + + // 关联查询 + $pk = $this->parent->getPk(); + + $condition[] = ['pivot.' . $localKey, '=', $this->parent->$pk]; + + return $this->belongsToManyQuery($foreignKey, $localKey, $condition); + } + + /** + * 延迟获取关联数据 + * @access public + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包查询条件 + * @return Collection + */ + public function getRelation($subRelation = '', $closure = null) + { + if ($closure) { + $closure($this->query); + } + + $result = $this->buildQuery()->relation($subRelation)->select(); + $this->hydratePivot($result); + + return $result; + } + + /** + * 重载select方法 + * @access public + * @param mixed $data + * @return Collection + */ + public function select($data = null) + { + $result = $this->buildQuery()->select($data); + $this->hydratePivot($result); + + return $result; + } + + /** + * 重载paginate方法 + * @access public + * @param null $listRows + * @param bool $simple + * @param array $config + * @return Paginator + */ + public function paginate($listRows = null, $simple = false, $config = []) + { + $result = $this->buildQuery()->paginate($listRows, $simple, $config); + $this->hydratePivot($result); + + return $result; + } + + /** + * 重载find方法 + * @access public + * @param mixed $data + * @return Model + */ + public function find($data = null) + { + $result = $this->buildQuery()->find($data); + if ($result) { + $this->hydratePivot([$result]); + } + + return $result; + } + + /** + * 查找多条记录 如果不存在则抛出异常 + * @access public + * @param array|string|Query|\Closure $data + * @return Collection + */ + public function selectOrFail($data = null) + { + return $this->failException(true)->select($data); + } + + /** + * 查找单条记录 如果不存在则抛出异常 + * @access public + * @param array|string|Query|\Closure $data + * @return Model + */ + public function findOrFail($data = null) + { + return $this->failException(true)->find($data); + } + + /** + * 根据关联条件查询当前模型 + * @access public + * @param string $operator 比较操作符 + * @param integer $count 个数 + * @param string $id 关联表的统计字段 + * @param string $joinType JOIN类型 + * @return Query + */ + public function has($operator = '>=', $count = 1, $id = '*', $joinType = 'INNER') + { + return $this->parent; + } + + /** + * 根据关联条件查询当前模型 + * @access public + * @param mixed $where 查询条件(数组或者闭包) + * @param mixed $fields 字段 + * @return Query + * @throws Exception + */ + public function hasWhere($where = [], $fields = null) + { + throw new Exception('relation not support: hasWhere'); + } + + /** + * 设置中间表的查询条件 + * @access public + * @param string $field + * @param string $op + * @param mixed $condition + * @return $this + */ + public function wherePivot($field, $op = null, $condition = null) + { + $this->query->where('pivot.' . $field, $op, $condition); + return $this; + } + + /** + * 预载入关联查询(数据集) + * @access public + * @param array $resultSet 数据集 + * @param string $relation 当前关联名 + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包 + * @return void + */ + public function eagerlyResultSet(&$resultSet, $relation, $subRelation, $closure) + { + $localKey = $this->localKey; + $foreignKey = $this->foreignKey; + + $pk = $resultSet[0]->getPk(); + $range = []; + foreach ($resultSet as $result) { + // 获取关联外键列表 + if (isset($result->$pk)) { + $range[] = $result->$pk; + } + } + + if (!empty($range)) { + // 查询关联数据 + $data = $this->eagerlyManyToMany([ + ['pivot.' . $localKey, 'in', $range], + ], $relation, $subRelation); + + // 关联属性名 + $attr = Loader::parseName($relation); + + // 关联数据封装 + foreach ($resultSet as $result) { + if (!isset($data[$result->$pk])) { + $data[$result->$pk] = []; + } + + $result->setRelation($attr, $this->resultSetBuild($data[$result->$pk])); + } + } + } + + /** + * 预载入关联查询(单个数据) + * @access public + * @param Model $result 数据对象 + * @param string $relation 当前关联名 + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包 + * @return void + */ + public function eagerlyResult(&$result, $relation, $subRelation, $closure) + { + $pk = $result->getPk(); + + if (isset($result->$pk)) { + $pk = $result->$pk; + // 查询管理数据 + $data = $this->eagerlyManyToMany([ + ['pivot.' . $this->localKey, '=', $pk], + ], $relation, $subRelation); + + // 关联数据封装 + if (!isset($data[$pk])) { + $data[$pk] = []; + } + + $result->setRelation(Loader::parseName($relation), $this->resultSetBuild($data[$pk])); + } + } + + /** + * 关联统计 + * @access public + * @param Model $result 数据对象 + * @param \Closure $closure 闭包 + * @param string $aggregate 聚合查询方法 + * @param string $field 字段 + * @return integer + */ + public function relationCount($result, $closure, $aggregate = 'count', $field = '*') + { + $pk = $result->getPk(); + $count = 0; + + if (isset($result->$pk)) { + $pk = $result->$pk; + $count = $this->belongsToManyQuery($this->foreignKey, $this->localKey, [ + ['pivot.' . $this->localKey, '=', $pk], + ])->$aggregate($field); + } + + return $count; + } + + /** + * 获取关联统计子查询 + * @access public + * @param \Closure $closure 闭包 + * @param string $aggregate 聚合查询方法 + * @param string $field 字段 + * @return string + */ + public function getRelationCountQuery($closure, $aggregate = 'count', $field = '*') + { + return $this->belongsToManyQuery($this->foreignKey, $this->localKey, [ + [ + 'pivot.' . $this->localKey, 'exp', '=' . $this->parent->getTable() . '.' . $this->parent->getPk(), + ], + ])->fetchSql()->$aggregate($field); + } + + /** + * 多对多 关联模型预查询 + * @access protected + * @param array $where 关联预查询条件 + * @param string $relation 关联名 + * @param string $subRelation 子关联 + * @return array + */ + protected function eagerlyManyToMany($where, $relation, $subRelation = '') + { + // 预载入关联查询 支持嵌套预载入 + $list = $this->belongsToManyQuery($this->foreignKey, $this->localKey, $where) + ->with($subRelation) + ->select(); + + // 组装模型数据 + $data = []; + foreach ($list as $set) { + $pivot = []; + foreach ($set->getData() as $key => $val) { + if (strpos($key, '__')) { + list($name, $attr) = explode('__', $key, 2); + if ('pivot' == $name) { + $pivot[$attr] = $val; + unset($set->$key); + } + } + } + + $set->setRelation('pivot', $this->newPivot($pivot)); + + $data[$pivot[$this->localKey]][] = $set; + } + + return $data; + } + + /** + * BELONGS TO MANY 关联查询 + * @access protected + * @param string $foreignKey 关联模型关联键 + * @param string $localKey 当前模型关联键 + * @param array $condition 关联查询条件 + * @return Query + */ + protected function belongsToManyQuery($foreignKey, $localKey, $condition = []) + { + // 关联查询封装 + $tableName = $this->query->getTable(); + $table = $this->pivot->getTable(); + $fields = $this->getQueryFields($tableName); + + $query = $this->query + ->field($fields) + ->field(true, false, $table, 'pivot', 'pivot__'); + + if (empty($this->baseQuery)) { + $relationFk = $this->query->getPk(); + $query->join([$table => 'pivot'], 'pivot.' . $foreignKey . '=' . $tableName . '.' . $relationFk) + ->where($condition); + } + + return $query; + } + + /** + * 保存(新增)当前关联数据对象 + * @access public + * @param mixed $data 数据 可以使用数组 关联模型对象 和 关联对象的主键 + * @param array $pivot 中间表额外数据 + * @return array|Pivot + */ + public function save($data, array $pivot = []) + { + // 保存关联表/中间表数据 + return $this->attach($data, $pivot); + } + + /** + * 批量保存当前关联数据对象 + * @access public + * @param array $dataSet 数据集 + * @param array $pivot 中间表额外数据 + * @param bool $samePivot 额外数据是否相同 + * @return array|false + */ + public function saveAll(array $dataSet, array $pivot = [], $samePivot = false) + { + $result = []; + + foreach ($dataSet as $key => $data) { + if (!$samePivot) { + $pivotData = isset($pivot[$key]) ? $pivot[$key] : []; + } else { + $pivotData = $pivot; + } + + $result[] = $this->attach($data, $pivotData); + } + + return empty($result) ? false : $result; + } + + /** + * 附加关联的一个中间表数据 + * @access public + * @param mixed $data 数据 可以使用数组、关联模型对象 或者 关联对象的主键 + * @param array $pivot 中间表额外数据 + * @return array|Pivot + * @throws Exception + */ + public function attach($data, $pivot = []) + { + if (is_array($data)) { + if (key($data) === 0) { + $id = $data; + } else { + // 保存关联表数据 + $model = new $this->model; + $model->save($data); + $id = $model->getLastInsID(); + } + } elseif (is_numeric($data) || is_string($data)) { + // 根据关联表主键直接写入中间表 + $id = $data; + } elseif ($data instanceof Model) { + // 根据关联表主键直接写入中间表 + $relationFk = $data->getPk(); + $id = $data->$relationFk; + } + + if ($id) { + // 保存中间表数据 + $pk = $this->parent->getPk(); + $pivot[$this->localKey] = $this->parent->$pk; + $ids = (array) $id; + + foreach ($ids as $id) { + $pivot[$this->foreignKey] = $id; + $this->pivot->insert($pivot, true); + $result[] = $this->newPivot($pivot); + } + + if (count($result) == 1) { + // 返回中间表模型对象 + $result = $result[0]; + } + + return $result; + } else { + throw new Exception('miss relation data'); + } + } + + /** + * 解除关联的一个中间表数据 + * @access public + * @param integer|array $data 数据 可以使用关联对象的主键 + * @param bool $relationDel 是否同时删除关联表数据 + * @return integer + */ + public function detach($data = null, $relationDel = false) + { + if (is_array($data)) { + $id = $data; + } elseif (is_numeric($data) || is_string($data)) { + // 根据关联表主键直接写入中间表 + $id = $data; + } elseif ($data instanceof Model) { + // 根据关联表主键直接写入中间表 + $relationFk = $data->getPk(); + $id = $data->$relationFk; + } + + // 删除中间表数据 + $pk = $this->parent->getPk(); + $pivot[] = [$this->localKey, '=', $this->parent->$pk]; + + if (isset($id)) { + $pivot[] = is_array($id) ? [$this->foreignKey, 'in', $id] : [$this->foreignKey, '=', $id]; + } + + $this->pivot->where($pivot)->delete(); + + // 删除关联表数据 + if (isset($id) && $relationDel) { + $model = $this->model; + $model::destroy($id); + } + } + + /** + * 数据同步 + * @access public + * @param array $ids + * @param bool $detaching + * @return array + */ + public function sync($ids, $detaching = true) + { + $changes = [ + 'attached' => [], + 'detached' => [], + 'updated' => [], + ]; + + $pk = $this->parent->getPk(); + + $current = $this->pivot + ->where($this->localKey, $this->parent->$pk) + ->column($this->foreignKey); + + $records = []; + + foreach ($ids as $key => $value) { + if (!is_array($value)) { + $records[$value] = []; + } else { + $records[$key] = $value; + } + } + + $detach = array_diff($current, array_keys($records)); + + if ($detaching && count($detach) > 0) { + $this->detach($detach); + $changes['detached'] = $detach; + } + + foreach ($records as $id => $attributes) { + if (!in_array($id, $current)) { + $this->attach($id, $attributes); + $changes['attached'][] = $id; + } elseif (count($attributes) > 0 && $this->attach($id, $attributes)) { + $changes['updated'][] = $id; + } + } + + return $changes; + } + + /** + * 执行基础查询(仅执行一次) + * @access protected + * @return void + */ + protected function baseQuery() + { + if (empty($this->baseQuery) && $this->parent->getData()) { + $pk = $this->parent->getPk(); + $table = $this->pivot->getTable(); + + $this->query + ->join([$table => 'pivot'], 'pivot.' . $this->foreignKey . '=' . $this->query->getTable() . '.' . $this->query->getPk()) + ->where('pivot.' . $this->localKey, $this->parent->$pk); + $this->baseQuery = true; + } + } + +} diff --git a/tp5/thinkphp/library/think/model/relation/HasMany.php b/tp5/thinkphp/library/think/model/relation/HasMany.php new file mode 100644 index 0000000..3a88229 --- /dev/null +++ b/tp5/thinkphp/library/think/model/relation/HasMany.php @@ -0,0 +1,325 @@ + +// +---------------------------------------------------------------------- + +namespace think\model\relation; + +use think\db\Query; +use think\Loader; +use think\Model; +use think\model\Relation; + +class HasMany extends Relation +{ + /** + * 架构函数 + * @access public + * @param Model $parent 上级模型对象 + * @param string $model 模型名 + * @param string $foreignKey 关联外键 + * @param string $localKey 当前模型主键 + */ + public function __construct(Model $parent, $model, $foreignKey, $localKey) + { + $this->parent = $parent; + $this->model = $model; + $this->foreignKey = $foreignKey; + $this->localKey = $localKey; + $this->query = (new $model)->db(); + } + + /** + * 延迟获取关联数据 + * @access public + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包查询条件 + * @return \think\Collection + */ + public function getRelation($subRelation = '', $closure = null) + { + if ($closure) { + $closure($this->query); + } + + $list = $this->query + ->where($this->foreignKey, $this->parent->{$this->localKey}) + ->relation($subRelation) + ->select(); + + $parent = clone $this->parent; + + foreach ($list as &$model) { + $model->setParent($parent); + } + + return $list; + } + + /** + * 预载入关联查询 + * @access public + * @param array $resultSet 数据集 + * @param string $relation 当前关联名 + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包 + * @return void + */ + public function eagerlyResultSet(&$resultSet, $relation, $subRelation, $closure) + { + $localKey = $this->localKey; + $range = []; + + foreach ($resultSet as $result) { + // 获取关联外键列表 + if (isset($result->$localKey)) { + $range[] = $result->$localKey; + } + } + + if (!empty($range)) { + $where = [ + [$this->foreignKey, 'in', $range], + ]; + $data = $this->eagerlyOneToMany($where, $relation, $subRelation, $closure); + + // 关联属性名 + $attr = Loader::parseName($relation); + + // 关联数据封装 + foreach ($resultSet as $result) { + $pk = $result->$localKey; + if (!isset($data[$pk])) { + $data[$pk] = []; + } + + foreach ($data[$pk] as &$relationModel) { + $relationModel->setParent(clone $result); + } + + $result->setRelation($attr, $this->resultSetBuild($data[$pk])); + } + } + } + + /** + * 预载入关联查询 + * @access public + * @param Model $result 数据对象 + * @param string $relation 当前关联名 + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包 + * @return void + */ + public function eagerlyResult(&$result, $relation, $subRelation, $closure) + { + $localKey = $this->localKey; + + if (isset($result->$localKey)) { + $pk = $result->$localKey; + $where = [ + [$this->foreignKey, '=', $pk], + ]; + $data = $this->eagerlyOneToMany($where, $relation, $subRelation, $closure); + + // 关联数据封装 + if (!isset($data[$pk])) { + $data[$pk] = []; + } + + foreach ($data[$pk] as &$relationModel) { + $relationModel->setParent(clone $result); + } + + $result->setRelation(Loader::parseName($relation), $this->resultSetBuild($data[$pk])); + } + } + + /** + * 关联统计 + * @access public + * @param Model $result 数据对象 + * @param \Closure $closure 闭包 + * @param string $aggregate 聚合查询方法 + * @param string $field 字段 + * @return integer + */ + public function relationCount($result, $closure, $aggregate = 'count', $field = '*') + { + $localKey = $this->localKey; + $count = 0; + + if (isset($result->$localKey)) { + if ($closure) { + $closure($this->query); + } + + $count = $this->query->where($this->foreignKey, '=', $result->$localKey)->$aggregate($field); + } + + return $count; + } + + /** + * 创建关联统计子查询 + * @access public + * @param \Closure $closure 闭包 + * @param string $aggregate 聚合查询方法 + * @param string $field 字段 + * @return string + */ + public function getRelationCountQuery($closure, $aggregate = 'count', $field = '*') + { + if ($closure) { + $closure($this->query); + } + + return $this->query + ->where($this->foreignKey, 'exp', '=' . $this->parent->getTable() . '.' . $this->parent->getPk()) + ->fetchSql() + ->$aggregate($field); + } + + /** + * 一对多 关联模型预查询 + * @access public + * @param array $where 关联预查询条件 + * @param string $relation 关联名 + * @param string $subRelation 子关联 + * @param bool $closure + * @return array + */ + protected function eagerlyOneToMany($where, $relation, $subRelation = '', $closure = false) + { + $foreignKey = $this->foreignKey; + + $this->query->removeWhereField($this->foreignKey); + + // 预载入关联查询 支持嵌套预载入 + if ($closure) { + $closure($this->query); + } + + $list = $this->query->where($where)->with($subRelation)->select(); + + // 组装模型数据 + $data = []; + + foreach ($list as $set) { + $data[$set->$foreignKey][] = $set; + } + + return $data; + } + + /** + * 保存(新增)当前关联数据对象 + * @access public + * @param mixed $data 数据 可以使用数组 关联模型对象 和 关联对象的主键 + * @return Model|false + */ + public function save($data) + { + if ($data instanceof Model) { + $data = $data->getData(); + } + + // 保存关联表数据 + $data[$this->foreignKey] = $this->parent->{$this->localKey}; + + $model = new $this->model; + + return $model->save($data) ? $model : false; + } + + /** + * 批量保存当前关联数据对象 + * @access public + * @param array $dataSet 数据集 + * @return array|false + */ + public function saveAll(array $dataSet) + { + $result = []; + + foreach ($dataSet as $key => $data) { + $result[] = $this->save($data); + } + + return empty($result) ? false : $result; + } + + /** + * 根据关联条件查询当前模型 + * @access public + * @param string $operator 比较操作符 + * @param integer $count 个数 + * @param string $id 关联表的统计字段 + * @param string $joinType JOIN类型 + * @return Query + */ + public function has($operator = '>=', $count = 1, $id = '*', $joinType = 'INNER') + { + $table = $this->query->getTable(); + $model = basename(str_replace('\\', '/', get_class($this->parent))); + $relation = basename(str_replace('\\', '/', $this->model)); + + return $this->parent->db() + ->alias($model) + ->field($model . '.*') + ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey, $joinType) + ->group($relation . '.' . $this->foreignKey) + ->having('count(' . $id . ')' . $operator . $count); + } + + /** + * 根据关联条件查询当前模型 + * @access public + * @param mixed $where 查询条件(数组或者闭包) + * @param mixed $fields 字段 + * @return Query + */ + public function hasWhere($where = [], $fields = null) + { + $table = $this->query->getTable(); + $model = basename(str_replace('\\', '/', get_class($this->parent))); + $relation = basename(str_replace('\\', '/', $this->model)); + + if (is_array($where)) { + $this->getQueryWhere($where, $relation); + } + + $fields = $this->getRelationQueryFields($fields, $model); + + return $this->parent->db() + ->alias($model) + ->group($model . '.' . $this->localKey) + ->field($fields) + ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey) + ->where($where); + } + + /** + * 执行基础查询(仅执行一次) + * @access protected + * @return void + */ + protected function baseQuery() + { + if (empty($this->baseQuery)) { + if (isset($this->parent->{$this->localKey})) { + // 关联查询带入关联条件 + $this->query->where($this->foreignKey, '=', $this->parent->{$this->localKey}); + } + + $this->baseQuery = true; + } + } + +} diff --git a/tp5/thinkphp/library/think/model/relation/HasManyThrough.php b/tp5/thinkphp/library/think/model/relation/HasManyThrough.php new file mode 100644 index 0000000..411f3fc --- /dev/null +++ b/tp5/thinkphp/library/think/model/relation/HasManyThrough.php @@ -0,0 +1,155 @@ + +// +---------------------------------------------------------------------- + +namespace think\model\relation; + +use think\db\Query; +use think\Exception; +use think\Loader; +use think\Model; +use think\model\Relation; + +class HasManyThrough extends Relation +{ + // 中间关联表外键 + protected $throughKey; + // 中间表模型 + protected $through; + + /** + * 架构函数 + * @access public + * @param Model $parent 上级模型对象 + * @param string $model 模型名 + * @param string $through 中间模型名 + * @param string $foreignKey 关联外键 + * @param string $throughKey 关联外键 + * @param string $localKey 当前主键 + */ + public function __construct(Model $parent, $model, $through, $foreignKey, $throughKey, $localKey) + { + $this->parent = $parent; + $this->model = $model; + $this->through = $through; + $this->foreignKey = $foreignKey; + $this->throughKey = $throughKey; + $this->localKey = $localKey; + $this->query = (new $model)->db(); + } + + /** + * 延迟获取关联数据 + * @access public + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包查询条件 + * @return \think\Collection + */ + public function getRelation($subRelation = '', $closure = null) + { + if ($closure) { + $closure($this->query); + } + + $this->baseQuery(); + + return $this->query->relation($subRelation)->select(); + } + + /** + * 根据关联条件查询当前模型 + * @access public + * @param string $operator 比较操作符 + * @param integer $count 个数 + * @param string $id 关联表的统计字段 + * @param string $joinType JOIN类型 + * @return Query + */ + public function has($operator = '>=', $count = 1, $id = '*', $joinType = 'INNER') + { + return $this->parent; + } + + /** + * 根据关联条件查询当前模型 + * @access public + * @param mixed $where 查询条件(数组或者闭包) + * @param mixed $fields 字段 + * @return Query + */ + public function hasWhere($where = [], $fields = null) + { + throw new Exception('relation not support: hasWhere'); + } + + /** + * 预载入关联查询 + * @access public + * @param array $resultSet 数据集 + * @param string $relation 当前关联名 + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包 + * @return void + */ + public function eagerlyResultSet(&$resultSet, $relation, $subRelation, $closure) + {} + + /** + * 预载入关联查询 返回模型对象 + * @access public + * @param Model $result 数据对象 + * @param string $relation 当前关联名 + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包 + * @return void + */ + public function eagerlyResult(&$result, $relation, $subRelation, $closure) + {} + + /** + * 关联统计 + * @access public + * @param Model $result 数据对象 + * @param \Closure $closure 闭包 + * @param string $aggregate 聚合查询方法 + * @param string $field 字段 + * @return integer + */ + public function relationCount($result, $closure, $aggregate = 'count', $field = '*') + {} + + /** + * 执行基础查询(仅执行一次) + * @access protected + * @return void + */ + protected function baseQuery() + { + if (empty($this->baseQuery) && $this->parent->getData()) { + $through = $this->through; + $alias = Loader::parseName(basename(str_replace('\\', '/', $this->model))); + $throughTable = $through::getTable(); + $pk = (new $through)->getPk(); + $throughKey = $this->throughKey; + $modelTable = $this->parent->getTable(); + $fields = $this->getQueryFields($alias); + + $this->query + ->field($fields) + ->alias($alias) + ->join($throughTable, $throughTable . '.' . $pk . '=' . $alias . '.' . $throughKey) + ->join($modelTable, $modelTable . '.' . $this->localKey . '=' . $throughTable . '.' . $this->foreignKey) + ->where($throughTable . '.' . $this->foreignKey, $this->parent->{$this->localKey}); + + $this->baseQuery = true; + } + } + +} diff --git a/tp5/thinkphp/library/think/model/relation/HasOne.php b/tp5/thinkphp/library/think/model/relation/HasOne.php new file mode 100644 index 0000000..915dea4 --- /dev/null +++ b/tp5/thinkphp/library/think/model/relation/HasOne.php @@ -0,0 +1,200 @@ + +// +---------------------------------------------------------------------- + +namespace think\model\relation; + +use think\db\Query; +use think\Loader; +use think\Model; + +class HasOne extends OneToOne +{ + /** + * 架构函数 + * @access public + * @param Model $parent 上级模型对象 + * @param string $model 模型名 + * @param string $foreignKey 关联外键 + * @param string $localKey 当前模型主键 + */ + public function __construct(Model $parent, $model, $foreignKey, $localKey) + { + $this->parent = $parent; + $this->model = $model; + $this->foreignKey = $foreignKey; + $this->localKey = $localKey; + $this->joinType = 'INNER'; + $this->query = (new $model)->db(); + } + + /** + * 延迟获取关联数据 + * @access public + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包查询条件 + * @return Model + */ + public function getRelation($subRelation = '', $closure = null) + { + $localKey = $this->localKey; + + if ($closure) { + $closure($this->query); + } + + // 判断关联类型执行查询 + $relationModel = $this->query + ->where($this->foreignKey, $this->parent->$localKey) + ->relation($subRelation) + ->find(); + + if ($relationModel) { + $relationModel->setParent(clone $this->parent); + } + + return $relationModel; + } + + /** + * 根据关联条件查询当前模型 + * @access public + * @return Query + */ + public function has() + { + $table = $this->query->getTable(); + $model = basename(str_replace('\\', '/', get_class($this->parent))); + $relation = basename(str_replace('\\', '/', $this->model)); + $localKey = $this->localKey; + $foreignKey = $this->foreignKey; + + return $this->parent->db() + ->alias($model) + ->whereExists(function ($query) use ($table, $model, $relation, $localKey, $foreignKey) { + $query->table([$table => $relation]) + ->field($relation . '.' . $foreignKey) + ->whereExp($model . '.' . $localKey, '=' . $relation . '.' . $foreignKey); + }); + } + + /** + * 根据关联条件查询当前模型 + * @access public + * @param mixed $where 查询条件(数组或者闭包) + * @param mixed $fields 字段 + * @return Query + */ + public function hasWhere($where = [], $fields = null) + { + $table = $this->query->getTable(); + $model = basename(str_replace('\\', '/', get_class($this->parent))); + $relation = basename(str_replace('\\', '/', $this->model)); + + if (is_array($where)) { + $this->getQueryWhere($where, $relation); + } + + $fields = $this->getRelationQueryFields($fields, $model); + + return $this->parent->db() + ->alias($model) + ->field($fields) + ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey, $this->joinType) + ->where($where); + } + + /** + * 预载入关联查询(数据集) + * @access protected + * @param array $resultSet 数据集 + * @param string $relation 当前关联名 + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包 + * @return void + */ + protected function eagerlySet(&$resultSet, $relation, $subRelation, $closure) + { + $localKey = $this->localKey; + $foreignKey = $this->foreignKey; + + $range = []; + foreach ($resultSet as $result) { + // 获取关联外键列表 + if (isset($result->$localKey)) { + $range[] = $result->$localKey; + } + } + + if (!empty($range)) { + $data = $this->eagerlyWhere([ + [$foreignKey, 'in', $range], + ], $foreignKey, $relation, $subRelation, $closure); + + // 关联属性名 + $attr = Loader::parseName($relation); + + // 关联数据封装 + foreach ($resultSet as $result) { + // 关联模型 + if (!isset($data[$result->$localKey])) { + $relationModel = null; + } else { + $relationModel = $data[$result->$localKey]; + $relationModel->setParent(clone $result); + $relationModel->isUpdate(true); + } + + if (!empty($this->bindAttr)) { + // 绑定关联属性 + $this->bindAttr($relationModel, $result, $this->bindAttr); + } else { + // 设置关联属性 + $result->setRelation($attr, $relationModel); + } + } + } + } + + /** + * 预载入关联查询(数据) + * @access protected + * @param Model $result 数据对象 + * @param string $relation 当前关联名 + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包 + * @return void + */ + protected function eagerlyOne(&$result, $relation, $subRelation, $closure) + { + $localKey = $this->localKey; + $foreignKey = $this->foreignKey; + $data = $this->eagerlyWhere([ + [$foreignKey, '=', $result->$localKey], + ], $foreignKey, $relation, $subRelation, $closure); + + // 关联模型 + if (!isset($data[$result->$localKey])) { + $relationModel = null; + } else { + $relationModel = $data[$result->$localKey]; + $relationModel->setParent(clone $result); + $relationModel->isUpdate(true); + } + + if (!empty($this->bindAttr)) { + // 绑定关联属性 + $this->bindAttr($relationModel, $result, $this->bindAttr); + } else { + $result->setRelation(Loader::parseName($relation), $relationModel); + } + } + +} diff --git a/tp5/thinkphp/library/think/model/relation/MorphMany.php b/tp5/thinkphp/library/think/model/relation/MorphMany.php new file mode 100644 index 0000000..b3a4f39 --- /dev/null +++ b/tp5/thinkphp/library/think/model/relation/MorphMany.php @@ -0,0 +1,324 @@ + +// +---------------------------------------------------------------------- + +namespace think\model\relation; + +use think\db\Query; +use think\Exception; +use think\Loader; +use think\Model; +use think\model\Relation; + +class MorphMany extends Relation +{ + // 多态字段 + protected $morphKey; + protected $morphType; + // 多态类型 + protected $type; + + /** + * 架构函数 + * @access public + * @param Model $parent 上级模型对象 + * @param string $model 模型名 + * @param string $morphKey 关联外键 + * @param string $morphType 多态字段名 + * @param string $type 多态类型 + */ + public function __construct(Model $parent, $model, $morphKey, $morphType, $type) + { + $this->parent = $parent; + $this->model = $model; + $this->type = $type; + $this->morphKey = $morphKey; + $this->morphType = $morphType; + $this->query = (new $model)->db(); + } + + /** + * 延迟获取关联数据 + * @access public + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包查询条件 + * @return \think\Collection + */ + public function getRelation($subRelation = '', $closure = null) + { + if ($closure) { + $closure($this->query); + } + + $this->baseQuery(); + + $list = $this->query->relation($subRelation)->select(); + $parent = clone $this->parent; + + foreach ($list as &$model) { + $model->setParent($parent); + } + + return $list; + } + + /** + * 根据关联条件查询当前模型 + * @access public + * @param string $operator 比较操作符 + * @param integer $count 个数 + * @param string $id 关联表的统计字段 + * @param string $joinType JOIN类型 + * @return Query + */ + public function has($operator = '>=', $count = 1, $id = '*', $joinType = 'INNER') + { + throw new Exception('relation not support: has'); + } + + /** + * 根据关联条件查询当前模型 + * @access public + * @param mixed $where 查询条件(数组或者闭包) + * @param mixed $fields 字段 + * @return Query + */ + public function hasWhere($where = [], $fields = null) + { + throw new Exception('relation not support: hasWhere'); + } + + /** + * 预载入关联查询 + * @access public + * @param array $resultSet 数据集 + * @param string $relation 当前关联名 + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包 + * @return void + */ + public function eagerlyResultSet(&$resultSet, $relation, $subRelation, $closure) + { + $morphType = $this->morphType; + $morphKey = $this->morphKey; + $type = $this->type; + $range = []; + + foreach ($resultSet as $result) { + $pk = $result->getPk(); + // 获取关联外键列表 + if (isset($result->$pk)) { + $range[] = $result->$pk; + } + } + + if (!empty($range)) { + $where = [ + [$morphKey, 'in', $range], + [$morphType, '=', $type], + ]; + $data = $this->eagerlyMorphToMany($where, $relation, $subRelation, $closure); + + // 关联属性名 + $attr = Loader::parseName($relation); + + // 关联数据封装 + foreach ($resultSet as $result) { + if (!isset($data[$result->$pk])) { + $data[$result->$pk] = []; + } + + foreach ($data[$result->$pk] as &$relationModel) { + $relationModel->setParent(clone $result); + $relationModel->isUpdate(true); + } + + $result->setRelation($attr, $this->resultSetBuild($data[$result->$pk])); + } + } + } + + /** + * 预载入关联查询 + * @access public + * @param Model $result 数据对象 + * @param string $relation 当前关联名 + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包 + * @return void + */ + public function eagerlyResult(&$result, $relation, $subRelation, $closure) + { + $pk = $result->getPk(); + + if (isset($result->$pk)) { + $key = $result->$pk; + $where = [ + [$this->morphKey, '=', $key], + [$this->morphType, '=', $this->type], + ]; + $data = $this->eagerlyMorphToMany($where, $relation, $subRelation, $closure); + + if (!isset($data[$key])) { + $data[$key] = []; + } + + foreach ($data[$key] as &$relationModel) { + $relationModel->setParent(clone $result); + $relationModel->isUpdate(true); + } + + $result->setRelation(Loader::parseName($relation), $this->resultSetBuild($data[$key])); + } + } + + /** + * 关联统计 + * @access public + * @param Model $result 数据对象 + * @param \Closure $closure 闭包 + * @param string $aggregate 聚合查询方法 + * @param string $field 字段 + * @return integer + */ + public function relationCount($result, $closure, $aggregate = 'count', $field = '*') + { + $pk = $result->getPk(); + $count = 0; + + if (isset($result->$pk)) { + if ($closure) { + $closur($this->query); + } + + $count = $this->query + ->where([ + [$this->morphKey, '=', $result->$pk], + [$this->morphType, '=', $this->type], + ]) + ->$aggregate($field); + } + + return $count; + } + + /** + * 获取关联统计子查询 + * @access public + * @param \Closure $closure 闭包 + * @param string $aggregate 聚合查询方法 + * @param string $field 字段 + * @return string + */ + public function getRelationCountQuery($closure, $aggregate = 'count', $field = '*') + { + if ($closure) { + $closure($this->query); + } + + return $this->query + ->where([ + [$this->morphKey, 'exp', '=' . $this->parent->getTable() . '.' . $this->parent->getPk()], + [$this->morphType, '=', $this->type], + ]) + ->fetchSql() + ->$aggregate($field); + } + + /** + * 多态一对多 关联模型预查询 + * @access protected + * @param array $where 关联预查询条件 + * @param string $relation 关联名 + * @param string $subRelation 子关联 + * @param bool|\Closure $closure 闭包 + * @return array + */ + protected function eagerlyMorphToMany($where, $relation, $subRelation = '', $closure = false) + { + // 预载入关联查询 支持嵌套预载入 + $this->query->removeOptions('where'); + + if ($closure) { + $closure($this->query); + } + + $list = $this->query->where($where)->with($subRelation)->select(); + $morphKey = $this->morphKey; + + // 组装模型数据 + $data = []; + foreach ($list as $set) { + $data[$set->$morphKey][] = $set; + } + + return $data; + } + + /** + * 保存(新增)当前关联数据对象 + * @access public + * @param mixed $data 数据 可以使用数组 关联模型对象 和 关联对象的主键 + * @return Model|false + */ + public function save($data) + { + if ($data instanceof Model) { + $data = $data->getData(); + } + + // 保存关联表数据 + $pk = $this->parent->getPk(); + + $model = new $this->model; + + $data[$this->morphKey] = $this->parent->$pk; + $data[$this->morphType] = $this->type; + + return $model->save($data) ? $model : false; + } + + /** + * 批量保存当前关联数据对象 + * @access public + * @param array $dataSet 数据集 + * @return array|false + */ + public function saveAll(array $dataSet) + { + $result = []; + + foreach ($dataSet as $key => $data) { + $result[] = $this->save($data); + } + + return empty($result) ? false : $result; + } + + /** + * 执行基础查询(仅执行一次) + * @access protected + * @return void + */ + protected function baseQuery() + { + if (empty($this->baseQuery) && $this->parent->getData()) { + $pk = $this->parent->getPk(); + + $this->query->where([ + [$this->morphKey, '=', $this->parent->$pk], + [$this->morphType, '=', $this->type], + ]); + + $this->baseQuery = true; + } + } + +} diff --git a/tp5/thinkphp/library/think/model/relation/MorphOne.php b/tp5/thinkphp/library/think/model/relation/MorphOne.php new file mode 100644 index 0000000..0944400 --- /dev/null +++ b/tp5/thinkphp/library/think/model/relation/MorphOne.php @@ -0,0 +1,245 @@ + +// +---------------------------------------------------------------------- + +namespace think\model\relation; + +use think\db\Query; +use think\Exception; +use think\Loader; +use think\Model; +use think\model\Relation; + +class MorphOne extends Relation +{ + // 多态字段 + protected $morphKey; + protected $morphType; + // 多态类型 + protected $type; + + /** + * 构造函数 + * @access public + * @param Model $parent 上级模型对象 + * @param string $model 模型名 + * @param string $morphKey 关联外键 + * @param string $morphType 多态字段名 + * @param string $type 多态类型 + */ + public function __construct(Model $parent, $model, $morphKey, $morphType, $type) + { + $this->parent = $parent; + $this->model = $model; + $this->type = $type; + $this->morphKey = $morphKey; + $this->morphType = $morphType; + $this->query = (new $model)->db(); + } + + /** + * 延迟获取关联数据 + * @access public + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包查询条件 + * @return Model + */ + public function getRelation($subRelation = '', $closure = null) + { + if ($closure) { + $closure($this->query); + } + + $this->baseQuery(); + + $relationModel = $this->query->relation($subRelation)->find(); + + if ($relationModel) { + $relationModel->setParent(clone $this->parent); + } + + return $relationModel; + } + + /** + * 根据关联条件查询当前模型 + * @access public + * @param string $operator 比较操作符 + * @param integer $count 个数 + * @param string $id 关联表的统计字段 + * @param string $joinType JOIN类型 + * @return Query + */ + public function has($operator = '>=', $count = 1, $id = '*', $joinType = 'INNER') + { + return $this->parent; + } + + /** + * 根据关联条件查询当前模型 + * @access public + * @param mixed $where 查询条件(数组或者闭包) + * @param mixed $fields 字段 + * @return Query + */ + public function hasWhere($where = [], $fields = null) + { + throw new Exception('relation not support: hasWhere'); + } + + /** + * 预载入关联查询 + * @access public + * @param array $resultSet 数据集 + * @param string $relation 当前关联名 + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包 + * @return void + */ + public function eagerlyResultSet(&$resultSet, $relation, $subRelation, $closure) + { + $morphType = $this->morphType; + $morphKey = $this->morphKey; + $type = $this->type; + $range = []; + + foreach ($resultSet as $result) { + $pk = $result->getPk(); + // 获取关联外键列表 + if (isset($result->$pk)) { + $range[] = $result->$pk; + } + } + + if (!empty($range)) { + $data = $this->eagerlyMorphToOne([ + [$morphKey, 'in', $range], + [$morphType, '=', $type], + ], $relation, $subRelation, $closure); + + // 关联属性名 + $attr = Loader::parseName($relation); + + // 关联数据封装 + foreach ($resultSet as $result) { + if (!isset($data[$result->$pk])) { + $relationModel = null; + } else { + $relationModel = $data[$result->$pk]; + $relationModel->setParent(clone $result); + $relationModel->isUpdate(true); + } + + $result->setRelation($attr, $relationModel); + } + } + } + + /** + * 预载入关联查询 + * @access public + * @param Model $result 数据对象 + * @param string $relation 当前关联名 + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包 + * @return void + */ + public function eagerlyResult(&$result, $relation, $subRelation, $closure) + { + $pk = $result->getPk(); + + if (isset($result->$pk)) { + $pk = $result->$pk; + $data = $this->eagerlyMorphToOne([ + [$this->morphKey, '=', $pk], + [$this->morphType, '=', $this->type], + ], $relation, $subRelation, $closure); + + if (isset($data[$pk])) { + $relationModel = $data[$pk]; + $relationModel->setParent(clone $result); + $relationModel->isUpdate(true); + } else { + $relationModel = null; + } + + $result->setRelation(Loader::parseName($relation), $relationModel); + } + } + + /** + * 多态一对一 关联模型预查询 + * @access protected + * @param array $where 关联预查询条件 + * @param string $relation 关联名 + * @param string $subRelation 子关联 + * @param bool|\Closure $closure 闭包 + * @return array + */ + protected function eagerlyMorphToOne($where, $relation, $subRelation = '', $closure = false) + { + // 预载入关联查询 支持嵌套预载入 + if ($closure) { + $closure($this->query); + } + + $list = $this->query->where($where)->with($subRelation)->find(); + $morphKey = $this->morphKey; + + // 组装模型数据 + $data = []; + + foreach ($list as $set) { + $data[$set->$morphKey] = $set; + } + + return $data; + } + + /** + * 保存(新增)当前关联数据对象 + * @access public + * @param mixed $data 数据 可以使用数组 关联模型对象 和 关联对象的主键 + * @return Model|false + */ + public function save($data) + { + if ($data instanceof Model) { + $data = $data->getData(); + } + // 保存关联表数据 + $pk = $this->parent->getPk(); + + $model = new $this->model; + + $data[$this->morphKey] = $this->parent->$pk; + $data[$this->morphType] = $this->type; + return $model->save($data) ? $model : false; + } + + /** + * 执行基础查询(进执行一次) + * @access protected + * @return void + */ + protected function baseQuery() + { + if (empty($this->baseQuery) && $this->parent->getData()) { + $pk = $this->parent->getPk(); + + $this->query->where([ + [$this->morphKey, '=', $this->parent->$pk], + [$this->morphType, '=', $this->type], + ]); + $this->baseQuery = true; + } + } + +} diff --git a/tp5/thinkphp/library/think/model/relation/MorphTo.php b/tp5/thinkphp/library/think/model/relation/MorphTo.php new file mode 100644 index 0000000..208c6ec --- /dev/null +++ b/tp5/thinkphp/library/think/model/relation/MorphTo.php @@ -0,0 +1,306 @@ + +// +---------------------------------------------------------------------- + +namespace think\model\relation; + +use think\Exception; +use think\Loader; +use think\Model; +use think\model\Relation; + +class MorphTo extends Relation +{ + // 多态字段 + protected $morphKey; + protected $morphType; + // 多态别名 + protected $alias; + // 关联名 + protected $relation; + + /** + * 架构函数 + * @access public + * @param Model $parent 上级模型对象 + * @param string $morphType 多态字段名 + * @param string $morphKey 外键名 + * @param array $alias 多态别名定义 + * @param string $relation 关联名 + */ + public function __construct(Model $parent, $morphType, $morphKey, $alias = [], $relation = null) + { + $this->parent = $parent; + $this->morphType = $morphType; + $this->morphKey = $morphKey; + $this->alias = $alias; + $this->relation = $relation; + } + + /** + * 获取当前的关联模型类的实例 + * @access public + * @return Model + */ + public function getModel() + { + $morphType = $this->morphType; + $model = $this->parseModel($this->parent->$morphType); + + return (new $model); + } + + /** + * 延迟获取关联数据 + * @access public + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包查询条件 + * @return Model + */ + public function getRelation($subRelation = '', $closure = null) + { + $morphKey = $this->morphKey; + $morphType = $this->morphType; + + // 多态模型 + $model = $this->parseModel($this->parent->$morphType); + + // 主键数据 + $pk = $this->parent->$morphKey; + + $relationModel = (new $model)->relation($subRelation)->find($pk); + + if ($relationModel) { + $relationModel->setParent(clone $this->parent); + } + + return $relationModel; + } + + /** + * 根据关联条件查询当前模型 + * @access public + * @param string $operator 比较操作符 + * @param integer $count 个数 + * @param string $id 关联表的统计字段 + * @param string $joinType JOIN类型 + * @return Query + */ + public function has($operator = '>=', $count = 1, $id = '*', $joinType = 'INNER') + { + return $this->parent; + } + + /** + * 根据关联条件查询当前模型 + * @access public + * @param mixed $where 查询条件(数组或者闭包) + * @param mixed $fields 字段 + * @return Query + */ + public function hasWhere($where = [], $fields = null) + { + throw new Exception('relation not support: hasWhere'); + } + + /** + * 解析模型的完整命名空间 + * @access public + * @param string $model 模型名(或者完整类名) + * @return string + */ + protected function parseModel($model) + { + if (isset($this->alias[$model])) { + $model = $this->alias[$model]; + } + + if (false === strpos($model, '\\')) { + $path = explode('\\', get_class($this->parent)); + array_pop($path); + array_push($path, Loader::parseName($model, 1)); + $model = implode('\\', $path); + } + + return $model; + } + + /** + * 设置多态别名 + * @access public + * @param array $alias 别名定义 + * @return $this + */ + public function setAlias($alias) + { + $this->alias = $alias; + + return $this; + } + + /** + * 移除关联查询参数 + * @access public + * @return $this + */ + public function removeOption() + { + return $this; + } + + /** + * 预载入关联查询 + * @access public + * @param array $resultSet 数据集 + * @param string $relation 当前关联名 + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包 + * @return void + * @throws Exception + */ + public function eagerlyResultSet(&$resultSet, $relation, $subRelation, $closure) + { + $morphKey = $this->morphKey; + $morphType = $this->morphType; + $range = []; + + foreach ($resultSet as $result) { + // 获取关联外键列表 + if (!empty($result->$morphKey)) { + $range[$result->$morphType][] = $result->$morphKey; + } + } + + if (!empty($range)) { + // 关联属性名 + $attr = Loader::parseName($relation); + + foreach ($range as $key => $val) { + // 多态类型映射 + $model = $this->parseModel($key); + $obj = new $model; + $pk = $obj->getPk(); + $list = $obj->all($val, $subRelation); + $data = []; + + foreach ($list as $k => $vo) { + $data[$vo->$pk] = $vo; + } + + foreach ($resultSet as $result) { + if ($key == $result->$morphType) { + // 关联模型 + if (!isset($data[$result->$morphKey])) { + throw new Exception('relation data not exists :' . $this->model); + } else { + $relationModel = $data[$result->$morphKey]; + $relationModel->setParent(clone $result); + $relationModel->isUpdate(true); + + $result->setRelation($attr, $relationModel); + } + } + } + } + } + } + + /** + * 预载入关联查询 + * @access public + * @param Model $result 数据对象 + * @param string $relation 当前关联名 + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包 + * @return void + */ + public function eagerlyResult(&$result, $relation, $subRelation, $closure) + { + $morphKey = $this->morphKey; + $morphType = $this->morphType; + // 多态类型映射 + $model = $this->parseModel($result->{$this->morphType}); + + $this->eagerlyMorphToOne($model, $relation, $result, $subRelation); + } + + /** + * 关联统计 + * @access public + * @param Model $result 数据对象 + * @param \Closure $closure 闭包 + * @param string $aggregate 聚合查询方法 + * @param string $field 字段 + * @return integer + */ + public function relationCount($result, $closure, $aggregate = 'count', $field = '*') + {} + + /** + * 多态MorphTo 关联模型预查询 + * @access protected + * @param string $model 关联模型对象 + * @param string $relation 关联名 + * @param Model $result + * @param string $subRelation 子关联 + * @return void + */ + protected function eagerlyMorphToOne($model, $relation, &$result, $subRelation = '') + { + // 预载入关联查询 支持嵌套预载入 + $pk = $this->parent->{$this->morphKey}; + $data = (new $model)->with($subRelation)->find($pk); + + if ($data) { + $data->setParent(clone $result); + $data->isUpdate(true); + } + + $result->setRelation(Loader::parseName($relation), $data ?: null); + } + + /** + * 添加关联数据 + * @access public + * @param Model $model 关联模型对象 + * @param string $type 多态类型 + * @return Model + */ + public function associate($model, $type = '') + { + $morphKey = $this->morphKey; + $morphType = $this->morphType; + $pk = $model->getPk(); + + $this->parent->setAttr($morphKey, $model->$pk); + $this->parent->setAttr($morphType, $type ?: get_class($model)); + $this->parent->save(); + + return $this->parent->setRelation($this->relation, $model); + } + + /** + * 注销关联数据 + * @access public + * @return Model + */ + public function dissociate() + { + $morphKey = $this->morphKey; + $morphType = $this->morphType; + + $this->parent->setAttr($morphKey, null); + $this->parent->setAttr($morphType, null); + $this->parent->save(); + + return $this->parent->setRelation($this->relation, null); + } + +} diff --git a/tp5/thinkphp/library/think/model/relation/OneToOne.php b/tp5/thinkphp/library/think/model/relation/OneToOne.php new file mode 100644 index 0000000..195d0bd --- /dev/null +++ b/tp5/thinkphp/library/think/model/relation/OneToOne.php @@ -0,0 +1,342 @@ + +// +---------------------------------------------------------------------- + +namespace think\model\relation; + +use think\db\Query; +use think\Exception; +use think\Loader; +use think\Model; +use think\model\Relation; + +/** + * Class OneToOne + * @package think\model\relation + * + */ +abstract class OneToOne extends Relation +{ + // 预载入方式 0 -JOIN 1 -IN + protected $eagerlyType = 1; + // 当前关联的JOIN类型 + protected $joinType; + // 要绑定的属性 + protected $bindAttr = []; + // 关联名 + protected $relation; + + /** + * 设置join类型 + * @access public + * @param string $type JOIN类型 + * @return $this + */ + public function joinType($type) + { + $this->joinType = $type; + return $this; + } + + /** + * 预载入关联查询(JOIN方式) + * @access public + * @param Query $query 查询对象 + * @param string $relation 关联名 + * @param string $subRelation 子关联 + * @param \Closure $closure 闭包条件 + * @param bool $first + * @return void + */ + public function eagerly(Query $query, $relation, $subRelation, $closure, $first) + { + $name = Loader::parseName(basename(str_replace('\\', '/', get_class($this->parent)))); + + if ($first) { + $table = $query->getTable(); + $query->table([$table => $name]); + + if ($query->getOptions('field')) { + $field = $query->getOptions('field'); + $query->removeOption('field'); + } else { + $field = true; + } + + $query->field($field, false, $table, $name); + } + + // 预载入封装 + $joinTable = $this->query->getTable(); + $joinAlias = $relation; + $query->via($joinAlias); + + if ($this instanceof BelongsTo) { + $query->join([$joinTable => $joinAlias], $name . '.' . $this->foreignKey . '=' . $joinAlias . '.' . $this->localKey, $this->joinType); + } else { + $query->join([$joinTable => $joinAlias], $name . '.' . $this->localKey . '=' . $joinAlias . '.' . $this->foreignKey, $this->joinType); + } + + if ($closure) { + // 执行闭包查询 + $closure($query); + // 使用withField指定获取关联的字段,如 + // $query->where(['id'=>1])->withField('id,name'); + if ($query->getOptions('with_field')) { + $field = $query->getOptions('with_field'); + $query->removeOption('with_field'); + } else { + $field = true; + } + } elseif (isset($this->option['field'])) { + $field = $this->option['field']; + } else { + $field = true; + } + + $query->field($field, false, $joinTable, $joinAlias, $relation . '__'); + } + + /** + * 预载入关联查询(数据集) + * @access protected + * @param array $resultSet + * @param string $relation + * @param string $subRelation + * @param \Closure $closure + * @return mixed + */ + abstract protected function eagerlySet(&$resultSet, $relation, $subRelation, $closure); + + /** + * 预载入关联查询(数据) + * @access protected + * @param Model $result + * @param string $relation + * @param string $subRelation + * @param \Closure $closure + * @return mixed + */ + abstract protected function eagerlyOne(&$result, $relation, $subRelation, $closure); + + /** + * 预载入关联查询(数据集) + * @access public + * @param array $resultSet 数据集 + * @param string $relation 当前关联名 + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包 + * @return void + */ + public function eagerlyResultSet(&$resultSet, $relation, $subRelation, $closure) + { + if (1 == $this->eagerlyType) { + // IN查询 + $this->eagerlySet($resultSet, $relation, $subRelation, $closure); + } else { + // 模型关联组装 + foreach ($resultSet as $result) { + $this->match($this->model, $relation, $result); + } + } + } + + /** + * 预载入关联查询(数据) + * @access public + * @param Model $result 数据对象 + * @param string $relation 当前关联名 + * @param string $subRelation 子关联名 + * @param \Closure $closure 闭包 + * @return void + */ + public function eagerlyResult(&$result, $relation, $subRelation, $closure) + { + if (1 == $this->eagerlyType) { + // IN查询 + $this->eagerlyOne($result, $relation, $subRelation, $closure); + } else { + // 模型关联组装 + $this->match($this->model, $relation, $result); + } + } + + /** + * 保存(新增)当前关联数据对象 + * @access public + * @param mixed $data 数据 可以使用数组 关联模型对象 和 关联对象的主键 + * @return Model|false + */ + public function save($data) + { + if ($data instanceof Model) { + $data = $data->getData(); + } + + $model = new $this->model; + // 保存关联表数据 + $data[$this->foreignKey] = $this->parent->{$this->localKey}; + + return $model->save($data) ? $model : false; + } + + /** + * 设置预载入方式 + * @access public + * @param integer $type 预载入方式 0 JOIN查询 1 IN查询 + * @return $this + */ + public function setEagerlyType($type) + { + $this->eagerlyType = $type; + + return $this; + } + + /** + * 获取预载入方式 + * @access public + * @return integer + */ + public function getEagerlyType() + { + return $this->eagerlyType; + } + + /** + * 绑定关联表的属性到父模型属性 + * @access public + * @param mixed $attr 要绑定的属性列表 + * @return $this + */ + public function bind($attr) + { + if (is_string($attr)) { + $attr = explode(',', $attr); + } + $this->bindAttr = $attr; + + return $this; + } + + /** + * 获取绑定属性 + * @access public + * @return array + */ + public function getBindAttr() + { + return $this->bindAttr; + } + + /** + * 关联统计 + * @access public + * @param Model $result 数据对象 + * @param \Closure $closure 闭包 + * @param string $aggregate 聚合查询方法 + * @param string $field 字段 + * @return integer + */ + public function relationCount($result, $closure, $aggregate = 'count', $field = '*') + { + throw new Exception('relation not support: ' . $aggregate); + } + + /** + * 一对一 关联模型预查询拼装 + * @access public + * @param string $model 模型名称 + * @param string $relation 关联名 + * @param Model $result 模型对象实例 + * @return void + */ + protected function match($model, $relation, &$result) + { + // 重新组装模型数据 + foreach ($result->getData() as $key => $val) { + if (strpos($key, '__')) { + list($name, $attr) = explode('__', $key, 2); + if ($name == $relation) { + $list[$name][$attr] = $val; + unset($result->$key); + } + } + } + + if (isset($list[$relation])) { + $relationModel = new $model($list[$relation]); + $relationModel->setParent(clone $result); + $relationModel->isUpdate(true); + + if (!empty($this->bindAttr)) { + $this->bindAttr($relationModel, $result, $this->bindAttr); + } + } else { + $relationModel = null; + } + + $result->setRelation(Loader::parseName($relation), $relationModel); + } + + /** + * 绑定关联属性到父模型 + * @access protected + * @param Model $model 关联模型对象 + * @param Model $result 父模型对象 + * @return void + * @throws Exception + */ + protected function bindAttr($model, &$result) + { + foreach ($this->bindAttr as $key => $attr) { + $key = is_numeric($key) ? $attr : $key; + if (isset($result->$key)) { + throw new Exception('bind attr has exists:' . $key); + } else { + $result->setAttr($key, $model ? $model->$attr : null); + } + } + } + + /** + * 一对一 关联模型预查询(IN方式) + * @access public + * @param array $where 关联预查询条件 + * @param string $key 关联键名 + * @param string $relation 关联名 + * @param string $subRelation 子关联 + * @param bool|\Closure $closure + * @return array + */ + protected function eagerlyWhere($where, $key, $relation, $subRelation = '', $closure = false) + { + // 预载入关联查询 支持嵌套预载入 + if ($closure) { + $closure($this->query); + + if ($field = $this->query->getOptions('with_field')) { + $this->query->field($field)->removeOption('with_field'); + } + } + + $list = $this->query->where($where)->with($subRelation)->select(); + + // 组装模型数据 + $data = []; + + foreach ($list as $set) { + $data[$set->$key] = $set; + } + + return $data; + } + +} diff --git a/tp5/thinkphp/library/think/paginator/Collection.php b/tp5/thinkphp/library/think/paginator/Collection.php new file mode 100644 index 0000000..4005c9f --- /dev/null +++ b/tp5/thinkphp/library/think/paginator/Collection.php @@ -0,0 +1,74 @@ + +// +---------------------------------------------------------------------- + +namespace think\paginator; + +use Exception; +use think\Paginator; + +/** + * Class Collection + * @package think\paginator + * @method integer total() + * @method integer listRows() + * @method integer currentPage() + * @method string render() + * @method Paginator fragment($fragment) + * @method Paginator appends($key, $value) + * @method integer lastPage() + * @method boolean hasPages() + */ +class Collection extends \think\Collection +{ + + /** @var Paginator */ + protected $paginator; + + public function __construct($items = [], Paginator $paginator = null) + { + $this->paginator = $paginator; + parent::__construct($items); + } + + public static function make($items = [], Paginator $paginator = null) + { + return new static($items, $paginator); + } + + public function toArray() + { + if ($this->paginator) { + try { + $total = $this->total(); + } catch (Exception $e) { + $total = null; + } + + return [ + 'total' => $total, + 'per_page' => $this->listRows(), + 'current_page' => $this->currentPage(), + 'data' => parent::toArray(), + ]; + } else { + return parent::toArray(); + } + } + + public function __call($method, $args) + { + if ($this->paginator && method_exists($this->paginator, $method)) { + return call_user_func_array([$this->paginator, $method], $args); + } else { + throw new Exception('method not exists:' . __CLASS__ . '->' . $method); + } + } +} diff --git a/tp5/thinkphp/library/think/paginator/driver/Bootstrap.php b/tp5/thinkphp/library/think/paginator/driver/Bootstrap.php new file mode 100644 index 0000000..ab5315c --- /dev/null +++ b/tp5/thinkphp/library/think/paginator/driver/Bootstrap.php @@ -0,0 +1,206 @@ + +// +---------------------------------------------------------------------- + +namespace think\paginator\driver; + +use think\Paginator; + +class Bootstrap extends Paginator +{ + + /** + * 上一页按钮 + * @param string $text + * @return string + */ + protected function getPreviousButton($text = "«") + { + + if ($this->currentPage() <= 1) { + return $this->getDisabledTextWrapper($text); + } + + $url = $this->url( + $this->currentPage() - 1 + ); + + return $this->getPageLinkWrapper($url, $text); + } + + /** + * 下一页按钮 + * @param string $text + * @return string + */ + protected function getNextButton($text = '»') + { + if (!$this->hasMore) { + return $this->getDisabledTextWrapper($text); + } + + $url = $this->url($this->currentPage() + 1); + + return $this->getPageLinkWrapper($url, $text); + } + + /** + * 页码按钮 + * @return string + */ + protected function getLinks() + { + if ($this->simple) { + return ''; + } + + $block = [ + 'first' => null, + 'slider' => null, + 'last' => null, + ]; + + $side = 3; + $window = $side * 2; + + if ($this->lastPage < $window + 6) { + $block['first'] = $this->getUrlRange(1, $this->lastPage); + } elseif ($this->currentPage <= $window) { + $block['first'] = $this->getUrlRange(1, $window + 2); + $block['last'] = $this->getUrlRange($this->lastPage - 1, $this->lastPage); + } elseif ($this->currentPage > ($this->lastPage - $window)) { + $block['first'] = $this->getUrlRange(1, 2); + $block['last'] = $this->getUrlRange($this->lastPage - ($window + 2), $this->lastPage); + } else { + $block['first'] = $this->getUrlRange(1, 2); + $block['slider'] = $this->getUrlRange($this->currentPage - $side, $this->currentPage + $side); + $block['last'] = $this->getUrlRange($this->lastPage - 1, $this->lastPage); + } + + $html = ''; + + if (is_array($block['first'])) { + $html .= $this->getUrlLinks($block['first']); + } + + if (is_array($block['slider'])) { + $html .= $this->getDots(); + $html .= $this->getUrlLinks($block['slider']); + } + + if (is_array($block['last'])) { + $html .= $this->getDots(); + $html .= $this->getUrlLinks($block['last']); + } + + return $html; + } + + /** + * 渲染分页html + * @return mixed + */ + public function render() + { + if ($this->hasPages()) { + if ($this->simple) { + return sprintf( + '
    %s %s
', + $this->getPreviousButton(), + $this->getNextButton() + ); + } else { + return sprintf( + '
    %s %s %s
', + $this->getPreviousButton(), + $this->getLinks(), + $this->getNextButton() + ); + } + } + } + + /** + * 生成一个可点击的按钮 + * + * @param string $url + * @param int $page + * @return string + */ + protected function getAvailablePageWrapper($url, $page) + { + return '
  • ' . $page . '
  • '; + } + + /** + * 生成一个禁用的按钮 + * + * @param string $text + * @return string + */ + protected function getDisabledTextWrapper($text) + { + return '
  • ' . $text . '
  • '; + } + + /** + * 生成一个激活的按钮 + * + * @param string $text + * @return string + */ + protected function getActivePageWrapper($text) + { + return '
  • ' . $text . '
  • '; + } + + /** + * 生成省略号按钮 + * + * @return string + */ + protected function getDots() + { + return $this->getDisabledTextWrapper('...'); + } + + /** + * 批量生成页码按钮. + * + * @param array $urls + * @return string + */ + protected function getUrlLinks(array $urls) + { + $html = ''; + + foreach ($urls as $page => $url) { + $html .= $this->getPageLinkWrapper($url, $page); + } + + return $html; + } + + /** + * 生成普通页码按钮 + * + * @param string $url + * @param int $page + * @return string + */ + protected function getPageLinkWrapper($url, $page) + { + if ($this->currentPage() == $page) { + return $this->getActivePageWrapper($page); + } + + return $this->getAvailablePageWrapper($url, $page); + } +} diff --git a/tp5/thinkphp/library/think/process/Builder.php b/tp5/thinkphp/library/think/process/Builder.php new file mode 100644 index 0000000..da56163 --- /dev/null +++ b/tp5/thinkphp/library/think/process/Builder.php @@ -0,0 +1,233 @@ + +// +---------------------------------------------------------------------- + +namespace think\process; + +use think\Process; + +class Builder +{ + private $arguments; + private $cwd; + private $env = null; + private $input; + private $timeout = 60; + private $options = []; + private $inheritEnv = true; + private $prefix = []; + private $outputDisabled = false; + + /** + * 构造方法 + * @param string[] $arguments 参数 + */ + public function __construct(array $arguments = []) + { + $this->arguments = $arguments; + } + + /** + * 创建一个实例 + * @param string[] $arguments 参数 + * @return self + */ + public static function create(array $arguments = []) + { + return new static($arguments); + } + + /** + * 添加一个参数 + * @param string $argument 参数 + * @return self + */ + public function add($argument) + { + $this->arguments[] = $argument; + + return $this; + } + + /** + * 添加一个前缀 + * @param string|array $prefix + * @return self + */ + public function setPrefix($prefix) + { + $this->prefix = is_array($prefix) ? $prefix : [$prefix]; + + return $this; + } + + /** + * 设置参数 + * @param string[] $arguments + * @return self + */ + public function setArguments(array $arguments) + { + $this->arguments = $arguments; + + return $this; + } + + /** + * 设置工作目录 + * @param null|string $cwd + * @return self + */ + public function setWorkingDirectory($cwd) + { + $this->cwd = $cwd; + + return $this; + } + + /** + * 是否初始化环境变量 + * @param bool $inheritEnv + * @return self + */ + public function inheritEnvironmentVariables($inheritEnv = true) + { + $this->inheritEnv = $inheritEnv; + + return $this; + } + + /** + * 设置环境变量 + * @param string $name + * @param null|string $value + * @return self + */ + public function setEnv($name, $value) + { + $this->env[$name] = $value; + + return $this; + } + + /** + * 添加环境变量 + * @param array $variables + * @return self + */ + public function addEnvironmentVariables(array $variables) + { + $this->env = array_replace($this->env, $variables); + + return $this; + } + + /** + * 设置输入 + * @param mixed $input + * @return self + */ + public function setInput($input) + { + $this->input = Utils::validateInput(sprintf('%s::%s', __CLASS__, __FUNCTION__), $input); + + return $this; + } + + /** + * 设置超时时间 + * @param float|null $timeout + * @return self + */ + public function setTimeout($timeout) + { + if (null === $timeout) { + $this->timeout = null; + + return $this; + } + + $timeout = (float) $timeout; + + if ($timeout < 0) { + throw new \InvalidArgumentException('The timeout value must be a valid positive integer or float number.'); + } + + $this->timeout = $timeout; + + return $this; + } + + /** + * 设置proc_open选项 + * @param string $name + * @param string $value + * @return self + */ + public function setOption($name, $value) + { + $this->options[$name] = $value; + + return $this; + } + + /** + * 禁止输出 + * @return self + */ + public function disableOutput() + { + $this->outputDisabled = true; + + return $this; + } + + /** + * 开启输出 + * @return self + */ + public function enableOutput() + { + $this->outputDisabled = false; + + return $this; + } + + /** + * 创建一个Process实例 + * @return Process + */ + public function getProcess() + { + if (0 === count($this->prefix) && 0 === count($this->arguments)) { + throw new \LogicException('You must add() command arguments before calling getProcess().'); + } + + $options = $this->options; + + $arguments = array_merge($this->prefix, $this->arguments); + $script = implode(' ', array_map([__NAMESPACE__ . '\\Utils', 'escapeArgument'], $arguments)); + + if ($this->inheritEnv) { + // include $_ENV for BC purposes + $env = array_replace($_ENV, $_SERVER, $this->env); + } else { + $env = $this->env; + } + + $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options); + + if ($this->outputDisabled) { + $process->disableOutput(); + } + + return $process; + } +} diff --git a/tp5/thinkphp/library/think/process/Utils.php b/tp5/thinkphp/library/think/process/Utils.php new file mode 100644 index 0000000..f94c648 --- /dev/null +++ b/tp5/thinkphp/library/think/process/Utils.php @@ -0,0 +1,75 @@ + +// +---------------------------------------------------------------------- + +namespace think\process; + +class Utils +{ + + /** + * 转义字符串 + * @param string $argument + * @return string + */ + public static function escapeArgument($argument) + { + + if ('' === $argument) { + return escapeshellarg($argument); + } + $escapedArgument = ''; + $quote = false; + foreach (preg_split('/(")/i', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) { + if ('"' === $part) { + $escapedArgument .= '\\"'; + } elseif (self::isSurroundedBy($part, '%')) { + // Avoid environment variable expansion + $escapedArgument .= '^%"' . substr($part, 1, -1) . '"^%'; + } else { + // escape trailing backslash + if ('\\' === substr($part, -1)) { + $part .= '\\'; + } + $quote = true; + $escapedArgument .= $part; + } + } + if ($quote) { + $escapedArgument = '"' . $escapedArgument . '"'; + } + return $escapedArgument; + } + + /** + * 验证并进行规范化Process输入。 + * @param string $caller + * @param mixed $input + * @return string + * @throws \InvalidArgumentException + */ + public static function validateInput($caller, $input) + { + if (null !== $input) { + if (is_resource($input)) { + return $input; + } + if (is_scalar($input)) { + return (string) $input; + } + throw new \InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller)); + } + return $input; + } + + private static function isSurroundedBy($arg, $char) + { + return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1]; + } + +} diff --git a/tp5/thinkphp/library/think/process/exception/Faild.php b/tp5/thinkphp/library/think/process/exception/Faild.php new file mode 100644 index 0000000..38647bc --- /dev/null +++ b/tp5/thinkphp/library/think/process/exception/Faild.php @@ -0,0 +1,42 @@ + +// +---------------------------------------------------------------------- + +namespace think\process\exception; + +use think\Process; + +class Faild extends \RuntimeException +{ + + private $process; + + public function __construct(Process $process) + { + if ($process->isSuccessful()) { + throw new \InvalidArgumentException('Expected a failed process, but the given process was successful.'); + } + + $error = sprintf('The command "%s" failed.' . "\nExit Code: %s(%s)", $process->getCommandLine(), $process->getExitCode(), $process->getExitCodeText()); + + if (!$process->isOutputDisabled()) { + $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s", $process->getOutput(), $process->getErrorOutput()); + } + + parent::__construct($error); + + $this->process = $process; + } + + public function getProcess() + { + return $this->process; + } +} diff --git a/tp5/thinkphp/library/think/process/exception/Failed.php b/tp5/thinkphp/library/think/process/exception/Failed.php new file mode 100644 index 0000000..5295082 --- /dev/null +++ b/tp5/thinkphp/library/think/process/exception/Failed.php @@ -0,0 +1,42 @@ + +// +---------------------------------------------------------------------- + +namespace think\process\exception; + +use think\Process; + +class Failed extends \RuntimeException +{ + + private $process; + + public function __construct(Process $process) + { + if ($process->isSuccessful()) { + throw new \InvalidArgumentException('Expected a failed process, but the given process was successful.'); + } + + $error = sprintf('The command "%s" failed.' . "\nExit Code: %s(%s)", $process->getCommandLine(), $process->getExitCode(), $process->getExitCodeText()); + + if (!$process->isOutputDisabled()) { + $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s", $process->getOutput(), $process->getErrorOutput()); + } + + parent::__construct($error); + + $this->process = $process; + } + + public function getProcess() + { + return $this->process; + } +} diff --git a/tp5/thinkphp/library/think/process/exception/Timeout.php b/tp5/thinkphp/library/think/process/exception/Timeout.php new file mode 100644 index 0000000..d5f1162 --- /dev/null +++ b/tp5/thinkphp/library/think/process/exception/Timeout.php @@ -0,0 +1,61 @@ + +// +---------------------------------------------------------------------- + +namespace think\process\exception; + +use think\Process; + +class Timeout extends \RuntimeException +{ + + const TYPE_GENERAL = 1; + const TYPE_IDLE = 2; + + private $process; + private $timeoutType; + + public function __construct(Process $process, $timeoutType) + { + $this->process = $process; + $this->timeoutType = $timeoutType; + + parent::__construct(sprintf('The process "%s" exceeded the timeout of %s seconds.', $process->getCommandLine(), $this->getExceededTimeout())); + } + + public function getProcess() + { + return $this->process; + } + + public function isGeneralTimeout() + { + return $this->timeoutType === self::TYPE_GENERAL; + } + + public function isIdleTimeout() + { + return $this->timeoutType === self::TYPE_IDLE; + } + + public function getExceededTimeout() + { + switch ($this->timeoutType) { + case self::TYPE_GENERAL: + return $this->process->getTimeout(); + + case self::TYPE_IDLE: + return $this->process->getIdleTimeout(); + + default: + throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType)); + } + } +} diff --git a/tp5/thinkphp/library/think/process/pipes/Pipes.php b/tp5/thinkphp/library/think/process/pipes/Pipes.php new file mode 100644 index 0000000..82396b8 --- /dev/null +++ b/tp5/thinkphp/library/think/process/pipes/Pipes.php @@ -0,0 +1,93 @@ + +// +---------------------------------------------------------------------- + +namespace think\process\pipes; + +abstract class Pipes +{ + + /** @var array */ + public $pipes = []; + + /** @var string */ + protected $inputBuffer = ''; + /** @var resource|null */ + protected $input; + + /** @var bool */ + private $blocked = true; + + const CHUNK_SIZE = 16384; + + /** + * 返回用于 proc_open 描述符的数组 + * @return array + */ + abstract public function getDescriptors(); + + /** + * 返回一个数组的索引由其相关的流,以防这些管道使用的临时文件的文件名。 + * @return string[] + */ + abstract public function getFiles(); + + /** + * 文件句柄和管道中读取数据。 + * @param bool $blocking 是否使用阻塞调用 + * @param bool $close 是否要关闭管道,如果他们已经到达 EOF。 + * @return string[] + */ + abstract public function readAndWrite($blocking, $close = false); + + /** + * 返回当前状态如果有打开的文件句柄或管道。 + * @return bool + */ + abstract public function areOpen(); + + /** + * {@inheritdoc} + */ + public function close() + { + foreach ($this->pipes as $pipe) { + fclose($pipe); + } + $this->pipes = []; + } + + /** + * 检查系统调用已被中断 + * @return bool + */ + protected function hasSystemCallBeenInterrupted() + { + $lastError = error_get_last(); + + return isset($lastError['message']) && false !== stripos($lastError['message'], 'interrupted system call'); + } + + protected function unblock() + { + if (!$this->blocked) { + return; + } + + foreach ($this->pipes as $pipe) { + stream_set_blocking($pipe, 0); + } + if (null !== $this->input) { + stream_set_blocking($this->input, 0); + } + + $this->blocked = false; + } +} diff --git a/tp5/thinkphp/library/think/process/pipes/Unix.php b/tp5/thinkphp/library/think/process/pipes/Unix.php new file mode 100644 index 0000000..fd99a5d --- /dev/null +++ b/tp5/thinkphp/library/think/process/pipes/Unix.php @@ -0,0 +1,196 @@ + +// +---------------------------------------------------------------------- + +namespace think\process\pipes; + +use think\Process; + +class Unix extends Pipes +{ + + /** @var bool */ + private $ttyMode; + /** @var bool */ + private $ptyMode; + /** @var bool */ + private $disableOutput; + + public function __construct($ttyMode, $ptyMode, $input, $disableOutput) + { + $this->ttyMode = (bool) $ttyMode; + $this->ptyMode = (bool) $ptyMode; + $this->disableOutput = (bool) $disableOutput; + + if (is_resource($input)) { + $this->input = $input; + } else { + $this->inputBuffer = (string) $input; + } + } + + public function __destruct() + { + $this->close(); + } + + /** + * {@inheritdoc} + */ + public function getDescriptors() + { + if ($this->disableOutput) { + $nullstream = fopen('/dev/null', 'c'); + + return [ + ['pipe', 'r'], + $nullstream, + $nullstream, + ]; + } + + if ($this->ttyMode) { + return [ + ['file', '/dev/tty', 'r'], + ['file', '/dev/tty', 'w'], + ['file', '/dev/tty', 'w'], + ]; + } + + if ($this->ptyMode && Process::isPtySupported()) { + return [ + ['pty'], + ['pty'], + ['pty'], + ]; + } + + return [ + ['pipe', 'r'], + ['pipe', 'w'], // stdout + ['pipe', 'w'], // stderr + ]; + } + + /** + * {@inheritdoc} + */ + public function getFiles() + { + return []; + } + + /** + * {@inheritdoc} + */ + public function readAndWrite($blocking, $close = false) + { + + if (1 === count($this->pipes) && [0] === array_keys($this->pipes)) { + fclose($this->pipes[0]); + unset($this->pipes[0]); + } + + if (empty($this->pipes)) { + return []; + } + + $this->unblock(); + + $read = []; + + if (null !== $this->input) { + $r = array_merge($this->pipes, ['input' => $this->input]); + } else { + $r = $this->pipes; + } + + unset($r[0]); + + $w = isset($this->pipes[0]) ? [$this->pipes[0]] : null; + $e = null; + + if (false === $n = @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) { + + if (!$this->hasSystemCallBeenInterrupted()) { + $this->pipes = []; + } + + return $read; + } + + if (0 === $n) { + return $read; + } + + foreach ($r as $pipe) { + + $type = (false !== $found = array_search($pipe, $this->pipes)) ? $found : 'input'; + $data = ''; + while ('' !== $dataread = (string) fread($pipe, self::CHUNK_SIZE)) { + $data .= $dataread; + } + + if ('' !== $data) { + if ('input' === $type) { + $this->inputBuffer .= $data; + } else { + $read[$type] = $data; + } + } + + if (false === $data || (true === $close && feof($pipe) && '' === $data)) { + if ('input' === $type) { + $this->input = null; + } else { + fclose($this->pipes[$type]); + unset($this->pipes[$type]); + } + } + } + + if (null !== $w && 0 < count($w)) { + while (strlen($this->inputBuffer)) { + $written = fwrite($w[0], $this->inputBuffer, 2 << 18); // write 512k + if ($written > 0) { + $this->inputBuffer = (string) substr($this->inputBuffer, $written); + } else { + break; + } + } + } + + if ('' === $this->inputBuffer && null === $this->input && isset($this->pipes[0])) { + fclose($this->pipes[0]); + unset($this->pipes[0]); + } + + return $read; + } + + /** + * {@inheritdoc} + */ + public function areOpen() + { + return (bool) $this->pipes; + } + + /** + * 创建一个新的 UnixPipes 实例 + * @param Process $process + * @param string|resource $input + * @return self + */ + public static function create(Process $process, $input) + { + return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled()); + } +} diff --git a/tp5/thinkphp/library/think/process/pipes/Windows.php b/tp5/thinkphp/library/think/process/pipes/Windows.php new file mode 100644 index 0000000..bba7e9b --- /dev/null +++ b/tp5/thinkphp/library/think/process/pipes/Windows.php @@ -0,0 +1,228 @@ + +// +---------------------------------------------------------------------- + +namespace think\process\pipes; + +use think\Process; + +class Windows extends Pipes +{ + + /** @var array */ + private $files = []; + /** @var array */ + private $fileHandles = []; + /** @var array */ + private $readBytes = [ + Process::STDOUT => 0, + Process::STDERR => 0, + ]; + /** @var bool */ + private $disableOutput; + + public function __construct($disableOutput, $input) + { + $this->disableOutput = (bool) $disableOutput; + + if (!$this->disableOutput) { + + $this->files = [ + Process::STDOUT => tempnam(sys_get_temp_dir(), 'sf_proc_stdout'), + Process::STDERR => tempnam(sys_get_temp_dir(), 'sf_proc_stderr'), + ]; + foreach ($this->files as $offset => $file) { + $this->fileHandles[$offset] = fopen($this->files[$offset], 'rb'); + if (false === $this->fileHandles[$offset]) { + throw new \RuntimeException('A temporary file could not be opened to write the process output to, verify that your TEMP environment variable is writable'); + } + } + } + + if (is_resource($input)) { + $this->input = $input; + } else { + $this->inputBuffer = $input; + } + } + + public function __destruct() + { + $this->close(); + $this->removeFiles(); + } + + /** + * {@inheritdoc} + */ + public function getDescriptors() + { + if ($this->disableOutput) { + $nullstream = fopen('NUL', 'c'); + + return [ + ['pipe', 'r'], + $nullstream, + $nullstream, + ]; + } + + return [ + ['pipe', 'r'], + ['file', 'NUL', 'w'], + ['file', 'NUL', 'w'], + ]; + } + + /** + * {@inheritdoc} + */ + public function getFiles() + { + return $this->files; + } + + /** + * {@inheritdoc} + */ + public function readAndWrite($blocking, $close = false) + { + $this->write($blocking, $close); + + $read = []; + $fh = $this->fileHandles; + foreach ($fh as $type => $fileHandle) { + if (0 !== fseek($fileHandle, $this->readBytes[$type])) { + continue; + } + $data = ''; + $dataread = null; + while (!feof($fileHandle)) { + if (false !== $dataread = fread($fileHandle, self::CHUNK_SIZE)) { + $data .= $dataread; + } + } + if (0 < $length = strlen($data)) { + $this->readBytes[$type] += $length; + $read[$type] = $data; + } + + if (false === $dataread || (true === $close && feof($fileHandle) && '' === $data)) { + fclose($this->fileHandles[$type]); + unset($this->fileHandles[$type]); + } + } + + return $read; + } + + /** + * {@inheritdoc} + */ + public function areOpen() + { + return (bool) $this->pipes && (bool) $this->fileHandles; + } + + /** + * {@inheritdoc} + */ + public function close() + { + parent::close(); + foreach ($this->fileHandles as $handle) { + fclose($handle); + } + $this->fileHandles = []; + } + + /** + * 创建一个新的 WindowsPipes 实例。 + * @param Process $process + * @param $input + * @return self + */ + public static function create(Process $process, $input) + { + return new static($process->isOutputDisabled(), $input); + } + + /** + * 删除临时文件 + */ + private function removeFiles() + { + foreach ($this->files as $filename) { + if (file_exists($filename)) { + @unlink($filename); + } + } + $this->files = []; + } + + /** + * 写入到 stdin 输入 + * @param bool $blocking + * @param bool $close + */ + private function write($blocking, $close) + { + if (empty($this->pipes)) { + return; + } + + $this->unblock(); + + $r = null !== $this->input ? ['input' => $this->input] : null; + $w = isset($this->pipes[0]) ? [$this->pipes[0]] : null; + $e = null; + + if (false === $n = @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) { + if (!$this->hasSystemCallBeenInterrupted()) { + $this->pipes = []; + } + + return; + } + + if (0 === $n) { + return; + } + + if (null !== $w && 0 < count($r)) { + $data = ''; + while ($dataread = fread($r['input'], self::CHUNK_SIZE)) { + $data .= $dataread; + } + + $this->inputBuffer .= $data; + + if (false === $data || (true === $close && feof($r['input']) && '' === $data)) { + $this->input = null; + } + } + + if (null !== $w && 0 < count($w)) { + while (strlen($this->inputBuffer)) { + $written = fwrite($w[0], $this->inputBuffer, 2 << 18); + if ($written > 0) { + $this->inputBuffer = (string) substr($this->inputBuffer, $written); + } else { + break; + } + } + } + + if ('' === $this->inputBuffer && null === $this->input && isset($this->pipes[0])) { + fclose($this->pipes[0]); + unset($this->pipes[0]); + } + } +} diff --git a/tp5/thinkphp/library/think/response/Json.php b/tp5/thinkphp/library/think/response/Json.php new file mode 100644 index 0000000..aa5bbd6 --- /dev/null +++ b/tp5/thinkphp/library/think/response/Json.php @@ -0,0 +1,51 @@ + +// +---------------------------------------------------------------------- + +namespace think\response; + +use think\Response; + +class Json extends Response +{ + // 输出参数 + protected $options = [ + 'json_encode_param' => JSON_UNESCAPED_UNICODE, + ]; + + protected $contentType = 'application/json'; + + /** + * 处理数据 + * @access protected + * @param mixed $data 要处理的数据 + * @return mixed + * @throws \Exception + */ + protected function output($data) + { + try { + // 返回JSON数据格式到客户端 包含状态信息 + $data = json_encode($data, $this->options['json_encode_param']); + + if (false === $data) { + throw new \InvalidArgumentException(json_last_error_msg()); + } + + return $data; + } catch (\Exception $e) { + if ($e->getPrevious()) { + throw $e->getPrevious(); + } + throw $e; + } + } + +} diff --git a/tp5/thinkphp/library/think/response/Jsonp.php b/tp5/thinkphp/library/think/response/Jsonp.php new file mode 100644 index 0000000..9e53da2 --- /dev/null +++ b/tp5/thinkphp/library/think/response/Jsonp.php @@ -0,0 +1,59 @@ + +// +---------------------------------------------------------------------- + +namespace think\response; + +use think\Container; +use think\Response; + +class Jsonp extends Response +{ + // 输出参数 + protected $options = [ + 'var_jsonp_handler' => 'callback', + 'default_jsonp_handler' => 'jsonpReturn', + 'json_encode_param' => JSON_UNESCAPED_UNICODE, + ]; + + protected $contentType = 'application/javascript'; + + /** + * 处理数据 + * @access protected + * @param mixed $data 要处理的数据 + * @return mixed + * @throws \Exception + */ + protected function output($data) + { + try { + // 返回JSON数据格式到客户端 包含状态信息 [当url_common_param为false时是无法获取到$_GET的数据的,故使用Request来获取] + $var_jsonp_handler = Container::get('request')->param($this->options['var_jsonp_handler'], ""); + $handler = !empty($var_jsonp_handler) ? $var_jsonp_handler : $this->options['default_jsonp_handler']; + + $data = json_encode($data, $this->options['json_encode_param']); + + if (false === $data) { + throw new \InvalidArgumentException(json_last_error_msg()); + } + + $data = $handler . '(' . $data . ');'; + + return $data; + } catch (\Exception $e) { + if ($e->getPrevious()) { + throw $e->getPrevious(); + } + throw $e; + } + } + +} diff --git a/tp5/thinkphp/library/think/response/Jump.php b/tp5/thinkphp/library/think/response/Jump.php new file mode 100644 index 0000000..214afc7 --- /dev/null +++ b/tp5/thinkphp/library/think/response/Jump.php @@ -0,0 +1,36 @@ + +// +---------------------------------------------------------------------- + +namespace think\response; + +use think\Container; +use think\Response; + +class Jump extends Response +{ + protected $contentType = 'text/html'; + + /** + * 处理数据 + * @access protected + * @param mixed $data 要处理的数据 + * @return mixed + * @throws \Exception + */ + protected function output($data) + { + $config = Container::get('config'); + $data = Container::get('view') + ->init($config->pull('template')) + ->fetch($this->options['jump_template'], $data); + return $data; + } +} diff --git a/tp5/thinkphp/library/think/response/Redirect.php b/tp5/thinkphp/library/think/response/Redirect.php new file mode 100644 index 0000000..d6e5101 --- /dev/null +++ b/tp5/thinkphp/library/think/response/Redirect.php @@ -0,0 +1,116 @@ + +// +---------------------------------------------------------------------- + +namespace think\response; + +use think\Container; +use think\Response; + +class Redirect extends Response +{ + + protected $options = []; + + // URL参数 + protected $params = []; + + public function __construct($data = '', $code = 302, array $header = [], array $options = []) + { + parent::__construct($data, $code, $header, $options); + + $this->cacheControl('no-cache,must-revalidate'); + } + + /** + * 处理数据 + * @access protected + * @param mixed $data 要处理的数据 + * @return mixed + */ + protected function output($data) + { + $this->header['Location'] = $this->getTargetUrl(); + + return; + } + + /** + * 重定向传值(通过Session) + * @access protected + * @param string|array $name 变量名或者数组 + * @param mixed $value 值 + * @return $this + */ + public function with($name, $value = null) + { + $session = Container::get('session'); + + if (is_array($name)) { + foreach ($name as $key => $val) { + $session->flash($key, $val); + } + } else { + $session->flash($name, $value); + } + + return $this; + } + + /** + * 获取跳转地址 + * @access public + * @return string + */ + public function getTargetUrl() + { + if (strpos($this->data, '://') || (0 === strpos($this->data, '/') && empty($this->params))) { + return $this->data; + } else { + return Container::get('url')->build($this->data, $this->params); + } + } + + public function params($params = []) + { + $this->params = $params; + + return $this; + } + + /** + * 记住当前url后跳转 + * @access public + * @return $this + */ + public function remember() + { + Container::get('session')->set('redirect_url', Container::get('request')->url()); + + return $this; + } + + /** + * 跳转到上次记住的url + * @access public + * @return $this + */ + public function restore() + { + $session = Container::get('session'); + + if ($session->has('redirect_url')) { + $this->data = $session->get('redirect_url'); + $session->delete('redirect_url'); + } + + return $this; + } +} diff --git a/tp5/thinkphp/library/think/response/View.php b/tp5/thinkphp/library/think/response/View.php new file mode 100644 index 0000000..fc32aa5 --- /dev/null +++ b/tp5/thinkphp/library/think/response/View.php @@ -0,0 +1,100 @@ + +// +---------------------------------------------------------------------- + +namespace think\response; + +use think\Container; +use think\Response; + +class View extends Response +{ + // 输出参数 + protected $options = []; + protected $vars = []; + protected $filter; + protected $contentType = 'text/html'; + + /** + * 处理数据 + * @access protected + * @param mixed $data 要处理的数据 + * @return mixed + */ + protected function output($data) + { + // 渲染模板输出 + $config = Container::get('config'); + return Container::get('view') + ->init($config->pull('template')) + ->filter($this->filter) + ->fetch($data, $this->vars); + } + + /** + * 获取视图变量 + * @access public + * @param string $name 模板变量 + * @return mixed + */ + public function getVars($name = null) + { + if (is_null($name)) { + return $this->vars; + } else { + return isset($this->vars[$name]) ? $this->vars[$name] : null; + } + } + + /** + * 模板变量赋值 + * @access public + * @param mixed $name 变量名 + * @param mixed $value 变量值 + * @return $this + */ + public function assign($name, $value = '') + { + if (is_array($name)) { + $this->vars = array_merge($this->vars, $name); + return $this; + } else { + $this->vars[$name] = $value; + } + + return $this; + } + + /** + * 视图内容过滤 + * @access public + * @param callable $filter + * @return $this + */ + public function filter($filter) + { + $this->filter = $filter; + return $this; + } + + /** + * 检查模板是否存在 + * @access private + * @param string|array $name 参数名 + * @return bool + */ + public function exists($name) + { + return Container::get('view') + ->init(Container::get('config')->pull('template')) + ->exists($name); + } + +} diff --git a/tp5/thinkphp/library/think/response/Xml.php b/tp5/thinkphp/library/think/response/Xml.php new file mode 100644 index 0000000..f92b99c --- /dev/null +++ b/tp5/thinkphp/library/think/response/Xml.php @@ -0,0 +1,107 @@ + +// +---------------------------------------------------------------------- + +namespace think\response; + +use think\Collection; +use think\Model; +use think\Response; + +class Xml extends Response +{ + // 输出参数 + protected $options = [ + // 根节点名 + 'root_node' => 'think', + // 根节点属性 + 'root_attr' => '', + //数字索引的子节点名 + 'item_node' => 'item', + // 数字索引子节点key转换的属性名 + 'item_key' => 'id', + // 数据编码 + 'encoding' => 'utf-8', + ]; + + protected $contentType = 'text/xml'; + + /** + * 处理数据 + * @access protected + * @param mixed $data 要处理的数据 + * @return mixed + */ + protected function output($data) + { + // XML数据转换 + return $this->xmlEncode($data, $this->options['root_node'], $this->options['item_node'], $this->options['root_attr'], $this->options['item_key'], $this->options['encoding']); + } + + /** + * XML编码 + * @access protected + * @param mixed $data 数据 + * @param string $root 根节点名 + * @param string $item 数字索引的子节点名 + * @param string $attr 根节点属性 + * @param string $id 数字索引子节点key转换的属性名 + * @param string $encoding 数据编码 + * @return string + */ + protected function xmlEncode($data, $root, $item, $attr, $id, $encoding) + { + if (is_array($attr)) { + $array = []; + foreach ($attr as $key => $value) { + $array[] = "{$key}=\"{$value}\""; + } + $attr = implode(' ', $array); + } + + $attr = trim($attr); + $attr = empty($attr) ? '' : " {$attr}"; + $xml = ""; + $xml .= "<{$root}{$attr}>"; + $xml .= $this->dataToXml($data, $item, $id); + $xml .= ""; + + return $xml; + } + + /** + * 数据XML编码 + * @access protected + * @param mixed $data 数据 + * @param string $item 数字索引时的节点名称 + * @param string $id 数字索引key转换为的属性名 + * @return string + */ + protected function dataToXml($data, $item, $id) + { + $xml = $attr = ''; + + if ($data instanceof Collection || $data instanceof Model) { + $data = $data->toArray(); + } + + foreach ($data as $key => $val) { + if (is_numeric($key)) { + $id && $attr = " {$id}=\"{$key}\""; + $key = $item; + } + $xml .= "<{$key}{$attr}>"; + $xml .= (is_array($val) || is_object($val)) ? $this->dataToXml($val, $item, $id) : $val; + $xml .= ""; + } + + return $xml; + } +} diff --git a/tp5/thinkphp/library/think/route/Dispatch.php b/tp5/thinkphp/library/think/route/Dispatch.php new file mode 100644 index 0000000..ca6b5d6 --- /dev/null +++ b/tp5/thinkphp/library/think/route/Dispatch.php @@ -0,0 +1,56 @@ + +// +---------------------------------------------------------------------- + +namespace think\route; + +use think\Container; + +abstract class Dispatch +{ + // 应用实例 + protected $app; + // 调度信息 + protected $dispatch; + // 调度参数 + protected $param; + // 状态码 + protected $code; + // 是否进行大小写转换 + protected $convert; + + public function __construct($dispatch, $param = [], $code = null) + { + $this->app = Container::get('app'); + $this->dispatch = $dispatch; + $this->param = $param; + $this->code = $code; + } + + public function convert($convert) + { + $this->convert = $convert; + + return $this; + } + + public function getDispatch() + { + return $this->dispatch; + } + + public function getParam() + { + return $this->param; + } + + abstract public function run(); + +} diff --git a/tp5/thinkphp/library/think/route/Domain.php b/tp5/thinkphp/library/think/route/Domain.php new file mode 100644 index 0000000..d8f3e4f --- /dev/null +++ b/tp5/thinkphp/library/think/route/Domain.php @@ -0,0 +1,257 @@ + +// +---------------------------------------------------------------------- + +namespace think\route; + +use think\Container; +use think\Loader; +use think\Response; +use think\Route; +use think\route\dispatch\Callback as CallbackDispatch; +use think\route\dispatch\Controller as ControllerDispatch; +use think\route\dispatch\Module as ModuleDispatch; +use think\route\dispatch\Response as ResponseDispatch; + +class Domain extends RuleGroup +{ + /** + * 架构函数 + * @access public + * @param Route $router 路由对象 + * @param string $name 分组名称 + * @param mixed $rule 域名路由 + * @param array $option 路由参数 + * @param array $pattern 变量规则 + */ + public function __construct(Route $router, $name = '', $rule = null, $option = [], $pattern = []) + { + $this->router = $router; + $this->name = trim($name, '/'); + $this->option = $option; + $this->rule = $rule; + $this->pattern = $pattern; + } + + /** + * 检测域名路由 + * @access public + * @param Request $request 请求对象 + * @param string $url 访问地址 + * @param string $depr 路径分隔符 + * @param bool $completeMatch 路由是否完全匹配 + * @return Dispatch|false + */ + public function check($request, $url, $depr = '/', $completeMatch = false) + { + if ($this->rule) { + // 延迟解析域名路由 + if ($this->rule instanceof Response) { + return new ResponseDispatch($this->rule); + } + + $group = new RuleGroup($this->router); + + $this->addRule($group); + + $this->router->setGroup($group); + + $this->router->parseGroupRule($this, $this->rule); + + $this->rule = null; + } + + // 检测别名路由 + if ($this->router->getAlias($url) || $this->router->getAlias(strstr($url, '|', true))) { + // 检测路由别名 + $result = $this->checkRouteAlias($request, $url, $depr); + if (false !== $result) { + return $result; + } + } + + // 检测URL绑定 + $result = $this->checkUrlBind($url, $depr); + + if (false !== $result) { + return $result; + } + + return parent::check($request, $url, $depr, $completeMatch); + } + + /** + * 检测路由别名 + * @access private + * @param Request $request + * @param string $url URL地址 + * @param string $depr URL分隔符 + * @return Dispatch|false + */ + private function checkRouteAlias($request, $url, $depr) + { + $array = explode('|', $url); + $alias = array_shift($array); + $item = $this->router->getAlias($alias); + + if (is_array($item)) { + list($rule, $option) = $item; + $action = $array[0]; + + if (isset($option['allow']) && !in_array($action, explode(',', $option['allow']))) { + // 允许操作 + return false; + } elseif (isset($option['except']) && in_array($action, explode(',', $option['except']))) { + // 排除操作 + return false; + } + + if (isset($option['method'][$action])) { + $option['method'] = $option['method'][$action]; + } + } else { + $rule = $item; + } + + $bind = implode('|', $array); + + // 参数有效性检查 + if (isset($option) && !$this->checkOption($option, $request)) { + // 路由不匹配 + return false; + } elseif (0 === strpos($rule, '\\')) { + // 路由到类 + return $this->bindToClass($bind, substr($rule, 1), $depr); + } elseif (0 === strpos($rule, '@')) { + // 路由到控制器类 + return $this->bindToController($bind, substr($rule, 1), $depr); + } else { + // 路由到模块/控制器 + return $this->bindToModule($bind, $rule, $depr); + } + } + + /** + * 检测URL绑定 + * @access private + * @param string $url URL地址 + * @param string $depr URL分隔符 + * @return Dispatch|false + */ + private function checkUrlBind(&$url, $depr = '/') + { + $bind = $this->router->getBind($this->name); + + if (!empty($bind)) { + // 记录绑定信息 + Container::get('app')->log('[ BIND ] ' . var_export($bind, true)); + + // 如果有URL绑定 则进行绑定检测 + if (0 === strpos($bind, '\\')) { + // 绑定到类 + return $this->bindToClass($url, substr($bind, 1), $depr); + } elseif (0 === strpos($bind, '@')) { + // 绑定到控制器类 + return $this->bindToController($url, substr($bind, 1), $depr); + } elseif (0 === strpos($bind, ':')) { + // 绑定到命名空间 + return $this->bindToNamespace($url, substr($bind, 1), $depr); + } + } + + return false; + } + + /** + * 绑定到类 + * @access public + * @param string $url URL地址 + * @param string $class 类名(带命名空间) + * @param string $depr URL分隔符 + * @return CallbackDispatch + */ + public function bindToClass($url, $class, $depr = '/') + { + $url = str_replace($depr, '|', $url); + $array = explode('|', $url, 2); + $action = !empty($array[0]) ? $array[0] : Container::get('config')->get('default_action'); + + if (!empty($array[1])) { + $this->parseUrlParams($array[1]); + } + + return new CallbackDispatch([$class, $action]); + } + + /** + * 绑定到命名空间 + * @access public + * @param string $url URL地址 + * @param string $namespace 命名空间 + * @param string $depr URL分隔符 + * @return CallbackDispatch + */ + public function bindToNamespace($url, $namespace, $depr = '/') + { + $url = str_replace($depr, '|', $url); + $array = explode('|', $url, 3); + $class = !empty($array[0]) ? $array[0] : Container::get('config')->get('default_controller'); + $method = !empty($array[1]) ? $array[1] : Container::get('config')->get('default_action'); + + if (!empty($array[2])) { + $this->parseUrlParams($array[2]); + } + + return new CallbackDispatch([$namespace . '\\' . Loader::parseName($class, 1), $method]); + } + + /** + * 绑定到控制器类 + * @access public + * @param string $url URL地址 + * @param string $controller 控制器名 (支持带模块名 index/user ) + * @param string $depr URL分隔符 + * @return ControllerDispatch + */ + public function bindToController($url, $controller, $depr = '/') + { + $url = str_replace($depr, '|', $url); + $array = explode('|', $url, 2); + $action = !empty($array[0]) ? $array[0] : Container::get('config')->get('default_action'); + + if (!empty($array[1])) { + $this->parseUrlParams($array[1]); + } + + return new ControllerDispatch($controller . '/' . $action); + } + + /** + * 绑定到模块/控制器 + * @access public + * @param string $url URL地址 + * @param string $controller 控制器类名(带命名空间) + * @param string $depr URL分隔符 + * @return ModuleDispatch + */ + public function bindToModule($url, $controller, $depr = '/') + { + $url = str_replace($depr, '|', $url); + $array = explode('|', $url, 2); + $action = !empty($array[0]) ? $array[0] : Container::get('config')->get('default_action'); + + if (!empty($array[1])) { + $this->parseUrlParams($array[1]); + } + + return new ModuleDispatch($controller . '/' . $action); + } + +} diff --git a/tp5/thinkphp/library/think/route/Resource.php b/tp5/thinkphp/library/think/route/Resource.php new file mode 100644 index 0000000..7072623 --- /dev/null +++ b/tp5/thinkphp/library/think/route/Resource.php @@ -0,0 +1,170 @@ + +// +---------------------------------------------------------------------- + +namespace think\route; + +use think\Route; + +class Resource extends RuleGroup +{ + // 资源路由名称 + protected $resource; + // 资源路由地址 + protected $route; + // REST路由方法定义 + protected $rest = []; + + /** + * 架构函数 + * @access public + * @param Route $router 路由对象 + * @param RuleGroup $group 路由所属分组对象 + * @param string $name 资源名称 + * @param string $route 路由地址 + * @param array $option 路由参数 + * @param array $pattern 变量规则 + * @param array $rest 资源定义 + */ + public function __construct(Route $router, RuleGroup $group = null, $name = '', $route = '', $option = [], $pattern = [], $rest = []) + { + $this->router = $router; + $this->parent = $group; + $this->resource = $name; + $this->route = $route; + $this->name = strpos($name, '.') ? strstr($name, '.', true) : $name; + + $this->setFullName(); + + // 资源路由默认为完整匹配 + $option['complete_match'] = true; + + $this->pattern = $pattern; + $this->option = $option; + $this->rest = $rest; + } + + /** + * 检测分组路由 + * @access public + * @param Request $request 请求对象 + * @param string $url 访问地址 + * @param string $depr 路径分隔符 + * @param bool $completeMatch 路由是否完全匹配 + * @return Dispatch + */ + public function check($request, $url, $depr = '/', $completeMatch = false) + { + // 生成资源路由的路由规则 + $this->buildResourceRule($this->resource, $this->option); + + return parent::check($request, $url, $depr, $completeMatch); + } + + /** + * 生成资源路由规则 + * @access protected + * @param string $rule 路由规则 + * @param array $option 路由参数 + * @return void + */ + protected function buildResourceRule($rule, $option = []) + { + if (strpos($rule, '.')) { + // 注册嵌套资源路由 + $array = explode('.', $rule); + $last = array_pop($array); + $item = []; + + foreach ($array as $val) { + $item[] = $val . '/:' . (isset($option['var'][$val]) ? $option['var'][$val] : $val . '_id'); + } + + $rule = implode('/', $item) . '/' . $last; + } + + // 注册分组 + $group = $this->router->getGroup(); + + $this->router->setGroup($this); + + // 注册资源路由 + foreach ($this->rest as $key => $val) { + if ((isset($option['only']) && !in_array($key, $option['only'])) + || (isset($option['except']) && in_array($key, $option['except']))) { + continue; + } + + if (isset($last) && strpos($val[1], ':id') && isset($option['var'][$last])) { + $val[1] = str_replace(':id', ':' . $option['var'][$last], $val[1]); + } elseif (strpos($val[1], ':id') && isset($option['var'][$rule])) { + $val[1] = str_replace(':id', ':' . $option['var'][$rule], $val[1]); + } + + $option['rest'] = $key; + + $this->router->rule(trim($val[1], '/'), $this->route . '/' . $val[2], $val[0], $option); + } + + $this->router->setGroup($group); + } + + /** + * rest方法定义和修改 + * @access public + * @param string $name 方法名称 + * @param array|bool $resource 资源 + * @return $this + */ + public function rest($name, $resource = []) + { + if (is_array($name)) { + $this->rest = $resource ? $name : array_merge($this->rest, $name); + } else { + $this->rest[$name] = $resource; + } + + return $this; + } + + /** + * 设置资源允许 + * @access public + * @param array $only + * @return $this + */ + public function only($only) + { + return $this->option('only', $only); + } + + /** + * 设置资源排除 + * @access public + * @param array $except + * @return $this + */ + public function except($except) + { + return $this->option('except', $except); + } + + /** + * 设置资源路由的变量 + * @access public + * @param array $vars + * @return $this + */ + public function vars($vars) + { + return $this->option('var', $vars); + } + +} diff --git a/tp5/thinkphp/library/think/route/Rule.php b/tp5/thinkphp/library/think/route/Rule.php new file mode 100644 index 0000000..7fe8d3e --- /dev/null +++ b/tp5/thinkphp/library/think/route/Rule.php @@ -0,0 +1,909 @@ + +// +---------------------------------------------------------------------- + +namespace think\route; + +use think\Container; +use think\exception\ValidateException; +use think\Request; +use think\Response; +use think\route\dispatch\Callback as CallbackDispatch; +use think\route\dispatch\Controller as ControllerDispatch; +use think\route\dispatch\Module as ModuleDispatch; +use think\route\dispatch\Redirect as RedirectDispatch; +use think\route\dispatch\Response as ResponseDispatch; +use think\route\dispatch\View as ViewDispatch; + +abstract class Rule +{ + protected $name; + // 路由对象实例 + protected $router; + // 路由父对象 + protected $parent; + // 路由参数 + protected $option = []; + // 路由变量规则 + protected $pattern = []; + // 需要合并的路由参数 + protected $mergeOptions = ['after', 'before', 'model']; + + abstract public function check($request, $url, $depr = '/'); + + /** + * 注册路由参数 + * @access public + * @param string|array $name 参数名 + * @param mixed $value 值 + * @return $this + */ + public function option($name, $value = '') + { + if (is_array($name)) { + $this->option = array_merge($this->option, $name); + } else { + $this->option[$name] = $value; + } + + return $this; + } + + /** + * 注册变量规则 + * @access public + * @param string|array $name 变量名 + * @param string $rule 变量规则 + * @return $this + */ + public function pattern($name, $rule = '') + { + if (is_array($name)) { + $this->pattern = array_merge($this->pattern, $name); + } else { + $this->pattern[$name] = $rule; + } + + return $this; + } + + /** + * 设置Name + * @access public + * @param string|array $name 变量名 + * @return $this + */ + public function name($name) + { + $this->name = '/' != $name ? ltrim($name, '/') : '/'; + + return $this; + } + + /** + * 获取Name + * @access public + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * 获取变量规则定义 + * @access public + * @param string $name 变量名 + * @return mixed + */ + public function getPattern($name = '') + { + if ('' === $name) { + return $this->pattern; + } + + return isset($this->pattern[$name]) ? $this->pattern[$name] : null; + } + + /** + * 获取路由参数定义 + * @access public + * @param string $name 参数名 + * @return mixed + */ + public function getOption($name = '') + { + if ('' === $name) { + return $this->option; + } + + return isset($this->option[$name]) ? $this->option[$name] : null; + } + + /** + * 附加路由隐式参数 + * @access public + * @param array $append + * @return $this + */ + public function append(array $append = []) + { + if (isset($this->option['append'])) { + $this->option['append'] = array_merge($this->option['append'], $append); + } else { + $this->option['append'] = $append; + } + + return $this; + } + + /** + * 设置路由请求类型 + * @access public + * @param string $method + * @return $this + */ + public function method($method) + { + return $this->option('method', strtolower($method)); + } + + /** + * 设置路由前置行为 + * @access public + * @param array|\Closure $before + * @return $this + */ + public function before($before) + { + return $this->option('before', $before); + } + + /** + * 设置路由后置行为 + * @access public + * @param array|\Closure $after + * @return $this + */ + public function after($after) + { + return $this->option('after', $after); + } + + /** + * 检查后缀 + * @access public + * @param string $ext + * @return $this + */ + public function ext($ext = '') + { + return $this->option('ext', $ext); + } + + /** + * 检查禁止后缀 + * @access public + * @param string $ext + * @return $this + */ + public function denyExt($ext = '') + { + return $this->option('deny_ext', $ext); + } + + /** + * 检查域名 + * @access public + * @param string $domain + * @return $this + */ + public function domain($domain) + { + return $this->option('domain', $domain); + } + + /** + * 绑定模型 + * @access public + * @param array|string $var 路由变量名 多个使用 & 分割 + * @param string|\Closure $model 绑定模型类 + * @param bool $exception 是否抛出异常 + * @return $this + */ + public function model($var, $model = null, $exception = true) + { + if (is_array($var)) { + $this->option['model'] = $var; + } elseif (is_null($model)) { + $this->option['model']['id'] = [$var, true]; + } else { + $this->option['model'][$var] = [$model, $exception]; + } + + return $this; + } + + /** + * 绑定验证 + * @access public + * @param mixed $validate 验证器类 + * @param string $scene 验证场景 + * @param array $message 验证提示 + * @param bool $batch 批量验证 + * @return $this + */ + public function validate($validate, $scene = null, $message = [], $batch = false) + { + $this->option['validate'] = [$validate, $scene, $message, $batch]; + + return $this; + } + + /** + * 绑定Response对象 + * @access public + * @param mixed $response + * @return $this + */ + public function response($response) + { + return $this->option('response', $response); + } + + /** + * 设置Response Header信息 + * @access public + * @param string|array $name 参数名 + * @param string $value 参数值 + * @return $this + */ + public function header($header, $value = null) + { + if (empty($this->option['header'])) { + $this->option['header'] = []; + } + + if (is_array($header)) { + $this->option['header'] = array_merge($this->option['header'], $header); + } else { + $this->option['header'][$header] = $value; + } + + return $this; + } + + /** + * 设置路由缓存 + * @access public + * @param array|string $cache + * @return $this + */ + public function cache($cache) + { + return $this->option('cache', $cache); + } + + /** + * 检查URL分隔符 + * @access public + * @param bool $depr + * @return $this + */ + public function depr($depr) + { + return $this->option('param_depr', $depr); + } + + /** + * 是否合并额外参数 + * @access public + * @param bool $merge + * @return $this + */ + public function mergeExtraVars($merge = true) + { + return $this->option('merge_extra_vars', $merge); + } + + /** + * 设置需要合并的路由参数 + * @access public + * @param array $option + * @return $this + */ + public function mergeOptions($option = []) + { + $this->mergeOptions = array_merge($this->mergeOptions, $option); + return $this; + } + + /** + * 检查是否为HTTPS请求 + * @access public + * @param bool $https + * @return $this + */ + public function https($https = true) + { + return $this->option('https', $https); + } + + /** + * 检查是否为AJAX请求 + * @access public + * @param bool $ajax + * @return $this + */ + public function ajax($ajax = true) + { + return $this->option('ajax', $ajax); + } + + /** + * 检查是否为PJAX请求 + * @access public + * @param bool $pjax + * @return $this + */ + public function pjax($pjax = true) + { + return $this->option('pjax', $pjax); + } + + /** + * 当前路由到一个模板地址 当使用数组的时候可以传入模板变量 + * @access public + * @param bool|array $view + * @return $this + */ + public function view($view = true) + { + return $this->option('view', $view); + } + + /** + * 当前路由为重定向 + * @access public + * @param bool $redirect 是否为重定向 + * @return $this + */ + public function redirect($redirect = true) + { + return $this->option('redirect', $redirect); + } + + /** + * 设置路由完整匹配 + * @access public + * @param bool $match + * @return $this + */ + public function completeMatch($match = true) + { + return $this->option('complete_match', $match); + } + + /** + * 是否去除URL最后的斜线 + * @access public + * @param bool $remove + * @return $this + */ + public function removeSlash($remove = true) + { + return $this->option('remove_slash', $remove); + } + + /** + * 设置是否允许跨域 + * @access public + * @param bool $allow + * @param array $header + * @return $this + */ + public function allowCrossDomain($allow = true, $header = []) + { + if (!empty($header)) { + $this->header($header); + } + + if ($allow && $this->parent) { + $this->parent->addRule($this, 'options'); + } + + return $this->option('cross_domain', $allow); + } + + /** + * 检查OPTIONS请求 + * @access public + * @param Request $request + * @return Dispatch|void + */ + protected function checkCrossDomain($request) + { + if (!empty($this->option['cross_domain'])) { + + $header = [ + 'Access-Control-Allow-Origin' => '*', + 'Access-Control-Allow-Methods' => 'GET, POST, PATCH, PUT, DELETE', + 'Access-Control-Allow-Headers' => 'Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With', + ]; + + if (!empty($this->option['header'])) { + $header = array_merge($header, $this->option['header']); + } + + $this->option['header'] = $header; + + if ($request->method(true) == 'OPTIONS') { + return new ResponseDispatch(Response::create()->code(204)->header($header)); + } + } + } + + /** + * 设置路由规则全局有效 + * @access public + * @return $this + */ + public function crossDomainRule() + { + if ($this instanceof RuleGroup) { + $method = '*'; + } else { + $method = $this->method; + } + + $this->router->setCrossDomainRule($this, $method); + + return $this; + } + + /** + * 合并分组参数 + * @access protected + * @return void + */ + protected function mergeGroupOptions() + { + $parentOption = $this->parent->getOption(); + // 合并分组参数 + foreach ($this->mergeOptions as $item) { + if (isset($parentOption[$item]) && isset($this->option[$item])) { + $this->option[$item] = array_merge($parentOption[$item], $this->option[$item]); + } + } + + $this->option = array_merge($parentOption, $this->option); + } + + /** + * 路由绑定模型实例 + * @access protected + * @param array|\Clousre $bindModel 绑定模型 + * @param array $matches 路由变量 + * @return void + */ + protected function createBindModel($bindModel, $matches) + { + foreach ($bindModel as $key => $val) { + if ($val instanceof \Closure) { + $result = Container::getInstance()->invokeFunction($val, $matches); + } else { + $fields = explode('&', $key); + + if (is_array($val)) { + list($model, $exception) = $val; + } else { + $model = $val; + $exception = true; + } + + $where = []; + $match = true; + + foreach ($fields as $field) { + if (!isset($matches[$field])) { + $match = false; + break; + } else { + $where[] = [$field, '=', $matches[$field]]; + } + } + + if ($match) { + $query = strpos($model, '\\') ? $model::where($where) : Container::get('app')->model($model)->where($where); + $result = $query->failException($exception)->find(); + } + } + + if (!empty($result)) { + // 注入容器 + Container::getInstance()->instance(get_class($result), $result); + } + } + } + + /** + * 处理路由请求缓存 + * @access protected + * @param Request $request 请求对象 + * @param string|array $cache 路由缓存 + * @return void + */ + protected function parseRequestCache($request, $cache) + { + if (is_array($cache)) { + list($key, $expire, $tag) = array_pad($cache, 3, null); + } else { + $key = str_replace('|', '/', $request->url()); + $expire = $cache; + $tag = null; + } + + $request->cache($key, $expire, $tag); + } + + /** + * 解析匹配到的规则路由 + * @access public + * @param Request $request 请求对象 + * @param string $rule 路由规则 + * @param string $route 路由地址 + * @param string $url URL地址 + * @param array $option 路由参数 + * @param array $matches 匹配的变量 + * @return Dispatch + */ + public function parseRule($request, $rule, $route, $url, $option = [], $matches = []) + { + if (is_string($route) && isset($option['prefix'])) { + // 路由地址前缀 + $route = $option['prefix'] . $route; + } + + // 替换路由地址中的变量 + if (is_string($route) && !empty($matches)) { + foreach ($matches as $key => $val) { + if (false !== strpos($route, ':' . $key)) { + $route = str_replace(':' . $key, $val, $route); + } + } + } + + // 绑定模型数据 + if (isset($option['model'])) { + $this->createBindModel($option['model'], $matches); + } + + // 指定Header数据 + if (!empty($option['header'])) { + $header = $option['header']; + Container::get('hook')->add('response_send', function ($response) use ($header) { + $response->header($header); + }); + } + + // 指定Response响应数据 + if (!empty($option['response'])) { + Container::get('hook')->add('response_send', $option['response']); + } + + // 开启请求缓存 + if (isset($option['cache']) && $request->isGet()) { + $this->parseRequestCache($request, $option['cache']); + } + + // 解析额外参数 + $count = substr_count($rule, '/'); + $url = array_slice(explode('|', $url), $count + 1); + $this->parseUrlParams(implode('|', $url), $matches); + + // 记录匹配的路由信息 + $request->routeInfo(['rule' => $rule, 'route' => $route, 'option' => $option, 'var' => $matches]); + + // 检测路由after行为 + if (!empty($option['after'])) { + $dispatch = $this->checkAfter($option['after']); + + if (false !== $dispatch) { + return $dispatch; + } + } + + // 数据自动验证 + if (isset($option['validate'])) { + $this->autoValidate($option['validate'], $request); + } + + // 发起路由调度 + return $this->dispatch($request, $route, $option); + } + + /** + * 验证数据 + * @access protected + * @param array $option + * @param \think\Request $request + * @return void + * @throws ValidateException + */ + protected function autoValidate($option, $request) + { + list($validate, $scene, $message, $batch) = $option; + + if (is_array($validate)) { + // 指定验证规则 + $v = Container::get('app')->validate(); + $v->rule($validate); + } else { + // 调用验证器 + $v = Container::get('app')->validate($validate); + if (!empty($scene)) { + $v->scene($scene); + } + } + + if (!empty($message)) { + $v->message($message); + } + + // 批量验证 + if ($batch) { + $v->batch(true); + } + + if (!$v->check($request->param())) { + throw new ValidateException($v->getError()); + } + } + + /** + * 检查路由前置行为 + * @access protected + * @param mixed $before 前置行为 + * @return mixed + */ + protected function checkBefore($before) + { + $hook = Container::get('hook'); + + foreach ((array) $before as $behavior) { + $result = $hook->exec($behavior); + + if (false === $result) { + return false; + } + } + } + + /** + * 检查路由后置行为 + * @access protected + * @param mixed $after 后置行为 + * @return mixed + */ + protected function checkAfter($after) + { + $hook = Container::get('hook'); + + $result = null; + + foreach ((array) $after as $behavior) { + $result = $hook->exec($behavior); + + if (!is_null($result)) { + break; + } + } + + // 路由规则重定向 + if ($result instanceof Response) { + return new ResponseDispatch($result); + } elseif ($result instanceof Dispatch) { + return $result; + } else { + return false; + } + } + + /** + * 发起路由调度 + * @access protected + * @param Request $request Request对象 + * @param mixed $route 路由地址 + * @param array $option 路由参数 + * @return Dispatch + */ + protected function dispatch($request, $route, $option) + { + if ($route instanceof \Closure) { + // 执行闭包 + $result = new CallbackDispatch($route); + } elseif ($route instanceof Response) { + $result = new ResponseDispatch($route); + } elseif (isset($option['view']) && false !== $option['view']) { + $result = new ViewDispatch($route, is_array($option['view']) ? $option['view'] : []); + } elseif (!empty($option['redirect']) || 0 === strpos($route, '/') || strpos($route, '://')) { + // 路由到重定向地址 + $result = new RedirectDispatch($route, [], isset($option['status']) ? $option['status'] : 301); + } elseif (false !== strpos($route, '\\')) { + // 路由到方法 + list($path, $var) = $this->parseUrlPath($route); + $route = str_replace('/', '@', implode('/', $path)); + $method = strpos($route, '@') ? explode('@', $route) : $route; + $result = new CallbackDispatch($method, $var); + } elseif (0 === strpos($route, '@')) { + // 路由到控制器 + $route = substr($route, 1); + list($route, $var) = $this->parseUrlPath($route); + $result = new ControllerDispatch(implode('/', $route), $var); + + $request->action(array_pop($route)); + $app = Container::get('app'); + $request->controller($route ? array_pop($route) : $app->config('default_controller')); + $request->module($route ? array_pop($route) : $app->config('default_module')); + $app->setModulePath($app->getAppPath() . ($app->config('app_multi_module') ? $request->module() . DIRECTORY_SEPARATOR : '')); + } else { + // 路由到模块/控制器/操作 + $result = $this->parseModule($route); + } + + return $result; + } + + /** + * 解析URL地址为 模块/控制器/操作 + * @access protected + * @param string $url URL地址 + * @return array + */ + protected function parseModule($url) + { + list($path, $var) = $this->parseUrlPath($url); + $config = Container::get('config'); + $request = Container::get('request'); + $action = array_pop($path); + $controller = !empty($path) ? array_pop($path) : null; + $module = $config->get('app_multi_module') && !empty($path) ? array_pop($path) : null; + $method = $request->method(); + + if ($config->get('use_action_prefix') && $this->router->getMethodPrefix($method)) { + $prefix = $this->router->getMethodPrefix($method); + // 操作方法前缀支持 + $action = 0 !== strpos($action, $prefix) ? $prefix . $action : $action; + } + + // 设置当前请求的路由变量 + $request->route($var); + + // 路由到模块/控制器/操作 + return (new ModuleDispatch([$module, $controller, $action]))->convert(false); + } + + /** + * 路由检查 + * @access protected + * @param array $option 路由参数 + * @param Request $request Request对象 + * @return bool + */ + protected function checkOption($option, Request $request) + { + // 请求类型检测 + if (!empty($option['method'])) { + if (is_string($option['method']) && false === stripos($option['method'], $request->method())) { + return false; + } + } + + // AJAX PJAX 请求检查 + foreach (['ajax', 'pjax'] as $item) { + if (isset($option[$item])) { + $call = 'is' . $item; + if ($option[$item] && !$request->$call() || !$option[$item] && $request->$call()) { + return false; + } + } + } + + // 伪静态后缀检测 + if ($request->url() != '/' && ((isset($option['ext']) && false === stripos('|' . $option['ext'] . '|', '|' . $request->ext() . '|')) + || (isset($option['deny_ext']) && false !== stripos('|' . $option['deny_ext'] . '|', '|' . $request->ext() . '|')))) { + return false; + } + + // 域名检查 + if ((isset($option['domain']) && !in_array($option['domain'], [$_SERVER['HTTP_HOST'], $request->subDomain()]))) { + return false; + } + + // HTTPS检查 + if ((isset($option['https']) && $option['https'] && !$request->isSsl()) + || (isset($option['https']) && !$option['https'] && $request->isSsl())) { + return false; + } + + return true; + } + + /** + * 解析URL地址中的参数Request对象 + * @access protected + * @param string $rule 路由规则 + * @param array $var 变量 + * @return void + */ + protected function parseUrlParams($url, &$var = []) + { + if ($url) { + if (Container::get('config')->get('url_param_type')) { + $var += explode('|', $url); + } else { + preg_replace_callback('/(\w+)\|([^\|]+)/', function ($match) use (&$var) { + $var[$match[1]] = strip_tags($match[2]); + }, $url); + } + } + + // 设置当前请求的参数 + Container::get('request')->route($var); + } + + /** + * 解析URL的pathinfo参数和变量 + * @access protected + * @param string $url URL地址 + * @return array + */ + protected function parseUrlPath($url) + { + // 分隔符替换 确保路由定义使用统一的分隔符 + $url = str_replace('|', '/', $url); + $url = trim($url, '/'); + $var = []; + + if (false !== strpos($url, '?')) { + // [模块/控制器/操作?]参数1=值1&参数2=值2... + $info = parse_url($url); + $path = explode('/', $info['path']); + parse_str($info['query'], $var); + } elseif (strpos($url, '/')) { + // [模块/控制器/操作] + $path = explode('/', $url); + } elseif (false !== strpos($url, '=')) { + // 参数1=值1&参数2=值2... + parse_str($url, $var); + } else { + $path = [$url]; + } + + return [$path, $var]; + } + + /** + * 设置路由参数 + * @access public + * @param string $method 方法名 + * @param array $args 调用参数 + * @return $this + */ + public function __call($method, $args) + { + if (count($args) > 1) { + $args[0] = $args; + } + array_unshift($args, $method); + + return call_user_func_array([$this, 'option'], $args); + } +} diff --git a/tp5/thinkphp/library/think/route/RuleGroup.php b/tp5/thinkphp/library/think/route/RuleGroup.php new file mode 100644 index 0000000..3f83174 --- /dev/null +++ b/tp5/thinkphp/library/think/route/RuleGroup.php @@ -0,0 +1,291 @@ + +// +---------------------------------------------------------------------- + +namespace think\route; + +use think\Container; +use think\Request; +use think\Response; +use think\Route; +use think\route\dispatch\Response as ResponseDispatch; +use think\route\dispatch\Url as UrlDispatch; + +class RuleGroup extends Rule +{ + // 分组路由(包括子分组) + protected $rules = [ + '*' => [], + 'get' => [], + 'post' => [], + 'put' => [], + 'patch' => [], + 'delete' => [], + 'head' => [], + 'options' => [], + ]; + + protected $rule; + + // MISS路由 + protected $miss; + + // 自动路由 + protected $auto; + + // 完整名称 + protected $fullName; + + /** + * 架构函数 + * @access public + * @param Route $router 路由对象 + * @param RuleGroup $group 路由所属分组对象 + * @param string $name 分组名称 + * @param mixed $rule 分组路由 + * @param array $option 路由参数 + * @param array $pattern 变量规则 + */ + public function __construct(Route $router, RuleGroup $group = null, $name = '', $rule = [], $option = [], $pattern = []) + { + $this->router = $router; + $this->parent = $group; + $this->rule = $rule; + $this->name = trim($name, '/'); + $this->option = $option; + $this->pattern = $pattern; + + $this->setFullName(); + } + + /** + * 设置分组的路由规则 + * @access public + * @return $this + */ + protected function setFullName() + { + if ($this->parent && $this->parent->getFullName()) { + $this->fullName = $this->parent->getFullName() . ($this->name ? '/' . $this->name : ''); + } else { + $this->fullName = $this->name; + } + } + + /** + * 设置分组的路由规则 + * @access public + * @param mixed $rule 路由规则 + * @return $this + */ + public function setRule($rule) + { + $this->rule = $rule; + return $this; + } + + /** + * 检测分组路由 + * @access public + * @param Request $request 请求对象 + * @param string $url 访问地址 + * @param string $depr 路径分隔符 + * @param bool $completeMatch 路由是否完全匹配 + * @return Dispatch|false + */ + public function check($request, $url, $depr = '/', $completeMatch = false) + { + if ($dispatch = $this->checkCrossDomain($request)) { + // 允许跨域 + return $dispatch; + } + + // 检查参数有效性 + if (!$this->checkOption($this->option, $request)) { + return false; + } + + if ($this->fullName) { + // 分组URL匹配检查 + $pos = strpos(str_replace('<', ':', $this->fullName), ':'); + + if (false !== $pos) { + $str = substr($this->fullName, 0, $pos); + } else { + $str = $this->fullName; + } + + if (0 !== stripos(str_replace('|', '/', $url), $str)) { + return false; + } + } + + if ($this->rule) { + // 延迟解析分组路由 + if ($this->rule instanceof Response) { + return new ResponseDispatch($this->rule); + } + + $group = $this->router->getGroup(); + + $this->router->setGroup($this); + + $this->router->parseGroupRule($this, $this->rule); + + $this->router->setGroup($group); + + $this->rule = null; + } + + // 分组匹配后执行的行为 + + // 指定Response响应数据 + if (!empty($this->option['response'])) { + Container::get('hook')->add('response_send', $this->option['response']); + } + + // 开启请求缓存 + if (isset($this->option['cache']) && $request->isGet()) { + $this->parseRequestCache($request, $this->option['cache']); + } + + // 获取当前路由规则 + $method = strtolower($request->method()); + $rules = array_merge($this->rules['*'], $this->rules[$method]); + + if ($this->parent) { + // 合并分组参数 + $this->mergeGroupOptions(); + } + + if (isset($this->option['complete_match'])) { + $completeMatch = $this->option['complete_match']; + } + + if (!empty($this->option['append'])) { + $request->route($this->option['append']); + } + + if (isset($rules[$url])) { + // 快速定位 + $item = $rules[$url]; + $result = $item->check($request, $url, $depr, $completeMatch); + + if (false !== $result) { + return $result; + } + } + + // 遍历分组路由 + foreach ($rules as $key => $item) { + $result = $item->check($request, $url, $depr, $completeMatch); + + if (false !== $result) { + return $result; + } + } + + if (isset($this->auto)) { + // 自动解析URL地址 + $result = new UrlDispatch($this->auto->getRoute() . '/' . $url, ['depr' => $depr, 'auto_search' => false]); + } elseif (isset($this->miss)) { + // 未匹配所有路由的路由规则处理 + $result = $this->parseRule($request, '', $this->miss->getRoute(), $url, $this->miss->getOption()); + } else { + $result = false; + } + + return $result; + } + + /** + * 设置自动路由 + * @access public + * @param RuleItem $rule 路由规则 + * @return $this + */ + public function setAutoRule(RuleItem $rule) + { + $this->auto = $rule; + return $this; + } + + /** + * 设置为MISS路由 + * @access public + * @param RuleItem $rule 路由规则 + * @return $this + */ + public function setMissRule(RuleItem $rule) + { + $this->miss = $rule; + return $this; + } + + /** + * 添加分组下的路由规则或者子分组 + * @access public + * @param Rule $rule 路由规则 + * @param string $method 请求类型 + * @return $this + */ + public function addRule($rule, $method = '*') + { + if (strpos($method, '|')) { + $rule->method($method); + $method = '*'; + } + + $this->rules[$method][] = $rule; + + return $this; + } + + /** + * 设置分组的路由前缀 + * @access public + * @param string $prefix + * @return $this + */ + public function prefix($prefix) + { + if ($this->parent->getOption('prefix')) { + $prefix = $this->parent->getOption('prefix') . $prefix; + } + + return $this->option('prefix', $prefix); + } + + /** + * 获取完整分组Name + * @access public + * @return string + */ + public function getFullName() + { + return $this->fullName; + } + + /** + * 获取分组的路由规则 + * @access public + * @param string $method + * @return array + */ + public function getRules($method = '') + { + if ('' === $method) { + return $this->rules; + } else { + return isset($this->rules[strtolower($method)]) ? $this->rules[strtolower($method)] : []; + } + } + +} diff --git a/tp5/thinkphp/library/think/route/RuleItem.php b/tp5/thinkphp/library/think/route/RuleItem.php new file mode 100644 index 0000000..e26637f --- /dev/null +++ b/tp5/thinkphp/library/think/route/RuleItem.php @@ -0,0 +1,298 @@ + +// +---------------------------------------------------------------------- + +namespace think\route; + +use think\Route; + +class RuleItem extends Rule +{ + /** + * 路由规则 + * @var string + */ + protected $name; + + /** + * 路由地址 + * @var string|\Closure + */ + protected $route; + + /** + * 请求类型 + * @var string + */ + protected $method; + + /** + * 架构函数 + * @access public + * @param Route $router 路由实例 + * @param RuleGroup $group 路由所属分组对象 + * @param string|array $name 路由规则 + * @param string $method 请求类型 + * @param string|\Closure $route 路由地址 + * @param array $option 路由参数 + * @param array $pattern 变量规则 + */ + public function __construct(Route $router, RuleGroup $group, $name, $route, $method = '*', $option = [], $pattern = []) + { + $this->router = $router; + $this->parent = $group; + $this->route = $route; + $this->method = $method; + $this->option = $option; + $this->pattern = $pattern; + + $this->setRule($name); + } + + /** + * 路由规则预处理 + * @access public + * @param string $rule 路由规则 + * @return void + */ + public function setRule($rule) + { + if ('$' == substr($rule, -1, 1)) { + // 是否完整匹配 + $rule = substr($rule, 0, -1); + + $this->option['complete_match'] = true; + } + + $this->name($rule); + } + + /** + * 获取当前路由地址 + * @access public + * @return mixed + */ + public function getRoute() + { + return $this->route; + } + + /** + * 设置为自动路由 + * @access public + * @return $this + */ + public function isAuto() + { + $this->parent->setAutoRule($this); + return $this; + } + + /** + * 设置为MISS路由 + * @access public + * @return $this + */ + public function isMiss() + { + $this->parent->setMissRule($this); + return $this; + } + + /** + * 检测路由 + * @access public + * @param Request $request 请求对象 + * @param string $url 访问地址 + * @param string $depr 路径分隔符 + * @param bool $completeMatch 路由是否完全匹配 + * @return Dispatch + */ + public function check($request, $url, $depr = '/', $completeMatch = false) + { + if ($this->parent && $prefix = $this->parent->getFullName()) { + $this->name = $prefix . ($this->name ? '/' . ltrim($this->name, '/') : ''); + } + + if ($dispatch = $this->checkCrossDomain($request)) { + // 允许跨域 + return $dispatch; + } + + // 检查参数有效性 + if (!$this->checkOption($this->option, $request)) { + return false; + } + + // 合并分组参数 + $this->mergeGroupOptions(); + $option = $this->option; + + if (!empty($option['append'])) { + $request->route($option['append']); + } + + // 是否区分 / 地址访问 + if (!empty($option['remove_slash']) && '/' != $this->name) { + $this->name = rtrim($this->name, '/'); + $url = rtrim($url, '|'); + } + + // 检查前置行为 + if (isset($option['before']) && false === $this->checkBefore($option['before'])) { + return false; + } + + if (isset($option['ext'])) { + // 路由ext参数 优先于系统配置的URL伪静态后缀参数 + $url = preg_replace('/\.(' . $request->ext() . ')$/i', '', $url); + } + + return $this->checkRule($request, $url, $depr, $completeMatch, $option); + } + + /** + * 检测路由规则 + * @access private + * @param Request $request 请求对象 + * @param string $url URL地址 + * @param string $depr URL分隔符(全局) + * @param bool $completeMatch 路由是否完全匹配 + * @param array $option 路由参数 + * @return array|false + */ + private function checkRule($request, $url, $depr, $completeMatch = false, $option = []) + { + // 检查完整规则定义 + if (isset($this->pattern['__url__']) && !preg_match(0 === strpos($this->pattern['__url__'], '/') ? $this->pattern['__url__'] : '/^' . $this->pattern['__url__'] . '/', str_replace('|', $depr, $url))) { + return false; + } + + // 检查路由的参数分隔符 + if (isset($option['param_depr'])) { + $url = str_replace(['|', $option['param_depr']], [$depr, '|'], $url); + } + + $len1 = substr_count($url, '|'); + $len2 = substr_count($this->name, '/'); + + // 多余参数是否合并 + $merge = !empty($option['merge_extra_vars']) ? true : false; + + if ($merge && $len1 > $len2) { + $url = str_replace('|', $depr, $url); + $url = implode('|', explode($depr, $url, $len2 + 1)); + } + + if (isset($option['complete_match'])) { + $completeMatch = $option['complete_match']; + } + + if ($len1 >= $len2 || strpos($this->name, '[')) { + // 完整匹配 + if ($completeMatch && (!$merge && $len1 != $len2 && (false === strpos($this->name, '[') || $len1 > $len2 || $len1 < $len2 - substr_count($this->name, '[')))) { + return false; + } + + $pattern = array_merge($this->parent->getPattern(), $this->pattern); + + if (false !== $match = $this->match($url, $pattern)) { + // 匹配到路由规则 + return $this->parseRule($request, $this->name, $this->route, $url, $option, $match); + } + } + + return false; + } + + /** + * 检测URL和规则路由是否匹配 + * @access private + * @param string $url URL地址 + * @param array $pattern 变量规则 + * @return array|false + */ + private function match($url, $pattern) + { + $m2 = explode('/', $this->name); + $m1 = explode('|', $url); + + $var = []; + + foreach ($m2 as $key => $val) { + // val中定义了多个变量 + if (false !== strpos($val, '<') && preg_match_all('/<(\w+(\??))>/', $val, $matches)) { + $value = []; + $replace = []; + + foreach ($matches[1] as $name) { + if (strpos($name, '?')) { + $name = substr($name, 0, -1); + $replace[] = '(' . (isset($pattern[$name]) ? $pattern[$name] : '\w+') . ')?'; + } else { + $replace[] = '(' . (isset($pattern[$name]) ? $pattern[$name] : '\w+') . ')'; + } + $value[] = $name; + } + + $val = str_replace($matches[0], $replace, $val); + + if (preg_match('/^' . $val . '$/', isset($m1[$key]) ? $m1[$key] : '', $match)) { + array_shift($match); + foreach ($value as $k => $name) { + if (isset($match[$k])) { + $var[$name] = $match[$k]; + } + } + continue; + } else { + return false; + } + } + + if (0 === strpos($val, '[:')) { + // 可选参数 + $val = substr($val, 1, -1); + $optional = true; + } else { + $optional = false; + } + + if (0 === strpos($val, ':')) { + // URL变量 + $name = substr($val, 1); + + if (!$optional && !isset($m1[$key])) { + return false; + } + + if (isset($m1[$key]) && isset($pattern[$name])) { + // 检查变量规则 + if ($pattern[$name] instanceof \Closure) { + $result = call_user_func_array($pattern[$name], [$m1[$key]]); + if (false === $result) { + return false; + } + } elseif (!preg_match(0 === strpos($pattern[$name], '/') ? $pattern[$name] : '/^' . $pattern[$name] . '$/', $m1[$key])) { + return false; + } + } + + $var[$name] = isset($m1[$key]) ? $m1[$key] : ''; + } elseif (!isset($m1[$key]) || 0 !== strcasecmp($val, $m1[$key])) { + return false; + } + } + + // 成功匹配后返回URL中的动态变量数组 + return $var; + } + +} diff --git a/tp5/thinkphp/library/think/route/dispatch/Callback.php b/tp5/thinkphp/library/think/route/dispatch/Callback.php new file mode 100644 index 0000000..7168228 --- /dev/null +++ b/tp5/thinkphp/library/think/route/dispatch/Callback.php @@ -0,0 +1,27 @@ + +// +---------------------------------------------------------------------- + +namespace think\route\dispatch; + +use think\Container; +use think\route\Dispatch; + +class Callback extends Dispatch +{ + public function run() + { + // 执行回调方法 + $vars = array_merge($this->app['request']->param(), $this->param); + + return Container::getInstance()->invoke($this->dispatch, $vars); + } + +} diff --git a/tp5/thinkphp/library/think/route/dispatch/Controller.php b/tp5/thinkphp/library/think/route/dispatch/Controller.php new file mode 100644 index 0000000..b48bccd --- /dev/null +++ b/tp5/thinkphp/library/think/route/dispatch/Controller.php @@ -0,0 +1,30 @@ + +// +---------------------------------------------------------------------- + +namespace think\route\dispatch; + +use think\route\Dispatch; + +class Controller extends Dispatch +{ + public function run() + { + // 执行控制器的操作方法 + $vars = array_merge($this->app['request']->param(), $this->param); + + return $this->app->action( + $this->dispatch, $vars, + $this->app->config('app.url_controller_layer'), + $this->app->config('app.controller_suffix') + ); + } + +} diff --git a/tp5/thinkphp/library/think/route/dispatch/Module.php b/tp5/thinkphp/library/think/route/dispatch/Module.php new file mode 100644 index 0000000..20bb812 --- /dev/null +++ b/tp5/thinkphp/library/think/route/dispatch/Module.php @@ -0,0 +1,126 @@ + +// +---------------------------------------------------------------------- + +namespace think\route\dispatch; + +use think\Container; +use think\exception\ClassNotFoundException; +use think\exception\HttpException; +use think\Loader; +use think\route\Dispatch; + +class Module extends Dispatch +{ + public function run() + { + $result = $this->dispatch; + + if (is_string($result)) { + $result = explode('/', $result); + } + + if ($this->app->config('app.app_multi_module')) { + // 多模块部署 + $module = strip_tags(strtolower($result[0] ?: $this->app->config('app.default_module'))); + $bind = $this->app['route']->getBind(); + $available = false; + + if ($bind && preg_match('/^[a-z]/is', $bind)) { + // 绑定模块 + list($bindModule) = explode('/', $bind); + if (empty($result[0])) { + $module = $bindModule; + } + $available = true; + } elseif (!in_array($module, $this->app->config('app.deny_module_list')) && is_dir($this->app->getAppPath() . $module)) { + $available = true; + } elseif ($this->app->config('app.empty_module')) { + $module = $this->app->config('app.empty_module'); + $available = true; + } + + // 模块初始化 + if ($module && $available) { + // 初始化模块 + $this->app['request']->module($module); + $this->app->init($module); + + // 加载当前模块语言包 + $this->app['lang']->load($this->app->getAppPath() . $module . '/lang/' . $this->app['request']->langset() . '.php'); + + // 模块请求缓存检查 + $this->app['request']->cache( + $this->app->config('app.request_cache'), + $this->app->config('app.request_cache_expire'), + $this->app->config('app.request_cache_except') + ); + } else { + throw new HttpException(404, 'module not exists:' . $module); + } + } else { + // 单一模块部署 + $module = ''; + $this->app['request']->module($module); + } + + // 当前模块路径 + $this->app->setModulePath($this->app->getAppPath() . ($module ? $module . '/' : '')); + + // 是否自动转换控制器和操作名 + $convert = is_bool($this->convert) ? $this->convert : $this->app->config('app.url_convert'); + // 获取控制器名 + $controller = strip_tags($result[1] ?: $this->app->config('app.default_controller')); + $controller = $convert ? strtolower($controller) : $controller; + + // 获取操作名 + $actionName = strip_tags($result[2] ?: $this->app->config('app.default_action')); + $actionName = $convert ? strtolower($actionName) : $actionName; + + // 设置当前请求的控制器、操作 + $this->app['request']->controller(Loader::parseName($controller, 1))->action($actionName); + + // 监听module_init + $this->app['hook']->listen('module_init'); + + // 实例化控制器 + try { + $instance = $this->app->controller($controller, + $this->app->config('app.url_controller_layer'), + $this->app->config('app.controller_suffix'), + $this->app->config('app.empty_controller')); + } catch (ClassNotFoundException $e) { + throw new HttpException(404, 'controller not exists:' . $e->getClass()); + } + + // 获取当前操作名 + $action = $actionName . $this->app->config('app.action_suffix'); + + if (is_callable([$instance, $action])) { + // 执行操作方法 + $call = [$instance, $action]; + // 自动获取请求变量 + $vars = $this->app->config('app.url_param_type') + ? $this->app['request']->route() + : $this->app['request']->param(); + } elseif (is_callable([$instance, '_empty'])) { + // 空操作 + $call = [$instance, '_empty']; + $vars = [$actionName]; + } else { + // 操作不存在 + throw new HttpException(404, 'method not exists:' . get_class($instance) . '->' . $action . '()'); + } + + $this->app['hook']->listen('action_begin', $call); + + return Container::getInstance()->invokeMethod($call, $vars); + } +} diff --git a/tp5/thinkphp/library/think/route/dispatch/Redirect.php b/tp5/thinkphp/library/think/route/dispatch/Redirect.php new file mode 100644 index 0000000..1a9208b --- /dev/null +++ b/tp5/thinkphp/library/think/route/dispatch/Redirect.php @@ -0,0 +1,23 @@ + +// +---------------------------------------------------------------------- + +namespace think\route\dispatch; + +use think\Response; +use think\route\Dispatch; + +class Redirect extends Dispatch +{ + public function run() + { + return Response::create($this->dispatch, 'redirect')->code($this->code); + } +} diff --git a/tp5/thinkphp/library/think/route/dispatch/Response.php b/tp5/thinkphp/library/think/route/dispatch/Response.php new file mode 100644 index 0000000..4b5fa16 --- /dev/null +++ b/tp5/thinkphp/library/think/route/dispatch/Response.php @@ -0,0 +1,23 @@ + +// +---------------------------------------------------------------------- + +namespace think\route\dispatch; + +use think\route\Dispatch; + +class Response extends Dispatch +{ + public function run() + { + return $this->dispatch; + } + +} diff --git a/tp5/thinkphp/library/think/route/dispatch/Url.php b/tp5/thinkphp/library/think/route/dispatch/Url.php new file mode 100644 index 0000000..1d5b9d0 --- /dev/null +++ b/tp5/thinkphp/library/think/route/dispatch/Url.php @@ -0,0 +1,190 @@ + +// +---------------------------------------------------------------------- + +namespace think\route\dispatch; + +use think\exception\HttpException; +use think\Loader; +use think\route\Dispatch; + +class Url extends Dispatch +{ + public function run() + { + // 解析默认的URL规则 + $url = str_replace($this->param['depr'], '|', $this->dispatch); + $result = $this->parseUrl($url); + + return (new Module($result))->run(); + } + + /** + * 解析URL地址 + * @access protected + * @param string $url URL + * @return array + */ + protected function parseUrl($url) + { + $router = $this->app['route']; + $bind = $router->getBind(); + $depr = $this->param['depr']; + + if (!empty($bind) && preg_match('/^[a-z]/is', $bind)) { + $bind = str_replace('/', $depr, $bind); + // 如果有模块/控制器绑定 + $url = $bind . ('.' != substr($bind, -1) ? $depr : '') . ltrim($url, $depr); + } + + list($path, $var) = $this->parseUrlPath($url); + if (empty($path)) { + return [null, null, null]; + } + + // 解析模块 + $module = $this->app->config('app_multi_module') ? array_shift($path) : null; + if ($this->param['auto_search']) { + $controller = $this->autoFindController($module, $path); + } else { + // 解析控制器 + $controller = !empty($path) ? array_shift($path) : null; + } + + // 解析操作 + $action = !empty($path) ? array_shift($path) : null; + + // 解析额外参数 + if ($path) { + if ($this->app['config']->get('url_param_type')) { + $var += $path; + } else { + preg_replace_callback('/(\w+)\|([^\|]+)/', function ($match) use (&$var) { + $var[$match[1]] = strip_tags($match[2]); + }, implode('|', $path)); + } + } + + $panDomain = $this->app['request']->panDomain(); + if ($panDomain && $key = array_search('*', $var)) { + // 泛域名赋值 + $var[$key] = $panDomain; + } + + // 设置当前请求的参数 + $this->app['request']->route($var); + + // 封装路由 + $route = [$module, $controller, $action]; + + if ($this->hasDefinedRoute($route, $bind)) { + throw new HttpException(404, 'invalid request:' . str_replace('|', $depr, $url)); + } + + return $route; + } + + /** + * 检查URL是否已经定义过路由 + * @access protected + * @param string $route 路由信息 + * @param string $bind 绑定信息 + * @return bool + */ + protected function hasDefinedRoute($route, $bind) + { + list($module, $controller, $action) = $route; + + // 检查地址是否被定义过路由 + $name = strtolower($module . '/' . Loader::parseName($controller, 1) . '/' . $action); + + $name2 = ''; + + if (empty($module) || $module == $bind) { + $name2 = strtolower(Loader::parseName($controller, 1) . '/' . $action); + } + + $router = $this->app['route']; + + if ($router->getName($name) || $router->getName($name2)) { + return true; + } + + return false; + } + + /** + * 自动定位控制器类 + * @access protected + * @param string $module 模块名 + * @param array $path URL + * @return string + */ + protected function autoFindController($module, &$path) + { + $dir = $this->app->getAppPath() . ($module ? $module . '/' : '') . $this->app->config('url_controller_layer'); + $suffix = $this->app->getSuffix() || $this->app->config('controller_suffix') ? ucfirst($this->app->config('url_controller_layer')) : ''; + + $item = []; + $find = false; + + foreach ($path as $val) { + $item[] = $val; + $file = $dir . '/' . str_replace('.', '/', $val) . $suffix . '.php'; + $file = pathinfo($file, PATHINFO_DIRNAME) . '/' . Loader::parseName(pathinfo($file, PATHINFO_FILENAME), 1) . '.php'; + if (is_file($file)) { + $find = true; + break; + } else { + $dir .= '/' . Loader::parseName($val); + } + } + + if ($find) { + $controller = implode('.', $item); + $path = array_slice($path, count($item)); + } else { + $controller = array_shift($path); + } + + return $controller; + } + + /** + * 解析URL的pathinfo参数和变量 + * @access private + * @param string $url URL地址 + * @return array + */ + private function parseUrlPath($url) + { + // 分隔符替换 确保路由定义使用统一的分隔符 + $url = str_replace('|', '/', $url); + $url = trim($url, '/'); + $var = []; + + if (false !== strpos($url, '?')) { + // [模块/控制器/操作?]参数1=值1&参数2=值2... + $info = parse_url($url); + $path = explode('/', $info['path']); + parse_str($info['query'], $var); + } elseif (strpos($url, '/')) { + // [模块/控制器/操作] + $path = explode('/', $url); + } elseif (false !== strpos($url, '=')) { + // 参数1=值1&参数2=值2... + parse_str($url, $var); + } else { + $path = [$url]; + } + + return [$path, $var]; + } +} diff --git a/tp5/thinkphp/library/think/route/dispatch/View.php b/tp5/thinkphp/library/think/route/dispatch/View.php new file mode 100644 index 0000000..85ef9d2 --- /dev/null +++ b/tp5/thinkphp/library/think/route/dispatch/View.php @@ -0,0 +1,28 @@ + +// +---------------------------------------------------------------------- + +namespace think\route\dispatch; + +use think\Container; +use think\route\Dispatch; + +class View extends Dispatch +{ + public function run() + { + // 渲染模板输出 + $vars = array_merge($this->app['request']->param(), $this->param); + + return Container::get('view') + ->init(Container::get('config')->pull('template')) + ->fetch($this->dispatch, $vars); + } +} diff --git a/tp5/thinkphp/library/think/session/driver/Memcache.php b/tp5/thinkphp/library/think/session/driver/Memcache.php new file mode 100644 index 0000000..40d7bb8 --- /dev/null +++ b/tp5/thinkphp/library/think/session/driver/Memcache.php @@ -0,0 +1,124 @@ + +// +---------------------------------------------------------------------- + +namespace think\session\driver; + +use SessionHandlerInterface; +use think\Exception; + +class Memcache implements SessionHandlerInterface +{ + protected $handler = null; + protected $config = [ + 'host' => '127.0.0.1', // memcache主机 + 'port' => 11211, // memcache端口 + 'expire' => 3600, // session有效期 + 'timeout' => 0, // 连接超时时间(单位:毫秒) + 'persistent' => true, // 长连接 + 'session_name' => '', // memcache key前缀 + ]; + + public function __construct($config = []) + { + $this->config = array_merge($this->config, $config); + } + + /** + * 打开Session + * @access public + * @param string $savePath + * @param mixed $sessName + */ + public function open($savePath, $sessName) + { + // 检测php环境 + if (!extension_loaded('memcache')) { + throw new Exception('not support:memcache'); + } + + $this->handler = new \Memcache; + + // 支持集群 + $hosts = explode(',', $this->config['host']); + $ports = explode(',', $this->config['port']); + + if (empty($ports[0])) { + $ports[0] = 11211; + } + + // 建立连接 + foreach ((array) $hosts as $i => $host) { + $port = isset($ports[$i]) ? $ports[$i] : $ports[0]; + $this->config['timeout'] > 0 ? + $this->handler->addServer($host, $port, $this->config['persistent'], 1, $this->config['timeout']) : + $this->handler->addServer($host, $port, $this->config['persistent'], 1); + } + + return true; + } + + /** + * 关闭Session + * @access public + */ + public function close() + { + $this->gc(ini_get('session.gc_maxlifetime')); + $this->handler->close(); + $this->handler = null; + + return true; + } + + /** + * 读取Session + * @access public + * @param string $sessID + */ + public function read($sessID) + { + return (string) $this->handler->get($this->config['session_name'] . $sessID); + } + + /** + * 写入Session + * @access public + * @param string $sessID + * @param string $sessData + * @return bool + */ + public function write($sessID, $sessData) + { + return $this->handler->set($this->config['session_name'] . $sessID, $sessData, 0, $this->config['expire']); + } + + /** + * 删除Session + * @access public + * @param string $sessID + * @return bool + */ + public function destroy($sessID) + { + return $this->handler->delete($this->config['session_name'] . $sessID); + } + + /** + * Session 垃圾回收 + * @access public + * @param string $sessMaxLifeTime + * @return true + */ + public function gc($sessMaxLifeTime) + { + return true; + } +} diff --git a/tp5/thinkphp/library/think/session/driver/Memcached.php b/tp5/thinkphp/library/think/session/driver/Memcached.php new file mode 100644 index 0000000..074b2ff --- /dev/null +++ b/tp5/thinkphp/library/think/session/driver/Memcached.php @@ -0,0 +1,135 @@ + +// +---------------------------------------------------------------------- + +namespace think\session\driver; + +use SessionHandlerInterface; +use think\Exception; + +class Memcached implements SessionHandlerInterface +{ + protected $handler = null; + protected $config = [ + 'host' => '127.0.0.1', // memcache主机 + 'port' => 11211, // memcache端口 + 'expire' => 3600, // session有效期 + 'timeout' => 0, // 连接超时时间(单位:毫秒) + 'session_name' => '', // memcache key前缀 + 'username' => '', //账号 + 'password' => '', //密码 + ]; + + public function __construct($config = []) + { + $this->config = array_merge($this->config, $config); + } + + /** + * 打开Session + * @access public + * @param string $savePath + * @param mixed $sessName + */ + public function open($savePath, $sessName) + { + // 检测php环境 + if (!extension_loaded('memcached')) { + throw new Exception('not support:memcached'); + } + + $this->handler = new \Memcached; + + // 设置连接超时时间(单位:毫秒) + if ($this->config['timeout'] > 0) { + $this->handler->setOption(\Memcached::OPT_CONNECT_TIMEOUT, $this->config['timeout']); + } + + // 支持集群 + $hosts = explode(',', $this->config['host']); + $ports = explode(',', $this->config['port']); + + if (empty($ports[0])) { + $ports[0] = 11211; + } + + // 建立连接 + $servers = []; + foreach ((array) $hosts as $i => $host) { + $servers[] = [$host, (isset($ports[$i]) ? $ports[$i] : $ports[0]), 1]; + } + + $this->handler->addServers($servers); + + if ('' != $this->config['username']) { + $this->handler->setOption(\Memcached::OPT_BINARY_PROTOCOL, true); + $this->handler->setSaslAuthData($this->config['username'], $this->config['password']); + } + + return true; + } + + /** + * 关闭Session + * @access public + */ + public function close() + { + $this->gc(ini_get('session.gc_maxlifetime')); + $this->handler->quit(); + $this->handler = null; + + return true; + } + + /** + * 读取Session + * @access public + * @param string $sessID + */ + public function read($sessID) + { + return (string) $this->handler->get($this->config['session_name'] . $sessID); + } + + /** + * 写入Session + * @access public + * @param string $sessID + * @param string $sessData + * @return bool + */ + public function write($sessID, $sessData) + { + return $this->handler->set($this->config['session_name'] . $sessID, $sessData, $this->config['expire']); + } + + /** + * 删除Session + * @access public + * @param string $sessID + * @return bool + */ + public function destroy($sessID) + { + return $this->handler->delete($this->config['session_name'] . $sessID); + } + + /** + * Session 垃圾回收 + * @access public + * @param string $sessMaxLifeTime + * @return true + */ + public function gc($sessMaxLifeTime) + { + return true; + } +} diff --git a/tp5/thinkphp/library/think/session/driver/Redis.php b/tp5/thinkphp/library/think/session/driver/Redis.php new file mode 100644 index 0000000..e09988e --- /dev/null +++ b/tp5/thinkphp/library/think/session/driver/Redis.php @@ -0,0 +1,169 @@ + +// +---------------------------------------------------------------------- + +namespace think\session\driver; + +use SessionHandlerInterface; +use think\Exception; + +class Redis implements SessionHandlerInterface +{ + /** @var \Redis */ + protected $handler = null; + protected $config = [ + 'host' => '127.0.0.1', // redis主机 + 'port' => 6379, // redis端口 + 'password' => '', // 密码 + 'select' => 0, // 操作库 + 'expire' => 3600, // 有效期(秒) + 'timeout' => 0, // 超时时间(秒) + 'persistent' => true, // 是否长连接 + 'session_name' => '', // sessionkey前缀 + ]; + + public function __construct($config = []) + { + $this->config = array_merge($this->config, $config); + } + + /** + * 打开Session + * @access public + * @param string $savePath + * @param mixed $sessName + * @return bool + * @throws Exception + */ + public function open($savePath, $sessName) + { + // 检测php环境 + if (!extension_loaded('redis')) { + throw new Exception('not support:redis'); + } + + $this->handler = new \Redis; + + // 建立连接 + $func = $this->config['persistent'] ? 'pconnect' : 'connect'; + $this->handler->$func($this->config['host'], $this->config['port'], $this->config['timeout']); + + if ('' != $this->config['password']) { + $this->handler->auth($this->config['password']); + } + + if (0 != $this->config['select']) { + $this->handler->select($this->config['select']); + } + + return true; + } + + /** + * 关闭Session + * @access public + */ + public function close() + { + $this->gc(ini_get('session.gc_maxlifetime')); + $this->handler->close(); + $this->handler = null; + + return true; + } + + /** + * 读取Session + * @access public + * @param string $sessID + * @return string + */ + public function read($sessID) + { + return (string) $this->handler->get($this->config['session_name'] . $sessID); + } + + /** + * 写入Session + * @access public + * @param string $sessID + * @param string $sessData + * @return bool + */ + public function write($sessID, $sessData) + { + if ($this->config['expire'] > 0) { + return $this->handler->setex($this->config['session_name'] . $sessID, $this->config['expire'], $sessData); + } else { + return $this->handler->set($this->config['session_name'] . $sessID, $sessData); + } + } + + /** + * 删除Session + * @access public + * @param string $sessID + * @return bool + */ + public function destroy($sessID) + { + return $this->handler->delete($this->config['session_name'] . $sessID) > 0; + } + + /** + * Session 垃圾回收 + * @access public + * @param string $sessMaxLifeTime + * @return bool + */ + public function gc($sessMaxLifeTime) + { + return true; + } + + /** + * Redis Session 驱动的加锁机制 + * @access public + * @param string $sessID 用于加锁的sessID + * @param integer $timeout 默认过期时间 + * @return bool + */ + public function lock($sessID, $timeout = 10) + { + if (null == $this->handler) { + $this->open('', ''); + } + + $lockKey = 'LOCK_PREFIX_' . $sessID; + // 使用setnx操作加锁 + $isLock = $this->handler->setnx($lockKey, 1); + if ($isLock) { + // 设置过期时间,防止死任务的出现 + $this->handler->expire($lockKey, $timeout); + return true; + } + + return false; + } + + /** + * Redis Session 驱动的解锁机制 + * @access public + * @param string $sessID 用于解锁的sessID + */ + public function unlock($sessID) + { + if (null == $this->handler) { + $this->open('', ''); + } + + $this->handler->del('LOCK_PREFIX_' . $sessID); + } +} diff --git a/tp5/thinkphp/library/think/template/TagLib.php b/tp5/thinkphp/library/think/template/TagLib.php new file mode 100644 index 0000000..3653b7d --- /dev/null +++ b/tp5/thinkphp/library/think/template/TagLib.php @@ -0,0 +1,351 @@ + +// +---------------------------------------------------------------------- + +namespace think\template; + +use think\Exception; + +/** + * ThinkPHP标签库TagLib解析基类 + * @category Think + * @package Think + * @subpackage Template + * @author liu21st + */ +class TagLib +{ + + /** + * 标签库定义XML文件 + * @var string + * @access protected + */ + protected $xml = ''; + protected $tags = []; // 标签定义 + /** + * 标签库名称 + * @var string + * @access protected + */ + protected $tagLib = ''; + + /** + * 标签库标签列表 + * @var array + * @access protected + */ + protected $tagList = []; + + /** + * 标签库分析数组 + * @var array + * @access protected + */ + protected $parse = []; + + /** + * 标签库是否有效 + * @var bool + * @access protected + */ + protected $valid = false; + + /** + * 当前模板对象 + * @var object + * @access protected + */ + protected $tpl; + + protected $comparison = [' nheq ' => ' !== ', ' heq ' => ' === ', ' neq ' => ' != ', ' eq ' => ' == ', ' egt ' => ' >= ', ' gt ' => ' > ', ' elt ' => ' <= ', ' lt ' => ' < ']; + + /** + * 架构函数 + * @access public + * @param \stdClass $template 模板引擎对象 + */ + public function __construct($template) + { + $this->tpl = $template; + } + + /** + * 按签标库替换页面中的标签 + * @access public + * @param string $content 模板内容 + * @param string $lib 标签库名 + * @return void + */ + public function parseTag(&$content, $lib = '') + { + $tags = []; + $lib = $lib ? strtolower($lib) . ':' : ''; + + foreach ($this->tags as $name => $val) { + $close = !isset($val['close']) || $val['close'] ? 1 : 0; + $tags[$close][$lib . $name] = $name; + if (isset($val['alias'])) { + // 别名设置 + $array = (array) $val['alias']; + foreach (explode(',', $array[0]) as $v) { + $tags[$close][$lib . $v] = $name; + } + } + } + + // 闭合标签 + if (!empty($tags[1])) { + $nodes = []; + $regex = $this->getRegex(array_keys($tags[1]), 1); + if (preg_match_all($regex, $content, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { + $right = []; + foreach ($matches as $match) { + if ('' == $match[1][0]) { + $name = strtolower($match[2][0]); + // 如果有没闭合的标签头则取出最后一个 + if (!empty($right[$name])) { + // $match[0][1]为标签结束符在模板中的位置 + $nodes[$match[0][1]] = [ + 'name' => $name, + 'begin' => array_pop($right[$name]), // 标签开始符 + 'end' => $match[0], // 标签结束符 + ]; + } + } else { + // 标签头压入栈 + $right[strtolower($match[1][0])][] = $match[0]; + } + } + unset($right, $matches); + // 按标签在模板中的位置从后向前排序 + krsort($nodes); + } + + $break = ''; + if ($nodes) { + $beginArray = []; + // 标签替换 从后向前 + foreach ($nodes as $pos => $node) { + // 对应的标签名 + $name = $tags[1][$node['name']]; + $alias = $lib . $name != $node['name'] ? ($lib ? strstr($node['name'], $lib) : $node['name']) : ''; + + // 解析标签属性 + $attrs = $this->parseAttr($node['begin'][0], $name, $alias); + $method = 'tag' . $name; + + // 读取标签库中对应的标签内容 replace[0]用来替换标签头,replace[1]用来替换标签尾 + $replace = explode($break, $this->$method($attrs, $break)); + + if (count($replace) > 1) { + while ($beginArray) { + $begin = end($beginArray); + // 判断当前标签尾的位置是否在栈中最后一个标签头的后面,是则为子标签 + if ($node['end'][1] > $begin['pos']) { + break; + } else { + // 不为子标签时,取出栈中最后一个标签头 + $begin = array_pop($beginArray); + // 替换标签头部 + $content = substr_replace($content, $begin['str'], $begin['pos'], $begin['len']); + } + } + // 替换标签尾部 + $content = substr_replace($content, $replace[1], $node['end'][1], strlen($node['end'][0])); + // 把标签头压入栈 + $beginArray[] = ['pos' => $node['begin'][1], 'len' => strlen($node['begin'][0]), 'str' => $replace[0]]; + } + } + + while ($beginArray) { + $begin = array_pop($beginArray); + // 替换标签头部 + $content = substr_replace($content, $begin['str'], $begin['pos'], $begin['len']); + } + } + } + // 自闭合标签 + if (!empty($tags[0])) { + $regex = $this->getRegex(array_keys($tags[0]), 0); + $content = preg_replace_callback($regex, function ($matches) use (&$tags, &$lib) { + // 对应的标签名 + $name = $tags[0][strtolower($matches[1])]; + $alias = $lib . $name != $matches[1] ? ($lib ? strstr($matches[1], $lib) : $matches[1]) : ''; + // 解析标签属性 + $attrs = $this->parseAttr($matches[0], $name, $alias); + $method = 'tag' . $name; + return $this->$method($attrs, ''); + }, $content); + } + + return; + } + + /** + * 按标签生成正则 + * @access public + * @param array|string $tags 标签名 + * @param boolean $close 是否为闭合标签 + * @return string + */ + public function getRegex($tags, $close) + { + $begin = $this->tpl->config('taglib_begin'); + $end = $this->tpl->config('taglib_end'); + $single = strlen(ltrim($begin, '\\')) == 1 && strlen(ltrim($end, '\\')) == 1 ? true : false; + $tagName = is_array($tags) ? implode('|', $tags) : $tags; + + if ($single) { + if ($close) { + // 如果是闭合标签 + $regex = $begin . '(?:(' . $tagName . ')\b(?>[^' . $end . ']*)|\/(' . $tagName . '))' . $end; + } else { + $regex = $begin . '(' . $tagName . ')\b(?>[^' . $end . ']*)' . $end; + } + } else { + if ($close) { + // 如果是闭合标签 + $regex = $begin . '(?:(' . $tagName . ')\b(?>(?:(?!' . $end . ').)*)|\/(' . $tagName . '))' . $end; + } else { + $regex = $begin . '(' . $tagName . ')\b(?>(?:(?!' . $end . ').)*)' . $end; + } + } + + return '/' . $regex . '/is'; + } + + /** + * 分析标签属性 正则方式 + * @access public + * @param string $str 标签属性字符串 + * @param string $name 标签名 + * @param string $alias 别名 + * @return array + */ + public function parseAttr($str, $name, $alias = '') + { + $regex = '/\s+(?>(?P[\w-]+)\s*)=(?>\s*)([\"\'])(?P(?:(?!\\2).)*)\\2/is'; + $result = []; + + if (preg_match_all($regex, $str, $matches)) { + foreach ($matches['name'] as $key => $val) { + $result[$val] = $matches['value'][$key]; + } + + if (!isset($this->tags[$name])) { + // 检测是否存在别名定义 + foreach ($this->tags as $key => $val) { + if (isset($val['alias'])) { + $array = (array) $val['alias']; + if (in_array($name, explode(',', $array[0]))) { + $tag = $val; + $type = !empty($array[1]) ? $array[1] : 'type'; + $result[$type] = $name; + break; + } + } + } + } else { + $tag = $this->tags[$name]; + // 设置了标签别名 + if (!empty($alias) && isset($tag['alias'])) { + $type = !empty($tag['alias'][1]) ? $tag['alias'][1] : 'type'; + $result[$type] = $alias; + } + } + + if (!empty($tag['must'])) { + $must = explode(',', $tag['must']); + foreach ($must as $name) { + if (!isset($result[$name])) { + throw new Exception('tag attr must:' . $name); + } + } + } + } else { + // 允许直接使用表达式的标签 + if (!empty($this->tags[$name]['expression'])) { + static $_taglibs; + if (!isset($_taglibs[$name])) { + $_taglibs[$name][0] = strlen($this->tpl->config('taglib_begin_origin') . $name); + $_taglibs[$name][1] = strlen($this->tpl->config('taglib_end_origin')); + } + $result['expression'] = substr($str, $_taglibs[$name][0], -$_taglibs[$name][1]); + // 清除自闭合标签尾部/ + $result['expression'] = rtrim($result['expression'], '/'); + $result['expression'] = trim($result['expression']); + } elseif (empty($this->tags[$name]) || !empty($this->tags[$name]['attr'])) { + throw new Exception('tag error:' . $name); + } + } + + return $result; + } + + /** + * 解析条件表达式 + * @access public + * @param string $condition 表达式标签内容 + * @return string + */ + public function parseCondition($condition) + { + if (strpos($condition, ':')) { + $condition = ' ' . substr(strstr($condition, ':'), 1); + } + + $condition = str_ireplace(array_keys($this->comparison), array_values($this->comparison), $condition); + $this->tpl->parseVar($condition); + + // $this->tpl->parseVarFunction($condition); // XXX: 此句能解析表达式中用|分隔的函数,但表达式中如果有|、||这样的逻辑运算就产生了歧异 + return $condition; + } + + /** + * 自动识别构建变量 + * @access public + * @param string $name 变量描述 + * @return string + */ + public function autoBuildVar(&$name) + { + $flag = substr($name, 0, 1); + + if (':' == $flag) { + // 以:开头为函数调用,解析前去掉: + $name = substr($name, 1); + } elseif ('$' != $flag && preg_match('/[a-zA-Z_]/', $flag)) { + // XXX: 这句的写法可能还需要改进 + // 常量不需要解析 + if (defined($name)) { + return $name; + } + + // 不以$开头并且也不是常量,自动补上$前缀 + $name = '$' . $name; + } + + $this->tpl->parseVar($name); + $this->tpl->parseVarFunction($name, false); + + return $name; + } + + /** + * 获取标签列表 + * @access public + * @return array + */ + public function getTags() + { + return $this->tags; + } +} diff --git a/tp5/thinkphp/library/think/template/driver/File.php b/tp5/thinkphp/library/think/template/driver/File.php new file mode 100644 index 0000000..95a6140 --- /dev/null +++ b/tp5/thinkphp/library/think/template/driver/File.php @@ -0,0 +1,79 @@ + +// +---------------------------------------------------------------------- + +namespace think\template\driver; + +use think\Exception; + +class File +{ + /** + * 写入编译缓存 + * @access public + * @param string $cacheFile 缓存的文件名 + * @param string $content 缓存的内容 + * @return void|array + */ + public function write($cacheFile, $content) + { + // 检测模板目录 + $dir = dirname($cacheFile); + + if (!is_dir($dir)) { + mkdir($dir, 0755, true); + } + + // 生成模板缓存文件 + if (false === file_put_contents($cacheFile, $content)) { + throw new Exception('cache write error:' . $cacheFile, 11602); + } + } + + /** + * 读取编译编译 + * @access public + * @param string $cacheFile 缓存的文件名 + * @param array $vars 变量数组 + * @return void + */ + public function read($cacheFile, $vars = []) + { + if (!empty($vars) && is_array($vars)) { + // 模板阵列变量分解成为独立变量 + extract($vars, EXTR_OVERWRITE); + } + + //载入模版缓存文件 + include $cacheFile; + } + + /** + * 检查编译缓存是否有效 + * @access public + * @param string $cacheFile 缓存的文件名 + * @param int $cacheTime 缓存时间 + * @return boolean + */ + public function check($cacheFile, $cacheTime) + { + // 缓存文件不存在, 直接返回false + if (!file_exists($cacheFile)) { + return false; + } + + if (0 != $cacheTime && time() > filemtime($cacheFile) + $cacheTime) { + // 缓存是否在有效期 + return false; + } + + return true; + } +} diff --git a/tp5/thinkphp/library/think/template/taglib/Cx.php b/tp5/thinkphp/library/think/template/taglib/Cx.php new file mode 100644 index 0000000..ad741f2 --- /dev/null +++ b/tp5/thinkphp/library/think/template/taglib/Cx.php @@ -0,0 +1,724 @@ + +// +---------------------------------------------------------------------- + +namespace think\template\taglib; + +use think\template\TagLib; + +/** + * CX标签库解析类 + * @category Think + * @package Think + * @subpackage Driver.Taglib + * @author liu21st + */ +class Cx extends Taglib +{ + + // 标签定义 + protected $tags = [ + // 标签定义: attr 属性列表 close 是否闭合(0 或者1 默认1) alias 标签别名 level 嵌套层次 + 'php' => ['attr' => ''], + 'volist' => ['attr' => 'name,id,offset,length,key,mod', 'alias' => 'iterate'], + 'foreach' => ['attr' => 'name,id,item,key,offset,length,mod', 'expression' => true], + 'if' => ['attr' => 'condition', 'expression' => true], + 'elseif' => ['attr' => 'condition', 'close' => 0, 'expression' => true], + 'else' => ['attr' => '', 'close' => 0], + 'switch' => ['attr' => 'name', 'expression' => true], + 'case' => ['attr' => 'value,break', 'expression' => true], + 'default' => ['attr' => '', 'close' => 0], + 'compare' => ['attr' => 'name,value,type', 'alias' => ['eq,equal,notequal,neq,gt,lt,egt,elt,heq,nheq', 'type']], + 'range' => ['attr' => 'name,value,type', 'alias' => ['in,notin,between,notbetween', 'type']], + 'empty' => ['attr' => 'name'], + 'notempty' => ['attr' => 'name'], + 'present' => ['attr' => 'name'], + 'notpresent' => ['attr' => 'name'], + 'defined' => ['attr' => 'name'], + 'notdefined' => ['attr' => 'name'], + 'load' => ['attr' => 'file,href,type,value,basepath', 'close' => 0, 'alias' => ['import,css,js', 'type']], + 'assign' => ['attr' => 'name,value', 'close' => 0], + 'define' => ['attr' => 'name,value', 'close' => 0], + 'for' => ['attr' => 'start,end,name,comparison,step'], + 'url' => ['attr' => 'link,vars,suffix,domain', 'close' => 0, 'expression' => true], + 'function' => ['attr' => 'name,vars,use,call'], + ]; + + /** + * php标签解析 + * 格式: + * {php}echo $name{/php} + * @access public + * @param array $tag 标签属性 + * @param string $content 标签内容 + * @return string + */ + public function tagPhp($tag, $content) + { + $parseStr = ''; + return $parseStr; + } + + /** + * volist标签解析 循环输出数据集 + * 格式: + * {volist name="userList" id="user" empty=""} + * {user.username} + * {user.email} + * {/volist} + * @access public + * @param array $tag 标签属性 + * @param string $content 标签内容 + * @return string|void + */ + public function tagVolist($tag, $content) + { + $name = $tag['name']; + $id = $tag['id']; + $empty = isset($tag['empty']) ? $tag['empty'] : ''; + $key = !empty($tag['key']) ? $tag['key'] : 'i'; + $mod = isset($tag['mod']) ? $tag['mod'] : '2'; + $offset = !empty($tag['offset']) && is_numeric($tag['offset']) ? intval($tag['offset']) : 0; + $length = !empty($tag['length']) && is_numeric($tag['length']) ? intval($tag['length']) : 'null'; + // 允许使用函数设定数据集 {$vo.name} + $parseStr = 'autoBuildVar($name); + $parseStr .= '$_result=' . $name . ';'; + $name = '$_result'; + } else { + $name = $this->autoBuildVar($name); + } + + $parseStr .= 'if(is_array(' . $name . ') || ' . $name . ' instanceof \think\Collection || ' . $name . ' instanceof \think\Paginator): $' . $key . ' = 0;'; + + // 设置了输出数组长度 + if (0 != $offset || 'null' != $length) { + $parseStr .= '$__LIST__ = is_array(' . $name . ') ? array_slice(' . $name . ',' . $offset . ',' . $length . ', true) : ' . $name . '->slice(' . $offset . ',' . $length . ', true); '; + } else { + $parseStr .= ' $__LIST__ = ' . $name . ';'; + } + + $parseStr .= 'if( count($__LIST__)==0 ) : echo "' . $empty . '" ;'; + $parseStr .= 'else: '; + $parseStr .= 'foreach($__LIST__ as $key=>$' . $id . '): '; + $parseStr .= '$mod = ($' . $key . ' % ' . $mod . ' );'; + $parseStr .= '++$' . $key . ';?>'; + $parseStr .= $content; + $parseStr .= ''; + + if (!empty($parseStr)) { + return $parseStr; + } + + return; + } + + /** + * foreach标签解析 循环输出数据集 + * 格式: + * {foreach name="userList" id="user" key="key" index="i" mod="2" offset="3" length="5" empty=""} + * {user.username} + * {/foreach} + * @access public + * @param array $tag 标签属性 + * @param string $content 标签内容 + * @return string|void + */ + public function tagForeach($tag, $content) + { + // 直接使用表达式 + if (!empty($tag['expression'])) { + $expression = ltrim(rtrim($tag['expression'], ')'), '('); + $expression = $this->autoBuildVar($expression); + $parseStr = ''; + $parseStr .= $content; + $parseStr .= ''; + return $parseStr; + } + + $name = $tag['name']; + $key = !empty($tag['key']) ? $tag['key'] : 'key'; + $item = !empty($tag['id']) ? $tag['id'] : $tag['item']; + $empty = isset($tag['empty']) ? $tag['empty'] : ''; + $offset = !empty($tag['offset']) && is_numeric($tag['offset']) ? intval($tag['offset']) : 0; + $length = !empty($tag['length']) && is_numeric($tag['length']) ? intval($tag['length']) : 'null'; + + $parseStr = 'autoBuildVar($name); + $parseStr .= $var . '=' . $name . '; '; + $name = $var; + } else { + $name = $this->autoBuildVar($name); + } + + $parseStr .= 'if(is_array(' . $name . ') || ' . $name . ' instanceof \think\Collection || ' . $name . ' instanceof \think\Paginator): '; + + // 设置了输出数组长度 + if (0 != $offset || 'null' != $length) { + if (!isset($var)) { + $var = '$_' . uniqid(); + } + $parseStr .= $var . ' = is_array(' . $name . ') ? array_slice(' . $name . ',' . $offset . ',' . $length . ', true) : ' . $name . '->slice(' . $offset . ',' . $length . ', true); '; + } else { + $var = &$name; + } + + $parseStr .= 'if( count(' . $var . ')==0 ) : echo "' . $empty . '" ;'; + $parseStr .= 'else: '; + + // 设置了索引项 + if (isset($tag['index'])) { + $index = $tag['index']; + $parseStr .= '$' . $index . '=0; '; + } + + $parseStr .= 'foreach(' . $var . ' as $' . $key . '=>$' . $item . '): '; + + // 设置了索引项 + if (isset($tag['index'])) { + $index = $tag['index']; + if (isset($tag['mod'])) { + $mod = (int) $tag['mod']; + $parseStr .= '$mod = ($' . $index . ' % ' . $mod . '); '; + } + $parseStr .= '++$' . $index . '; '; + } + + $parseStr .= '?>'; + // 循环体中的内容 + $parseStr .= $content; + $parseStr .= ''; + + if (!empty($parseStr)) { + return $parseStr; + } + + return; + } + + /** + * if标签解析 + * 格式: + * {if condition=" $a eq 1"} + * {elseif condition="$a eq 2" /} + * {else /} + * {/if} + * 表达式支持 eq neq gt egt lt elt == > >= < <= or and || && + * @access public + * @param array $tag 标签属性 + * @param string $content 标签内容 + * @return string + */ + public function tagIf($tag, $content) + { + $condition = !empty($tag['expression']) ? $tag['expression'] : $tag['condition']; + $condition = $this->parseCondition($condition); + $parseStr = '' . $content . ''; + + return $parseStr; + } + + /** + * elseif标签解析 + * 格式:见if标签 + * @access public + * @param array $tag 标签属性 + * @param string $content 标签内容 + * @return string + */ + public function tagElseif($tag, $content) + { + $condition = !empty($tag['expression']) ? $tag['expression'] : $tag['condition']; + $condition = $this->parseCondition($condition); + $parseStr = ''; + + return $parseStr; + } + + /** + * else标签解析 + * 格式:见if标签 + * @access public + * @param array $tag 标签属性 + * @return string + */ + public function tagElse($tag) + { + $parseStr = ''; + + return $parseStr; + } + + /** + * switch标签解析 + * 格式: + * {switch name="a.name"} + * {case value="1" break="false"}1{/case} + * {case value="2" }2{/case} + * {default /}other + * {/switch} + * @access public + * @param array $tag 标签属性 + * @param string $content 标签内容 + * @return string + */ + public function tagSwitch($tag, $content) + { + $name = !empty($tag['expression']) ? $tag['expression'] : $tag['name']; + $name = $this->autoBuildVar($name); + $parseStr = '' . $content . ''; + + return $parseStr; + } + + /** + * case标签解析 需要配合switch才有效 + * @access public + * @param array $tag 标签属性 + * @param string $content 标签内容 + * @return string + */ + public function tagCase($tag, $content) + { + $value = isset($tag['expression']) ? $tag['expression'] : $tag['value']; + $flag = substr($value, 0, 1); + + if ('$' == $flag || ':' == $flag) { + $value = $this->autoBuildVar($value); + $value = 'case ' . $value . ':'; + } elseif (strpos($value, '|')) { + $values = explode('|', $value); + $value = ''; + foreach ($values as $val) { + $value .= 'case "' . addslashes($val) . '":'; + } + } else { + $value = 'case "' . $value . '":'; + } + + $parseStr = '' . $content; + $isBreak = isset($tag['break']) ? $tag['break'] : ''; + + if ('' == $isBreak || $isBreak) { + $parseStr .= ''; + } + + return $parseStr; + } + + /** + * default标签解析 需要配合switch才有效 + * 使用: {default /}ddfdf + * @access public + * @param array $tag 标签属性 + * @param string $content 标签内容 + * @return string + */ + public function tagDefault($tag) + { + $parseStr = ''; + + return $parseStr; + } + + /** + * compare标签解析 + * 用于值的比较 支持 eq neq gt lt egt elt heq nheq 默认是eq + * 格式: {compare name="" type="eq" value="" }content{/compare} + * @access public + * @param array $tag 标签属性 + * @param string $content 标签内容 + * @return string + */ + public function tagCompare($tag, $content) + { + $name = $tag['name']; + $value = $tag['value']; + $type = isset($tag['type']) ? $tag['type'] : 'eq'; // 比较类型 + $name = $this->autoBuildVar($name); + $flag = substr($value, 0, 1); + + if ('$' == $flag || ':' == $flag) { + $value = $this->autoBuildVar($value); + } else { + $value = '\'' . $value . '\''; + } + + switch ($type) { + case 'equal': + $type = 'eq'; + break; + case 'notequal': + $type = 'neq'; + break; + } + $type = $this->parseCondition(' ' . $type . ' '); + $parseStr = '' . $content . ''; + + return $parseStr; + } + + /** + * range标签解析 + * 如果某个变量存在于某个范围 则输出内容 type= in 表示在范围内 否则表示在范围外 + * 格式: {range name="var|function" value="val" type='in|notin' }content{/range} + * example: {range name="a" value="1,2,3" type='in' }content{/range} + * @access public + * @param array $tag 标签属性 + * @param string $content 标签内容 + * @return string + */ + public function tagRange($tag, $content) + { + $name = $tag['name']; + $value = $tag['value']; + $type = isset($tag['type']) ? $tag['type'] : 'in'; // 比较类型 + + $name = $this->autoBuildVar($name); + $flag = substr($value, 0, 1); + + if ('$' == $flag || ':' == $flag) { + $value = $this->autoBuildVar($value); + $str = 'is_array(' . $value . ')?' . $value . ':explode(\',\',' . $value . ')'; + } else { + $value = '"' . $value . '"'; + $str = 'explode(\',\',' . $value . ')'; + } + + if ('between' == $type) { + $parseStr = '= $_RANGE_VAR_[0] && ' . $name . '<= $_RANGE_VAR_[1]):?>' . $content . ''; + } elseif ('notbetween' == $type) { + $parseStr = '$_RANGE_VAR_[1]):?>' . $content . ''; + } else { + $fun = ('in' == $type) ? 'in_array' : '!in_array'; + $parseStr = '' . $content . ''; + } + + return $parseStr; + } + + /** + * present标签解析 + * 如果某个变量已经设置 则输出内容 + * 格式: {present name="" }content{/present} + * @access public + * @param array $tag 标签属性 + * @param string $content 标签内容 + * @return string + */ + public function tagPresent($tag, $content) + { + $name = $tag['name']; + $name = $this->autoBuildVar($name); + $parseStr = '' . $content . ''; + + return $parseStr; + } + + /** + * notpresent标签解析 + * 如果某个变量没有设置,则输出内容 + * 格式: {notpresent name="" }content{/notpresent} + * @access public + * @param array $tag 标签属性 + * @param string $content 标签内容 + * @return string + */ + public function tagNotpresent($tag, $content) + { + $name = $tag['name']; + $name = $this->autoBuildVar($name); + $parseStr = '' . $content . ''; + + return $parseStr; + } + + /** + * empty标签解析 + * 如果某个变量为empty 则输出内容 + * 格式: {empty name="" }content{/empty} + * @access public + * @param array $tag 标签属性 + * @param string $content 标签内容 + * @return string + */ + public function tagEmpty($tag, $content) + { + $name = $tag['name']; + $name = $this->autoBuildVar($name); + $parseStr = 'isEmpty())): ?>' . $content . ''; + + return $parseStr; + } + + /** + * notempty标签解析 + * 如果某个变量不为empty 则输出内容 + * 格式: {notempty name="" }content{/notempty} + * @access public + * @param array $tag 标签属性 + * @param string $content 标签内容 + * @return string + */ + public function tagNotempty($tag, $content) + { + $name = $tag['name']; + $name = $this->autoBuildVar($name); + $parseStr = 'isEmpty()))): ?>' . $content . ''; + + return $parseStr; + } + + /** + * 判断是否已经定义了该常量 + * {defined name='TXT'}已定义{/defined} + * @access public + * @param array $tag + * @param string $content + * @return string + */ + public function tagDefined($tag, $content) + { + $name = $tag['name']; + $parseStr = '' . $content . ''; + + return $parseStr; + } + + /** + * 判断是否没有定义了该常量 + * {notdefined name='TXT'}已定义{/notdefined} + * @access public + * @param array $tag + * @param string $content + * @return string + */ + public function tagNotdefined($tag, $content) + { + $name = $tag['name']; + $parseStr = '' . $content . ''; + + return $parseStr; + } + + /** + * load 标签解析 {load file="/static/js/base.js" /} + * 格式:{load file="/static/css/base.css" /} + * @access public + * @param array $tag 标签属性 + * @param string $content 标签内容 + * @return string + */ + public function tagLoad($tag, $content) + { + $file = isset($tag['file']) ? $tag['file'] : $tag['href']; + $type = isset($tag['type']) ? strtolower($tag['type']) : ''; + + $parseStr = ''; + $endStr = ''; + + // 判断是否存在加载条件 允许使用函数判断(默认为isset) + if (isset($tag['value'])) { + $name = $tag['value']; + $name = $this->autoBuildVar($name); + $name = 'isset(' . $name . ')'; + $parseStr .= ''; + $endStr = ''; + } + + // 文件方式导入 + $array = explode(',', $file); + + foreach ($array as $val) { + $type = strtolower(substr(strrchr($val, '.'), 1)); + switch ($type) { + case 'js': + $parseStr .= ''; + break; + case 'css': + $parseStr .= ''; + break; + case 'php': + $parseStr .= ''; + break; + } + } + + return $parseStr . $endStr; + } + + /** + * assign标签解析 + * 在模板中给某个变量赋值 支持变量赋值 + * 格式: {assign name="" value="" /} + * @access public + * @param array $tag 标签属性 + * @param string $content 标签内容 + * @return string + */ + public function tagAssign($tag, $content) + { + $name = $this->autoBuildVar($tag['name']); + $flag = substr($tag['value'], 0, 1); + + if ('$' == $flag || ':' == $flag) { + $value = $this->autoBuildVar($tag['value']); + } else { + $value = '\'' . $tag['value'] . '\''; + } + + $parseStr = ''; + + return $parseStr; + } + + /** + * define标签解析 + * 在模板中定义常量 支持变量赋值 + * 格式: {define name="" value="" /} + * @access public + * @param array $tag 标签属性 + * @param string $content 标签内容 + * @return string + */ + public function tagDefine($tag, $content) + { + $name = '\'' . $tag['name'] . '\''; + $flag = substr($tag['value'], 0, 1); + + if ('$' == $flag || ':' == $flag) { + $value = $this->autoBuildVar($tag['value']); + } else { + $value = '\'' . $tag['value'] . '\''; + } + + $parseStr = ''; + + return $parseStr; + } + + /** + * for标签解析 + * 格式: + * {for start="" end="" comparison="" step="" name=""} + * content + * {/for} + * @access public + * @param array $tag 标签属性 + * @param string $content 标签内容 + * @return string + */ + public function tagFor($tag, $content) + { + //设置默认值 + $start = 0; + $end = 0; + $step = 1; + $comparison = 'lt'; + $name = 'i'; + $rand = rand(); //添加随机数,防止嵌套变量冲突 + + //获取属性 + foreach ($tag as $key => $value) { + $value = trim($value); + $flag = substr($value, 0, 1); + if ('$' == $flag || ':' == $flag) { + $value = $this->autoBuildVar($value); + } + + switch ($key) { + case 'start': + $start = $value; + break; + case 'end': + $end = $value; + break; + case 'step': + $step = $value; + break; + case 'comparison': + $comparison = $value; + break; + case 'name': + $name = $value; + break; + } + } + + $parseStr = 'parseCondition('$' . $name . ' ' . $comparison . ' $__FOR_END_' . $rand . '__') . ';$' . $name . '+=' . $step . '){ ?>'; + $parseStr .= $content; + $parseStr .= ''; + + return $parseStr; + } + + /** + * url函数的tag标签 + * 格式:{url link="模块/控制器/方法" vars="参数" suffix="true或者false 是否带有后缀" domain="true或者false 是否携带域名" /} + * @access public + * @param array $tag 标签属性 + * @param string $content 标签内容 + * @return string + */ + public function tagUrl($tag, $content) + { + $url = isset($tag['link']) ? $tag['link'] : ''; + $vars = isset($tag['vars']) ? $tag['vars'] : ''; + $suffix = isset($tag['suffix']) ? $tag['suffix'] : 'true'; + $domain = isset($tag['domain']) ? $tag['domain'] : 'false'; + + return ''; + } + + /** + * function标签解析 匿名函数,可实现递归 + * 使用: + * {function name="func" vars="$data" call="$list" use="&$a,&$b"} + * {if is_array($data)} + * {foreach $data as $val} + * {~func($val) /} + * {/foreach} + * {else /} + * {$data} + * {/if} + * {/function} + * @access public + * @param array $tag 标签属性 + * @param string $content 标签内容 + * @return string + */ + public function tagFunction($tag, $content) + { + $name = !empty($tag['name']) ? $tag['name'] : 'func'; + $vars = !empty($tag['vars']) ? $tag['vars'] : ''; + $call = !empty($tag['call']) ? $tag['call'] : ''; + $use = ['&$' . $name]; + + if (!empty($tag['use'])) { + foreach (explode(',', $tag['use']) as $val) { + $use[] = '&' . ltrim(trim($val), '&'); + } + } + + $parseStr = '' . $content . '' : '?>'; + + return $parseStr; + } +} diff --git a/tp5/thinkphp/library/think/validate/ValidateRule.php b/tp5/thinkphp/library/think/validate/ValidateRule.php new file mode 100644 index 0000000..5253465 --- /dev/null +++ b/tp5/thinkphp/library/think/validate/ValidateRule.php @@ -0,0 +1,171 @@ + +// +---------------------------------------------------------------------- + +namespace think\validate; + +/** + * Class ValidateRule + * @package think\validate + * @method ValidateRule confirm(mixed $rule, string $msg = '') static 验证是否和某个字段的值一致 + * @method ValidateRule different(mixed $rule, string $msg = '') static 验证是否和某个字段的值是否不同 + * @method ValidateRule egt(mixed $rule, string $msg = '') static 验证是否大于等于某个值 + * @method ValidateRule gt(mixed $rule, string $msg = '') static 验证是否大于某个值 + * @method ValidateRule elt(mixed $rule, string $msg = '') static 验证是否小于等于某个值 + * @method ValidateRule lt(mixed $rule, string $msg = '') static 验证是否小于某个值 + * @method ValidateRule eg(mixed $rule, string $msg = '') static 验证是否等于某个值 + * @method ValidateRule in(mixed $rule, string $msg = '') static 验证是否在范围内 + * @method ValidateRule notIn(mixed $rule, string $msg = '') static 验证是否不在某个范围 + * @method ValidateRule between(mixed $rule, string $msg = '') static 验证是否在某个区间 + * @method ValidateRule notBetween(mixed $rule, string $msg = '') static 验证是否不在某个区间 + * @method ValidateRule length(mixed $rule, string $msg = '') static 验证数据长度 + * @method ValidateRule max(mixed $rule, string $msg = '') static 验证数据最大长度 + * @method ValidateRule min(mixed $rule, string $msg = '') static 验证数据最小长度 + * @method ValidateRule after(mixed $rule, string $msg = '') static 验证日期 + * @method ValidateRule before(mixed $rule, string $msg = '') static 验证日期 + * @method ValidateRule expire(mixed $rule, string $msg = '') static 验证有效期 + * @method ValidateRule allowIp(mixed $rule, string $msg = '') static 验证IP许可 + * @method ValidateRule denyIp(mixed $rule, string $msg = '') static 验证IP禁用 + * @method ValidateRule regex(mixed $rule, string $msg = '') static 使用正则验证数据 + * @method ValidateRule token(mixed $rule='__token__', string $msg = '') static 验证表单令牌 + * @method ValidateRule is(mixed $rule, string $msg = '') static 验证字段值是否为有效格式 + * @method ValidateRule isRequire(mixed $rule, string $msg = '') static 验证字段必须 + * @method ValidateRule isNumber(mixed $rule, string $msg = '') static 验证字段值是否为数字 + * @method ValidateRule isArray(mixed $rule, string $msg = '') static 验证字段值是否为数组 + * @method ValidateRule isInteger(mixed $rule, string $msg = '') static 验证字段值是否为整形 + * @method ValidateRule isFloat(mixed $rule, string $msg = '') static 验证字段值是否为浮点数 + * @method ValidateRule isMobile(mixed $rule, string $msg = '') static 验证字段值是否为手机 + * @method ValidateRule isIdCard(mixed $rule, string $msg = '') static 验证字段值是否为身份证号码 + * @method ValidateRule isChs(mixed $rule, string $msg = '') static 验证字段值是否为中文 + * @method ValidateRule isChsDash(mixed $rule, string $msg = '') static 验证字段值是否为中文字母及下划线 + * @method ValidateRule isChsAlpha(mixed $rule, string $msg = '') static 验证字段值是否为中文和字母 + * @method ValidateRule isChsAlphaNum(mixed $rule, string $msg = '') static 验证字段值是否为中文字母和数字 + * @method ValidateRule isDate(mixed $rule, string $msg = '') static 验证字段值是否为有效格式 + * @method ValidateRule isBool(mixed $rule, string $msg = '') static 验证字段值是否为布尔值 + * @method ValidateRule isAlpha(mixed $rule, string $msg = '') static 验证字段值是否为字母 + * @method ValidateRule isAlphaDash(mixed $rule, string $msg = '') static 验证字段值是否为字母和下划线 + * @method ValidateRule isAlphaNum(mixed $rule, string $msg = '') static 验证字段值是否为字母和数字 + * @method ValidateRule isAccepted(mixed $rule, string $msg = '') static 验证字段值是否为yes, on, 或是 1 + * @method ValidateRule isEmail(mixed $rule, string $msg = '') static 验证字段值是否为有效邮箱格式 + * @method ValidateRule isUrl(mixed $rule, string $msg = '') static 验证字段值是否为有效URL地址 + * @method ValidateRule activeUrl(mixed $rule, string $msg = '') static 验证是否为合格的域名或者IP + * @method ValidateRule ip(mixed $rule, string $msg = '') static 验证是否有效IP + * @method ValidateRule fileExt(mixed $rule, string $msg = '') static 验证文件后缀 + * @method ValidateRule fileMime(mixed $rule, string $msg = '') static 验证文件类型 + * @method ValidateRule fileSize(mixed $rule, string $msg = '') static 验证文件大小 + * @method ValidateRule image(mixed $rule, string $msg = '') static 验证图像文件 + * @method ValidateRule method(mixed $rule, string $msg = '') static 验证请求类型 + * @method ValidateRule dateFormat(mixed $rule, string $msg = '') static 验证时间和日期是否符合指定格式 + * @method ValidateRule unique(mixed $rule, string $msg = '') static 验证是否唯一 + * @method ValidateRule behavior(mixed $rule, string $msg = '') static 使用行为类验证 + * @method ValidateRule filter(mixed $rule, string $msg = '') static 使用filter_var方式验证 + * @method ValidateRule requireIf(mixed $rule, string $msg = '') static 验证某个字段等于某个值的时候必须 + * @method ValidateRule requireCallback(mixed $rule, string $msg = '') static 通过回调方法验证某个字段是否必须 + * @method ValidateRule requireWith(mixed $rule, string $msg = '') static 验证某个字段有值的情况下必须 + * @method ValidateRule must(mixed $rule=null, string $msg = '') static 必须验证 + */ +class ValidateRule +{ + // 验证字段的名称 + protected $title; + + // 当前验证规则 + protected $rule = []; + + // 验证提示信息 + protected $message = []; + + /** + * 添加验证因子 + * @access protected + * @param string $name 验证名称 + * @param mixed $rule 验证规则 + * @param string $msg 提示信息 + * @return $this + */ + protected function addItem($name, $rule = null, $msg = '') + { + if ($rule || 0 === $rule) { + $this->rule[$name] = $rule; + } else { + $this->rule[] = $name; + } + + $this->message[] = $msg; + + return $this; + } + + /** + * 获取验证规则 + * @access public + * @return array + */ + public function getRule() + { + return $this->rule; + } + + /** + * 获取验证字段名称 + * @access public + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * 获取验证提示 + * @access public + * @return array + */ + public function getMsg() + { + return $this->message; + } + + /** + * 设置验证字段名称 + * @access public + * @return $this + */ + public function title($title) + { + $this->title = $title; + + return $this; + } + + public function __call($method, $args) + { + if ('is' == strtolower(substr($method, 0, 2))) { + $method = substr($method, 2); + } + + array_unshift($args, lcfirst($method)); + + return call_user_func_array([$this, 'addItem'], $args); + } + + public static function __callStatic($method, $args) + { + $rule = new static(); + + if ('is' == strtolower(substr($method, 0, 2))) { + $method = substr($method, 2); + } + + array_unshift($args, lcfirst($method)); + + return call_user_func_array([$rule, 'addItem'], $args); + } +} diff --git a/tp5/thinkphp/library/think/view/driver/Php.php b/tp5/thinkphp/library/think/view/driver/Php.php new file mode 100644 index 0000000..e2091aa --- /dev/null +++ b/tp5/thinkphp/library/think/view/driver/Php.php @@ -0,0 +1,172 @@ + +// +---------------------------------------------------------------------- + +namespace think\view\driver; + +use think\Container; +use think\exception\TemplateNotFoundException; +use think\Loader; + +class Php +{ + // 模板引擎参数 + protected $config = [ + // 视图基础目录(集中式) + 'view_base' => '', + // 模板起始路径 + 'view_path' => '', + // 模板文件后缀 + 'view_suffix' => 'php', + // 模板文件名分隔符 + 'view_depr' => DIRECTORY_SEPARATOR, + ]; + + public function __construct($config = []) + { + $this->config = array_merge($this->config, (array) $config); + } + + /** + * 检测是否存在模板文件 + * @access public + * @param string $template 模板文件或者模板规则 + * @return bool + */ + public function exists($template) + { + if ('' == pathinfo($template, PATHINFO_EXTENSION)) { + // 获取模板文件名 + $template = $this->parseTemplate($template); + } + + return is_file($template); + } + + /** + * 渲染模板文件 + * @access public + * @param string $template 模板文件 + * @param array $data 模板变量 + * @return void + */ + public function fetch($template, $data = []) + { + if ('' == pathinfo($template, PATHINFO_EXTENSION)) { + // 获取模板文件名 + $template = $this->parseTemplate($template); + } + + // 模板不存在 抛出异常 + if (!is_file($template)) { + throw new TemplateNotFoundException('template not exists:' . $template, $template); + } + + // 记录视图信息 + Container::get('app') + ->log('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]'); + + if (isset($data['template'])) { + $__template__ = $template; + extract($data, EXTR_OVERWRITE); + include $__template__; + } else { + extract($data, EXTR_OVERWRITE); + include $template; + } + } + + /** + * 渲染模板内容 + * @access public + * @param string $content 模板内容 + * @param array $data 模板变量 + * @return void + */ + public function display($content, $data = []) + { + if (isset($data['content'])) { + $__content__ = $content; + extract($data, EXTR_OVERWRITE); + eval('?>' . $__content__); + } else { + extract($data, EXTR_OVERWRITE); + eval('?>' . $content); + } + } + + /** + * 自动定位模板文件 + * @access private + * @param string $template 模板文件规则 + * @return string + */ + private function parseTemplate($template) + { + if (empty($this->config['view_path'])) { + $this->config['view_path'] = Container::get('app')->getModulePath() . 'view' . DIRECTORY_SEPARATOR; + } + + $request = Container::get('request'); + + // 获取视图根目录 + if (strpos($template, '@')) { + // 跨模块调用 + list($module, $template) = explode('@', $template); + } + + if ($this->config['view_base']) { + // 基础视图目录 + $module = isset($module) ? $module : $request->module(); + $path = $this->config['view_base'] . ($module ? $module . DIRECTORY_SEPARATOR : ''); + } else { + $path = isset($module) ? Container::get('app')->getAppPath() . $module . DIRECTORY_SEPARATOR . 'view' . DIRECTORY_SEPARATOR : $this->config['view_path']; + } + + $depr = $this->config['view_depr']; + + if (0 !== strpos($template, '/')) { + $template = str_replace(['/', ':'], $depr, $template); + $controller = Loader::parseName($request->controller()); + + if ($controller) { + if ('' == $template) { + // 如果模板文件名为空 按照默认规则定位 + $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $request->action(); + } elseif (false === strpos($template, $depr)) { + $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; + } + } + } else { + $template = str_replace(['/', ':'], $depr, substr($template, 1)); + } + + return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.'); + } + + /** + * 配置模板引擎 + * @access private + * @param string|array $name 参数名 + * @param mixed $value 参数值 + * @return void + */ + public function config($name, $value = null) + { + if (is_array($name)) { + $this->config = array_merge($this->config, $name); + } elseif (is_null($value)) { + return isset($this->config[$name]) ? $this->config[$name] : null; + } else { + $this->config[$name] = $value; + } + } + +} diff --git a/tp5/thinkphp/library/think/view/driver/Think.php b/tp5/thinkphp/library/think/view/driver/Think.php new file mode 100644 index 0000000..83daa1c --- /dev/null +++ b/tp5/thinkphp/library/think/view/driver/Think.php @@ -0,0 +1,172 @@ + +// +---------------------------------------------------------------------- + +namespace think\view\driver; + +use think\Container; +use think\exception\TemplateNotFoundException; +use think\Loader; +use think\Template; + +class Think +{ + // 模板引擎实例 + private $template; + // 模板引擎参数 + protected $config = [ + // 视图基础目录(集中式) + 'view_base' => '', + // 模板起始路径 + 'view_path' => '', + // 模板文件后缀 + 'view_suffix' => 'html', + // 模板文件名分隔符 + 'view_depr' => DIRECTORY_SEPARATOR, + // 是否开启模板编译缓存,设为false则每次都会重新编译 + 'tpl_cache' => true, + ]; + + public function __construct($config = []) + { + $this->config = array_merge($this->config, (array) $config); + if (empty($this->config['view_path'])) { + $this->config['view_path'] = Container::get('app')->getModulePath() . 'view' . DIRECTORY_SEPARATOR; + } + + $this->template = new Template($this->config); + } + + /** + * 检测是否存在模板文件 + * @access public + * @param string $template 模板文件或者模板规则 + * @return bool + */ + public function exists($template) + { + if ('' == pathinfo($template, PATHINFO_EXTENSION)) { + // 获取模板文件名 + $template = $this->parseTemplate($template); + } + + return is_file($template); + } + + /** + * 渲染模板文件 + * @access public + * @param string $template 模板文件 + * @param array $data 模板变量 + * @param array $config 模板参数 + * @return void + */ + public function fetch($template, $data = [], $config = []) + { + if ('' == pathinfo($template, PATHINFO_EXTENSION)) { + // 获取模板文件名 + $template = $this->parseTemplate($template); + } + + // 模板不存在 抛出异常 + if (!is_file($template)) { + throw new TemplateNotFoundException('template not exists:' . $template, $template); + } + + // 记录视图信息 + Container::get('app') + ->log('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]'); + + $this->template->fetch($template, $data, $config); + } + + /** + * 渲染模板内容 + * @access public + * @param string $template 模板内容 + * @param array $data 模板变量 + * @param array $config 模板参数 + * @return void + */ + public function display($template, $data = [], $config = []) + { + $this->template->display($template, $data, $config); + } + + /** + * 自动定位模板文件 + * @access private + * @param string $template 模板文件规则 + * @return string + */ + private function parseTemplate($template) + { + // 分析模板文件规则 + $request = Container::get('request'); + + // 获取视图根目录 + if (strpos($template, '@')) { + // 跨模块调用 + list($module, $template) = explode('@', $template); + } + + if ($this->config['view_base']) { + // 基础视图目录 + $module = isset($module) ? $module : $request->module(); + $path = $this->config['view_base'] . ($module ? $module . DIRECTORY_SEPARATOR : ''); + } else { + $path = isset($module) ? Container::get('app')->getAppPath() . $module . DIRECTORY_SEPARATOR . 'view' . DIRECTORY_SEPARATOR : $this->config['view_path']; + } + + $depr = $this->config['view_depr']; + + if (0 !== strpos($template, '/')) { + $template = str_replace(['/', ':'], $depr, $template); + $controller = Loader::parseName($request->controller()); + if ($controller) { + if ('' == $template) { + // 如果模板文件名为空 按照默认规则定位 + $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $request->action(); + } elseif (false === strpos($template, $depr)) { + $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; + } + } + } else { + $template = str_replace(['/', ':'], $depr, substr($template, 1)); + } + + return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.'); + } + + /** + * 配置或者获取模板引擎参数 + * @access private + * @param string|array $name 参数名 + * @param mixed $value 参数值 + * @return mixed + */ + public function config($name, $value = null) + { + if (is_array($name)) { + $this->template->config($name); + $this->config = array_merge($this->config, $name); + } elseif (is_null($value)) { + return $this->template->config($name); + } else { + $this->template->$name = $value; + $this->config[$name] = $value; + } + } + + public function __call($method, $params) + { + return call_user_func_array([$this->template, $method], $params); + } +} diff --git a/tp5/thinkphp/library/traits/controller/Jump.php b/tp5/thinkphp/library/traits/controller/Jump.php new file mode 100644 index 0000000..8ea2ee4 --- /dev/null +++ b/tp5/thinkphp/library/traits/controller/Jump.php @@ -0,0 +1,158 @@ +error(); + * $this->redirect(); + * } + * } + */ +namespace traits\controller; + +use think\Container; +use think\exception\HttpResponseException; +use think\Response; +use think\response\Redirect; + +trait Jump +{ + /** + * 操作成功跳转的快捷方法 + * @access protected + * @param mixed $msg 提示信息 + * @param string $url 跳转的URL地址 + * @param mixed $data 返回的数据 + * @param integer $wait 跳转等待时间 + * @param array $header 发送的Header信息 + * @return void + */ + protected function success($msg = '', $url = null, $data = '', $wait = 3, array $header = []) + { + if (is_null($url) && isset($_SERVER["HTTP_REFERER"])) { + $url = $_SERVER["HTTP_REFERER"]; + } elseif ('' !== $url) { + $url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : Container::get('url')->build($url); + } + + $result = [ + 'code' => 1, + 'msg' => $msg, + 'data' => $data, + 'url' => $url, + 'wait' => $wait, + ]; + + $type = $this->getResponseType(); + // 把跳转模板的渲染下沉,这样在 response_send 行为里通过getData()获得的数据是一致性的格式 + if ('html' == strtolower($type)) { + $type = 'jump'; + } + + $response = Response::create($result, $type)->header($header)->options(['jump_template' => Container::get('config')->get('dispatch_success_tmpl')]); + + throw new HttpResponseException($response); + } + + /** + * 操作错误跳转的快捷方法 + * @access protected + * @param mixed $msg 提示信息 + * @param string $url 跳转的URL地址 + * @param mixed $data 返回的数据 + * @param integer $wait 跳转等待时间 + * @param array $header 发送的Header信息 + * @return void + */ + protected function error($msg = '', $url = null, $data = '', $wait = 3, array $header = []) + { + if (is_null($url)) { + $url = Container::get('request')->isAjax() ? '' : 'javascript:history.back(-1);'; + } elseif ('' !== $url) { + $url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : Container::get('url')->build($url); + } + + $result = [ + 'code' => 0, + 'msg' => $msg, + 'data' => $data, + 'url' => $url, + 'wait' => $wait, + ]; + + $type = $this->getResponseType(); + if ('html' == strtolower($type)) { + $type = 'jump'; + } + + $response = Response::create($result, $type)->header($header)->options(['jump_template' => Container::get('config')->get('dispatch_error_tmpl')]); + + throw new HttpResponseException($response); + } + + /** + * 返回封装后的API数据到客户端 + * @access protected + * @param mixed $data 要返回的数据 + * @param integer $code 返回的code + * @param mixed $msg 提示信息 + * @param string $type 返回数据格式 + * @param array $header 发送的Header信息 + * @return void + */ + protected function result($data, $code = 0, $msg = '', $type = '', array $header = []) + { + $result = [ + 'code' => $code, + 'msg' => $msg, + 'time' => time(), + 'data' => $data, + ]; + + $type = $type ?: $this->getResponseType(); + $response = Response::create($result, $type)->header($header); + + throw new HttpResponseException($response); + } + + /** + * URL重定向 + * @access protected + * @param string $url 跳转的URL表达式 + * @param array|integer $params 其它URL参数 + * @param integer $code http code + * @param array $with 隐式传参 + * @return void + */ + protected function redirect($url, $params = [], $code = 302, $with = []) + { + $response = new Redirect($url); + + if (is_integer($params)) { + $code = $params; + $params = []; + } + + $response->code($code)->params($params)->with($with); + + throw new HttpResponseException($response); + } + + /** + * 获取当前的response 输出类型 + * @access protected + * @return string + */ + protected function getResponseType() + { + $isAjax = Container::get('request')->isAjax(); + $config = Container::get('config'); + + return $isAjax + ? $config->get('default_ajax_return') + : $config->get('default_return_type'); + } +} diff --git a/tp5/thinkphp/logo.png b/tp5/thinkphp/logo.png new file mode 100644 index 0000000..25fd059 Binary files /dev/null and b/tp5/thinkphp/logo.png differ diff --git a/tp5/thinkphp/phpunit.xml.dist b/tp5/thinkphp/phpunit.xml.dist new file mode 100644 index 0000000..37c3d2b --- /dev/null +++ b/tp5/thinkphp/phpunit.xml.dist @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + ./library/think/*/tests/ + + + + + + ./library/ + + ./library/think/*/tests + ./library/think/*/assets + ./library/think/*/resources + ./library/think/*/vendor + + + + \ No newline at end of file diff --git a/tp5/thinkphp/tpl/default_index.tpl b/tp5/thinkphp/tpl/default_index.tpl new file mode 100644 index 0000000..740b192 --- /dev/null +++ b/tp5/thinkphp/tpl/default_index.tpl @@ -0,0 +1,10 @@ +*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }

    :) 2018新年快乐

    ThinkPHP V5.1
    12载初心不改(2006-2018) - 你值得信赖的PHP框架

    '; + } +} diff --git a/tp5/thinkphp/tpl/dispatch_jump.tpl b/tp5/thinkphp/tpl/dispatch_jump.tpl new file mode 100644 index 0000000..583376b --- /dev/null +++ b/tp5/thinkphp/tpl/dispatch_jump.tpl @@ -0,0 +1,49 @@ +{__NOLAYOUT__} + + + + + 跳转提示 + + + +
    + + +

    :)

    +

    + + +

    :(

    +

    + + +

    +

    + 页面自动 跳转 等待时间: +

    +
    + + + diff --git a/tp5/thinkphp/tpl/page_trace.tpl b/tp5/thinkphp/tpl/page_trace.tpl new file mode 100644 index 0000000..2e5afba --- /dev/null +++ b/tp5/thinkphp/tpl/page_trace.tpl @@ -0,0 +1,71 @@ +
    + + +
    +
    +
    getUseTime().'s ';?>
    + +
    + + diff --git a/tp5/thinkphp/tpl/think_exception.tpl b/tp5/thinkphp/tpl/think_exception.tpl new file mode 100644 index 0000000..19ecbdc --- /dev/null +++ b/tp5/thinkphp/tpl/think_exception.tpl @@ -0,0 +1,507 @@ +'.end($names).''; + } + } + + if(!function_exists('parse_file')){ + function parse_file($file, $line) + { + return ''.basename($file)." line {$line}".''; + } + } + + if(!function_exists('parse_args')){ + function parse_args($args) + { + $result = []; + + foreach ($args as $key => $item) { + switch (true) { + case is_object($item): + $value = sprintf('object(%s)', parse_class(get_class($item))); + break; + case is_array($item): + if(count($item) > 3){ + $value = sprintf('[%s, ...]', parse_args(array_slice($item, 0, 3))); + } else { + $value = sprintf('[%s]', parse_args($item)); + } + break; + case is_string($item): + if(strlen($item) > 20){ + $value = sprintf( + '\'%s...\'', + htmlentities($item), + htmlentities(substr($item, 0, 20)) + ); + } else { + $value = sprintf("'%s'", htmlentities($item)); + } + break; + case is_int($item): + case is_float($item): + $value = $item; + break; + case is_null($item): + $value = 'null'; + break; + case is_bool($item): + $value = '' . ($item ? 'true' : 'false') . ''; + break; + case is_resource($item): + $value = 'resource'; + break; + default: + $value = htmlentities(str_replace("\n", '', var_export(strval($item), true))); + break; + } + + $result[] = is_int($key) ? $value : "'{$key}' => {$value}"; + } + + return implode(', ', $result); + } + } +?> + + + + + 系统发生错误 + + + + +
    + +
    + +
    +
    + +
    +
    +

    [

    +
    +

    +
    + +
    + +
    +
      $value) { ?>
    +
    + +
    +

    Call Stack

    +
      +
    1. + +
    2. + +
    3. + +
    +
    +
    + +
    + +

    + +
    + + + +
    +

    Exception Datas

    + $value) { ?> + + + + + + + $val) { ?> + + + + + + + +
    empty
    + +
    + +
    + + + +
    +

    Environment Variables

    + $value) { ?> + + + + + + + $val) { ?> + + + + + + + +
    empty
    + +
    + +
    + + + + + + + + diff --git a/tp5/vendor/autoload.php b/tp5/vendor/autoload.php new file mode 100644 index 0000000..4cae05e --- /dev/null +++ b/tp5/vendor/autoload.php @@ -0,0 +1,7 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see http://www.php-fig.org/psr/psr-0/ + * @see http://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + // PSR-4 + private $prefixLengthsPsr4 = array(); + private $prefixDirsPsr4 = array(); + private $fallbackDirsPsr4 = array(); + + // PSR-0 + private $prefixesPsr0 = array(); + private $fallbackDirsPsr0 = array(); + + private $useIncludePath = false; + private $classMap = array(); + private $classMapAuthoritative = false; + private $missingClasses = array(); + private $apcuPrefix; + + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', $this->prefixesPsr0); + } + + return array(); + } + + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 base directories + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + } + + /** + * Unregisters this instance as an autoloader. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return bool|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath.'\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + */ +function includeFile($file) +{ + include $file; +} diff --git a/tp5/vendor/composer/LICENSE b/tp5/vendor/composer/LICENSE new file mode 100644 index 0000000..f27399a --- /dev/null +++ b/tp5/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/tp5/vendor/composer/autoload_classmap.php b/tp5/vendor/composer/autoload_classmap.php new file mode 100644 index 0000000..7a91153 --- /dev/null +++ b/tp5/vendor/composer/autoload_classmap.php @@ -0,0 +1,9 @@ + $vendorDir . '/topthink/think-migration/src/config.php', +); diff --git a/tp5/vendor/composer/autoload_namespaces.php b/tp5/vendor/composer/autoload_namespaces.php new file mode 100644 index 0000000..b7fc012 --- /dev/null +++ b/tp5/vendor/composer/autoload_namespaces.php @@ -0,0 +1,9 @@ + array($vendorDir . '/topthink/think-migration/src'), + 'think\\composer\\' => array($vendorDir . '/topthink/think-installer/src'), + 'app\\' => array($baseDir . '/application'), + 'Phinx\\' => array($vendorDir . '/topthink/think-migration/phinx/src/Phinx'), +); diff --git a/tp5/vendor/composer/autoload_real.php b/tp5/vendor/composer/autoload_real.php new file mode 100644 index 0000000..7e34ca2 --- /dev/null +++ b/tp5/vendor/composer/autoload_real.php @@ -0,0 +1,70 @@ += 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); + if ($useStaticLoader) { + require_once __DIR__ . '/autoload_static.php'; + + call_user_func(\Composer\Autoload\ComposerStaticInitd5c82465914d2a5f6b25ba2f923c76b9::getInitializer($loader)); + } else { + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + } + + $loader->register(true); + + if ($useStaticLoader) { + $includeFiles = Composer\Autoload\ComposerStaticInitd5c82465914d2a5f6b25ba2f923c76b9::$files; + } else { + $includeFiles = require __DIR__ . '/autoload_files.php'; + } + foreach ($includeFiles as $fileIdentifier => $file) { + composerRequired5c82465914d2a5f6b25ba2f923c76b9($fileIdentifier, $file); + } + + return $loader; + } +} + +function composerRequired5c82465914d2a5f6b25ba2f923c76b9($fileIdentifier, $file) +{ + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + require $file; + + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + } +} diff --git a/tp5/vendor/composer/autoload_static.php b/tp5/vendor/composer/autoload_static.php new file mode 100644 index 0000000..002ea56 --- /dev/null +++ b/tp5/vendor/composer/autoload_static.php @@ -0,0 +1,56 @@ + __DIR__ . '/..' . '/topthink/think-migration/src/config.php', + ); + + public static $prefixLengthsPsr4 = array ( + 't' => + array ( + 'think\\migration\\' => 16, + 'think\\composer\\' => 15, + ), + 'a' => + array ( + 'app\\' => 4, + ), + 'P' => + array ( + 'Phinx\\' => 6, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'think\\migration\\' => + array ( + 0 => __DIR__ . '/..' . '/topthink/think-migration/src', + ), + 'think\\composer\\' => + array ( + 0 => __DIR__ . '/..' . '/topthink/think-installer/src', + ), + 'app\\' => + array ( + 0 => __DIR__ . '/../..' . '/application', + ), + 'Phinx\\' => + array ( + 0 => __DIR__ . '/..' . '/topthink/think-migration/phinx/src/Phinx', + ), + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInitd5c82465914d2a5f6b25ba2f923c76b9::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitd5c82465914d2a5f6b25ba2f923c76b9::$prefixDirsPsr4; + + }, null, ClassLoader::class); + } +} diff --git a/tp5/vendor/composer/installed.json b/tp5/vendor/composer/installed.json new file mode 100644 index 0000000..517174f --- /dev/null +++ b/tp5/vendor/composer/installed.json @@ -0,0 +1,139 @@ +[ + { + "name": "topthink/framework", + "version": "v5.1.5", + "version_normalized": "5.1.5.0", + "source": { + "type": "git", + "url": "https://github.com/top-think/framework.git", + "reference": "f81c4282cdf401be44fbe1a28b3e3df425e3017f" + }, + "dist": { + "type": "zip", + "url": "https://files.phpcomposer.com/files/top-think/framework/f81c4282cdf401be44fbe1a28b3e3df425e3017f.zip", + "reference": "f81c4282cdf401be44fbe1a28b3e3df425e3017f", + "shasum": "" + }, + "require": { + "php": ">=5.6.0", + "topthink/think-installer": "~1.0" + }, + "require-dev": { + "johnkary/phpunit-speedtrap": "^1.0", + "mikey179/vfsstream": "~1.6", + "phpdocumentor/reflection-docblock": "^2.0", + "phploc/phploc": "2.*", + "phpunit/phpunit": "^5.0|^6.0", + "sebastian/phpcpd": "2.*", + "squizlabs/php_codesniffer": "2.*" + }, + "time": "2018-02-02T05:39:38+00:00", + "type": "think-framework", + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "liu21st", + "email": "liu21st@gmail.com" + }, + { + "name": "yunwuxin", + "email": "448901948@qq.com" + } + ], + "description": "the new thinkphp framework", + "homepage": "http://thinkphp.cn/", + "keywords": [ + "framework", + "orm", + "thinkphp" + ] + }, + { + "name": "topthink/think-installer", + "version": "v1.0.12", + "version_normalized": "1.0.12.0", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-installer.git", + "reference": "1be326e68f63de4e95977ed50f46ae75f017556d" + }, + "dist": { + "type": "zip", + "url": "https://files.phpcomposer.com/files/top-think/think-installer/1be326e68f63de4e95977ed50f46ae75f017556d.zip", + "reference": "1be326e68f63de4e95977ed50f46ae75f017556d", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0" + }, + "require-dev": { + "composer/composer": "1.0.*@dev" + }, + "time": "2017-05-27T06:58:09+00:00", + "type": "composer-plugin", + "extra": { + "class": "think\\composer\\Plugin" + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "think\\composer\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "yunwuxin", + "email": "448901948@qq.com" + } + ] + }, + { + "name": "topthink/think-migration", + "version": "v2.0.3", + "version_normalized": "2.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/top-think/think-migration.git", + "reference": "70c89850ca29c2eab988c7c3475d1d5331901bb8" + }, + "dist": { + "type": "zip", + "url": "https://files.phpcomposer.com/files/top-think/think-migration/70c89850ca29c2eab988c7c3475d1d5331901bb8.zip", + "reference": "70c89850ca29c2eab988c7c3475d1d5331901bb8", + "shasum": "" + }, + "require": { + "topthink/framework": "5.1.*" + }, + "time": "2017-12-31T16:32:22+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Phinx\\": "phinx/src/Phinx", + "think\\migration\\": "src" + }, + "files": [ + "src/config.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "yunwuxin", + "email": "448901948@qq.com" + } + ] + } +] diff --git a/tp5/vendor/topthink/think-installer/.gitignore b/tp5/vendor/topthink/think-installer/.gitignore new file mode 100644 index 0000000..8f4c02d --- /dev/null +++ b/tp5/vendor/topthink/think-installer/.gitignore @@ -0,0 +1,3 @@ +/.idea +composer.lock +/vendor \ No newline at end of file diff --git a/tp5/vendor/topthink/think-installer/composer.json b/tp5/vendor/topthink/think-installer/composer.json new file mode 100644 index 0000000..4005de2 --- /dev/null +++ b/tp5/vendor/topthink/think-installer/composer.json @@ -0,0 +1,25 @@ +{ + "name": "topthink/think-installer", + "type": "composer-plugin", + "require": { + "composer-plugin-api": "^1.0" + }, + "require-dev": { + "composer/composer": "1.0.*@dev" + }, + "license": "Apache-2.0", + "authors": [ + { + "name": "yunwuxin", + "email": "448901948@qq.com" + } + ], + "autoload": { + "psr-4": { + "think\\composer\\": "src" + } + }, + "extra": { + "class": "think\\composer\\Plugin" + } +} diff --git a/tp5/vendor/topthink/think-installer/src/Plugin.php b/tp5/vendor/topthink/think-installer/src/Plugin.php new file mode 100644 index 0000000..757c30f --- /dev/null +++ b/tp5/vendor/topthink/think-installer/src/Plugin.php @@ -0,0 +1,26 @@ +getInstallationManager(); + + //框架核心 + $manager->addInstaller(new ThinkFramework($io, $composer)); + + //单元测试 + $manager->addInstaller(new ThinkTesting($io, $composer)); + + //扩展 + $manager->addInstaller(new ThinkExtend($io, $composer)); + + } +} \ No newline at end of file diff --git a/tp5/vendor/topthink/think-installer/src/ThinkExtend.php b/tp5/vendor/topthink/think-installer/src/ThinkExtend.php new file mode 100644 index 0000000..d78f118 --- /dev/null +++ b/tp5/vendor/topthink/think-installer/src/ThinkExtend.php @@ -0,0 +1,77 @@ + +// +---------------------------------------------------------------------- + +namespace think\composer; + +use Composer\Installer\LibraryInstaller; +use Composer\Package\PackageInterface; +use Composer\Repository\InstalledRepositoryInterface; + +class ThinkExtend extends LibraryInstaller +{ + + public function install(InstalledRepositoryInterface $repo, PackageInterface $package) + { + parent::install($repo, $package); + $this->copyExtraFiles($package); + } + + public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target) + { + parent::update($repo, $initial, $target); + $this->copyExtraFiles($target); + + } + + protected function copyExtraFiles(PackageInterface $package) + { + if ($this->composer->getPackage()->getType() == 'project') { + + $extra = $package->getExtra(); + + if (!empty($extra['think-config'])) { + + $composerExtra = $this->composer->getPackage()->getExtra(); + + $appDir = !empty($composerExtra['app-path']) ? $composerExtra['app-path'] : 'application'; + + if (is_dir($appDir)) { + + $extraDir = $appDir . DIRECTORY_SEPARATOR . 'extra'; + $this->filesystem->ensureDirectoryExists($extraDir); + + //配置文件 + foreach ((array) $extra['think-config'] as $name => $config) { + $target = $extraDir . DIRECTORY_SEPARATOR . $name . '.php'; + $source = $this->getInstallPath($package) . DIRECTORY_SEPARATOR . $config; + + if (is_file($target)) { + $this->io->write("File {$target} exist!"); + continue; + } + + if (!is_file($source)) { + $this->io->write("File {$target} not exist!"); + continue; + } + + copy($source, $target); + } + } + } + } + } + + public function supports($packageType) + { + return 'think-extend' === $packageType; + } +} \ No newline at end of file diff --git a/tp5/vendor/topthink/think-installer/src/ThinkFramework.php b/tp5/vendor/topthink/think-installer/src/ThinkFramework.php new file mode 100644 index 0000000..cdb7d84 --- /dev/null +++ b/tp5/vendor/topthink/think-installer/src/ThinkFramework.php @@ -0,0 +1,59 @@ +composer->getPackage()->getType() == 'project' && $package->getInstallationSource() != 'source') { + //remove tests dir + $this->filesystem->removeDirectory($this->getInstallPath($package) . DIRECTORY_SEPARATOR . 'tests'); + } + } + + /** + * {@inheritDoc} + */ + public function getInstallPath(PackageInterface $package) + { + if ('topthink/framework' !== $package->getPrettyName()) { + throw new \InvalidArgumentException('Unable to install this library!'); + } + + if ($this->composer->getPackage()->getType() !== 'project') { + return parent::getInstallPath($package); + } + + if ($this->composer->getPackage()) { + $extra = $this->composer->getPackage()->getExtra(); + if (!empty($extra['think-path'])) { + return $extra['think-path']; + } + } + + return 'thinkphp'; + } + + public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target) + { + parent::update($repo, $initial, $target); + if ($this->composer->getPackage()->getType() == 'project' && $target->getInstallationSource() != 'source') { + //remove tests dir + $this->filesystem->removeDirectory($this->getInstallPath($target) . DIRECTORY_SEPARATOR . 'tests'); + } + } + + /** + * {@inheritDoc} + */ + public function supports($packageType) + { + return 'think-framework' === $packageType; + } +} \ No newline at end of file diff --git a/tp5/vendor/topthink/think-installer/src/ThinkTesting.php b/tp5/vendor/topthink/think-installer/src/ThinkTesting.php new file mode 100644 index 0000000..bf27f72 --- /dev/null +++ b/tp5/vendor/topthink/think-installer/src/ThinkTesting.php @@ -0,0 +1,68 @@ + +// +---------------------------------------------------------------------- + +namespace think\composer; + + +use Composer\Installer\LibraryInstaller; +use Composer\Package\PackageInterface; +use Composer\Repository\InstalledRepositoryInterface; + +class ThinkTesting extends LibraryInstaller +{ + /** + * {@inheritDoc} + */ + public function getInstallPath(PackageInterface $package) + { + if ('topthink/think-testing' !== $package->getPrettyName()) { + throw new \InvalidArgumentException('Unable to install this library!'); + } + + return parent::getInstallPath($package); + } + + public function install(InstalledRepositoryInterface $repo, PackageInterface $package) + { + parent::install($repo, $package); + + $this->copyTestDir($package); + + + } + + public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target) + { + parent::update($repo, $initial, $target); + + $this->copyTestDir($target); + + } + + private function copyTestDir(PackageInterface $package) + { + $appDir = dirname($this->vendorDir); + $source = $this->getInstallPath($package) . DIRECTORY_SEPARATOR . 'example'; + if (!is_file($appDir . DIRECTORY_SEPARATOR . 'phpunit.xml')) { + $this->filesystem->copyThenRemove($source, $appDir); + } else { + $this->filesystem->removeDirectoryPhp($source); + } + } + + /** + * {@inheritDoc} + */ + public function supports($packageType) + { + return 'think-testing' === $packageType; + } +} \ No newline at end of file diff --git a/tp5/vendor/topthink/think-migration/.gitignore b/tp5/vendor/topthink/think-migration/.gitignore new file mode 100644 index 0000000..30babff --- /dev/null +++ b/tp5/vendor/topthink/think-migration/.gitignore @@ -0,0 +1,3 @@ +/vendor/ +.idea +composer.lock diff --git a/tp5/vendor/topthink/think-migration/LICENSE b/tp5/vendor/topthink/think-migration/LICENSE new file mode 100644 index 0000000..2c76a5a --- /dev/null +++ b/tp5/vendor/topthink/think-migration/LICENSE @@ -0,0 +1,32 @@ + +ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 +版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn) +All rights reserved。 +ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 + +Apache Licence是著名的非盈利开源组织Apache采用的协议。 +该协议和BSD类似,鼓励代码共享和尊重原作者的著作权, +允许代码修改,再作为开源或商业软件发布。需要满足 +的条件: +1. 需要给代码的用户一份Apache Licence ; +2. 如果你修改了代码,需要在被修改的文件中说明; +3. 在延伸的代码中(修改和有源代码衍生的代码中)需要 +带有原来代码中的协议,商标,专利声明和其他原来作者规 +定需要包含的说明; +4. 如果再发布的产品中包含一个Notice文件,则在Notice文 +件中需要带有本协议内容。你可以在Notice中增加自己的 +许可,但不可以表现为对Apache Licence构成更改。 +具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0 + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"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 THE +COPYRIGHT OWNER OR 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. \ No newline at end of file diff --git a/tp5/vendor/topthink/think-migration/README.md b/tp5/vendor/topthink/think-migration/README.md new file mode 100644 index 0000000..bc92a95 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/README.md @@ -0,0 +1,6 @@ +# thinkphp5.1 数据库迁移工具 + +## 安装 +~~~ +composer require topthink/think-migration +~~~ diff --git a/tp5/vendor/topthink/think-migration/composer.json b/tp5/vendor/topthink/think-migration/composer.json new file mode 100644 index 0000000..7d275e5 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/composer.json @@ -0,0 +1,22 @@ +{ + "name": "topthink/think-migration", + "authors": [ + { + "name": "yunwuxin", + "email": "448901948@qq.com" + } + ], + "license": "Apache-2.0", + "autoload": { + "psr-4": { + "Phinx\\": "phinx/src/Phinx", + "think\\migration\\": "src" + }, + "files": [ + "src/config.php" + ] + }, + "require": { + "topthink/framework": "5.1.*" + } +} diff --git a/tp5/vendor/topthink/think-migration/phinx/CHANGELOG.md b/tp5/vendor/topthink/think-migration/phinx/CHANGELOG.md new file mode 100644 index 0000000..df1c2e4 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/CHANGELOG.md @@ -0,0 +1,370 @@ +# Version History + +**0.6.5** (Thursday, 27 October 2016) + +* Documentation updates +* Pull requests + * [#831](https://github.com/robmorgan/phinx/pull/831) Typos + * [#929](https://github.com/robmorgan/phinx/pull/929) Support glob brace for seed paths + * [#949](https://github.com/robmorgan/phinx/pull/949) Fix for Config::getMigrationBaseClassName + * [#958](https://github.com/robmorgan/phinx/pull/958) Allow console input to be used within adapters + +**0.6.4** (Wednesday, 27th July 2016) + +* Documentation updates +* Pull requests + * [#909](https://github.com/robmorgan/phinx/pull/909) Declare test class properties + * [#910](https://github.com/robmorgan/phinx/pull/910), [#916](https://github.com/robmorgan/phinx/pull/916) Remove unused variables + * [#912](https://github.com/robmorgan/phinx/pull/912) ConfigInterface usage consistency + * [#914](https://github.com/robmorgan/phinx/pull/914) Set return values and @return documentation + * [#918](https://github.com/robmorgan/phinx/pull/918) Docblock correction for Phinx\Migration\Manager::executeSeed() + * [#921](https://github.com/robmorgan/phinx/pull/921) Add Phinx\Wrapper\TextWrapper::getSeed() +* Bug fixes + * [#908](https://github.com/robmorgan/phinx/pull/908) Fix setting options for Column, ForeignKey and Index + * [#922](https://github.com/robmorgan/phinx/pull/922) SQLite adapter drops table on changeColumn if there's a foreign key + +**0.6.3** (Monday, 18th July 2016) + +* New features + * [#707](https://github.com/robmorgan/phinx/pull/707/files) Add arguments for timestamps columns names +* Documentation cleanup +* Bug fixes + * [#884](https://github.com/robmorgan/phinx/pull/884) Only rollback 1 migration when only 2 migrations exist + * Input and Output are now correctly supplied to migration template creation classes + +**0.6.2** (Thursday, 23rd June 2016) + +* Fix breakpoint support for Postgres +* HHVM now passes all tests + +**0.6.1** (Tuesday, 21st June 2016) + +* Fix rollback when only 1 migration + +**0.6.0** (Tuesday, 21st June 2016) + +* Backward incompatibility - see [UPGRADE_0.6](UPGRADE_0.6.md) document +* Introduce Input and Output access to migrations and template creation +* New breakpoint command +* Moved version history to this CHANGELOG.md document +* More tests + +**0.5.5** (Friday, 17th May 2016) + +* Fix support for running multiple seeders +* Bug fix for migration template source - defaults and command line +* Bug fixes + +**0.5.4** (Monday, 25th April 2016) + +* Added support for running multiple seeders +* Use `GLOB_BRACE` when finding migrations only if its available +* Added support for MySQL `VARBINARY` column type +* Minor bug fixes + +**0.5.3** (Monday, 7th March 2016) + +* Critical fix: allow `migration_name` to be `null`. Introduced in 0.5.2 +* Status command now shows migration start and end times +* Bug fix for rolling back by date +* Documentation improvements + +**0.5.2** (Tuesday, 1st March 2016) + +* Status command now includes missing migration names +* Added support for Postgres table comments +* Added `insert()` for the TablePrefixAdapter +* Fixed the migration verbosity flag +* Added MySQL 5.7 JSON support +* Added support for MySQL `FULLTEXT` indexes +* Postgres now supports `BIGSERIAL` for primary keys +* Added support for MySQL index limits +* Initial support for multiple migration paths (using glob) +* Documentation improvements +* Unit test enhancements + +**0.5.1** (Wednesday, 30th December 2015) + +* **PHP 5.3 is no longer supported!** +* Add support for Symfony 3.0 components +* Ensure that the `status` command returns the correct exit code +* Allow `$version` to be passed into templates +* Support for MySQL `YEAR` column type +* Multiple documentation updates and corrections + +**0.5.0** (Monday, 30th November 2015) + +* Support for seeding data after database creation +* The migration and seed directories are now nested under `db` by default +* Moved `Phinx\Migration\Util` to `Phinx\Util\Util` +* All `insert()` methods now have a slightly different method signature +* Fixed key/insert operations for MySQL +* Introduced `AdapterInterface::hasIndexByName()` +* Improved `dropForeignKey()` handling for SQLite +* Added support for the MySQL `binary` datatype. BLOBs now use the proper type. +* The status command shows a count of pending migrations in JSON output +* We are now testing against PHP 7 + +**0.4.6** (Friday, 11th September 2015) + +* You can now set custom migration templates in the config files +* Support for MySQL unsigned booleans +* Support for Postgres `smallint` column types +* Support for `AFTER` when using `changeColumn()` with MySQL +* Support for `precision` and `scale` when using the Postgres `decimal` type +* Fixed a bug where duplicate migration names could be used +* The schema table is now created with a primary key +* Fixed issues when using the MySQL `STRICT_TRANS_TABLE` mode +* Improved the docs in the default migration template +* Made Box PHAR ignore the bundled `phinx.yml` configuration file +* Updated Box installer URL +* Internal code improvements +* Documentation improvements + +**0.4.5** (Tuesday, 1st September 2015) + +* The rollback command now supports a date argument +* Fixed DBLIB DSN strings for Microsoft SQL Server +* Postgres support for `jsonb` columns added +* The `addTimestamps()` helper method no longer updates the `created_at` column +* Fix for Postgres named foreign keys +* Unit test improvements (including strict warnings) +* Documentation improvements + +**0.4.4** (Sunday, 14th June 2015) + +* The `change` method is now the default +* Added a generic adapter insert method. Warning: The implementation will change! +* Updated Symfony depdencies to ~2.7 +* Support for MySQL `BLOB` column types +* SQLite migration fixes +* Documentation improvements + +**0.4.3** (Monday, 23rd Feburary 2015) + +* Postgres bugfix for modifying column DEFAULTs +* MySQL bugfix for setting column INTEGER lengths +* SQLite bugfix for creating multiple indexes with similar names + +**0.4.2.1** (Saturday, 7th Feburary 2015) + +* Proper release, updated docs + +**0.4.2** (Friday, 6th Feburary 2015) + +* Postgres support for `json` columns added +* MySQL support for `enum` and `set` columns added +* Allow setting `identity` option on columns +* Template configuration and generation made more extensible +* Created a base class for `ProxyAdapter` and `TablePrefixAdapter` +* Switched to PSR-4 + +**0.4.1** (Tuesday, 23rd December 2014) + +* MySQL support for reserved words in hasColumn and getColumns methods +* Better MySQL Adapter test coverage and performance fixes +* Updated dependent Symfony components to 2.6.x + +**0.4.0** (Sunday, 14th December 2014) + +* Adding initial support for running Phinx via a web interface +* Support for table prefixes and suffixes +* Bugfix for foreign key options +* MySQL keeps column default when renaming columns +* MySQL support for tiny/medium and longtext columns added +* Changed SQL Server binary columns to varbinary +* MySQL supports table comments +* Postgres supports column comments +* Empty strings are now supported for default column values +* Booleans are now supported for default column values +* Fixed SQL Server default constraint error when changing column types +* Migration timestamps are now created in UTC +* Locked Symfony Components to 2.5.0 +* Support for custom migration base classes +* Cleaned up source code formatting +* Migrations have access to the output stream +* Support for custom PDO connections when a PHP config +* Added support for Postgres UUID type +* Fixed issue with Postgres dropping foreign keys + +**0.3.8** (Sunday, 5th October 2014) + +* Added new CHAR & Geospatial column types +* Added MySQL unix socket support +* Added precision & scale support for SQL Server +* Several bug fixes for SQLite +* Improved error messages +* Overall code optimizations +* Optimizations to MySQL hasTable method + +**0.3.7** (Tuesday, 12th August 2014) + +* Smarter configuration file support +* Support for Postgres Schemas +* Fixed charset support for Microsoft SQL Server +* Fix for Unique indexes in all adapters +* Improvements for MySQL foreign key migration syntax +* Allow MySQL column types with extra info +* Fixed SQLite autoincrement behaviour +* PHPDoc improvements +* Documentation improvements +* Unit test improvements +* Removing primary_key as a type + +**0.3.6** (Sunday, 29th June 2014) + +* Add custom adapter support +* Fix PHP 5.3 compatibility for SQL Server + +**0.3.5** (Saturday, 21st June 2014) + +* Added Microsoft SQL Server support +* Removed Primary Key column type +* Cleaned up and optimized many methods +* Updated Symfony dependencies to v2.5.0 +* PHPDoc improvements + +**0.3.4** (Sunday, 27th April 2014) + +* Added support MySQL unsigned integer, biginteger, float and decimal types +* Added JSON output support for the status command +* Fix a bug where Postgres couldnt rollback foreign keys +* Moved Phinx type references to interface constants +* Fixed a bug with SQLite in-memory databases + +**0.3.3** (Saturday, 22nd March 2014) + +* Added support for JSON configuration +* Named index support for all adapters (thanks @archer308) +* Updated Composer dependencies +* Fix for SQLite Integer Type +* Fix for MySQL port option + +**0.3.2** (Monday, 24th February 2014) + +* Adding better Postgres type support + +**0.3.1** (Sunday, 23rd February 2014) + +* Adding MySQL charset support to the YAML config +* Removing trailing spaces + +**0.3.0** (Sunday, 2nd February 2014) + +* PSR-2 support +* Method to add timestamps easily to tables +* Support for column comments in the Postgres adapter +* Fixes for MySQL driver options +* Fixes for MySQL biginteger type + +**0.2.9** (Saturday, 16th November 2013) + +* Added SQLite Support +* Improving the unit tests, especially on Windows + +**0.2.8** (Sunday, 25th August 2013) + +* Added PostgresSQL Support + +**0.2.7** (Saturday, 24th August 2013) + +* Critical fix for a token parsing bug +* Removed legacy build system +* Improving docs + +**0.2.6** (Saturday, 24th August 2013) + +* Added support for environment vars in config files +* Added support for environment vars to set the Phinx Env +* Improving docs +* Fixed a bug with column names in indexes +* Changes for developers in regards to the unit tests + +**0.2.5** (Sunday, 26th May 2013) + +* Added support for Box Phar Archive Packaging +* Added support for MYSQL_ATTR driver options +* Fixed a bug where foreign keys cannot be removed +* Added support for MySQL table collation +* Updated Composer dependencies +* Removed verbosity options, now relies on Symfony instead +* Improved unit tests + +**0.2.4** (Saturday, 20th April 2013) + +* The Rollback command supports the verbosity parameter +* The Rollback command has more detailed output +* Table::dropForeignKey now returns the table instance + +**0.2.3** (Saturday, 6th April 2013) + +* Fixed a reporting bug when Phinx couldn't connect to a database +* Added support for the MySQL 'ON UPDATE' function +* Phinx timestamp is now mapped to MySQL timestamp instead of datetime +* Fixed a docs typo for the minimum PHP version +* Added UTF8 support for migrations +* Changed regex to handle migration names differently +* Added support for custom MySQL table engines such as MyISAM +* Added the change method to the migration template + +**0.2.2** (Sunday, 3rd March 2013) + +* Added a new verbosity parameter to see more output when migrating +* Support for PHP config files + +**0.2.1** (Sunday, 3rd March 2013) + +* Broken Release. Do not use! +* Unit tests no longer rely on the default phinx.yml file +* Running migrate for the first time does not give php warnings +* `default_migration_table` is now actually supported +* Updated docblocks to 2013. + +**0.2.0** (Sunday, 13th January 2013) + +* First Birthday Release +* Added Reversible Migrations +* Removed options parameter from AdapterInterface::hasColumn() + +**0.1.7** (Tuesday, 8th January 2013) + +* Improved documentation on the YAML configuration file +* Removed options parameter from AdapterInterface::dropIndex() + +**0.1.6** (Sunday, 9th December 2012) + +* Added foreign key support +* Removed PEAR support +* Support for auto_increment on custom id columns +* Bugfix for column default value 0 +* Documentation improvements + +**0.1.5** (Sunday, 4th November 2012) + +* Added a test command +* Added transactions for adapters that support it +* Changing the Table API to use pending column methods +* Fixed a bug when defining multiple indexes on a table + +**0.1.4** (Sunday, 21st October 2012) + +* Documentation Improvements + +**0.1.3** (Saturday, 20th October 2012) + +* Fixed broken composer support + +**0.1.2** (Saturday, 20th October 2012) + +* Added composer support +* Now forces migrations to be in CamelCase format +* Now specifies the database name when migrating +* Creates the internal log table using its API instead of raw SQL + +**0.1.1** (Wednesday, 13th June 2012) + +* First point release. Ready for limited production use. + +**0.1.0** (Friday, 13th January 2012) + +* Initial public release. diff --git a/tp5/vendor/topthink/think-migration/phinx/CONTRIBUTING.md b/tp5/vendor/topthink/think-migration/phinx/CONTRIBUTING.md new file mode 100644 index 0000000..73b54ac --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/CONTRIBUTING.md @@ -0,0 +1,66 @@ +# How to contribute to Phinx + +Phinx relies heavily on external contributions in order to make it the best database migration +tool possible. Without the support of our 115+ contributors we wouldn't be where we are today! +We encourage anyone to submit documentation enhancements and code. + +Issues, feature requests and bugs should be submitted using the Github issue tool: +https://github.com/robmorgan/phinx/issues. + +This document briefly outlines the requirements to contribute code to Phinx. + +## Considerations + +Before you submit your pull request take a moment to answer the following questions. + +Answering '**YES**' to all questions will increase the likelihood of your PR being accepted! + +* Have I implemented my feature for as many database adapters as possible? +* Does my new feature improve Phinx's performance or keep it consistent? +* Does my feature fit within the database migration space? +* Is the code entirely my own and free from any commercial licensing? +* Am I happy to release my code under the MIT license? +* Is my code formatted using the [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) coding standard? + +**Note:** We accept bug fixes much faster into our development branch than features. + +## Getting Started + +Great, so you want to contribute. Let's get started: + +1. Start by forking Phinx on GitHub: https://github.com/robmorgan/phinx + +1. Clone your repository to a local directory on your development box. + +1. If you do not have Composer set up already, install it: + + ``` + curl -sS https://getcomposer.org/installer | php + ``` + +1. Change to your Phinx clone directory and pull the necessary dependencies: + + ``` + php composer.phar install + ``` + +1. Copy the `phpunit.xml.dist` template to `phpunit.xml` and change the configuration to suit your environment. If you are not using any particular adapter you can disable it in the `phpunit.xml` file. + +1. Run the unit tests locally to ensure they pass: + + ``` + php vendor/bin/phpunit --config phpunit.xml + ``` + +1. Write the code and unit tests for your bug fix or feature. + +1. Add any relevant documentation. + +1. Run the unit tests again and ensure they pass. + +1. Open a pull request on the Github project page. Ensure the code is being merged into the latest development branch (e.g: `0.5.x-dev`) and not `master`. + +## Documentation + +The Phinx documentation is stored in the **docs** directory using the [RestructedText](http://docutils.sourceforge.net/rst.html) format. All documentation merged to `master` is automatically published to the Phinx documentation site available +at: http://docs.phinx.org. Keep this in mind when submitting your PR, or ask someone to merge the development branch back down to master. diff --git a/tp5/vendor/topthink/think-migration/phinx/LICENSE b/tp5/vendor/topthink/think-migration/phinx/LICENSE new file mode 100644 index 0000000..26ade90 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/LICENSE @@ -0,0 +1,9 @@ +(The MIT license) + +Copyright (c) 2014 Rob Morgan + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/tp5/vendor/topthink/think-migration/phinx/README.md b/tp5/vendor/topthink/think-migration/phinx/README.md new file mode 100644 index 0000000..ed1badc --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/README.md @@ -0,0 +1,128 @@ +# [Phinx](https://phinx.org): Simple PHP Database Migrations + +[![Build Status](https://travis-ci.org/robmorgan/phinx.png?branch=master)](https://travis-ci.org/robmorgan/phinx) +[![Build status](https://ci.appveyor.com/api/projects/status/9vag4892hfq6effr)](https://ci.appveyor.com/project/robmorgan/phinx) +[![Code Coverage](https://scrutinizer-ci.com/g/robmorgan/phinx/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/robmorgan/phinx/) +[![Latest Stable Version](https://poser.pugx.org/robmorgan/phinx/version.png)](https://packagist.org/packages/robmorgan/phinx) +[![Total Downloads](https://poser.pugx.org/robmorgan/phinx/d/total.png)](https://packagist.org/packages/robmorgan/phinx) + +Phinx makes it ridiculously easy to manage the database migrations for your PHP app. In less than 5 minutes you can install Phinx and create your first database migration. Phinx is just about migrations without all the bloat of a database ORM system or framework. + +**Check out http://docs.phinx.org for the comprehensive documentation.** + +![phinxterm](https://cloud.githubusercontent.com/assets/178939/3887559/e6b5e524-21f2-11e4-8256-0ba6040725fc.gif) + +### Features + +* Write database migrations using database agnostic PHP code. +* Migrate up and down. +* Migrate on deployment. +* Seed data after database creation. +* Get going in less than 5 minutes. +* Stop worrying about the state of your database. +* Take advantage of SCM features such as branching. +* Integrate with any app. + +### Supported Adapters + +Phinx natively supports the following database adapters: + +* MySQL +* PostgreSQL +* SQLite +* Microsoft SQL Server + +## Install & Run + +### Composer + +The fastest way to install Phinx is to add it to your project using Composer (http://getcomposer.org/). + +1. Install Composer: + + ``` + curl -sS https://getcomposer.org/installer | php + ``` + +1. Require Phinx as a dependency using Composer: + + ``` + php composer.phar require robmorgan/phinx + ``` + +1. Install Phinx: + + ``` + php composer.phar install + ``` + +1. Execute Phinx: + + ``` + php vendor/bin/phinx + ``` + +### As a Phar + +You can also use the Box application to build Phinx as a Phar archive (https://box-project.github.io/box2/). + +1. Clone Phinx from GitHub + + ``` + git clone git://github.com/robmorgan/phinx.git + cd phinx + ``` + +1. Install Composer + + ``` + curl -s https://getcomposer.org/installer | php + ``` + +1. Install the Phinx dependencies + + ``` + php composer.phar install + ``` + +1. Install Box: + + ``` + curl -LSs https://box-project.github.io/box2/installer.php | php + ``` + +1. Create a Phar archive + + ``` + php box.phar build + ``` + +## Documentation + +Check out http://docs.phinx.org for the comprehensive documentation. + +## Contributing + +Please read the [CONTRIBUTING](CONTRIBUTING.md) document. + +## News & Updates + +Follow Rob (@\_rjm\_) on Twitter to stay up to date (http://twitter.com/_rjm_) + +## Misc + +### Version History + +Please read the [CHANGELOG](CHANGELOG.md) document. + +### License + +(The MIT license) + +Copyright (c) 2016 Rob Morgan + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/AdapterFactory.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/AdapterFactory.php new file mode 100644 index 0000000..90674f9 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/AdapterFactory.php @@ -0,0 +1,181 @@ + + */ +class AdapterFactory +{ + /** + * @var AdapterFactory + */ + protected static $instance; + + /** + * Get the factory singleton instance. + * + * @return AdapterFactory + */ + public static function instance() + { + if (!static::$instance) { + static::$instance = new static(); + } + return static::$instance; + } + + /** + * Class map of database adapters, indexed by PDO::ATTR_DRIVER_NAME. + * + * @var array + */ + protected $adapters = array( + 'mysql' => 'Phinx\Db\Adapter\MysqlAdapter', + 'pgsql' => 'Phinx\Db\Adapter\PostgresAdapter', + 'sqlite' => 'Phinx\Db\Adapter\SQLiteAdapter', + 'sqlsrv' => 'Phinx\Db\Adapter\SqlServerAdapter', + ); + + /** + * Class map of adapters wrappers, indexed by name. + * + * @var array + */ + protected $wrappers = array( + 'prefix' => 'Phinx\Db\Adapter\TablePrefixAdapter', + 'proxy' => 'Phinx\Db\Adapter\ProxyAdapter', + ); + + /** + * Add or replace an adapter with a fully qualified class name. + * + * @throws \RuntimeException + * @param string $name + * @param string $class + * @return $this + */ + public function registerAdapter($name, $class) + { + if (!is_subclass_of($class, 'Phinx\Db\Adapter\AdapterInterface')) { + throw new \RuntimeException(sprintf( + 'Adapter class "%s" must implement Phinx\\Db\\Adapter\\AdapterInterface', + $class + )); + } + $this->adapters[$name] = $class; + return $this; + } + + /** + * Get an adapter class by name. + * + * @throws \RuntimeException + * @param string $name + * @return string + */ + protected function getClass($name) + { + if (empty($this->adapters[$name])) { + throw new \RuntimeException(sprintf( + 'Adapter "%s" has not been registered', + $name + )); + } + return $this->adapters[$name]; + } + + /** + * Get an adapter instance by name. + * + * @param string $name + * @param array $options + * @return AdapterInterface + */ + public function getAdapter($name, array $options) + { + $class = $this->getClass($name); + return new $class($options); + } + + /** + * Add or replace a wrapper with a fully qualified class name. + * + * @throws \RuntimeException + * @param string $name + * @param string $class + * @return $this + */ + public function registerWrapper($name, $class) + { + if (!is_subclass_of($class, 'Phinx\Db\Adapter\WrapperInterface')) { + throw new \RuntimeException(sprintf( + 'Wrapper class "%s" must be implement Phinx\\Db\\Adapter\\WrapperInterface', + $class + )); + } + $this->wrappers[$name] = $class; + return $this; + } + + /** + * Get a wrapper class by name. + * + * @throws \RuntimeException + * @param string $name + * @return string + */ + protected function getWrapperClass($name) + { + if (empty($this->wrappers[$name])) { + throw new \RuntimeException(sprintf( + 'Wrapper "%s" has not been registered', + $name + )); + } + return $this->wrappers[$name]; + } + + /** + * Get a wrapper instance by name. + * + * @param string $name + * @param AdapterInterface $adapter + * @return AdapterInterface + */ + public function getWrapper($name, AdapterInterface $adapter) + { + $class = $this->getWrapperClass($name); + return new $class($adapter); + } +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/AdapterInterface.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/AdapterInterface.php new file mode 100644 index 0000000..f2e9fe1 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/AdapterInterface.php @@ -0,0 +1,510 @@ + + */ +interface AdapterInterface +{ + const PHINX_TYPE_STRING = 'string'; + const PHINX_TYPE_CHAR = 'char'; + const PHINX_TYPE_TEXT = 'text'; + const PHINX_TYPE_INTEGER = 'integer'; + const PHINX_TYPE_BIG_INTEGER = 'biginteger'; + const PHINX_TYPE_FLOAT = 'float'; + const PHINX_TYPE_DECIMAL = 'decimal'; + const PHINX_TYPE_DATETIME = 'datetime'; + const PHINX_TYPE_TIMESTAMP = 'timestamp'; + const PHINX_TYPE_TIME = 'time'; + const PHINX_TYPE_DATE = 'date'; + const PHINX_TYPE_BINARY = 'binary'; + const PHINX_TYPE_VARBINARY = 'varbinary'; + const PHINX_TYPE_BLOB = 'blob'; + const PHINX_TYPE_BOOLEAN = 'boolean'; + const PHINX_TYPE_JSON = 'json'; + const PHINX_TYPE_JSONB = 'jsonb'; + const PHINX_TYPE_UUID = 'uuid'; + const PHINX_TYPE_FILESTREAM = 'filestream'; + + // Geospatial database types + const PHINX_TYPE_GEOMETRY = 'geometry'; + const PHINX_TYPE_POINT = 'point'; + const PHINX_TYPE_LINESTRING = 'linestring'; + const PHINX_TYPE_POLYGON = 'polygon'; + + // only for mysql so far + const PHINX_TYPE_ENUM = 'enum'; + const PHINX_TYPE_SET = 'set'; + + /** + * Get all migrated version numbers. + * + * @return array + */ + public function getVersions(); + + /** + * Get all migration log entries, indexed by version number. + * + * @return array + */ + public function getVersionLog(); + + /** + * Set adapter configuration options. + * + * @param array $options + * @return AdapterInterface + */ + public function setOptions(array $options); + + /** + * Get all adapter options. + * + * @return array + */ + public function getOptions(); + + /** + * Check if an option has been set. + * + * @param string $name + * @return boolean + */ + public function hasOption($name); + + /** + * Get a single adapter option, or null if the option does not exist. + * + * @param string $name + * @return mixed + */ + public function getOption($name); + + /** + * Sets the console input. + * + * @param InputInterface $input Input + * @return AdapterInterface + */ + public function setInput(InputInterface $input); + + /** + * Gets the console input. + * + * @return InputInterface + */ + public function getInput(); + + /** + * Sets the console output. + * + * @param OutputInterface $output Output + * @return AdapterInterface + */ + public function setOutput(OutputInterface $output); + + /** + * Gets the console output. + * + * @return OutputInterface + */ + public function getOutput(); + + /** + * Records a migration being run. + * + * @param MigrationInterface $migration Migration + * @param string $direction Direction + * @param int $startTime Start Time + * @param int $endTime End Time + * @return AdapterInterface + */ + public function migrated(MigrationInterface $migration, $direction, $startTime, $endTime); + + /** + * Toggle a migration breakpoint. + * + * @param MigrationInterface $migration + * + * @return AdapterInterface + */ + public function toggleBreakpoint(MigrationInterface $migration); + + /** + * Reset all migration breakpoints. + * + * @return int The number of breakpoints reset + */ + public function resetAllBreakpoints(); + + /** + * Does the schema table exist? + * + * @deprecated use hasTable instead. + * @return boolean + */ + public function hasSchemaTable(); + + /** + * Creates the schema table. + * + * @return void + */ + public function createSchemaTable(); + + /** + * Returns the adapter type. + * + * @return string + */ + public function getAdapterType(); + + /** + * Initializes the database connection. + * + * @throws \RuntimeException When the requested database driver is not installed. + * @return void + */ + public function connect(); + + /** + * Closes the database connection. + * + * @return void + */ + public function disconnect(); + + /** + * Does the adapter support transactions? + * + * @return boolean + */ + public function hasTransactions(); + + /** + * Begin a transaction. + * + * @return void + */ + public function beginTransaction(); + + /** + * Commit a transaction. + * + * @return void + */ + public function commitTransaction(); + + /** + * Rollback a transaction. + * + * @return void + */ + public function rollbackTransaction(); + + /** + * Executes a SQL statement and returns the number of affected rows. + * + * @param string $sql SQL + * @return int + */ + public function execute($sql); + + /** + * Executes a SQL statement and returns the result as an array. + * + * @param string $sql SQL + * @return array + */ + public function query($sql); + + /** + * Executes a query and returns only one row as an array. + * + * @param string $sql SQL + * @return array + */ + public function fetchRow($sql); + + /** + * Executes a query and returns an array of rows. + * + * @param string $sql SQL + * @return array + */ + public function fetchAll($sql); + + /** + * Inserts data into a table. + * + * @param Table $table where to insert data + * @param array $row + * @return void + */ + public function insert(Table $table, $row); + + /** + * Quotes a table name for use in a query. + * + * @param string $tableName Table Name + * @return string + */ + public function quoteTableName($tableName); + + /** + * Quotes a column name for use in a query. + * + * @param string $columnName Table Name + * @return string + */ + public function quoteColumnName($columnName); + + /** + * Checks to see if a table exists. + * + * @param string $tableName Table Name + * @return boolean + */ + public function hasTable($tableName); + + /** + * Creates the specified database table. + * + * @param Table $table Table + * @return void + */ + public function createTable(Table $table); + + /** + * Renames the specified database table. + * + * @param string $tableName Table Name + * @param string $newName New Name + * @return void + */ + public function renameTable($tableName, $newName); + + /** + * Drops the specified database table. + * + * @param string $tableName Table Name + * @return void + */ + public function dropTable($tableName); + + /** + * Returns table columns + * + * @param string $tableName Table Name + * @return Column[] + */ + public function getColumns($tableName); + + /** + * Checks to see if a column exists. + * + * @param string $tableName Table Name + * @param string $columnName Column Name + * @return boolean + */ + public function hasColumn($tableName, $columnName); + + /** + * Adds the specified column to a database table. + * + * @param Table $table Table + * @param Column $column Column + * @return void + */ + public function addColumn(Table $table, Column $column); + + /** + * Renames the specified column. + * + * @param string $tableName Table Name + * @param string $columnName Column Name + * @param string $newColumnName New Column Name + * @return void + */ + public function renameColumn($tableName, $columnName, $newColumnName); + + /** + * Change a table column type. + * + * @param string $tableName Table Name + * @param string $columnName Column Name + * @param Column $newColumn New Column + * @return Table + */ + public function changeColumn($tableName, $columnName, Column $newColumn); + + /** + * Drops the specified column. + * + * @param string $tableName Table Name + * @param string $columnName Column Name + * @return void + */ + public function dropColumn($tableName, $columnName); + + /** + * Checks to see if an index exists. + * + * @param string $tableName Table Name + * @param mixed $columns Column(s) + * @return boolean + */ + public function hasIndex($tableName, $columns); + + /** + * Checks to see if an index specified by name exists. + * + * @param string $tableName Table Name + * @param string $indexName + * @return boolean + */ + public function hasIndexByName($tableName, $indexName); + + /** + * Adds the specified index to a database table. + * + * @param Table $table Table + * @param Index $index Index + * @return void + */ + public function addIndex(Table $table, Index $index); + + /** + * Drops the specified index from a database table. + * + * @param string $tableName + * @param mixed $columns Column(s) + * @return void + */ + public function dropIndex($tableName, $columns); + + /** + * Drops the index specified by name from a database table. + * + * @param string $tableName + * @param string $indexName + * @return void + */ + public function dropIndexByName($tableName, $indexName); + + /** + * Checks to see if a foreign key exists. + * + * @param string $tableName + * @param string[] $columns Column(s) + * @param string $constraint Constraint name + * @return boolean + */ + public function hasForeignKey($tableName, $columns, $constraint = null); + + /** + * Adds the specified foreign key to a database table. + * + * @param Table $table + * @param ForeignKey $foreignKey + * @return void + */ + public function addForeignKey(Table $table, ForeignKey $foreignKey); + + /** + * Drops the specified foreign key from a database table. + * + * @param string $tableName + * @param string[] $columns Column(s) + * @param string $constraint Constraint name + * @return void + */ + public function dropForeignKey($tableName, $columns, $constraint = null); + + /** + * Returns an array of the supported Phinx column types. + * + * @return array + */ + public function getColumnTypes(); + + /** + * Checks that the given column is of a supported type. + * + * @param Column $column + * @return boolean + */ + public function isValidColumnType(Column $column); + + /** + * Converts the Phinx logical type to the adapter's SQL type. + * + * @param string $type + * @param integer $limit + * @return string + */ + public function getSqlType($type, $limit = null); + + /** + * Creates a new database. + * + * @param string $name Database Name + * @param array $options Options + * @return void + */ + public function createDatabase($name, $options = array()); + + /** + * Checks to see if a database exists. + * + * @param string $name Database Name + * @return boolean + */ + public function hasDatabase($name); + + /** + * Drops the specified database. + * + * @param string $name Database Name + * @return void + */ + public function dropDatabase($name); +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/AdapterWrapper.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/AdapterWrapper.php new file mode 100644 index 0000000..ae5ec39 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/AdapterWrapper.php @@ -0,0 +1,507 @@ + + */ +abstract class AdapterWrapper implements AdapterInterface, WrapperInterface +{ + /** + * @var AdapterInterface + */ + protected $adapter; + + /** + * {@inheritdoc} + */ + public function __construct(AdapterInterface $adapter) + { + $this->setAdapter($adapter); + } + + /** + * {@inheritdoc} + */ + public function setAdapter(AdapterInterface $adapter) + { + $this->adapter = $adapter; + return $this; + } + + /** + * {@inheritdoc} + */ + public function getAdapter() + { + return $this->adapter; + } + + /** + * {@inheritdoc} + */ + public function setOptions(array $options) + { + $this->adapter->setOptions($options); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getOptions() + { + return $this->adapter->getOptions(); + } + + /** + * {@inheritdoc} + */ + public function hasOption($name) + { + return $this->adapter->hasOption($name); + } + + /** + * {@inheritdoc} + */ + public function getOption($name) + { + return $this->adapter->getOption($name); + } + + /** + * {@inheritdoc} + */ + public function setInput(InputInterface $input) + { + $this->adapter->setInput($input); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getInput() + { + return $this->adapter->getInput(); + } + + /** + * {@inheritdoc} + */ + public function setOutput(OutputInterface $output) + { + $this->adapter->setOutput($output); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getOutput() + { + return $this->adapter->getOutput(); + } + + /** + * {@inheritdoc} + */ + public function connect() + { + return $this->getAdapter()->connect(); + } + + /** + * {@inheritdoc} + */ + public function disconnect() + { + return $this->getAdapter()->disconnect(); + } + + /** + * {@inheritdoc} + */ + public function execute($sql) + { + return $this->getAdapter()->execute($sql); + } + + /** + * {@inheritdoc} + */ + public function query($sql) + { + return $this->getAdapter()->query($sql); + } + + /** + * {@inheritdoc} + */ + public function insert(Table $table, $row) + { + return $this->getAdapter()->insert($table, $row); + } + + /** + * {@inheritdoc} + */ + public function fetchRow($sql) + { + return $this->getAdapter()->fetchRow($sql); + } + + /** + * {@inheritdoc} + */ + public function fetchAll($sql) + { + return $this->getAdapter()->fetchAll($sql); + } + + /** + * {@inheritdoc} + */ + public function getVersions() + { + return $this->getAdapter()->getVersions(); + } + + /** + * {@inheritdoc} + */ + public function getVersionLog() + { + return $this->getAdapter()->getVersionLog(); + } + + /** + * {@inheritdoc} + */ + public function migrated(MigrationInterface $migration, $direction, $startTime, $endTime) + { + $this->getAdapter()->migrated($migration, $direction, $startTime, $endTime); + return $this; + } + + /** + * @inheritDoc + */ + public function toggleBreakpoint(MigrationInterface $migration) + { + $this->getAdapter()->toggleBreakpoint($migration); + return $this; + } + + /** + * @inheritDoc + */ + public function resetAllBreakpoints() + { + return $this->getAdapter()->resetAllBreakpoints(); + } + + /** + * {@inheritdoc} + */ + public function hasSchemaTable() + { + return $this->getAdapter()->hasSchemaTable(); + } + + /** + * {@inheritdoc} + */ + public function createSchemaTable() + { + return $this->getAdapter()->createSchemaTable(); + } + + /** + * {@inheritdoc} + */ + public function getColumnTypes() + { + return $this->getAdapter()->getColumnTypes(); + } + + /** + * {@inheritdoc} + */ + public function isValidColumnType(Column $column) + { + return $this->getAdapter()->isValidColumnType($column); + } + + /** + * {@inheritdoc} + */ + public function hasTransactions() + { + return $this->getAdapter()->hasTransactions(); + } + + /** + * {@inheritdoc} + */ + public function beginTransaction() + { + return $this->getAdapter()->beginTransaction(); + } + + /** + * {@inheritdoc} + */ + public function commitTransaction() + { + return $this->getAdapter()->commitTransaction(); + } + + /** + * {@inheritdoc} + */ + public function rollbackTransaction() + { + return $this->getAdapter()->rollbackTransaction(); + } + + /** + * {@inheritdoc} + */ + public function quoteTableName($tableName) + { + return $this->getAdapter()->quoteTableName($tableName); + } + + /** + * {@inheritdoc} + */ + public function quoteColumnName($columnName) + { + return $this->getAdapter()->quoteColumnName($columnName); + } + + /** + * {@inheritdoc} + */ + public function hasTable($tableName) + { + return $this->getAdapter()->hasTable($tableName); + } + + /** + * {@inheritdoc} + */ + public function createTable(Table $table) + { + return $this->getAdapter()->createTable($table); + } + + /** + * {@inheritdoc} + */ + public function renameTable($tableName, $newTableName) + { + return $this->getAdapter()->renameTable($tableName, $newTableName); + } + + /** + * {@inheritdoc} + */ + public function dropTable($tableName) + { + return $this->getAdapter()->dropTable($tableName); + } + + /** + * {@inheritdoc} + */ + public function getColumns($tableName) + { + return $this->getAdapter()->getColumns($tableName); + } + + /** + * {@inheritdoc} + */ + public function hasColumn($tableName, $columnName) + { + return $this->getAdapter()->hasColumn($tableName, $columnName); + } + + /** + * {@inheritdoc} + */ + public function addColumn(Table $table, Column $column) + { + return $this->getAdapter()->addColumn($table, $column); + } + + /** + * {@inheritdoc} + */ + public function renameColumn($tableName, $columnName, $newColumnName) + { + return $this->getAdapter()->renameColumn($tableName, $columnName, $newColumnName); + } + + /** + * {@inheritdoc} + */ + public function changeColumn($tableName, $columnName, Column $newColumn) + { + return $this->getAdapter()->changeColumn($tableName, $columnName, $newColumn); + } + + /** + * {@inheritdoc} + */ + public function dropColumn($tableName, $columnName) + { + return $this->getAdapter()->dropColumn($tableName, $columnName); + } + + /** + * {@inheritdoc} + */ + public function hasIndex($tableName, $columns) + { + return $this->getAdapter()->hasIndex($tableName, $columns); + } + + /** + * {@inheritdoc} + */ + public function hasIndexByName($tableName, $indexName) + { + return $this->getAdapter()->hasIndexByName($tableName, $indexName); + } + + /** + * {@inheritdoc} + */ + public function addIndex(Table $table, Index $index) + { + return $this->getAdapter()->addIndex($table, $index); + } + + /** + * {@inheritdoc} + */ + public function dropIndex($tableName, $columns, $options = array()) + { + return $this->getAdapter()->dropIndex($tableName, $columns, $options); + } + + /** + * {@inheritdoc} + */ + public function dropIndexByName($tableName, $indexName) + { + return $this->getAdapter()->dropIndexByName($tableName, $indexName); + } + + /** + * {@inheritdoc} + */ + public function hasForeignKey($tableName, $columns, $constraint = null) + { + return $this->getAdapter()->hasForeignKey($tableName, $columns, $constraint); + } + + /** + * {@inheritdoc} + */ + public function addForeignKey(Table $table, ForeignKey $foreignKey) + { + return $this->getAdapter()->addForeignKey($table, $foreignKey); + } + + /** + * {@inheritdoc} + */ + public function dropForeignKey($tableName, $columns, $constraint = null) + { + return $this->getAdapter()->dropForeignKey($tableName, $columns, $constraint); + } + + /** + * {@inheritdoc} + */ + public function getSqlType($type, $limit = null) + { + return $this->getAdapter()->getSqlType($type, $limit); + } + + /** + * {@inheritdoc} + */ + public function createDatabase($name, $options = array()) + { + return $this->getAdapter()->createDatabase($name, $options); + } + + /** + * {@inheritdoc} + */ + public function hasDatabase($name) + { + return $this->getAdapter()->hasDatabase($name); + } + + /** + * {@inheritdoc} + */ + public function dropDatabase($name) + { + return $this->getAdapter()->dropDatabase($name); + } + + /** + * @inheritDoc + */ + public function castToBool($value) + { + return $this->getAdapter()->castToBool($value); + } +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/MysqlAdapter.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/MysqlAdapter.php new file mode 100644 index 0000000..37710a6 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/MysqlAdapter.php @@ -0,0 +1,1148 @@ + + */ +class MysqlAdapter extends PdoAdapter implements AdapterInterface +{ + + protected $signedColumnTypes = array('integer' => true, 'biginteger' => true, 'float' => true, 'decimal' => true, 'boolean' => true); + + const TEXT_TINY = 255; + const TEXT_SMALL = 255; /* deprecated, alias of TEXT_TINY */ + const TEXT_REGULAR = 65535; + const TEXT_MEDIUM = 16777215; + const TEXT_LONG = 4294967295; + + // According to https://dev.mysql.com/doc/refman/5.0/en/blob.html BLOB sizes are the same as TEXT + const BLOB_TINY = 255; + const BLOB_SMALL = 255; /* deprecated, alias of BLOB_TINY */ + const BLOB_REGULAR = 65535; + const BLOB_MEDIUM = 16777215; + const BLOB_LONG = 4294967295; + + const INT_TINY = 255; + const INT_SMALL = 65535; + const INT_MEDIUM = 16777215; + const INT_REGULAR = 4294967295; + const INT_BIG = 18446744073709551615; + + const TYPE_YEAR = 'year'; + + /** + * {@inheritdoc} + */ + public function connect() + { + if (null === $this->connection) { + if (!class_exists('PDO') || !in_array('mysql', \PDO::getAvailableDrivers(), true)) { + // @codeCoverageIgnoreStart + throw new \RuntimeException('You need to enable the PDO_Mysql extension for Phinx to run properly.'); + // @codeCoverageIgnoreEnd + } + + $db = null; + $options = $this->getOptions(); + + $dsn = 'mysql:'; + + if (!empty($options['unix_socket'])) { + // use socket connection + $dsn .= 'unix_socket=' . $options['unix_socket']; + } else { + // use network connection + $dsn .= 'host=' . $options['host']; + if (!empty($options['port'])) { + $dsn .= ';port=' . $options['port']; + } + } + + $dsn .= ';dbname=' . $options['name']; + + // charset support + if (!empty($options['charset'])) { + $dsn .= ';charset=' . $options['charset']; + } + + $driverOptions = array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION); + + // support arbitrary \PDO::MYSQL_ATTR_* driver options and pass them to PDO + // http://php.net/manual/en/ref.pdo-mysql.php#pdo-mysql.constants + foreach ($options as $key => $option) { + if (strpos($key, 'mysql_attr_') === 0) { + $driverOptions[constant('\PDO::' . strtoupper($key))] = $option; + } + } + + try { + $db = new \PDO($dsn, $options['user'], $options['pass'], $driverOptions); + } catch (\PDOException $exception) { + throw new \InvalidArgumentException(sprintf( + 'There was a problem connecting to the database: %s', + $exception->getMessage() + )); + } + + $this->setConnection($db); + } + } + + /** + * {@inheritdoc} + */ + public function disconnect() + { + $this->connection = null; + } + + /** + * {@inheritdoc} + */ + public function hasTransactions() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function beginTransaction() + { + $this->execute('START TRANSACTION'); + } + + /** + * {@inheritdoc} + */ + public function commitTransaction() + { + $this->execute('COMMIT'); + } + + /** + * {@inheritdoc} + */ + public function rollbackTransaction() + { + $this->execute('ROLLBACK'); + } + + /** + * {@inheritdoc} + */ + public function quoteTableName($tableName) + { + return str_replace('.', '`.`', $this->quoteColumnName($tableName)); + } + + /** + * {@inheritdoc} + */ + public function quoteColumnName($columnName) + { + return '`' . str_replace('`', '``', $columnName) . '`'; + } + + /** + * {@inheritdoc} + */ + public function hasTable($tableName) + { + $options = $this->getOptions(); + + $exists = $this->fetchRow(sprintf( + "SELECT TABLE_NAME + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'", + $options['name'], $tableName + )); + + return !empty($exists); + } + + /** + * {@inheritdoc} + */ + public function createTable(Table $table) + { + $this->startCommandTimer(); + + // This method is based on the MySQL docs here: http://dev.mysql.com/doc/refman/5.1/en/create-index.html + $defaultOptions = array( + 'engine' => 'InnoDB', + 'collation' => 'utf8_general_ci' + ); + $options = array_merge($defaultOptions, $table->getOptions()); + + // Add the default primary key + $columns = $table->getPendingColumns(); + if (!isset($options['id']) || (isset($options['id']) && $options['id'] === true)) { + $column = new Column(); + $column->setName('id') + ->setType('integer') + ->setIdentity(true); + + array_unshift($columns, $column); + $options['primary_key'] = 'id'; + + } elseif (isset($options['id']) && is_string($options['id'])) { + // Handle id => "field_name" to support AUTO_INCREMENT + $column = new Column(); + $column->setName($options['id']) + ->setType('integer') + ->setIdentity(true); + + array_unshift($columns, $column); + $options['primary_key'] = $options['id']; + } + + // TODO - process table options like collation etc + + // process table engine (default to InnoDB) + $optionsStr = 'ENGINE = InnoDB'; + if (isset($options['engine'])) { + $optionsStr = sprintf('ENGINE = %s', $options['engine']); + } + + // process table collation + if (isset($options['collation'])) { + $charset = explode('_', $options['collation']); + $optionsStr .= sprintf(' CHARACTER SET %s', $charset[0]); + $optionsStr .= sprintf(' COLLATE %s', $options['collation']); + } + + // set the table comment + if (isset($options['comment'])) { + $optionsStr .= sprintf(" COMMENT=%s ", $this->getConnection()->quote($options['comment'])); + } + + $sql = 'CREATE TABLE '; + $sql .= $this->quoteTableName($table->getName()) . ' ('; + foreach ($columns as $column) { + $sql .= $this->quoteColumnName($column->getName()) . ' ' . $this->getColumnSqlDefinition($column) . ', '; + } + + // set the primary key(s) + if (isset($options['primary_key'])) { + $sql = rtrim($sql); + $sql .= ' PRIMARY KEY ('; + if (is_string($options['primary_key'])) { // handle primary_key => 'id' + $sql .= $this->quoteColumnName($options['primary_key']); + } elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id') + // PHP 5.4 will allow access of $this, so we can call quoteColumnName() directly in the + // anonymous function, but for now just hard-code the adapter quotes + $sql .= implode( + ',', + array_map( + function ($v) { + return '`' . $v . '`'; + }, + $options['primary_key'] + ) + ); + } + $sql .= ')'; + } else { + $sql = substr(rtrim($sql), 0, -1); // no primary keys + } + + // set the indexes + $indexes = $table->getIndexes(); + if (!empty($indexes)) { + foreach ($indexes as $index) { + $sql .= ', ' . $this->getIndexSqlDefinition($index); + } + } + + // set the foreign keys + $foreignKeys = $table->getForeignKeys(); + if (!empty($foreignKeys)) { + foreach ($foreignKeys as $foreignKey) { + $sql .= ', ' . $this->getForeignKeySqlDefinition($foreignKey); + } + } + + $sql .= ') ' . $optionsStr; + $sql = rtrim($sql) . ';'; + + // execute the sql + $this->writeCommand('createTable', array($table->getName())); + $this->execute($sql); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function renameTable($tableName, $newTableName) + { + $this->startCommandTimer(); + $this->writeCommand('renameTable', array($tableName, $newTableName)); + $this->execute(sprintf('RENAME TABLE %s TO %s', $this->quoteTableName($tableName), $this->quoteTableName($newTableName))); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function dropTable($tableName) + { + $this->startCommandTimer(); + $this->writeCommand('dropTable', array($tableName)); + $this->execute(sprintf('DROP TABLE %s', $this->quoteTableName($tableName))); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function getColumns($tableName) + { + $columns = array(); + $rows = $this->fetchAll(sprintf('SHOW COLUMNS FROM %s', $this->quoteTableName($tableName))); + foreach ($rows as $columnInfo) { + + $phinxType = $this->getPhinxType($columnInfo['Type']); + + $column = new Column(); + $column->setName($columnInfo['Field']) + ->setNull($columnInfo['Null'] !== 'NO') + ->setDefault($columnInfo['Default']) + ->setType($phinxType['name']) + ->setLimit($phinxType['limit']); + + if ($columnInfo['Extra'] === 'auto_increment') { + $column->setIdentity(true); + } + + $columns[] = $column; + } + + return $columns; + } + + /** + * {@inheritdoc} + */ + public function hasColumn($tableName, $columnName) + { + $rows = $this->fetchAll(sprintf('SHOW COLUMNS FROM %s', $this->quoteTableName($tableName))); + foreach ($rows as $column) { + if (strcasecmp($column['Field'], $columnName) === 0) { + return true; + } + } + + return false; + } + + /** + * Get the defintion for a `DEFAULT` statement. + * + * @param mixed $default + * @return string + */ + protected function getDefaultValueDefinition($default) + { + if (is_string($default) && 'CURRENT_TIMESTAMP' !== $default) { + $default = $this->getConnection()->quote($default); + } elseif (is_bool($default)) { + $default = $this->castToBool($default); + } + return isset($default) ? ' DEFAULT ' . $default : ''; + } + + /** + * {@inheritdoc} + */ + public function addColumn(Table $table, Column $column) + { + $this->startCommandTimer(); + $sql = sprintf( + 'ALTER TABLE %s ADD %s %s', + $this->quoteTableName($table->getName()), + $this->quoteColumnName($column->getName()), + $this->getColumnSqlDefinition($column) + ); + + if ($column->getAfter()) { + $sql .= ' AFTER ' . $this->quoteColumnName($column->getAfter()); + } + + $this->writeCommand('addColumn', array($table->getName(), $column->getName(), $column->getType())); + $this->execute($sql); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function renameColumn($tableName, $columnName, $newColumnName) + { + $this->startCommandTimer(); + $rows = $this->fetchAll(sprintf('DESCRIBE %s', $this->quoteTableName($tableName))); + foreach ($rows as $row) { + if (strcasecmp($row['Field'], $columnName) === 0) { + $null = ($row['Null'] == 'NO') ? 'NOT NULL' : 'NULL'; + $extra = ' ' . strtoupper($row['Extra']); + if (!is_null($row['Default'])) { + $extra .= $this->getDefaultValueDefinition($row['Default']); + } + $definition = $row['Type'] . ' ' . $null . $extra; + + $this->writeCommand('renameColumn', array($tableName, $columnName, $newColumnName)); + $this->execute( + sprintf( + 'ALTER TABLE %s CHANGE COLUMN %s %s %s', + $this->quoteTableName($tableName), + $this->quoteColumnName($columnName), + $this->quoteColumnName($newColumnName), + $definition + ) + ); + $this->endCommandTimer(); + return; + } + } + + throw new \InvalidArgumentException(sprintf( + 'The specified column doesn\'t exist: ' + . $columnName + )); + } + + /** + * {@inheritdoc} + */ + public function changeColumn($tableName, $columnName, Column $newColumn) + { + $this->startCommandTimer(); + $this->writeCommand('changeColumn', array($tableName, $columnName, $newColumn->getType())); + $after = $newColumn->getAfter() ? ' AFTER ' . $this->quoteColumnName($newColumn->getAfter()) : ''; + $this->execute( + sprintf( + 'ALTER TABLE %s CHANGE %s %s %s%s', + $this->quoteTableName($tableName), + $this->quoteColumnName($columnName), + $this->quoteColumnName($newColumn->getName()), + $this->getColumnSqlDefinition($newColumn), + $after + ) + ); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function dropColumn($tableName, $columnName) + { + $this->startCommandTimer(); + $this->writeCommand('dropColumn', array($tableName, $columnName)); + $this->execute( + sprintf( + 'ALTER TABLE %s DROP COLUMN %s', + $this->quoteTableName($tableName), + $this->quoteColumnName($columnName) + ) + ); + $this->endCommandTimer(); + } + + /** + * Get an array of indexes from a particular table. + * + * @param string $tableName Table Name + * @return array + */ + protected function getIndexes($tableName) + { + $indexes = array(); + $rows = $this->fetchAll(sprintf('SHOW INDEXES FROM %s', $this->quoteTableName($tableName))); + foreach ($rows as $row) { + if (!isset($indexes[$row['Key_name']])) { + $indexes[$row['Key_name']] = array('columns' => array()); + } + $indexes[$row['Key_name']]['columns'][] = strtolower($row['Column_name']); + } + return $indexes; + } + + /** + * {@inheritdoc} + */ + public function hasIndex($tableName, $columns) + { + if (is_string($columns)) { + $columns = array($columns); // str to array + } + + $columns = array_map('strtolower', $columns); + $indexes = $this->getIndexes($tableName); + + foreach ($indexes as $index) { + if ($columns == $index['columns']) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function hasIndexByName($tableName, $indexName) + { + $indexes = $this->getIndexes($tableName); + + foreach ($indexes as $name => $index) { + if ($name === $indexName) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function addIndex(Table $table, Index $index) + { + $this->startCommandTimer(); + $this->writeCommand('addIndex', array($table->getName(), $index->getColumns())); + $this->execute( + sprintf( + 'ALTER TABLE %s ADD %s', + $this->quoteTableName($table->getName()), + $this->getIndexSqlDefinition($index) + ) + ); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function dropIndex($tableName, $columns) + { + $this->startCommandTimer(); + if (is_string($columns)) { + $columns = array($columns); // str to array + } + + $this->writeCommand('dropIndex', array($tableName, $columns)); + $indexes = $this->getIndexes($tableName); + $columns = array_map('strtolower', $columns); + + foreach ($indexes as $indexName => $index) { + if ($columns == $index['columns']) { + $this->execute( + sprintf( + 'ALTER TABLE %s DROP INDEX %s', + $this->quoteTableName($tableName), + $this->quoteColumnName($indexName) + ) + ); + $this->endCommandTimer(); + return; + } + } + } + + /** + * {@inheritdoc} + */ + public function dropIndexByName($tableName, $indexName) + { + $this->startCommandTimer(); + $this->writeCommand('dropIndexByName', array($tableName, $indexName)); + $indexes = $this->getIndexes($tableName); + + foreach ($indexes as $name => $index) { + //$a = array_diff($columns, $index['columns']); + if ($name === $indexName) { + $this->execute( + sprintf( + 'ALTER TABLE %s DROP INDEX %s', + $this->quoteTableName($tableName), + $this->quoteColumnName($indexName) + ) + ); + $this->endCommandTimer(); + return; + } + } + } + + /** + * {@inheritdoc} + */ + public function hasForeignKey($tableName, $columns, $constraint = null) + { + if (is_string($columns)) { + $columns = array($columns); // str to array + } + $foreignKeys = $this->getForeignKeys($tableName); + if ($constraint) { + if (isset($foreignKeys[$constraint])) { + return !empty($foreignKeys[$constraint]); + } + return false; + } else { + foreach ($foreignKeys as $key) { + $a = array_diff($columns, $key['columns']); + if ($columns == $key['columns']) { + return true; + } + } + return false; + } + } + + /** + * Get an array of foreign keys from a particular table. + * + * @param string $tableName Table Name + * @return array + */ + protected function getForeignKeys($tableName) + { + $foreignKeys = array(); + $rows = $this->fetchAll(sprintf( + "SELECT + CONSTRAINT_NAME, + TABLE_NAME, + COLUMN_NAME, + REFERENCED_TABLE_NAME, + REFERENCED_COLUMN_NAME + FROM information_schema.KEY_COLUMN_USAGE + WHERE REFERENCED_TABLE_SCHEMA = DATABASE() + AND REFERENCED_TABLE_NAME IS NOT NULL + AND TABLE_NAME = '%s' + ORDER BY POSITION_IN_UNIQUE_CONSTRAINT", + $tableName + )); + foreach ($rows as $row) { + $foreignKeys[$row['CONSTRAINT_NAME']]['table'] = $row['TABLE_NAME']; + $foreignKeys[$row['CONSTRAINT_NAME']]['columns'][] = $row['COLUMN_NAME']; + $foreignKeys[$row['CONSTRAINT_NAME']]['referenced_table'] = $row['REFERENCED_TABLE_NAME']; + $foreignKeys[$row['CONSTRAINT_NAME']]['referenced_columns'][] = $row['REFERENCED_COLUMN_NAME']; + } + return $foreignKeys; + } + + /** + * {@inheritdoc} + */ + public function addForeignKey(Table $table, ForeignKey $foreignKey) + { + $this->startCommandTimer(); + $this->writeCommand('addForeignKey', array($table->getName(), $foreignKey->getColumns())); + $this->execute( + sprintf( + 'ALTER TABLE %s ADD %s', + $this->quoteTableName($table->getName()), + $this->getForeignKeySqlDefinition($foreignKey) + ) + ); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function dropForeignKey($tableName, $columns, $constraint = null) + { + $this->startCommandTimer(); + if (is_string($columns)) { + $columns = array($columns); // str to array + } + + $this->writeCommand('dropForeignKey', array($tableName, $columns)); + + if ($constraint) { + $this->execute( + sprintf( + 'ALTER TABLE %s DROP FOREIGN KEY %s', + $this->quoteTableName($tableName), + $constraint + ) + ); + $this->endCommandTimer(); + return; + } else { + foreach ($columns as $column) { + $rows = $this->fetchAll(sprintf( + "SELECT + CONSTRAINT_NAME + FROM information_schema.KEY_COLUMN_USAGE + WHERE REFERENCED_TABLE_SCHEMA = DATABASE() + AND REFERENCED_TABLE_NAME IS NOT NULL + AND TABLE_NAME = '%s' + AND COLUMN_NAME = '%s' + ORDER BY POSITION_IN_UNIQUE_CONSTRAINT", + $tableName, + $column + )); + foreach ($rows as $row) { + $this->dropForeignKey($tableName, $columns, $row['CONSTRAINT_NAME']); + } + } + } + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function getSqlType($type, $limit = null) + { + switch ($type) { + case static::PHINX_TYPE_STRING: + return array('name' => 'varchar', 'limit' => $limit ? $limit : 255); + break; + case static::PHINX_TYPE_CHAR: + return array('name' => 'char', 'limit' => $limit ? $limit : 255); + break; + case static::PHINX_TYPE_TEXT: + if ($limit) { + $sizes = array( + // Order matters! Size must always be tested from longest to shortest! + 'longtext' => static::TEXT_LONG, + 'mediumtext' => static::TEXT_MEDIUM, + 'text' => static::TEXT_REGULAR, + 'tinytext' => static::TEXT_SMALL, + ); + foreach ($sizes as $name => $length) { + if ($limit >= $length) { + return array('name' => $name); + } + } + } + return array('name' => 'text'); + break; + case static::PHINX_TYPE_BINARY: + return array('name' => 'binary', 'limit' => $limit ? $limit : 255); + break; + case static::PHINX_TYPE_VARBINARY: + return array('name' => 'varbinary', 'limit' => $limit ? $limit : 255); + break; + case static::PHINX_TYPE_BLOB: + if ($limit) { + $sizes = array( + // Order matters! Size must always be tested from longest to shortest! + 'longblob' => static::BLOB_LONG, + 'mediumblob' => static::BLOB_MEDIUM, + 'blob' => static::BLOB_REGULAR, + 'tinyblob' => static::BLOB_SMALL, + ); + foreach ($sizes as $name => $length) { + if ($limit >= $length) { + return array('name' => $name); + } + } + } + return array('name' => 'blob'); + break; + case static::PHINX_TYPE_INTEGER: + if ($limit && $limit >= static::INT_TINY) { + $sizes = array( + // Order matters! Size must always be tested from longest to shortest! + 'bigint' => static::INT_BIG, + 'int' => static::INT_REGULAR, + 'mediumint' => static::INT_MEDIUM, + 'smallint' => static::INT_SMALL, + 'tinyint' => static::INT_TINY, + ); + $limits = array( + 'int' => 11, + 'bigint' => 20, + ); + foreach ($sizes as $name => $length) { + if ($limit >= $length) { + $def = array('name' => $name); + if (isset($limits[$name])) { + $def['limit'] = $limits[$name]; + } + return $def; + } + } + } elseif (!$limit) { + $limit = 11; + } + return array('name' => 'int', 'limit' => $limit); + break; + case static::PHINX_TYPE_BIG_INTEGER: + return array('name' => 'bigint', 'limit' => 20); + break; + case static::PHINX_TYPE_FLOAT: + return array('name' => 'float'); + break; + case static::PHINX_TYPE_DECIMAL: + return array('name' => 'decimal'); + break; + case static::PHINX_TYPE_DATETIME: + return array('name' => 'datetime'); + break; + case static::PHINX_TYPE_TIMESTAMP: + return array('name' => 'timestamp'); + break; + case static::PHINX_TYPE_TIME: + return array('name' => 'time'); + break; + case static::PHINX_TYPE_DATE: + return array('name' => 'date'); + break; + case static::PHINX_TYPE_BOOLEAN: + return array('name' => 'tinyint', 'limit' => 1); + break; + case static::PHINX_TYPE_UUID: + return array('name' => 'char', 'limit' => 36); + // Geospatial database types + case static::PHINX_TYPE_GEOMETRY: + case static::PHINX_TYPE_POINT: + case static::PHINX_TYPE_LINESTRING: + case static::PHINX_TYPE_POLYGON: + return array('name' => $type); + case static::PHINX_TYPE_ENUM: + return array('name' => 'enum'); + break; + case static::PHINX_TYPE_SET: + return array('name' => 'set'); + break; + case static::TYPE_YEAR: + if (!$limit || in_array($limit, array(2, 4))) + $limit = 4; + return array('name' => 'year', 'limit' => $limit); + break; + case static::PHINX_TYPE_JSON: + return array('name' => 'json'); + break; + default: + throw new \RuntimeException('The type: "' . $type . '" is not supported.'); + } + } + + /** + * Returns Phinx type by SQL type + * + * @param string $sqlTypeDef + * @throws \RuntimeException + * @internal param string $sqlType SQL type + * @returns string Phinx type + */ + public function getPhinxType($sqlTypeDef) + { + if (!preg_match('/^([\w]+)(\(([\d]+)*(,([\d]+))*\))*(.+)*$/', $sqlTypeDef, $matches)) { + throw new \RuntimeException('Column type ' . $sqlTypeDef . ' is not supported'); + } else { + $limit = null; + $precision = null; + $type = $matches[1]; + if (count($matches) > 2) { + $limit = $matches[3] ? (int) $matches[3] : null; + } + if (count($matches) > 4) { + $precision = (int) $matches[5]; + } + if ($type === 'tinyint' && $limit === 1) { + $type = static::PHINX_TYPE_BOOLEAN; + $limit = null; + } + switch ($type) { + case 'varchar': + $type = static::PHINX_TYPE_STRING; + if ($limit === 255) { + $limit = null; + } + break; + case 'char': + $type = static::PHINX_TYPE_CHAR; + if ($limit === 255) { + $limit = null; + } + if ($limit === 36) { + $type = static::PHINX_TYPE_UUID; + } + break; + case 'tinyint': + $type = static::PHINX_TYPE_INTEGER; + $limit = static::INT_TINY; + break; + case 'smallint': + $type = static::PHINX_TYPE_INTEGER; + $limit = static::INT_SMALL; + break; + case 'mediumint': + $type = static::PHINX_TYPE_INTEGER; + $limit = static::INT_MEDIUM; + break; + case 'int': + $type = static::PHINX_TYPE_INTEGER; + if ($limit === 11) { + $limit = null; + } + break; + case 'bigint': + if ($limit === 20) { + $limit = null; + } + $type = static::PHINX_TYPE_BIG_INTEGER; + break; + case 'blob': + $type = static::PHINX_TYPE_BINARY; + break; + case 'tinyblob': + $type = static::PHINX_TYPE_BINARY; + $limit = static::BLOB_TINY; + break; + case 'mediumblob': + $type = static::PHINX_TYPE_BINARY; + $limit = static::BLOB_MEDIUM; + break; + case 'longblob': + $type = static::PHINX_TYPE_BINARY; + $limit = static::BLOB_LONG; + break; + case 'tinytext': + $type = static::PHINX_TYPE_TEXT; + $limit = static::TEXT_TINY; + break; + case 'mediumtext': + $type = static::PHINX_TYPE_TEXT; + $limit = static::TEXT_MEDIUM; + break; + case 'longtext': + $type = static::PHINX_TYPE_TEXT; + $limit = static::TEXT_LONG; + break; + } + + $this->getSqlType($type, $limit); + + return array( + 'name' => $type, + 'limit' => $limit, + 'precision' => $precision + ); + } + } + + /** + * {@inheritdoc} + */ + public function createDatabase($name, $options = array()) + { + $this->startCommandTimer(); + $this->writeCommand('createDatabase', array($name)); + $charset = isset($options['charset']) ? $options['charset'] : 'utf8'; + + if (isset($options['collation'])) { + $this->execute(sprintf('CREATE DATABASE `%s` DEFAULT CHARACTER SET `%s` COLLATE `%s`', $name, $charset, $options['collation'])); + } else { + $this->execute(sprintf('CREATE DATABASE `%s` DEFAULT CHARACTER SET `%s`', $name, $charset)); + } + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function hasDatabase($name) + { + $rows = $this->fetchAll( + sprintf( + 'SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = \'%s\'', + $name + ) + ); + + foreach ($rows as $row) { + if (!empty($row)) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function dropDatabase($name) + { + $this->startCommandTimer(); + $this->writeCommand('dropDatabase', array($name)); + $this->execute(sprintf('DROP DATABASE IF EXISTS `%s`', $name)); + $this->endCommandTimer(); + } + + /** + * Gets the MySQL Column Definition for a Column object. + * + * @param Column $column Column + * @return string + */ + protected function getColumnSqlDefinition(Column $column) + { + $sqlType = $this->getSqlType($column->getType(), $column->getLimit()); + + $def = ''; + $def .= strtoupper($sqlType['name']); + if ($column->getPrecision() && $column->getScale()) { + $def .= '(' . $column->getPrecision() . ',' . $column->getScale() . ')'; + } elseif (isset($sqlType['limit'])) { + $def .= '(' . $sqlType['limit'] . ')'; + } + if (($values = $column->getValues()) && is_array($values)) { + $def .= "('" . implode("', '", $values) . "')"; + } + $def .= (!$column->isSigned() && isset($this->signedColumnTypes[$column->getType()])) ? ' unsigned' : '' ; + $def .= ($column->isNull() == false) ? ' NOT NULL' : ' NULL'; + $def .= ($column->isIdentity()) ? ' AUTO_INCREMENT' : ''; + $def .= $this->getDefaultValueDefinition($column->getDefault()); + + if ($column->getComment()) { + $def .= ' COMMENT ' . $this->getConnection()->quote($column->getComment()); + } + + if ($column->getUpdate()) { + $def .= ' ON UPDATE ' . $column->getUpdate(); + } + + return $def; + } + + /** + * Gets the MySQL Index Definition for an Index object. + * + * @param Index $index Index + * @return string + */ + protected function getIndexSqlDefinition(Index $index) + { + $def = ''; + $limit = ''; + if ($index->getLimit()) { + $limit = '(' . $index->getLimit() . ')'; + } + + if ($index->getType() == Index::UNIQUE) { + $def .= ' UNIQUE'; + } + + if ($index->getType() == Index::FULLTEXT) { + $def .= ' FULLTEXT'; + } + + $def .= ' KEY'; + + if (is_string($index->getName())) { + $def .= ' `' . $index->getName() . '`'; + } + + $def .= ' (`' . implode('`,`', $index->getColumns()) . '`' . $limit . ')'; + + return $def; + } + + /** + * Gets the MySQL Foreign Key Definition for an ForeignKey object. + * + * @param ForeignKey $foreignKey + * @return string + */ + protected function getForeignKeySqlDefinition(ForeignKey $foreignKey) + { + $def = ''; + if ($foreignKey->getConstraint()) { + $def .= ' CONSTRAINT ' . $this->quoteColumnName($foreignKey->getConstraint()); + } + $columnNames = array(); + foreach ($foreignKey->getColumns() as $column) { + $columnNames[] = $this->quoteColumnName($column); + } + $def .= ' FOREIGN KEY (' . implode(',', $columnNames) . ')'; + $refColumnNames = array(); + foreach ($foreignKey->getReferencedColumns() as $column) { + $refColumnNames[] = $this->quoteColumnName($column); + } + $def .= ' REFERENCES ' . $this->quoteTableName($foreignKey->getReferencedTable()->getName()) . ' (' . implode(',', $refColumnNames) . ')'; + if ($foreignKey->getOnDelete()) { + $def .= ' ON DELETE ' . $foreignKey->getOnDelete(); + } + if ($foreignKey->getOnUpdate()) { + $def .= ' ON UPDATE ' . $foreignKey->getOnUpdate(); + } + return $def; + } + + /** + * Describes a database table. This is a MySQL adapter specific method. + * + * @param string $tableName Table name + * @return array + */ + public function describeTable($tableName) + { + $options = $this->getOptions(); + + // mysql specific + $sql = sprintf( + "SELECT * + FROM information_schema.tables + WHERE table_schema = '%s' + AND table_name = '%s'", + $options['name'], + $tableName + ); + + return $this->fetchRow($sql); + } + + /** + * Returns MySQL column types (inherited and MySQL specified). + * @return array + */ + public function getColumnTypes() + { + return array_merge(parent::getColumnTypes(), array('enum', 'set', 'year', 'json')); + } +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/PdoAdapter.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/PdoAdapter.php new file mode 100644 index 0000000..9924c3a --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/PdoAdapter.php @@ -0,0 +1,587 @@ + + */ +abstract class PdoAdapter implements AdapterInterface +{ + /** + * @var array + */ + protected $options = array(); + + /** + * @var InputInterface + */ + protected $input; + + /** + * @var OutputInterface + */ + protected $output; + + /** + * @var string + */ + protected $schemaTableName = 'migrations'; + + /** + * @var \PDO + */ + protected $connection; + + /** + * @var float + */ + protected $commandStartTime; + + /** + * Class Constructor. + * + * @param array $options Options + * @param InputInterface $input Input Interface + * @param OutputInterface $output Output Interface + */ + public function __construct(array $options, InputInterface $input = null, OutputInterface $output = null) + { + $this->setOptions($options); + if (null !== $input) { + $this->setInput($input); + } + if (null !== $output) { + $this->setOutput($output); + } + } + + /** + * {@inheritdoc} + */ + public function setOptions(array $options) + { + $this->options = $options; + + if (isset($options['default_migration_table'])) { + $this->setSchemaTableName($options['default_migration_table']); + } + + if (isset($options['connection'])) { + $this->setConnection($options['connection']); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getOptions() + { + return $this->options; + } + + /** + * {@inheritdoc} + */ + public function hasOption($name) + { + return isset($this->options[$name]); + } + + /** + * {@inheritdoc} + */ + public function getOption($name) + { + if (!$this->hasOption($name)) { + return; + } + return $this->options[$name]; + } + + /** + * {@inheritdoc} + */ + public function setInput(InputInterface $input) + { + $this->input = $input; + return $this; + } + + /** + * {@inheritdoc} + */ + public function getInput() + { + return $this->input; + } + + /** + * {@inheritdoc} + */ + public function setOutput(OutputInterface $output) + { + $this->output = $output; + return $this; + } + + /** + * {@inheritdoc} + */ + public function getOutput() + { + if (null === $this->output) { + $output = new OutputInterface('nothing'); + $this->setOutput($output); + } + return $this->output; + } + + /** + * Sets the schema table name. + * + * @param string $schemaTableName Schema Table Name + * @return PdoAdapter + */ + public function setSchemaTableName($schemaTableName) + { + $this->schemaTableName = $schemaTableName; + return $this; + } + + /** + * Gets the schema table name. + * + * @return string + */ + public function getSchemaTableName() + { + return $this->schemaTableName; + } + + /** + * Sets the database connection. + * + * @param \PDO $connection Connection + * @return AdapterInterface + */ + public function setConnection(\PDO $connection) + { + $this->connection = $connection; + + // Create the schema table if it doesn't already exist + if (!$this->hasSchemaTable()) { + $this->createSchemaTable(); + } else { + $table = new Table($this->getSchemaTableName(), array(), $this); + if (!$table->hasColumn('migration_name')) { + $table + ->addColumn('migration_name', 'string', + array('limit' => 100, 'after' => 'version', 'default' => null, 'null' => true) + ) + ->save(); + } + if (!$table->hasColumn('breakpoint')) { + $table + ->addColumn('breakpoint', 'boolean', array('default' => false)) + ->save(); + } + } + + return $this; + } + + /** + * Gets the database connection + * + * @return \PDO + */ + public function getConnection() + { + if (null === $this->connection) { + $this->connect(); + } + return $this->connection; + } + + /** + * Sets the command start time + * + * @param int $time + * @return AdapterInterface + */ + public function setCommandStartTime($time) + { + $this->commandStartTime = $time; + return $this; + } + + /** + * Gets the command start time + * + * @return int + */ + public function getCommandStartTime() + { + return $this->commandStartTime; + } + + /** + * Start timing a command. + * + * @return void + */ + public function startCommandTimer() + { + $this->setCommandStartTime(microtime(true)); + } + + /** + * Stop timing the current command and write the elapsed time to the + * output. + * + * @return void + */ + public function endCommandTimer() + { + $end = microtime(true); + if (OutputInterface::VERBOSITY_VERBOSE <= $this->getOutput()->getVerbosity()) { + $this->getOutput()->writeln(' -> ' . sprintf('%.4fs', $end - $this->getCommandStartTime())); + } + } + + /** + * Write a Phinx command to the output. + * + * @param string $command Command Name + * @param array $args Command Args + * @return void + */ + public function writeCommand($command, $args = array()) + { + if (OutputInterface::VERBOSITY_VERBOSE <= $this->getOutput()->getVerbosity()) { + if (count($args)) { + $outArr = array(); + foreach ($args as $arg) { + if (is_array($arg)) { + $arg = array_map(function ($value) { + return '\'' . $value . '\''; + }, $arg); + $outArr[] = '[' . implode(', ', $arg) . ']'; + continue; + } + + $outArr[] = '\'' . $arg . '\''; + } + $this->getOutput()->writeln(' -- ' . $command . '(' . implode(', ', $outArr) . ')'); + return; + } + $this->getOutput()->writeln(' -- ' . $command); + } + } + + /** + * {@inheritdoc} + */ + public function connect() + { + } + + /** + * {@inheritdoc} + */ + public function disconnect() + { + } + + /** + * {@inheritdoc} + */ + public function execute($sql) + { + return $this->getConnection()->exec($sql); + } + + /** + * {@inheritdoc} + */ + public function query($sql) + { + return $this->getConnection()->query($sql); + } + + /** + * {@inheritdoc} + */ + public function fetchRow($sql) + { + $result = $this->query($sql); + return $result->fetch(); + } + + /** + * {@inheritdoc} + */ + public function fetchAll($sql) + { + $rows = array(); + $result = $this->query($sql); + while ($row = $result->fetch()) { + $rows[] = $row; + } + return $rows; + } + + /** + * {@inheritdoc} + */ + public function insert(Table $table, $row) + { + $this->startCommandTimer(); + $this->writeCommand('insert', array($table->getName())); + + $sql = sprintf( + "INSERT INTO %s ", + $this->quoteTableName($table->getName()) + ); + + $columns = array_keys($row); + $sql .= "(". implode(', ', array_map(array($this, 'quoteColumnName'), $columns)) . ")"; + $sql .= " VALUES (" . implode(', ', array_fill(0, count($columns), '?')) . ")"; + + $stmt = $this->getConnection()->prepare($sql); + $stmt->execute(array_values($row)); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function getVersions() + { + $rows = $this->getVersionLog(); + + return array_keys($rows); + } + + /** + * {@inheritdoc} + */ + public function getVersionLog() + { + $result = array(); + $rows = $this->fetchAll(sprintf('SELECT * FROM %s ORDER BY version ASC', $this->getSchemaTableName())); + foreach ($rows as $version) { + $result[$version['version']] = $version; + } + + return $result; + } + + /** + * {@inheritdoc} + */ + public function migrated(MigrationInterface $migration, $direction, $startTime, $endTime) + { + if (strcasecmp($direction, MigrationInterface::UP) === 0) { + // up + $sql = sprintf( + "INSERT INTO %s (%s, %s, %s, %s, %s) VALUES ('%s', '%s', '%s', '%s', %s);", + $this->getSchemaTableName(), + $this->quoteColumnName('version'), + $this->quoteColumnName('migration_name'), + $this->quoteColumnName('start_time'), + $this->quoteColumnName('end_time'), + $this->quoteColumnName('breakpoint'), + $migration->getVersion(), + substr($migration->getName(), 0, 100), + $startTime, + $endTime, + $this->castToBool(false) + ); + + $this->query($sql); + } else { + // down + $sql = sprintf( + "DELETE FROM %s WHERE %s = '%s'", + $this->getSchemaTableName(), + $this->quoteColumnName('version'), + $migration->getVersion() + ); + + $this->query($sql); + } + + return $this; + } + + /** + * @inheritDoc + */ + public function toggleBreakpoint(MigrationInterface $migration) + { + $this->query( + sprintf( + 'UPDATE %1$s SET %2$s = CASE %2$s WHEN %3$s THEN %4$s ELSE %3$s END WHERE %5$s = \'%6$s\';', + $this->getSchemaTableName(), + $this->quoteColumnName('breakpoint'), + $this->castToBool(true), + $this->castToBool(false), + $this->quoteColumnName('version'), + $migration->getVersion() + ) + ); + + return $this; + } + + /** + * @inheritDoc + */ + public function resetAllBreakpoints() + { + return $this->execute( + sprintf( + 'UPDATE %1$s SET %2$s = %3$s WHERE %2$s <> %3$s;', + $this->getSchemaTableName(), + $this->quoteColumnName('breakpoint'), + $this->castToBool(false) + ) + ); + } + + /** + * {@inheritdoc} + */ + public function hasSchemaTable() + { + return $this->hasTable($this->getSchemaTableName()); + } + + /** + * {@inheritdoc} + */ + public function createSchemaTable() + { + try { + $options = array( + 'id' => false, + 'primary_key' => 'version' + ); + + $table = new Table($this->getSchemaTableName(), $options, $this); + + if ($this->getConnection()->getAttribute(\PDO::ATTR_DRIVER_NAME) === 'mysql' + && version_compare($this->getConnection()->getAttribute(\PDO::ATTR_SERVER_VERSION), '5.6.0', '>=')) { + $table->addColumn('version', 'biginteger', array('limit' => 14)) + ->addColumn('migration_name', 'string', array('limit' => 100, 'default' => null, 'null' => true)) + ->addColumn('start_time', 'timestamp', array('default' => 'CURRENT_TIMESTAMP')) + ->addColumn('end_time', 'timestamp', array('default' => 'CURRENT_TIMESTAMP')) + ->addColumn('breakpoint', 'boolean', array('default' => false)) + ->save(); + } else { + $table->addColumn('version', 'biginteger') + ->addColumn('migration_name', 'string', array('limit' => 100, 'default' => null, 'null' => true)) + ->addColumn('start_time', 'timestamp') + ->addColumn('end_time', 'timestamp') + ->addColumn('breakpoint', 'boolean', array('default' => false)) + ->save(); + } + } catch (\Exception $exception) { + throw new \InvalidArgumentException('There was a problem creating the schema table: ' . $exception->getMessage()); + } + } + + /** + * {@inheritdoc} + */ + public function getAdapterType() + { + return $this->getOption('adapter'); + } + + /** + * {@inheritdoc} + */ + public function getColumnTypes() + { + return array( + 'string', + 'char', + 'text', + 'integer', + 'biginteger', + 'float', + 'decimal', + 'datetime', + 'timestamp', + 'time', + 'date', + 'blob', + 'binary', + 'varbinary', + 'boolean', + 'uuid', + // Geospatial data types + 'geometry', + 'point', + 'linestring', + 'polygon', + ); + } + + /** + * {@inheritdoc} + */ + public function isValidColumnType(Column $column) { + return in_array($column->getType(), $this->getColumnTypes()); + } + + /** + * Cast a value to a boolean appropriate for the adapter. + * + * @param mixed $value The value to be cast + * + * @return mixed + */ + public function castToBool($value) + { + return (bool) $value ? 1 : 0; + } +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/PostgresAdapter.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/PostgresAdapter.php new file mode 100644 index 0000000..3c506bd --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/PostgresAdapter.php @@ -0,0 +1,1182 @@ +connection) { + if (!class_exists('PDO') || !in_array('pgsql', \PDO::getAvailableDrivers(), true)) { + // @codeCoverageIgnoreStart + throw new \RuntimeException('You need to enable the PDO_Pgsql extension for Phinx to run properly.'); + // @codeCoverageIgnoreEnd + } + + $db = null; + $options = $this->getOptions(); + + // if port is specified use it, otherwise use the PostgreSQL default + if (isset($options['port'])) { + $dsn = 'pgsql:host=' . $options['host'] . ';port=' . $options['port'] . ';dbname=' . $options['name']; + } else { + $dsn = 'pgsql:host=' . $options['host'] . ';dbname=' . $options['name']; + } + + try { + $db = new \PDO($dsn, $options['user'], $options['pass'], array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION)); + } catch (\PDOException $exception) { + throw new \InvalidArgumentException(sprintf( + 'There was a problem connecting to the database: %s', + $exception->getMessage() + )); + } + + $this->setConnection($db); + } + } + + /** + * {@inheritdoc} + */ + public function disconnect() + { + $this->connection = null; + } + + /** + * {@inheritdoc} + */ + public function hasTransactions() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function beginTransaction() + { + $this->execute('BEGIN'); + } + + /** + * {@inheritdoc} + */ + public function commitTransaction() + { + $this->execute('COMMIT'); + } + + /** + * {@inheritdoc} + */ + public function rollbackTransaction() + { + $this->execute('ROLLBACK'); + } + + /** + * Quotes a schema name for use in a query. + * + * @param string $schemaName Schema Name + * @return string + */ + public function quoteSchemaName($schemaName) + { + return $this->quoteColumnName($schemaName); + } + + /** + * {@inheritdoc} + */ + public function quoteTableName($tableName) + { + return $this->quoteSchemaName($this->getSchemaName()) . '.' . $this->quoteColumnName($tableName); + } + + /** + * {@inheritdoc} + */ + public function quoteColumnName($columnName) + { + return '"'. $columnName . '"'; + } + + /** + * {@inheritdoc} + */ + public function hasTable($tableName) + { + $result = $this->getConnection()->query( + sprintf( + 'SELECT * + FROM information_schema.tables + WHERE table_schema = %s + AND lower(table_name) = lower(%s)', + $this->getConnection()->quote($this->getSchemaName()), + $this->getConnection()->quote($tableName) + ) + ); + + return $result->rowCount() === 1; + } + + /** + * {@inheritdoc} + */ + public function createTable(Table $table) + { + $this->startCommandTimer(); + $options = $table->getOptions(); + + // Add the default primary key + $columns = $table->getPendingColumns(); + if (!isset($options['id']) || (isset($options['id']) && $options['id'] === true)) { + $column = new Column(); + $column->setName('id') + ->setType('integer') + ->setIdentity(true); + + array_unshift($columns, $column); + $options['primary_key'] = 'id'; + + } elseif (isset($options['id']) && is_string($options['id'])) { + // Handle id => "field_name" to support AUTO_INCREMENT + $column = new Column(); + $column->setName($options['id']) + ->setType('integer') + ->setIdentity(true); + + array_unshift($columns, $column); + $options['primary_key'] = $options['id']; + } + + // TODO - process table options like collation etc + $sql = 'CREATE TABLE '; + $sql .= $this->quoteTableName($table->getName()) . ' ('; + + $this->columnsWithComments = array(); + foreach ($columns as $column) { + $sql .= $this->quoteColumnName($column->getName()) . ' ' . $this->getColumnSqlDefinition($column) . ', '; + + // set column comments, if needed + if ($column->getComment()) { + $this->columnsWithComments[] = $column; + } + } + + // set the primary key(s) + if (isset($options['primary_key'])) { + $sql = rtrim($sql); + $sql .= sprintf(' CONSTRAINT %s_pkey PRIMARY KEY (', $table->getName()); + if (is_string($options['primary_key'])) { // handle primary_key => 'id' + $sql .= $this->quoteColumnName($options['primary_key']); + } elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id') + // PHP 5.4 will allow access of $this, so we can call quoteColumnName() directly in the anonymous function, + // but for now just hard-code the adapter quotes + $sql .= implode( + ',', + array_map( + function ($v) { + return '"' . $v . '"'; + }, + $options['primary_key'] + ) + ); + } + $sql .= ')'; + } else { + $sql = substr(rtrim($sql), 0, -1); // no primary keys + } + + // set the foreign keys + $foreignKeys = $table->getForeignKeys(); + if (!empty($foreignKeys)) { + foreach ($foreignKeys as $foreignKey) { + $sql .= ', ' . $this->getForeignKeySqlDefinition($foreignKey, $table->getName()); + } + } + + $sql .= ');'; + + // process column comments + if (!empty($this->columnsWithComments)) { + foreach ($this->columnsWithComments as $column) { + $sql .= $this->getColumnCommentSqlDefinition($column, $table->getName()); + } + } + + // set the indexes + $indexes = $table->getIndexes(); + if (!empty($indexes)) { + foreach ($indexes as $index) { + $sql .= $this->getIndexSqlDefinition($index, $table->getName()); + } + } + + // execute the sql + $this->writeCommand('createTable', array($table->getName())); + $this->execute($sql); + + // process table comments + if (isset($options['comment'])) { + $sql = sprintf( + 'COMMENT ON TABLE %s IS %s', + $this->quoteTableName($table->getName()), + $this->getConnection()->quote($options['comment']) + ); + $this->execute($sql); + } + + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function renameTable($tableName, $newTableName) + { + $this->startCommandTimer(); + $this->writeCommand('renameTable', array($tableName, $newTableName)); + $sql = sprintf( + 'ALTER TABLE %s RENAME TO %s', + $this->quoteTableName($tableName), + $this->quoteColumnName($newTableName) + ); + $this->execute($sql); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function dropTable($tableName) + { + $this->startCommandTimer(); + $this->writeCommand('dropTable', array($tableName)); + $this->execute(sprintf('DROP TABLE %s', $this->quoteTableName($tableName))); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function getColumns($tableName) + { + $columns = array(); + $sql = sprintf( + "SELECT column_name, data_type, is_identity, is_nullable, + column_default, character_maximum_length, numeric_precision, numeric_scale + FROM information_schema.columns + WHERE table_name ='%s'", + $tableName + ); + $columnsInfo = $this->fetchAll($sql); + + foreach ($columnsInfo as $columnInfo) { + $column = new Column(); + $column->setName($columnInfo['column_name']) + ->setType($this->getPhinxType($columnInfo['data_type'])) + ->setNull($columnInfo['is_nullable'] === 'YES') + ->setDefault($columnInfo['column_default']) + ->setIdentity($columnInfo['is_identity'] === 'YES') + ->setPrecision($columnInfo['numeric_precision']) + ->setScale($columnInfo['numeric_scale']); + + if (preg_match('/\bwith time zone$/', $columnInfo['data_type'])) { + $column->setTimezone(true); + } + + if (isset($columnInfo['character_maximum_length'])) { + $column->setLimit($columnInfo['character_maximum_length']); + } + $columns[] = $column; + } + return $columns; + } + + /** + * {@inheritdoc} + */ + public function hasColumn($tableName, $columnName, $options = array()) + { + $sql = sprintf("SELECT count(*) + FROM information_schema.columns + WHERE table_schema = '%s' AND table_name = '%s' AND column_name = '%s'", + $this->getSchemaName(), + $tableName, + $columnName + ); + + $result = $this->fetchRow($sql); + return $result['count'] > 0; + } + + /** + * {@inheritdoc} + */ + public function addColumn(Table $table, Column $column) + { + $this->startCommandTimer(); + $this->writeCommand('addColumn', array($table->getName(), $column->getName(), $column->getType())); + $sql = sprintf( + 'ALTER TABLE %s ADD %s %s', + $this->quoteTableName($table->getName()), + $this->quoteColumnName($column->getName()), + $this->getColumnSqlDefinition($column) + ); + + $this->execute($sql); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function renameColumn($tableName, $columnName, $newColumnName) + { + $this->startCommandTimer(); + $sql = sprintf( + "SELECT CASE WHEN COUNT(*) > 0 THEN 1 ELSE 0 END AS column_exists + FROM information_schema.columns + WHERE table_name ='%s' AND column_name = '%s'", + $tableName, + $columnName + ); + $result = $this->fetchRow($sql); + if (!(bool) $result['column_exists']) { + throw new \InvalidArgumentException("The specified column does not exist: $columnName"); + } + $this->writeCommand('renameColumn', array($tableName, $columnName, $newColumnName)); + $this->execute( + sprintf( + 'ALTER TABLE %s RENAME COLUMN %s TO %s', + $this->quoteTableName($tableName), + $this->quoteColumnName($columnName), + $newColumnName + ) + ); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function changeColumn($tableName, $columnName, Column $newColumn) + { + // TODO - is it possible to merge these 3 queries into less? + $this->startCommandTimer(); + $this->writeCommand('changeColumn', array($tableName, $columnName, $newColumn->getType())); + // change data type + $sql = sprintf( + 'ALTER TABLE %s ALTER COLUMN %s TYPE %s', + $this->quoteTableName($tableName), + $this->quoteColumnName($columnName), + $this->getColumnSqlDefinition($newColumn) + ); + //NULL and DEFAULT cannot be set while changing column type + $sql = preg_replace('/ NOT NULL/', '', $sql); + $sql = preg_replace('/ NULL/', '', $sql); + //If it is set, DEFAULT is the last definition + $sql = preg_replace('/DEFAULT .*/', '', $sql); + $this->execute($sql); + // process null + $sql = sprintf( + 'ALTER TABLE %s ALTER COLUMN %s', + $this->quoteTableName($tableName), + $this->quoteColumnName($columnName) + ); + if ($newColumn->isNull()) { + $sql .= ' DROP NOT NULL'; + } else { + $sql .= ' SET NOT NULL'; + } + $this->execute($sql); + if (!is_null($newColumn->getDefault())) { + //change default + $this->execute( + sprintf( + 'ALTER TABLE %s ALTER COLUMN %s SET %s', + $this->quoteTableName($tableName), + $this->quoteColumnName($columnName), + $this->getDefaultValueDefinition($newColumn->getDefault()) + ) + ); + } + else { + //drop default + $this->execute( + sprintf( + 'ALTER TABLE %s ALTER COLUMN %s DROP DEFAULT', + $this->quoteTableName($tableName), + $this->quoteColumnName($columnName) + ) + ); + } + // rename column + if ($columnName !== $newColumn->getName()) { + $this->execute( + sprintf( + 'ALTER TABLE %s RENAME COLUMN %s TO %s', + $this->quoteTableName($tableName), + $this->quoteColumnName($columnName), + $this->quoteColumnName($newColumn->getName()) + ) + ); + } + + // change column comment if needed + if ($newColumn->getComment()) { + $sql = $this->getColumnCommentSqlDefinition($newColumn, $tableName); + $this->execute($sql); + } + + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function dropColumn($tableName, $columnName) + { + $this->startCommandTimer(); + $this->writeCommand('dropColumn', array($tableName, $columnName)); + $this->execute( + sprintf( + 'ALTER TABLE %s DROP COLUMN %s', + $this->quoteTableName($tableName), + $this->quoteColumnName($columnName) + ) + ); + $this->endCommandTimer(); + } + + /** + * Get an array of indexes from a particular table. + * + * @param string $tableName Table Name + * @return array + */ + protected function getIndexes($tableName) + { + $indexes = array(); + $sql = "SELECT + i.relname AS index_name, + a.attname AS column_name + FROM + pg_class t, + pg_class i, + pg_index ix, + pg_attribute a + WHERE + t.oid = ix.indrelid + AND i.oid = ix.indexrelid + AND a.attrelid = t.oid + AND a.attnum = ANY(ix.indkey) + AND t.relkind = 'r' + AND t.relname = '$tableName' + ORDER BY + t.relname, + i.relname;"; + $rows = $this->fetchAll($sql); + foreach ($rows as $row) { + if (!isset($indexes[$row['index_name']])) { + $indexes[$row['index_name']] = array('columns' => array()); + } + $indexes[$row['index_name']]['columns'][] = strtolower($row['column_name']); + } + return $indexes; + } + + /** + * {@inheritdoc} + */ + public function hasIndex($tableName, $columns) + { + if (is_string($columns)) { + $columns = array($columns); + } + $columns = array_map('strtolower', $columns); + $indexes = $this->getIndexes($tableName); + foreach ($indexes as $index) { + if (array_diff($index['columns'], $columns) === array_diff($columns, $index['columns'])) { + return true; + } + } + return false; + } + + /** + * {@inheritdoc} + */ + public function hasIndexByName($tableName, $indexName) + { + $indexes = $this->getIndexes($tableName); + foreach ($indexes as $name => $index) { + if ($name === $indexName) { + return true; + } + } + return false; + } + + /** + * {@inheritdoc} + */ + public function addIndex(Table $table, Index $index) + { + $this->startCommandTimer(); + $this->writeCommand('addIndex', array($table->getName(), $index->getColumns())); + $sql = $this->getIndexSqlDefinition($index, $table->getName()); + $this->execute($sql); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function dropIndex($tableName, $columns) + { + $this->startCommandTimer(); + if (is_string($columns)) { + $columns = array($columns); // str to array + } + + $this->writeCommand('dropIndex', array($tableName, $columns)); + $indexes = $this->getIndexes($tableName); + $columns = array_map('strtolower', $columns); + + foreach ($indexes as $indexName => $index) { + $a = array_diff($columns, $index['columns']); + if (empty($a)) { + $this->execute( + sprintf( + 'DROP INDEX IF EXISTS %s', + $this->quoteColumnName($indexName) + ) + ); + $this->endCommandTimer(); + return; + } + } + } + + /** + * {@inheritdoc} + */ + public function dropIndexByName($tableName, $indexName) + { + $this->startCommandTimer(); + $this->writeCommand('dropIndexByName', array($tableName, $indexName)); + $sql = sprintf( + 'DROP INDEX IF EXISTS %s', + $indexName + ); + $this->execute($sql); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function hasForeignKey($tableName, $columns, $constraint = null) + { + if (is_string($columns)) { + $columns = array($columns); // str to array + } + $foreignKeys = $this->getForeignKeys($tableName); + if ($constraint) { + if (isset($foreignKeys[$constraint])) { + return !empty($foreignKeys[$constraint]); + } + return false; + } else { + foreach ($foreignKeys as $key) { + $a = array_diff($columns, $key['columns']); + if (empty($a)) { + return true; + } + } + return false; + } + } + + /** + * Get an array of foreign keys from a particular table. + * + * @param string $tableName Table Name + * @return array + */ + protected function getForeignKeys($tableName) + { + $foreignKeys = array(); + $rows = $this->fetchAll(sprintf( + "SELECT + tc.constraint_name, + tc.table_name, kcu.column_name, + ccu.table_name AS referenced_table_name, + ccu.column_name AS referenced_column_name + FROM + information_schema.table_constraints AS tc + JOIN information_schema.key_column_usage AS kcu ON tc.constraint_name = kcu.constraint_name + JOIN information_schema.constraint_column_usage AS ccu ON ccu.constraint_name = tc.constraint_name + WHERE constraint_type = 'FOREIGN KEY' AND tc.table_name = '%s' + ORDER BY kcu.position_in_unique_constraint", + $tableName + )); + foreach ($rows as $row) { + $foreignKeys[$row['constraint_name']]['table'] = $row['table_name']; + $foreignKeys[$row['constraint_name']]['columns'][] = $row['column_name']; + $foreignKeys[$row['constraint_name']]['referenced_table'] = $row['referenced_table_name']; + $foreignKeys[$row['constraint_name']]['referenced_columns'][] = $row['referenced_column_name']; + } + return $foreignKeys; + } + + /** + * {@inheritdoc} + */ + public function addForeignKey(Table $table, ForeignKey $foreignKey) + { + $this->startCommandTimer(); + $this->writeCommand('addForeignKey', array($table->getName(), $foreignKey->getColumns())); + $sql = sprintf( + 'ALTER TABLE %s ADD %s', + $this->quoteTableName($table->getName()), + $this->getForeignKeySqlDefinition($foreignKey, $table->getName()) + ); + $this->execute($sql); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function dropForeignKey($tableName, $columns, $constraint = null) + { + $this->startCommandTimer(); + if (is_string($columns)) { + $columns = array($columns); // str to array + } + $this->writeCommand('dropForeignKey', array($tableName, $columns)); + + if ($constraint) { + $this->execute( + sprintf( + 'ALTER TABLE %s DROP CONSTRAINT %s', + $this->quoteTableName($tableName), + $constraint + ) + ); + } else { + foreach ($columns as $column) { + $rows = $this->fetchAll(sprintf( + "SELECT CONSTRAINT_NAME + FROM information_schema.KEY_COLUMN_USAGE + WHERE TABLE_SCHEMA = CURRENT_SCHEMA() + AND TABLE_NAME IS NOT NULL + AND TABLE_NAME = '%s' + AND COLUMN_NAME = '%s' + ORDER BY POSITION_IN_UNIQUE_CONSTRAINT", + $tableName, + $column + )); + + foreach ($rows as $row) { + $this->dropForeignKey($tableName, $columns, $row['constraint_name']); + } + } + } + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function getSqlType($type, $limit = null) + { + switch ($type) { + case static::PHINX_TYPE_INTEGER: + if ($limit && $limit == static::INT_SMALL) { + return array( + 'name' => 'smallint', + 'limit' => static::INT_SMALL + ); + } + return array('name' => $type); + case static::PHINX_TYPE_TEXT: + case static::PHINX_TYPE_TIME: + case static::PHINX_TYPE_DATE: + case static::PHINX_TYPE_BOOLEAN: + case static::PHINX_TYPE_JSON: + case static::PHINX_TYPE_JSONB: + case static::PHINX_TYPE_UUID: + return array('name' => $type); + case static::PHINX_TYPE_DECIMAL: + return array('name' => $type, 'precision' => 18, 'scale' => 0); + case static::PHINX_TYPE_STRING: + return array('name' => 'character varying', 'limit' => 255); + case static::PHINX_TYPE_CHAR: + return array('name' => 'character', 'limit' => 255); + case static::PHINX_TYPE_BIG_INTEGER: + return array('name' => 'bigint'); + case static::PHINX_TYPE_FLOAT: + return array('name' => 'real'); + case static::PHINX_TYPE_DATETIME: + case static::PHINX_TYPE_TIMESTAMP: + return array('name' => 'timestamp'); + case static::PHINX_TYPE_BLOB: + case static::PHINX_TYPE_BINARY: + return array('name' => 'bytea'); + // Geospatial database types + // Spatial storage in Postgres is done via the PostGIS extension, + // which enables the use of the "geography" type in combination + // with SRID 4326. + case static::PHINX_TYPE_GEOMETRY: + return array('name' => 'geography', 'geometry', 4326); + break; + case static::PHINX_TYPE_POINT: + return array('name' => 'geography', 'point', 4326); + break; + case static::PHINX_TYPE_LINESTRING: + return array('name' => 'geography', 'linestring', 4326); + break; + case static::PHINX_TYPE_POLYGON: + return array('name' => 'geography', 'polygon', 4326); + break; + default: + if ($this->isArrayType($type)) { + return array('name' => $type); + } + // Return array type + throw new \RuntimeException('The type: "' . $type . '" is not supported'); + } + } + + /** + * Returns Phinx type by SQL type + * + * @param string $sqlType SQL type + * @returns string Phinx type + */ + public function getPhinxType($sqlType) + { + switch ($sqlType) { + case 'character varying': + case 'varchar': + return static::PHINX_TYPE_STRING; + case 'character': + case 'char': + return static::PHINX_TYPE_CHAR; + case 'text': + return static::PHINX_TYPE_TEXT; + case 'json': + return static::PHINX_TYPE_JSON; + case 'jsonb': + return static::PHINX_TYPE_JSONB; + case 'smallint': + return array( + 'name' => 'smallint', + 'limit' => static::INT_SMALL + ); + case 'int': + case 'int4': + case 'integer': + return static::PHINX_TYPE_INTEGER; + case 'decimal': + case 'numeric': + return static::PHINX_TYPE_DECIMAL; + case 'bigint': + case 'int8': + return static::PHINX_TYPE_BIG_INTEGER; + case 'real': + case 'float4': + return static::PHINX_TYPE_FLOAT; + case 'bytea': + return static::PHINX_TYPE_BINARY; + break; + case 'time': + case 'timetz': + case 'time with time zone': + case 'time without time zone': + return static::PHINX_TYPE_TIME; + case 'date': + return static::PHINX_TYPE_DATE; + case 'timestamp': + case 'timestamptz': + case 'timestamp with time zone': + case 'timestamp without time zone': + return static::PHINX_TYPE_DATETIME; + case 'bool': + case 'boolean': + return static::PHINX_TYPE_BOOLEAN; + case 'uuid': + return static::PHINX_TYPE_UUID; + default: + throw new \RuntimeException('The PostgreSQL type: "' . $sqlType . '" is not supported'); + } + } + + /** + * {@inheritdoc} + */ + public function createDatabase($name, $options = array()) + { + $this->startCommandTimer(); + $this->writeCommand('createDatabase', array($name)); + $charset = isset($options['charset']) ? $options['charset'] : 'utf8'; + $this->execute(sprintf("CREATE DATABASE %s WITH ENCODING = '%s'", $name, $charset)); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function hasDatabase($databaseName) + { + $sql = sprintf("SELECT count(*) FROM pg_database WHERE datname = '%s'", $databaseName); + $result = $this->fetchRow($sql); + return $result['count'] > 0; + } + + /** + * {@inheritdoc} + */ + public function dropDatabase($name) + { + $this->startCommandTimer(); + $this->writeCommand('dropDatabase', array($name)); + $this->disconnect(); + $this->execute(sprintf('DROP DATABASE IF EXISTS %s', $name)); + $this->connect(); + $this->endCommandTimer(); + } + + /** + * Get the defintion for a `DEFAULT` statement. + * + * @param mixed $default + * @return string + */ + protected function getDefaultValueDefinition($default) + { + if (is_string($default) && 'CURRENT_TIMESTAMP' !== $default) { + $default = $this->getConnection()->quote($default); + } elseif (is_bool($default)) { + $default = $this->castToBool($default); + } + return isset($default) ? 'DEFAULT ' . $default : ''; + } + + /** + * Gets the PostgreSQL Column Definition for a Column object. + * + * @param Column $column Column + * @return string + */ + protected function getColumnSqlDefinition(Column $column) + { + $buffer = array(); + if ($column->isIdentity()) { + $buffer[] = $column->getType() == 'biginteger' ? 'BIGSERIAL' : 'SERIAL'; + } else { + $sqlType = $this->getSqlType($column->getType(), $column->getLimit()); + $buffer[] = strtoupper($sqlType['name']); + // integers cant have limits in postgres + if (static::PHINX_TYPE_DECIMAL === $sqlType['name'] && ($column->getPrecision() || $column->getScale())) { + $buffer[] = sprintf( + '(%s, %s)', + $column->getPrecision() ? $column->getPrecision() : $sqlType['precision'], + $column->getScale() ? $column->getScale() : $sqlType['scale'] + ); + } elseif (!in_array($sqlType['name'], array('integer', 'smallint'))) { + if ($column->getLimit() || isset($sqlType['limit'])) { + $buffer[] = sprintf('(%s)', $column->getLimit() ? $column->getLimit() : $sqlType['limit']); + } + } + + $timeTypes = array( + 'time', + 'timestamp', + ); + if (in_array($sqlType['name'], $timeTypes) && $column->isTimezone()) { + $buffer[] = strtoupper('with time zone'); + } + } + + $buffer[] = $column->isNull() ? 'NULL' : 'NOT NULL'; + + if (!is_null($column->getDefault())) { + $buffer[] = $this->getDefaultValueDefinition($column->getDefault()); + } + + return implode(' ', $buffer); + } + + /** + * Gets the PostgreSQL Column Comment Defininition for a column object. + * + * @param Column $column Column + * @param string $tableName Table name + * @return string + */ + protected function getColumnCommentSqlDefinition(Column $column, $tableName) + { + // passing 'null' is to remove column comment + $comment = (strcasecmp($column->getComment(), 'NULL') !== 0) + ? $this->getConnection()->quote($column->getComment()) + : 'NULL'; + + return sprintf( + 'COMMENT ON COLUMN %s.%s IS %s;', + $tableName, + $column->getName(), + $comment + ); + } + + /** + * Gets the PostgreSQL Index Definition for an Index object. + * + * @param Index $index Index + * @param string $tableName Table name + * @return string + */ + protected function getIndexSqlDefinition(Index $index, $tableName) + { + if (is_string($index->getName())) { + $indexName = $index->getName(); + } else { + $columnNames = $index->getColumns(); + if (is_string($columnNames)) { + $columnNames = array($columnNames); + } + $indexName = sprintf('%s_%s', $tableName, implode('_', $columnNames)); + } + $def = sprintf( + "CREATE %s INDEX %s ON %s (%s);", + ($index->getType() === Index::UNIQUE ? 'UNIQUE' : ''), + $indexName, + $this->quoteTableName($tableName), + implode(',', $index->getColumns()) + ); + return $def; + } + + /** + * Gets the MySQL Foreign Key Definition for an ForeignKey object. + * + * @param ForeignKey $foreignKey + * @param string $tableName Table name + * @return string + */ + protected function getForeignKeySqlDefinition(ForeignKey $foreignKey, $tableName) + { + $constraintName = $foreignKey->getConstraint() ?: $tableName . '_' . implode('_', $foreignKey->getColumns()); + $def = ' CONSTRAINT "' . $constraintName . '" FOREIGN KEY ("' . implode('", "', $foreignKey->getColumns()) . '")'; + $def .= " REFERENCES {$this->quoteTableName($foreignKey->getReferencedTable()->getName())} (\"" . implode('", "', $foreignKey->getReferencedColumns()) . '")'; + if ($foreignKey->getOnDelete()) { + $def .= " ON DELETE {$foreignKey->getOnDelete()}"; + } + if ($foreignKey->getOnUpdate()) { + $def .= " ON UPDATE {$foreignKey->getOnUpdate()}"; + } + return $def; + } + + /** + * {@inheritdoc} + */ + public function createSchemaTable() + { + // Create the public/custom schema if it doesn't already exist + if (false === $this->hasSchema($this->getSchemaName())) { + $this->createSchema($this->getSchemaName()); + } + + $this->fetchAll(sprintf('SET search_path TO %s', $this->getSchemaName())); + + return parent::createSchemaTable(); + } + + /** + * Creates the specified schema. + * + * @param string $schemaName Schema Name + * @return void + */ + public function createSchema($schemaName = 'public') + { + $this->startCommandTimer(); + $this->writeCommand('addSchema', array($schemaName)); + $sql = sprintf('CREATE SCHEMA %s;', $this->quoteSchemaName($schemaName)); // from postgres 9.3 we can use "CREATE SCHEMA IF NOT EXISTS schema_name" + $this->execute($sql); + $this->endCommandTimer(); + } + + /** + * Checks to see if a schema exists. + * + * @param string $schemaName Schema Name + * @return boolean + */ + public function hasSchema($schemaName) + { + $sql = sprintf( + "SELECT count(*) + FROM pg_namespace + WHERE nspname = '%s'", + $schemaName + ); + $result = $this->fetchRow($sql); + return $result['count'] > 0; + } + + /** + * Drops the specified schema table. + * + * @param string $schemaName Schema name + * @return void + */ + public function dropSchema($schemaName) + { + $this->startCommandTimer(); + $this->writeCommand('dropSchema', array($schemaName)); + $sql = sprintf("DROP SCHEMA IF EXISTS %s CASCADE;", $this->quoteSchemaName($schemaName)); + $this->execute($sql); + $this->endCommandTimer(); + } + + /** + * Drops all schemas. + * + * @return void + */ + public function dropAllSchemas() + { + $this->startCommandTimer(); + $this->writeCommand('dropAllSchemas'); + foreach ($this->getAllSchemas() as $schema) { + $this->dropSchema($schema); + } + $this->endCommandTimer(); + } + + /** + * Returns schemas. + * + * @return array + */ + public function getAllSchemas() + { + $sql = "SELECT schema_name + FROM information_schema.schemata + WHERE schema_name <> 'information_schema' AND schema_name !~ '^pg_'"; + $items = $this->fetchAll($sql); + $schemaNames = array(); + foreach ($items as $item) { + $schemaNames[] = $item['schema_name']; + } + return $schemaNames; + } + + /** + * {@inheritdoc} + */ + public function getColumnTypes() + { + return array_merge(parent::getColumnTypes(), array('json', 'jsonb')); + } + + /** + * {@inheritdoc} + */ + public function isValidColumnType(Column $column) + { + // If not a standard column type, maybe it is array type? + return (parent::isValidColumnType($column) || $this->isArrayType($column->getType())); + } + + /** + * Check if the given column is an array of a valid type. + * + * @param string $columnType + * @return bool + */ + protected function isArrayType($columnType) + { + if (!preg_match('/^([a-z]+)(?:\[\]){1,}$/', $columnType, $matches)) { + return false; + } + + $baseType = $matches[1]; + return in_array($baseType, $this->getColumnTypes()); + } + + /** + * Gets the schema name. + * + * @return string + */ + private function getSchemaName() + { + $options = $this->getOptions(); + return empty($options['schema']) ? 'public' : $options['schema']; + } + + /** + * Cast a value to a boolean appropriate for the adapter. + * + * @param mixed $value The value to be cast + * + * @return mixed + */ + public function castToBool($value) + { + return (bool) $value ? 'TRUE' : 'FALSE'; + } +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/ProxyAdapter.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/ProxyAdapter.php new file mode 100644 index 0000000..1236031 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/ProxyAdapter.php @@ -0,0 +1,325 @@ + + */ +class ProxyAdapter extends AdapterWrapper +{ + /** + * @var array + */ + protected $commands; + + /** + * {@inheritdoc} + */ + public function getAdapterType() + { + return 'ProxyAdapter'; + } + /** + * {@inheritdoc} + */ + public function createTable(Table $table) + { + $this->recordCommand('createTable', array($table->getName())); + } + + /** + * {@inheritdoc} + */ + public function renameTable($tableName, $newTableName) + { + $this->recordCommand('renameTable', array($tableName, $newTableName)); + } + + /** + * {@inheritdoc} + */ + public function dropTable($tableName) + { + $this->recordCommand('dropTable', array($tableName)); + } + + /** + * {@inheritdoc} + */ + public function addColumn(Table $table, Column $column) + { + $this->recordCommand('addColumn', array($table, $column)); + } + + /** + * {@inheritdoc} + */ + public function renameColumn($tableName, $columnName, $newColumnName) + { + $this->recordCommand('renameColumn', array($tableName, $columnName, $newColumnName)); + } + + /** + * {@inheritdoc} + */ + public function changeColumn($tableName, $columnName, Column $newColumn) + { + $this->recordCommand('changeColumn', array($tableName, $columnName, $newColumn)); + } + + /** + * {@inheritdoc} + */ + public function dropColumn($tableName, $columnName) + { + $this->recordCommand('dropColumn', array($tableName, $columnName)); + } + + /** + * {@inheritdoc} + */ + public function addIndex(Table $table, Index $index) + { + $this->recordCommand('addIndex', array($table, $index)); + } + + /** + * {@inheritdoc} + */ + public function dropIndex($tableName, $columns, $options = array()) + { + $this->recordCommand('dropIndex', array($tableName, $columns, $options)); + } + + /** + * {@inheritdoc} + */ + public function dropIndexByName($tableName, $indexName) + { + $this->recordCommand('dropIndexByName', array($tableName, $indexName)); + } + + /** + * {@inheritdoc} + */ + public function addForeignKey(Table $table, ForeignKey $foreignKey) + { + $this->recordCommand('addForeignKey', array($table, $foreignKey)); + } + + /** + * {@inheritdoc} + */ + public function dropForeignKey($tableName, $columns, $constraint = null) + { + $this->recordCommand('dropForeignKey', array($columns, $constraint)); + } + + /** + * {@inheritdoc} + */ + public function createDatabase($name, $options = array()) + { + $this->recordCommand('createDatabase', array($name, $options)); + } + + /** + * Record a command for execution later. + * + * @param string $name Command Name + * @param array $arguments Command Arguments + * @return void + */ + public function recordCommand($name, $arguments) + { + $this->commands[] = array( + 'name' => $name, + 'arguments' => $arguments + ); + } + + /** + * Sets an array of recorded commands. + * + * @param array $commands Commands + * @return ProxyAdapter + */ + public function setCommands($commands) + { + $this->commands = $commands; + return $this; + } + + /** + * Gets an array of the recorded commands. + * + * @return array + */ + public function getCommands() + { + return $this->commands; + } + + /** + * Gets an array of the recorded commands in reverse. + * + * @throws IrreversibleMigrationException if a command cannot be reversed. + * @return array + */ + public function getInvertedCommands() + { + if (null === $this->getCommands()) { + return array(); + } + + $invCommands = array(); + $supportedCommands = array( + 'createTable', 'renameTable', 'addColumn', + 'renameColumn', 'addIndex', 'addForeignKey' + ); + foreach (array_reverse($this->getCommands()) as $command) { + if (!in_array($command['name'], $supportedCommands)) { + throw new IrreversibleMigrationException(sprintf( + 'Cannot reverse a "%s" command', + $command['name'] + )); + } + $invertMethod = 'invert' . ucfirst($command['name']); + $invertedCommand = $this->$invertMethod($command['arguments']); + $invCommands[] = array( + 'name' => $invertedCommand['name'], + 'arguments' => $invertedCommand['arguments'] + ); + } + + return $invCommands; + } + + /** + * Execute the recorded commands. + * + * @return void + */ + public function executeCommands() + { + $commands = $this->getCommands(); + foreach ($commands as $command) { + call_user_func_array(array($this->getAdapter(), $command['name']), $command['arguments']); + } + } + + /** + * Execute the recorded commands in reverse. + * + * @return void + */ + public function executeInvertedCommands() + { + $commands = $this->getInvertedCommands(); + foreach ($commands as $command) { + call_user_func_array(array($this->getAdapter(), $command['name']), $command['arguments']); + } + } + + /** + * Returns the reverse of a createTable command. + * + * @param array $args Method Arguments + * @return array + */ + public function invertCreateTable($args) + { + return array('name' => 'dropTable', 'arguments' => array($args[0])); + } + + /** + * Returns the reverse of a renameTable command. + * + * @param array $args Method Arguments + * @return array + */ + public function invertRenameTable($args) + { + return array('name' => 'renameTable', 'arguments' => array($args[1], $args[0])); + } + + /** + * Returns the reverse of a addColumn command. + * + * @param array $args Method Arguments + * @return array + */ + public function invertAddColumn($args) + { + return array('name' => 'dropColumn', 'arguments' => array($args[0]->getName(), $args[1]->getName())); + } + + /** + * Returns the reverse of a renameColumn command. + * + * @param array $args Method Arguments + * @return array + */ + public function invertRenameColumn($args) + { + return array('name' => 'renameColumn', 'arguments' => array($args[0], $args[2], $args[1])); + } + + /** + * Returns the reverse of a addIndex command. + * + * @param array $args Method Arguments + * @return array + */ + public function invertAddIndex($args) + { + return array('name' => 'dropIndex', 'arguments' => array($args[0]->getName(), $args[1]->getColumns())); + } + + /** + * Returns the reverse of a addForeignKey command. + * + * @param array $args Method Arguments + * @return array + */ + public function invertAddForeignKey($args) + { + return array('name' => 'dropForeignKey', 'arguments' => array($args[0]->getName(), $args[1]->getColumns())); + } +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/SQLiteAdapter.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/SQLiteAdapter.php new file mode 100644 index 0000000..4ff7b74 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/SQLiteAdapter.php @@ -0,0 +1,1136 @@ + + * @author Richard McIntyre + */ +class SQLiteAdapter extends PdoAdapter implements AdapterInterface +{ + protected $definitionsWithLimits = array( + 'CHARACTER', + 'VARCHAR', + 'VARYING CHARACTER', + 'NCHAR', + 'NATIVE CHARACTER', + 'NVARCHAR' + ); + + /** + * {@inheritdoc} + */ + public function connect() + { + if (null === $this->connection) { + if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers(), true)) { + // @codeCoverageIgnoreStart + throw new \RuntimeException('You need to enable the PDO_SQLITE extension for Phinx to run properly.'); + // @codeCoverageIgnoreEnd + } + + $db = null; + $options = $this->getOptions(); + + // if port is specified use it, otherwise use the MySQL default + if (isset($options['memory'])) { + $dsn = 'sqlite::memory:'; + } else { + $dsn = 'sqlite:' . $options['name']; + if (file_exists($options['name'] . '.sqlite3')) { + $dsn = 'sqlite:' . $options['name'] . '.sqlite3'; + } + } + + try { + $db = new \PDO($dsn); + } catch (\PDOException $exception) { + throw new \InvalidArgumentException(sprintf( + 'There was a problem connecting to the database: %s', + $exception->getMessage() + )); + } + + $this->setConnection($db); + } + } + + /** + * {@inheritdoc} + */ + public function disconnect() + { + $this->connection = null; + } + + /** + * {@inheritdoc} + */ + public function hasTransactions() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function beginTransaction() + { + $this->execute('BEGIN TRANSACTION'); + } + + /** + * {@inheritdoc} + */ + public function commitTransaction() + { + $this->execute('COMMIT'); + } + + /** + * {@inheritdoc} + */ + public function rollbackTransaction() + { + $this->execute('ROLLBACK'); + } + + /** + * {@inheritdoc} + */ + public function quoteTableName($tableName) + { + return str_replace('.', '`.`', $this->quoteColumnName($tableName)); + } + + /** + * {@inheritdoc} + */ + public function quoteColumnName($columnName) + { + return '`' . str_replace('`', '``', $columnName) . '`'; + } + + /** + * {@inheritdoc} + */ + public function hasTable($tableName) + { + $tables = array(); + $rows = $this->fetchAll(sprintf('SELECT name FROM sqlite_master WHERE type=\'table\' AND name=\'%s\'', $tableName)); + foreach ($rows as $row) { + $tables[] = strtolower($row[0]); + } + + return in_array(strtolower($tableName), $tables); + } + + /** + * {@inheritdoc} + */ + public function createTable(Table $table) + { + $this->startCommandTimer(); + + // Add the default primary key + $columns = $table->getPendingColumns(); + $options = $table->getOptions(); + if (!isset($options['id']) || (isset($options['id']) && $options['id'] === true)) { + $column = new Column(); + $column->setName('id') + ->setType('integer') + ->setIdentity(true); + + array_unshift($columns, $column); + + } elseif (isset($options['id']) && is_string($options['id'])) { + // Handle id => "field_name" to support AUTO_INCREMENT + $column = new Column(); + $column->setName($options['id']) + ->setType('integer') + ->setIdentity(true); + + array_unshift($columns, $column); + } + + $sql = 'CREATE TABLE '; + $sql .= $this->quoteTableName($table->getName()) . ' ('; + foreach ($columns as $column) { + $sql .= $this->quoteColumnName($column->getName()) . ' ' . $this->getColumnSqlDefinition($column) . ', '; + } + + // set the primary key(s) + if (isset($options['primary_key'])) { + $sql = rtrim($sql); + $sql .= ' PRIMARY KEY ('; + if (is_string($options['primary_key'])) { // handle primary_key => 'id' + $sql .= $this->quoteColumnName($options['primary_key']); + } elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id') + // PHP 5.4 will allow access of $this, so we can call quoteColumnName() directly in the anonymous function, + // but for now just hard-code the adapter quotes + $sql .= implode( + ',', + array_map( + function ($v) { + return '`' . $v . '`'; + }, + $options['primary_key'] + ) + ); + } + $sql .= ')'; + } else { + $sql = substr(rtrim($sql), 0, -1); // no primary keys + } + + // set the foreign keys + $foreignKeys = $table->getForeignKeys(); + if (!empty($foreignKeys)) { + foreach ($foreignKeys as $foreignKey) { + $sql .= ', ' . $this->getForeignKeySqlDefinition($foreignKey); + } + } + + $sql = rtrim($sql) . ');'; + // execute the sql + $this->writeCommand('createTable', array($table->getName())); + $this->execute($sql); + $this->endCommandTimer(); + + foreach ($table->getIndexes() as $index) { + $this->addIndex($table, $index); + } + } + + /** + * {@inheritdoc} + */ + public function renameTable($tableName, $newTableName) + { + $this->startCommandTimer(); + $this->writeCommand('renameTable', array($tableName, $newTableName)); + $this->execute(sprintf('ALTER TABLE %s RENAME TO %s', $this->quoteTableName($tableName), $this->quoteTableName($newTableName))); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function dropTable($tableName) + { + $this->startCommandTimer(); + $this->writeCommand('dropTable', array($tableName)); + $this->execute(sprintf('DROP TABLE %s', $this->quoteTableName($tableName))); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function getColumns($tableName) + { + $columns = array(); + $rows = $this->fetchAll(sprintf('pragma table_info(%s)', $this->quoteTableName($tableName))); + + foreach ($rows as $columnInfo) { + $column = new Column(); + $type = strtolower($columnInfo['type']); + $column->setName($columnInfo['name']) + ->setNull($columnInfo['notnull'] !== '1') + ->setDefault($columnInfo['dflt_value']); + + $phinxType = $this->getPhinxType($type); + $column->setType($phinxType['name']) + ->setLimit($phinxType['limit']); + + if ($columnInfo['pk'] == 1) { + $column->setIdentity(true); + } + + $columns[] = $column; + } + + return $columns; + } + + /** + * {@inheritdoc} + */ + public function hasColumn($tableName, $columnName) + { + $rows = $this->fetchAll(sprintf('pragma table_info(%s)', $this->quoteTableName($tableName))); + foreach ($rows as $column) { + if (strcasecmp($column['name'], $columnName) === 0) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function addColumn(Table $table, Column $column) + { + $this->startCommandTimer(); + + $sql = sprintf( + 'ALTER TABLE %s ADD COLUMN %s %s', + $this->quoteTableName($table->getName()), + $this->quoteColumnName($column->getName()), + $this->getColumnSqlDefinition($column) + ); + + $this->writeCommand('addColumn', array($table->getName(), $column->getName(), $column->getType())); + $this->execute($sql); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function renameColumn($tableName, $columnName, $newColumnName) + { + $tmpTableName = 'tmp_' . $tableName; + + $rows = $this->fetchAll('select * from sqlite_master where `type` = \'table\''); + + $sql = ''; + foreach ($rows as $table) { + if ($table['tbl_name'] === $tableName) { + $sql = $table['sql']; + } + } + + $columns = $this->fetchAll(sprintf('pragma table_info(%s)', $this->quoteTableName($tableName))); + $selectColumns = array(); + $writeColumns = array(); + foreach ($columns as $column) { + $selectName = $column['name']; + $writeName = ($selectName == $columnName) ? $newColumnName : $selectName; + $selectColumns[] = $this->quoteColumnName($selectName); + $writeColumns[] = $this->quoteColumnName($writeName); + } + + if (!in_array($this->quoteColumnName($columnName), $selectColumns)) { + throw new \InvalidArgumentException(sprintf( + 'The specified column doesn\'t exist: ' . $columnName + )); + } + + $this->execute(sprintf('ALTER TABLE %s RENAME TO %s', $tableName, $tmpTableName)); + + $sql = str_replace( + $this->quoteColumnName($columnName), + $this->quoteColumnName($newColumnName), + $sql + ); + $this->execute($sql); + + $sql = sprintf( + 'INSERT INTO %s(%s) SELECT %s FROM %s', + $tableName, + implode(', ', $writeColumns), + implode(', ', $selectColumns), + $tmpTableName + ); + + $this->execute($sql); + + $this->execute(sprintf('DROP TABLE %s', $this->quoteTableName($tmpTableName))); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function changeColumn($tableName, $columnName, Column $newColumn) + { + + // TODO: DRY this up.... + + $this->startCommandTimer(); + $this->writeCommand('changeColumn', array($tableName, $columnName, $newColumn->getType())); + + $tmpTableName = 'tmp_' . $tableName; + + $rows = $this->fetchAll('select * from sqlite_master where `type` = \'table\''); + + $sql = ''; + foreach ($rows as $table) { + if ($table['tbl_name'] === $tableName) { + $sql = $table['sql']; + } + } + + $columns = $this->fetchAll(sprintf('pragma table_info(%s)', $this->quoteTableName($tableName))); + $selectColumns = array(); + $writeColumns = array(); + foreach ($columns as $column) { + $selectName = $column['name']; + $writeName = ($selectName === $columnName) ? $newColumn->getName() : $selectName; + $selectColumns[] = $this->quoteColumnName($selectName); + $writeColumns[] = $this->quoteColumnName($writeName); + } + + if (!in_array($this->quoteColumnName($columnName), $selectColumns)) { + throw new \InvalidArgumentException(sprintf( + 'The specified column doesn\'t exist: ' . $columnName + )); + } + + $this->execute(sprintf('ALTER TABLE %s RENAME TO %s', $tableName, $tmpTableName)); + + $sql = preg_replace( + sprintf("/%s[^,]+([,)])/", $this->quoteColumnName($columnName)), + sprintf('%s %s$1', $this->quoteColumnName($newColumn->getName()), $this->getColumnSqlDefinition($newColumn)), + $sql, + 1 + ); + + $this->execute($sql); + + $sql = sprintf( + 'INSERT INTO %s(%s) SELECT %s FROM %s', + $tableName, + implode(', ', $writeColumns), + implode(', ', $selectColumns), + $tmpTableName + ); + + $this->execute($sql); + $this->execute(sprintf('DROP TABLE %s', $this->quoteTableName($tmpTableName))); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function dropColumn($tableName, $columnName) + { + // TODO: DRY this up.... + + $this->startCommandTimer(); + $this->writeCommand('dropColumn', array($tableName, $columnName)); + + $tmpTableName = 'tmp_' . $tableName; + + $rows = $this->fetchAll('select * from sqlite_master where `type` = \'table\''); + + $sql = ''; + foreach ($rows as $table) { + if ($table['tbl_name'] === $tableName) { + $sql = $table['sql']; + } + } + + $rows = $this->fetchAll(sprintf('pragma table_info(%s)', $this->quoteTableName($tableName))); + $columns = array(); + $columnType = null; + foreach ($rows as $row) { + if ($row['name'] !== $columnName) { + $columns[] = $row['name']; + } else { + $found = true; + $columnType = $row['type']; + } + } + + if (!isset($found)) { + throw new \InvalidArgumentException(sprintf( + 'The specified column doesn\'t exist: ' . $columnName + )); + } + + $this->execute(sprintf('ALTER TABLE %s RENAME TO %s', $tableName, $tmpTableName)); + + $sql = preg_replace( + sprintf("/%s\s%s[^,)]*(,\s|\))/", preg_quote($this->quoteColumnName($columnName)), preg_quote($columnType)), + "", + $sql + ); + + if (substr($sql, -2) === ', ') { + $sql = substr($sql, 0, -2) . ')'; + } + + $this->execute($sql); + + $sql = sprintf( + 'INSERT INTO %s(%s) SELECT %s FROM %s', + $tableName, + implode(', ', $columns), + implode(', ', $columns), + $tmpTableName + ); + + $this->execute($sql); + $this->execute(sprintf('DROP TABLE %s', $this->quoteTableName($tmpTableName))); + $this->endCommandTimer(); + } + + /** + * Get an array of indexes from a particular table. + * + * @param string $tableName Table Name + * @return array + */ + protected function getIndexes($tableName) + { + $indexes = array(); + $rows = $this->fetchAll(sprintf('pragma index_list(%s)', $tableName)); + + foreach ($rows as $row) { + $indexData = $this->fetchAll(sprintf('pragma index_info(%s)', $row['name'])); + if (!isset($indexes[$tableName])) { + $indexes[$tableName] = array('index' => $row['name'], 'columns' => array()); + } + foreach ($indexData as $indexItem) { + $indexes[$tableName]['columns'][] = strtolower($indexItem['name']); + } + } + return $indexes; + } + + /** + * {@inheritdoc} + */ + public function hasIndex($tableName, $columns) + { + if (is_string($columns)) { + $columns = array($columns); // str to array + } + + $columns = array_map('strtolower', $columns); + $indexes = $this->getIndexes($tableName); + + foreach ($indexes as $index) { + $a = array_diff($columns, $index['columns']); + if (empty($a)) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function hasIndexByName($tableName, $indexName) + { + $indexes = $this->getIndexes($tableName); + + foreach ($indexes as $index) { + if ($indexName === $index['index']) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function addIndex(Table $table, Index $index) + { + $this->startCommandTimer(); + $this->writeCommand('addIndex', array($table->getName(), $index->getColumns())); + $indexColumnArray = array(); + foreach ($index->getColumns() as $column) { + $indexColumnArray []= sprintf('`%s` ASC', $column); + } + $indexColumns = implode(',', $indexColumnArray); + $this->execute( + sprintf( + 'CREATE %s ON %s (%s)', + $this->getIndexSqlDefinition($table, $index), + $this->quoteTableName($table->getName()), + $indexColumns + ) + ); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function dropIndex($tableName, $columns) + { + $this->startCommandTimer(); + if (is_string($columns)) { + $columns = array($columns); // str to array + } + + $this->writeCommand('dropIndex', array($tableName, $columns)); + $indexes = $this->getIndexes($tableName); + $columns = array_map('strtolower', $columns); + + foreach ($indexes as $index) { + $a = array_diff($columns, $index['columns']); + if (empty($a)) { + $this->execute( + sprintf( + 'DROP INDEX %s', + $this->quoteColumnName($index['index']) + ) + ); + $this->endCommandTimer(); + return; + } + } + } + + /** + * {@inheritdoc} + */ + public function dropIndexByName($tableName, $indexName) + { + $this->startCommandTimer(); + + $this->writeCommand('dropIndexByName', array($tableName, $indexName)); + $indexes = $this->getIndexes($tableName); + + foreach ($indexes as $index) { + if ($indexName === $index['index']) { + $this->execute( + sprintf( + 'DROP INDEX %s', + $this->quoteColumnName($indexName) + ) + ); + $this->endCommandTimer(); + return; + } + } + } + + /** + * {@inheritdoc} + */ + public function hasForeignKey($tableName, $columns, $constraint = null) + { + if (is_string($columns)) { + $columns = array($columns); // str to array + } + $foreignKeys = $this->getForeignKeys($tableName); + + $a = array_diff($columns, $foreignKeys); + if (empty($a)) { + return true; + } + return false; + } + + /** + * Get an array of foreign keys from a particular table. + * + * @param string $tableName Table Name + * @return array + */ + protected function getForeignKeys($tableName) + { + $foreignKeys = array(); + $rows = $this->fetchAll( + "SELECT sql, tbl_name + FROM ( + SELECT sql sql, type type, tbl_name tbl_name, name name + FROM sqlite_master + UNION ALL + SELECT sql, type, tbl_name, name + FROM sqlite_temp_master + ) + WHERE type != 'meta' + AND sql NOTNULL + AND name NOT LIKE 'sqlite_%' + ORDER BY substr(type, 2, 1), name" + ); + + foreach ($rows as $row) { + if ($row['tbl_name'] === $tableName) { + + if (strpos($row['sql'], 'REFERENCES') !== false) { + preg_match_all("/\(`([^`]*)`\) REFERENCES/", $row['sql'], $matches); + foreach ($matches[1] as $match) { + $foreignKeys[] = $match; + } + } + } + } + return $foreignKeys; + } + + /** + * {@inheritdoc} + */ + public function addForeignKey(Table $table, ForeignKey $foreignKey) + { + // TODO: DRY this up.... + $this->startCommandTimer(); + $this->writeCommand('addForeignKey', array($table->getName(), $foreignKey->getColumns())); + $this->execute('pragma foreign_keys = ON'); + + $tmpTableName = 'tmp_' . $table->getName(); + $rows = $this->fetchAll('select * from sqlite_master where `type` = \'table\''); + + $sql = ''; + foreach ($rows as $row) { + if ($row['tbl_name'] === $table->getName()) { + $sql = $row['sql']; + } + } + + $rows = $this->fetchAll(sprintf('pragma table_info(%s)', $this->quoteTableName($table->getName()))); + $columns = array(); + foreach ($rows as $column) { + $columns[] = $this->quoteColumnName($column['name']); + } + + $this->execute(sprintf('ALTER TABLE %s RENAME TO %s', $this->quoteTableName($table->getName()), $tmpTableName)); + + $sql = substr($sql, 0, -1) . ',' . $this->getForeignKeySqlDefinition($foreignKey) . ')'; + $this->execute($sql); + + $sql = sprintf( + 'INSERT INTO %s(%s) SELECT %s FROM %s', + $this->quoteTableName($table->getName()), + implode(', ', $columns), + implode(', ', $columns), + $this->quoteTableName($tmpTableName) + ); + + $this->execute($sql); + $this->execute(sprintf('DROP TABLE %s', $this->quoteTableName($tmpTableName))); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function dropForeignKey($tableName, $columns, $constraint = null) + { + // TODO: DRY this up.... + + $this->startCommandTimer(); + if (is_string($columns)) { + $columns = array($columns); // str to array + } + + $this->writeCommand('dropForeignKey', array($tableName, $columns)); + + $tmpTableName = 'tmp_' . $tableName; + + $rows = $this->fetchAll('select * from sqlite_master where `type` = \'table\''); + + $sql = ''; + foreach ($rows as $table) { + if ($table['tbl_name'] === $tableName) { + $sql = $table['sql']; + } + } + + $rows = $this->fetchAll(sprintf('pragma table_info(%s)', $this->quoteTableName($tableName))); + $replaceColumns = array(); + foreach ($rows as $row) { + if (!in_array($row['name'], $columns)) { + $replaceColumns[] = $row['name']; + } else { + $found = true; + } + } + + if (!isset($found)) { + throw new \InvalidArgumentException(sprintf( + 'The specified column doesn\'t exist: ' + )); + } + + $this->execute(sprintf('ALTER TABLE %s RENAME TO %s', $this->quoteTableName($tableName), $tmpTableName)); + + foreach ($columns as $columnName) { + $search = sprintf( + "/,[^,]*\(%s(?:,`?(.*)`?)?\) REFERENCES[^,]*\([^\)]*\)[^,)]*/", + $this->quoteColumnName($columnName) + ); + $sql = preg_replace($search, '', $sql, 1); + } + + $this->execute($sql); + + $sql = sprintf( + 'INSERT INTO %s(%s) SELECT %s FROM %s', + $tableName, + implode(', ', $columns), + implode(', ', $columns), + $tmpTableName + ); + + $this->execute($sql); + $this->execute(sprintf('DROP TABLE %s', $this->quoteTableName($tmpTableName))); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function insert(Table $table, $row) + { + $this->startCommandTimer(); + $this->writeCommand('insert', array($table->getName())); + + $sql = sprintf( + "INSERT INTO %s ", + $this->quoteTableName($table->getName()) + ); + + $columns = array_keys($row); + $sql .= "(". implode(', ', array_map(array($this, 'quoteColumnName'), $columns)) . ")"; + $sql .= " VALUES "; + + $sql .= "(" . implode(', ', array_map(function ($value) { + if (is_numeric($value)) { + return $value; + } + return "'{$value}'"; + }, $row)) . ")"; + + $this->execute($sql); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function getSqlType($type, $limit = null) + { + switch ($type) { + case static::PHINX_TYPE_STRING: + return array('name' => 'varchar', 'limit' => 255); + break; + case static::PHINX_TYPE_CHAR: + return array('name' => 'char', 'limit' => 255); + break; + case static::PHINX_TYPE_TEXT: + return array('name' => 'text'); + break; + case static::PHINX_TYPE_INTEGER: + return array('name' => 'integer'); + break; + case static::PHINX_TYPE_BIG_INTEGER: + return array('name' => 'bigint'); + break; + case static::PHINX_TYPE_FLOAT: + return array('name' => 'float'); + break; + case static::PHINX_TYPE_DECIMAL: + return array('name' => 'decimal'); + break; + case static::PHINX_TYPE_DATETIME: + return array('name' => 'datetime'); + break; + case static::PHINX_TYPE_TIMESTAMP: + return array('name' => 'datetime'); + break; + case static::PHINX_TYPE_TIME: + return array('name' => 'time'); + break; + case static::PHINX_TYPE_DATE: + return array('name' => 'date'); + break; + case static::PHINX_TYPE_BLOB: + case static::PHINX_TYPE_BINARY: + return array('name' => 'blob'); + break; + case static::PHINX_TYPE_BOOLEAN: + return array('name' => 'boolean'); + break; + case static::PHINX_TYPE_UUID: + return array('name' => 'char', 'limit' => 36); + case static::PHINX_TYPE_ENUM: + return array('name' => 'enum'); + // Geospatial database types + // No specific data types exist in SQLite, instead all geospatial + // functionality is handled in the client. See also: SpatiaLite. + case static::PHINX_TYPE_GEOMETRY: + case static::PHINX_TYPE_POLYGON: + return array('name' => 'text'); + return; + case static::PHINX_TYPE_LINESTRING: + return array('name' => 'varchar', 'limit' => 255); + break; + case static::PHINX_TYPE_POINT: + return array('name' => 'float'); + default: + throw new \RuntimeException('The type: "' . $type . '" is not supported.'); + } + } + + /** + * Returns Phinx type by SQL type + * + * @param string $sqlTypeDef SQL type + * @returns string Phinx type + */ + public function getPhinxType($sqlTypeDef) + { + if (!preg_match('/^([\w]+)(\(([\d]+)*(,([\d]+))*\))*$/', $sqlTypeDef, $matches)) { + throw new \RuntimeException('Column type ' . $sqlTypeDef . ' is not supported'); + } else { + $limit = null; + $precision = null; + $type = $matches[1]; + if (count($matches) > 2) { + $limit = $matches[3] ? $matches[3] : null; + } + if (count($matches) > 4) { + $precision = $matches[5]; + } + switch ($matches[1]) { + case 'varchar': + $type = static::PHINX_TYPE_STRING; + if ($limit === 255) { + $limit = null; + } + break; + case 'char': + $type = static::PHINX_TYPE_CHAR; + if ($limit === 255) { + $limit = null; + } + if ($limit === 36) { + $type = static::PHINX_TYPE_UUID; + } + break; + case 'int': + $type = static::PHINX_TYPE_INTEGER; + if ($limit === 11) { + $limit = null; + } + break; + case 'bigint': + if ($limit === 11) { + $limit = null; + } + $type = static::PHINX_TYPE_BIG_INTEGER; + break; + case 'blob': + $type = static::PHINX_TYPE_BINARY; + break; + } + if ($type === 'tinyint') { + if ($matches[3] === 1) { + $type = static::PHINX_TYPE_BOOLEAN; + $limit = null; + } + } + + $this->getSqlType($type); + + return array( + 'name' => $type, + 'limit' => $limit, + 'precision' => $precision + ); + } + } + + /** + * {@inheritdoc} + */ + public function createDatabase($name, $options = array()) + { + $this->startCommandTimer(); + $this->writeCommand('createDatabase', array($name)); + touch($name . '.sqlite3'); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function hasDatabase($name) + { + return is_file($name . '.sqlite3'); + } + + /** + * {@inheritdoc} + */ + public function dropDatabase($name) + { + $this->startCommandTimer(); + $this->writeCommand('dropDatabase', array($name)); + if (file_exists($name . '.sqlite3')) { + unlink($name . '.sqlite3'); + } + $this->endCommandTimer(); + } + + /** + * Get the definition for a `DEFAULT` statement. + * + * @param mixed $default + * @return string + */ + protected function getDefaultValueDefinition($default) + { + if (is_string($default) && 'CURRENT_TIMESTAMP' !== $default) { + $default = $this->getConnection()->quote($default); + } elseif (is_bool($default)) { + $default = $this->castToBool($default); + } + return isset($default) ? ' DEFAULT ' . $default : ''; + } + + /** + * Gets the SQLite Column Definition for a Column object. + * + * @param Column $column Column + * @return string + */ + protected function getColumnSqlDefinition(Column $column) + { + $sqlType = $this->getSqlType($column->getType()); + $def = ''; + $def .= strtoupper($sqlType['name']); + if ($column->getPrecision() && $column->getScale()) { + $def .= '(' . $column->getPrecision() . ',' . $column->getScale() . ')'; + } + $limitable = in_array(strtoupper($sqlType['name']), $this->definitionsWithLimits); + if (($column->getLimit() || isset($sqlType['limit'])) && $limitable) { + $def .= '(' . ($column->getLimit() ? $column->getLimit() : $sqlType['limit']) . ')'; + } + if (($values = $column->getValues()) && is_array($values)) { + $def .= " CHECK({$column->getName()} IN ('" . implode("', '", $values) . "'))"; + } + + $default = $column->getDefault(); + + $def .= ($column->isNull() || is_null($default)) ? ' NULL' : ' NOT NULL'; + $def .= $this->getDefaultValueDefinition($default); + $def .= ($column->isIdentity()) ? ' PRIMARY KEY AUTOINCREMENT' : ''; + + if ($column->getUpdate()) { + $def .= ' ON UPDATE ' . $column->getUpdate(); + } + + $def .= $this->getCommentDefinition($column); + + return $def; + } + + /** + * Gets the comment Definition for a Column object. + * + * @param Column $column Column + * @return string + */ + protected function getCommentDefinition(Column $column) + { + if ($column->getComment()) { + return ' /* ' . $column->getComment() . ' */ '; + } + return ''; + } + + /** + * Gets the SQLite Index Definition for an Index object. + * + * @param Index $index Index + * @return string + */ + protected function getIndexSqlDefinition(Table $table, Index $index) + { + if ($index->getType() === Index::UNIQUE) { + $def = 'UNIQUE INDEX'; + } else { + $def = 'INDEX'; + } + if (is_string($index->getName())) { + $indexName = $index->getName(); + } else { + $indexName = $table->getName() . '_'; + foreach ($index->getColumns() as $column) { + $indexName .= $column . '_'; + } + $indexName .= 'index'; + } + $def .= ' `' . $indexName . '`'; + return $def; + } + + /** + * {@inheritdoc} + */ + public function getColumnTypes() + { + return array_merge(parent::getColumnTypes(), array('enum')); + } + + /** + * Gets the SQLite Foreign Key Definition for an ForeignKey object. + * + * @param ForeignKey $foreignKey + * @return string + */ + protected function getForeignKeySqlDefinition(ForeignKey $foreignKey) + { + $def = ''; + if ($foreignKey->getConstraint()) { + $def .= ' CONSTRAINT ' . $this->quoteColumnName($foreignKey->getConstraint()); + } else { + $columnNames = array(); + foreach ($foreignKey->getColumns() as $column) { + $columnNames[] = $this->quoteColumnName($column); + } + $def .= ' FOREIGN KEY (' . implode(',', $columnNames) . ')'; + $refColumnNames = array(); + foreach ($foreignKey->getReferencedColumns() as $column) { + $refColumnNames[] = $this->quoteColumnName($column); + } + $def .= ' REFERENCES ' . $this->quoteTableName($foreignKey->getReferencedTable()->getName()) . ' (' . implode(',', $refColumnNames) . ')'; + if ($foreignKey->getOnDelete()) { + $def .= ' ON DELETE ' . $foreignKey->getOnDelete(); + } + if ($foreignKey->getOnUpdate()) { + $def .= ' ON UPDATE ' . $foreignKey->getOnUpdate(); + } + } + return $def; + } +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/SqlServerAdapter.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/SqlServerAdapter.php new file mode 100644 index 0000000..99f8a82 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/SqlServerAdapter.php @@ -0,0 +1,1165 @@ + + */ +class SqlServerAdapter extends PdoAdapter implements AdapterInterface +{ + protected $schema = 'dbo'; + + protected $signedColumnTypes = array('integer' => true, 'biginteger' => true, 'float' => true, 'decimal' => true); + + /** + * {@inheritdoc} + */ + public function connect() + { + if (null === $this->connection) { + if (!class_exists('PDO') || !in_array('sqlsrv', \PDO::getAvailableDrivers(), true)) { + // try our connection via freetds (Mac/Linux) + return $this->connectDblib(); + } + + $db = null; + $options = $this->getOptions(); + + // if port is specified use it, otherwise use the SqlServer default + if (empty($options['port'])) { + $dsn = 'sqlsrv:server=' . $options['host'] . ';database=' . $options['name']; + } else { + $dsn = 'sqlsrv:server=' . $options['host'] . ',' . $options['port'] . ';database=' . $options['name']; + } + $dsn .= ';MultipleActiveResultSets=false'; + + $driverOptions = array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION); + + // charset support + if (isset($options['charset'])) { + $driverOptions[\PDO::SQLSRV_ATTR_ENCODING] = $options['charset']; + } + + // support arbitrary \PDO::SQLSRV_ATTR_* driver options and pass them to PDO + // http://php.net/manual/en/ref.pdo-sqlsrv.php#pdo-sqlsrv.constants + foreach ($options as $key => $option) { + if (strpos($key, 'sqlsrv_attr_') === 0) { + $driverOptions[constant('\PDO::' . strtoupper($key))] = $option; + } + } + + try { + $db = new \PDO($dsn, $options['user'], $options['pass'], $driverOptions); + } catch (\PDOException $exception) { + throw new \InvalidArgumentException(sprintf( + 'There was a problem connecting to the database: %s', + $exception->getMessage() + )); + } + + $this->setConnection($db); + } + } + + /** + * Connect to MSSQL using dblib/freetds. + * + * The "sqlsrv" driver is not available on Unix machines. + * + * @throws \InvalidArgumentException + */ + protected function connectDblib() + { + if (!class_exists('PDO') || !in_array('dblib', \PDO::getAvailableDrivers(), true)) { + // @codeCoverageIgnoreStart + throw new \RuntimeException('You need to enable the PDO_Dblib extension for Phinx to run properly.'); + // @codeCoverageIgnoreEnd + } + + $options = $this->getOptions(); + + // if port is specified use it, otherwise use the SqlServer default + if (empty($options['port'])) { + $dsn = 'dblib:host=' . $options['host'] . ';dbname=' . $options['name']; + } else { + $dsn = 'dblib:host=' . $options['host'] . ':' . $options['port'] . ';dbname=' . $options['name']; + } + + $driverOptions = array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION); + + try { + $db = new \PDO($dsn, $options['user'], $options['pass'], $driverOptions); + } catch (\PDOException $exception) { + throw new \InvalidArgumentException(sprintf( + 'There was a problem connecting to the database: %s', + $exception->getMessage() + )); + } + + $this->setConnection($db); + } + + /** + * {@inheritdoc} + */ + public function disconnect() + { + $this->connection = null; + } + + /** + * {@inheritdoc} + */ + public function hasTransactions() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function beginTransaction() + { + $this->execute('BEGIN TRANSACTION'); + } + + /** + * {@inheritdoc} + */ + public function commitTransaction() + { + $this->execute('COMMIT TRANSACTION'); + } + + /** + * {@inheritdoc} + */ + public function rollbackTransaction() + { + $this->execute('ROLLBACK TRANSACTION'); + } + + /** + * {@inheritdoc} + */ + public function quoteTableName($tableName) + { + return str_replace('.', '].[', $this->quoteColumnName($tableName)); + } + + /** + * {@inheritdoc} + */ + public function quoteColumnName($columnName) + { + return '[' . str_replace(']', '\]', $columnName) . ']'; + } + + /** + * {@inheritdoc} + */ + public function hasTable($tableName) + { + $result = $this->fetchRow(sprintf('SELECT count(*) as [count] FROM information_schema.tables WHERE table_name = \'%s\';', $tableName)); + return $result['count'] > 0; + } + + /** + * {@inheritdoc} + */ + public function createTable(Table $table) + { + $this->startCommandTimer(); + + $options = $table->getOptions(); + + // Add the default primary key + $columns = $table->getPendingColumns(); + if (!isset($options['id']) || (isset($options['id']) && $options['id'] === true)) { + $column = new Column(); + $column->setName('id') + ->setType('integer') + ->setIdentity(true); + + array_unshift($columns, $column); + $options['primary_key'] = 'id'; + + } elseif (isset($options['id']) && is_string($options['id'])) { + // Handle id => "field_name" to support AUTO_INCREMENT + $column = new Column(); + $column->setName($options['id']) + ->setType('integer') + ->setIdentity(true); + + array_unshift($columns, $column); + $options['primary_key'] = $options['id']; + } + + $sql = 'CREATE TABLE '; + $sql .= $this->quoteTableName($table->getName()) . ' ('; + $sqlBuffer = array(); + $columnsWithComments = array(); + foreach ($columns as $column) { + $sqlBuffer[] = $this->quoteColumnName($column->getName()) . ' ' . $this->getColumnSqlDefinition($column); + + // set column comments, if needed + if ($column->getComment()) { + $columnsWithComments[] = $column; + } + } + + // set the primary key(s) + if (isset($options['primary_key'])) { + $pkSql = sprintf('CONSTRAINT PK_%s PRIMARY KEY (', $table->getName()); + if (is_string($options['primary_key'])) { // handle primary_key => 'id' + $pkSql .= $this->quoteColumnName($options['primary_key']); + } elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id') + // PHP 5.4 will allow access of $this, so we can call quoteColumnName() directly in the anonymous function, + // but for now just hard-code the adapter quotes + $pkSql .= implode( + ',', + array_map( + function ($v) { + return '[' . $v . ']'; + }, + $options['primary_key'] + ) + ); + } + $pkSql .= ')'; + $sqlBuffer[] = $pkSql; + } + + // set the foreign keys + $foreignKeys = $table->getForeignKeys(); + if (!empty($foreignKeys)) { + foreach ($foreignKeys as $foreignKey) { + $sqlBuffer[] = $this->getForeignKeySqlDefinition($foreignKey, $table->getName()); + } + } + + $sql .= implode(', ', $sqlBuffer); + $sql .= ');'; + + // process column comments + if (!empty($columnsWithComments)) { + foreach ($columnsWithComments as $column) { + $sql .= $this->getColumnCommentSqlDefinition($column, $table->getName()); + } + } + + // set the indexes + $indexes = $table->getIndexes(); + if (!empty($indexes)) { + foreach ($indexes as $index) { + $sql .= $this->getIndexSqlDefinition($index, $table->getName()); + } + } + + // execute the sql + $this->writeCommand('createTable', array($table->getName())); + $this->execute($sql); + $this->endCommandTimer(); + } + + /** + * Gets the SqlServer Column Comment Defininition for a column object. + * + * @param Column $column Column + * @param string $tableName Table name + * + * @return string + */ + protected function getColumnCommentSqlDefinition(Column $column, $tableName) + { + // passing 'null' is to remove column comment + $currentComment = $this->getColumnComment($tableName, $column->getName()); + + $comment = (strcasecmp($column->getComment(), 'NULL') !== 0) ? $this->getConnection()->quote($column->getComment()) : '\'\''; + $command = $currentComment === false ? 'sp_addextendedproperty' : 'sp_updateextendedproperty'; + return sprintf( + "EXECUTE %s N'MS_Description', N%s, N'SCHEMA', N'%s', N'TABLE', N'%s', N'COLUMN', N'%s';", + $command, + $comment, + $this->schema, + $tableName, + $column->getName() + ); + } + + /** + * {@inheritdoc} + */ + public function renameTable($tableName, $newTableName) + { + $this->startCommandTimer(); + $this->writeCommand('renameTable', array($tableName, $newTableName)); + $this->execute(sprintf('EXEC sp_rename \'%s\', \'%s\'', $tableName, $newTableName)); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function dropTable($tableName) + { + $this->startCommandTimer(); + $this->writeCommand('dropTable', array($tableName)); + $this->execute(sprintf('DROP TABLE %s', $this->quoteTableName($tableName))); + $this->endCommandTimer(); + } + + public function getColumnComment($tableName, $columnName) + { + $sql = sprintf("SELECT cast(extended_properties.[value] as nvarchar(4000)) comment + FROM sys.schemas + INNER JOIN sys.tables + ON schemas.schema_id = tables.schema_id + INNER JOIN sys.columns + ON tables.object_id = columns.object_id + INNER JOIN sys.extended_properties + ON tables.object_id = extended_properties.major_id + AND columns.column_id = extended_properties.minor_id + AND extended_properties.name = 'MS_Description' + WHERE schemas.[name] = '%s' AND tables.[name] = '%s' AND columns.[name] = '%s'", $this->schema, $tableName, $columnName); + $row = $this->fetchRow($sql); + + if ($row) { + return $row['comment']; + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function getColumns($tableName) + { + $columns = array(); + $sql = sprintf( + "SELECT DISTINCT TABLE_SCHEMA AS [schema], TABLE_NAME as [table_name], COLUMN_NAME AS [name], DATA_TYPE AS [type], + IS_NULLABLE AS [null], COLUMN_DEFAULT AS [default], + CHARACTER_MAXIMUM_LENGTH AS [char_length], + NUMERIC_PRECISION AS [precision], + NUMERIC_SCALE AS [scale], ORDINAL_POSITION AS [ordinal_position], + COLUMNPROPERTY(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity') as [identity] + FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_NAME = '%s' + ORDER BY ordinal_position", + $tableName + ); + $rows = $this->fetchAll($sql); + foreach ($rows as $columnInfo) { + $column = new Column(); + $column->setName($columnInfo['name']) + ->setType($this->getPhinxType($columnInfo['type'])) + ->setNull($columnInfo['null'] !== 'NO') + ->setDefault($this->parseDefault($columnInfo['default'])) + ->setIdentity($columnInfo['identity'] === '1') + ->setComment($this->getColumnComment($columnInfo['table_name'], $columnInfo['name'])); + + if (!empty($columnInfo['char_length'])) { + $column->setLimit($columnInfo['char_length']); + } + + $columns[$columnInfo['name']] = $column; + } + + return $columns; + } + + protected function parseDefault($default) + { + $default = preg_replace(array("/\('(.*)'\)/", "/\(\((.*)\)\)/", "/\((.*)\)/"), '$1', $default); + + if (strtoupper($default) === 'NULL') { + $default = null; + } elseif (is_numeric($default)) { + $default = (int) $default; + } + + return $default; + } + + /** + * {@inheritdoc} + */ + public function hasColumn($tableName, $columnName, $options = array()) + { + $sql = sprintf( + "SELECT count(*) as [count] + FROM information_schema.columns + WHERE table_name = '%s' AND column_name = '%s'", + $tableName, + $columnName + ); + $result = $this->fetchRow($sql); + + return $result['count'] > 0; + } + + /** + * {@inheritdoc} + */ + public function addColumn(Table $table, Column $column) + { + $this->startCommandTimer(); + $sql = sprintf( + 'ALTER TABLE %s ADD %s %s', + $this->quoteTableName($table->getName()), + $this->quoteColumnName($column->getName()), + $this->getColumnSqlDefinition($column) + ); + + $this->writeCommand('addColumn', array($table->getName(), $column->getName(), $column->getType())); + $this->execute($sql); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function renameColumn($tableName, $columnName, $newColumnName) + { + $this->startCommandTimer(); + + if (!$this->hasColumn($tableName, $columnName)) { + throw new \InvalidArgumentException("The specified column does not exist: $columnName"); + } + $this->writeCommand('renameColumn', array($tableName, $columnName, $newColumnName)); + $this->renameDefault($tableName, $columnName, $newColumnName); + $this->execute( + sprintf( + "EXECUTE sp_rename N'%s.%s', N'%s', 'COLUMN' ", + $tableName, + $columnName, + $newColumnName + ) + ); + $this->endCommandTimer(); + } + + protected function renameDefault($tableName, $columnName, $newColumnName) + { + $oldConstraintName = "DF_{$tableName}_{$columnName}"; + $newConstraintName = "DF_{$tableName}_{$newColumnName}"; + $sql = <<execute(sprintf( + $sql, + $oldConstraintName, + $newConstraintName + )); + } + + public function changeDefault($tableName, Column $newColumn) + { + $constraintName = "DF_{$tableName}_{$newColumn->getName()}"; + $default = $newColumn->getDefault(); + + if ($default === null) { + $default = 'DEFAULT NULL'; + } else { + $default = $this->getDefaultValueDefinition($default); + } + + if (empty($default)) { + return; + } + + $this->execute(sprintf( + 'ALTER TABLE %s ADD CONSTRAINT %s %s FOR %s', + $this->quoteTableName($tableName), + $constraintName, + $default, + $this->quoteColumnName($newColumn->getName()) + )); + } + + /** + * {@inheritdoc} + */ + public function changeColumn($tableName, $columnName, Column $newColumn) + { + $this->startCommandTimer(); + $this->writeCommand('changeColumn', array($tableName, $columnName, $newColumn->getType())); + $columns = $this->getColumns($tableName); + $changeDefault = $newColumn->getDefault() !== $columns[$columnName]->getDefault() || $newColumn->getType() !== $columns[$columnName]->getType(); + if ($columnName !== $newColumn->getName()) { + $this->renameColumn($tableName, $columnName, $newColumn->getName()); + } + + if ($changeDefault) { + $this->dropDefaultConstraint($tableName, $newColumn->getName()); + } + + $this->execute( + sprintf( + 'ALTER TABLE %s ALTER COLUMN %s %s', + $this->quoteTableName($tableName), + $this->quoteColumnName($newColumn->getName()), + $this->getColumnSqlDefinition($newColumn, false) + ) + ); + // change column comment if needed + if ($newColumn->getComment()) { + $sql = $this->getColumnCommentSqlDefinition($newColumn, $tableName); + $this->execute($sql); + } + + if ($changeDefault) { + $this->changeDefault($tableName, $newColumn); + } + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function dropColumn($tableName, $columnName) + { + $this->startCommandTimer(); + $this->writeCommand('dropColumn', array($tableName, $columnName)); + $this->dropDefaultConstraint($tableName, $columnName); + + $this->execute( + sprintf( + 'ALTER TABLE %s DROP COLUMN %s', + $this->quoteTableName($tableName), + $this->quoteColumnName($columnName) + ) + ); + $this->endCommandTimer(); + } + + protected function dropDefaultConstraint($tableName, $columnName) + { + $defaultConstraint = $this->getDefaultConstraint($tableName, $columnName); + + if (!$defaultConstraint) { + return; + } + + $this->dropForeignKey($tableName, $columnName, $defaultConstraint); + } + + protected function getDefaultConstraint($tableName, $columnName) + { + $sql = "SELECT + default_constraints.name +FROM + sys.all_columns + + INNER JOIN + sys.tables + ON all_columns.object_id = tables.object_id + + INNER JOIN + sys.schemas + ON tables.schema_id = schemas.schema_id + + INNER JOIN + sys.default_constraints + ON all_columns.default_object_id = default_constraints.object_id + +WHERE + schemas.name = 'dbo' + AND tables.name = '{$tableName}' + AND all_columns.name = '{$columnName}'"; + + $rows = $this->fetchAll($sql); + return empty($rows) ? false : $rows[0]['name']; + } + + protected function getIndexColums($tableId, $indexId) + { + $sql = "SELECT AC.[name] AS [column_name] +FROM sys.[index_columns] IC + INNER JOIN sys.[all_columns] AC ON IC.[column_id] = AC.[column_id] +WHERE AC.[object_id] = {$tableId} AND IC.[index_id] = {$indexId} AND IC.[object_id] = {$tableId} +ORDER BY IC.[key_ordinal];"; + + $rows = $this->fetchAll($sql); + $columns = array(); + foreach($rows as $row) { + $columns[] = strtolower($row['column_name']); + } + return $columns; + } + + /** + * Get an array of indexes from a particular table. + * + * @param string $tableName Table Name + * @return array + */ + public function getIndexes($tableName) + { + $indexes = array(); + $sql = "SELECT I.[name] AS [index_name], I.[index_id] as [index_id], T.[object_id] as [table_id] +FROM sys.[tables] AS T + INNER JOIN sys.[indexes] I ON T.[object_id] = I.[object_id] +WHERE T.[is_ms_shipped] = 0 AND I.[type_desc] <> 'HEAP' AND T.[name] = '{$tableName}' +ORDER BY T.[name], I.[index_id];"; + + $rows = $this->fetchAll($sql); + foreach ($rows as $row) { + $columns = $this->getIndexColums($row['table_id'], $row['index_id']); + $indexes[$row['index_name']] = array('columns' => $columns); + } + + return $indexes; + } + + /** + * {@inheritdoc} + */ + public function hasIndex($tableName, $columns) + { + if (is_string($columns)) { + $columns = array($columns); // str to array + } + + $columns = array_map('strtolower', $columns); + $indexes = $this->getIndexes($tableName); + + foreach ($indexes as $index) { + $a = array_diff($columns, $index['columns']); + + if (empty($a)) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function hasIndexByName($tableName, $indexName) + { + $indexes = $this->getIndexes($tableName); + + foreach ($indexes as $name => $index) { + if ($name === $indexName) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function addIndex(Table $table, Index $index) + { + $this->startCommandTimer(); + $this->writeCommand('addIndex', array($table->getName(), $index->getColumns())); + $sql = $this->getIndexSqlDefinition($index, $table->getName()); + $this->execute($sql); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function dropIndex($tableName, $columns) + { + $this->startCommandTimer(); + if (is_string($columns)) { + $columns = array($columns); // str to array + } + + $this->writeCommand('dropIndex', array($tableName, $columns)); + $indexes = $this->getIndexes($tableName); + $columns = array_map('strtolower', $columns); + + foreach ($indexes as $indexName => $index) { + $a = array_diff($columns, $index['columns']); + if (empty($a)) { + $this->execute( + sprintf( + 'DROP INDEX %s ON %s', + $this->quoteColumnName($indexName), + $this->quoteTableName($tableName) + ) + ); + $this->endCommandTimer(); + return; + } + } + } + + /** + * {@inheritdoc} + */ + public function dropIndexByName($tableName, $indexName) + { + $this->startCommandTimer(); + + $this->writeCommand('dropIndexByName', array($tableName, $indexName)); + $indexes = $this->getIndexes($tableName); + + foreach ($indexes as $name => $index) { + if ($name === $indexName) { + $this->execute( + sprintf( + 'DROP INDEX %s ON %s', + $this->quoteColumnName($indexName), + $this->quoteTableName($tableName) + ) + ); + $this->endCommandTimer(); + return; + } + } + } + + /** + * {@inheritdoc} + */ + public function hasForeignKey($tableName, $columns, $constraint = null) + { + if (is_string($columns)) { + $columns = array($columns); // str to array + } + $foreignKeys = $this->getForeignKeys($tableName); + if ($constraint) { + if (isset($foreignKeys[$constraint])) { + return !empty($foreignKeys[$constraint]); + } + return false; + } else { + foreach ($foreignKeys as $key) { + $a = array_diff($columns, $key['columns']); + if (empty($a)) { + return true; + } + } + return false; + } + } + + /** + * Get an array of foreign keys from a particular table. + * + * @param string $tableName Table Name + * @return array + */ + protected function getForeignKeys($tableName) + { + $foreignKeys = array(); + $rows = $this->fetchAll(sprintf( + "SELECT + tc.constraint_name, + tc.table_name, kcu.column_name, + ccu.table_name AS referenced_table_name, + ccu.column_name AS referenced_column_name + FROM + information_schema.table_constraints AS tc + JOIN information_schema.key_column_usage AS kcu ON tc.constraint_name = kcu.constraint_name + JOIN information_schema.constraint_column_usage AS ccu ON ccu.constraint_name = tc.constraint_name + WHERE constraint_type = 'FOREIGN KEY' AND tc.table_name = '%s' + ORDER BY kcu.ordinal_position", + $tableName + )); + foreach ($rows as $row) { + $foreignKeys[$row['constraint_name']]['table'] = $row['table_name']; + $foreignKeys[$row['constraint_name']]['columns'][] = $row['column_name']; + $foreignKeys[$row['constraint_name']]['referenced_table'] = $row['referenced_table_name']; + $foreignKeys[$row['constraint_name']]['referenced_columns'][] = $row['referenced_column_name']; + } + + return $foreignKeys; + } + + /** + * {@inheritdoc} + */ + public function addForeignKey(Table $table, ForeignKey $foreignKey) + { + $this->startCommandTimer(); + $this->writeCommand('addForeignKey', array($table->getName(), $foreignKey->getColumns())); + $this->execute( + sprintf( + 'ALTER TABLE %s ADD %s', + $this->quoteTableName($table->getName()), + $this->getForeignKeySqlDefinition($foreignKey, $table->getName()) + ) + ); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function dropForeignKey($tableName, $columns, $constraint = null) + { + $this->startCommandTimer(); + if (is_string($columns)) { + $columns = array($columns); // str to array + } + + $this->writeCommand('dropForeignKey', array($tableName, $columns)); + + if ($constraint) { + $this->execute( + sprintf( + 'ALTER TABLE %s DROP CONSTRAINT %s', + $this->quoteTableName($tableName), + $constraint + ) + ); + $this->endCommandTimer(); + return; + } else { + foreach ($columns as $column) { + $rows = $this->fetchAll(sprintf( + "SELECT + tc.constraint_name, + tc.table_name, kcu.column_name, + ccu.table_name AS referenced_table_name, + ccu.column_name AS referenced_column_name + FROM + information_schema.table_constraints AS tc + JOIN information_schema.key_column_usage AS kcu ON tc.constraint_name = kcu.constraint_name + JOIN information_schema.constraint_column_usage AS ccu ON ccu.constraint_name = tc.constraint_name + WHERE constraint_type = 'FOREIGN KEY' AND tc.table_name = '%s' and ccu.column_name='%s' + ORDER BY kcu.ordinal_position", + $tableName, + $column + )); + foreach ($rows as $row) { + $this->dropForeignKey($tableName, $columns, $row['constraint_name']); + } + } + } + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function getSqlType($type, $limit = null) + { + switch ($type) { + case static::PHINX_TYPE_STRING: + return array('name' => 'nvarchar', 'limit' => 255); + break; + case static::PHINX_TYPE_CHAR: + return array('name' => 'nchar', 'limit' => 255); + break; + case static::PHINX_TYPE_TEXT: + return array('name' => 'ntext'); + break; + case static::PHINX_TYPE_INTEGER: + return array('name' => 'int'); + break; + case static::PHINX_TYPE_BIG_INTEGER: + return array('name' => 'bigint'); + break; + case static::PHINX_TYPE_FLOAT: + return array('name' => 'float'); + break; + case static::PHINX_TYPE_DECIMAL: + return array('name' => 'decimal'); + break; + case static::PHINX_TYPE_DATETIME: + case static::PHINX_TYPE_TIMESTAMP: + return array('name' => 'datetime'); + break; + case static::PHINX_TYPE_TIME: + return array('name' => 'time'); + break; + case static::PHINX_TYPE_DATE: + return array('name' => 'date'); + break; + case static::PHINX_TYPE_BLOB: + case static::PHINX_TYPE_BINARY: + return array('name' => 'varbinary'); + break; + case static::PHINX_TYPE_BOOLEAN: + return array('name' => 'bit'); + break; + case static::PHINX_TYPE_UUID: + return array('name' => 'uniqueidentifier'); + case static::PHINX_TYPE_FILESTREAM: + return array('name' => 'varbinary', 'limit' => 'max'); + // Geospatial database types + case static::PHINX_TYPE_GEOMETRY: + case static::PHINX_TYPE_POINT: + case static::PHINX_TYPE_LINESTRING: + case static::PHINX_TYPE_POLYGON: + // SQL Server stores all spatial data using a single data type. + // Specific types (point, polygon, etc) are set at insert time. + return array('name' => 'geography'); + break; + default: + throw new \RuntimeException('The type: "' . $type . '" is not supported.'); + } + } + + /** + * Returns Phinx type by SQL type + * + * @param $sqlTypeDef + * @throws \RuntimeException + * @internal param string $sqlType SQL type + * @returns string Phinx type + */ + public function getPhinxType($sqlType) + { + switch ($sqlType) { + case 'nvarchar': + case 'varchar': + return static::PHINX_TYPE_STRING; + case 'char': + case 'nchar': + return static::PHINX_TYPE_CHAR; + case 'text': + case 'ntext': + return static::PHINX_TYPE_TEXT; + case 'int': + case 'integer': + return static::PHINX_TYPE_INTEGER; + case 'decimal': + case 'numeric': + case 'money': + return static::PHINX_TYPE_DECIMAL; + case 'bigint': + return static::PHINX_TYPE_BIG_INTEGER; + case 'real': + case 'float': + return static::PHINX_TYPE_FLOAT; + case 'binary': + case 'image': + case 'varbinary': + return static::PHINX_TYPE_BINARY; + break; + case 'time': + return static::PHINX_TYPE_TIME; + case 'date': + return static::PHINX_TYPE_DATE; + case 'datetime': + case 'timestamp': + return static::PHINX_TYPE_DATETIME; + case 'bit': + return static::PHINX_TYPE_BOOLEAN; + case 'uniqueidentifier': + return static::PHINX_TYPE_UUID; + case 'filestream': + return static::PHINX_TYPE_FILESTREAM; + default: + throw new \RuntimeException('The SqlServer type: "' . $sqlType . '" is not supported'); + } + } + + /** + * {@inheritdoc} + */ + public function createDatabase($name, $options = array()) + { + $this->startCommandTimer(); + $this->writeCommand('createDatabase', array($name)); + + if (isset($options['collation'])) { + $this->execute(sprintf('CREATE DATABASE [%s] COLLATE [%s]', $name, $options['collation'])); + } else { + $this->execute(sprintf('CREATE DATABASE [%s]', $name)); + } + $this->execute(sprintf('USE [%s]', $name)); + $this->endCommandTimer(); + } + + /** + * {@inheritdoc} + */ + public function hasDatabase($name) + { + $result = $this->fetchRow( + sprintf( + 'SELECT count(*) as [count] FROM master.dbo.sysdatabases WHERE [name] = \'%s\'', + $name + ) + ); + + return $result['count'] > 0; + } + + /** + * {@inheritdoc} + */ + public function dropDatabase($name) + { + $this->startCommandTimer(); + $this->writeCommand('dropDatabase', array($name)); + $sql = <<execute($sql); + $this->endCommandTimer(); + } + + /** + * Get the defintion for a `DEFAULT` statement. + * + * @param mixed $default + * @return string + */ + protected function getDefaultValueDefinition($default) + { + if (is_string($default) && 'CURRENT_TIMESTAMP' !== $default) { + $default = $this->getConnection()->quote($default); + } elseif (is_bool($default)) { + $default = $this->castToBool($default); + } + return isset($default) ? ' DEFAULT ' . $default : ''; + } + + /** + * Gets the SqlServer Column Definition for a Column object. + * + * @param Column $column Column + * @return string + */ + protected function getColumnSqlDefinition(Column $column, $create = true) + { + $buffer = array(); + + $sqlType = $this->getSqlType($column->getType()); + $buffer[] = strtoupper($sqlType['name']); + // integers cant have limits in SQlServer + $noLimits = array( + 'bigint', + 'int', + 'tinyint' + ); + if (!in_array($sqlType['name'], $noLimits) && ($column->getLimit() || isset($sqlType['limit']))) { + $buffer[] = sprintf('(%s)', $column->getLimit() ? $column->getLimit() : $sqlType['limit']); + } + if ($column->getPrecision() && $column->getScale()) { + $buffer[] = '(' . $column->getPrecision() . ',' . $column->getScale() . ')'; + } + + $properties = $column->getProperties(); + $buffer[] = $column->getType() === 'filestream' ? 'FILESTREAM' : ''; + $buffer[] = isset($properties['rowguidcol']) ? 'ROWGUIDCOL' : ''; + + $buffer[] = $column->isNull() ? 'NULL' : 'NOT NULL'; + + if ($create === true) { + if ($column->getDefault() === null && $column->isNull()) { + $buffer[] = ' DEFAULT NULL'; + } else { + $buffer[] = $this->getDefaultValueDefinition($column->getDefault()); + } + } + + if ($column->isIdentity()) { + $buffer[] = 'IDENTITY(1, 1)'; + } + + return implode(' ', $buffer); + } + + /** + * Gets the SqlServer Index Definition for an Index object. + * + * @param Index $index Index + * @return string + */ + protected function getIndexSqlDefinition(Index $index, $tableName) + { + if (is_string($index->getName())) { + $indexName = $index->getName(); + } else { + $columnNames = $index->getColumns(); + if (is_string($columnNames)) { + $columnNames = array($columnNames); + } + $indexName = sprintf('%s_%s', $tableName, implode('_', $columnNames)); + } + $def = sprintf( + "CREATE %s INDEX %s ON %s (%s);", + ($index->getType() === Index::UNIQUE ? 'UNIQUE' : ''), + $indexName, + $this->quoteTableName($tableName), + '[' . implode('],[', $index->getColumns()) . ']' + ); + + return $def; + } + + /** + * Gets the SqlServer Foreign Key Definition for an ForeignKey object. + * + * @param ForeignKey $foreignKey + * @return string + */ + protected function getForeignKeySqlDefinition(ForeignKey $foreignKey, $tableName) + { + $def = ' CONSTRAINT "'; + $def .= $tableName . '_' . implode('_', $foreignKey->getColumns()); + $def .= '" FOREIGN KEY ("' . implode('", "', $foreignKey->getColumns()) . '")'; + $def .= " REFERENCES {$this->quoteTableName($foreignKey->getReferencedTable()->getName())} (\"" . implode('", "', $foreignKey->getReferencedColumns()) . '")'; + if ($foreignKey->getOnDelete()) { + $def .= " ON DELETE {$foreignKey->getOnDelete()}"; + } + if ($foreignKey->getOnUpdate()) { + $def .= " ON UPDATE {$foreignKey->getOnUpdate()}"; + } + + return $def; + } + + /** + * {@inheritdoc} + */ + public function getColumnTypes() + { + return array_merge(parent::getColumnTypes(), array('filestream')); + } +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/TablePrefixAdapter.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/TablePrefixAdapter.php new file mode 100644 index 0000000..66a850c --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/TablePrefixAdapter.php @@ -0,0 +1,272 @@ + + */ +class TablePrefixAdapter extends AdapterWrapper +{ + /** + * {@inheritdoc} + */ + public function getAdapterType() + { + return 'TablePrefixAdapter'; + } + + /** + * {@inheritdoc} + */ + public function hasTable($tableName) + { + $adapterTableName = $this->getAdapterTableName($tableName); + return parent::hasTable($adapterTableName); + } + + /** + * {@inheritdoc} + */ + public function createTable(Table $table) + { + $adapterTable = clone $table; + $adapterTableName = $this->getAdapterTableName($table->getName()); + $adapterTable->setName($adapterTableName); + + foreach ($adapterTable->getForeignKeys() as $fk) { + $adapterReferenceTable = $fk->getReferencedTable(); + $adapterReferenceTableName = $this->getAdapterTableName($adapterReferenceTable->getName()); + $adapterReferenceTable->setName($adapterReferenceTableName); + } + + return parent::createTable($adapterTable); + } + + /** + * {@inheritdoc} + */ + public function renameTable($tableName, $newTableName) + { + $adapterTableName = $this->getAdapterTableName($tableName); + $adapterNewTableName = $this->getAdapterTableName($newTableName); + return parent::renameTable($adapterTableName, $adapterNewTableName); + } + + /** + * {@inheritdoc} + */ + public function dropTable($tableName) + { + $adapterTableName = $this->getAdapterTableName($tableName); + return parent::dropTable($adapterTableName); + } + + /** + * {@inheritdoc} + */ + public function getColumns($tableName) + { + $adapterTableName = $this->getAdapterTableName($tableName); + return parent::getColumns($adapterTableName); + } + + /** + * {@inheritdoc} + */ + public function hasColumn($tableName, $columnName) + { + $adapterTableName = $this->getAdapterTableName($tableName); + return parent::hasColumn($adapterTableName, $columnName); + } + + /** + * {@inheritdoc} + */ + public function addColumn(Table $table, Column $column) + { + $adapterTable = clone $table; + $adapterTableName = $this->getAdapterTableName($table->getName()); + $adapterTable->setName($adapterTableName); + return parent::addColumn($adapterTable, $column); + } + + /** + * {@inheritdoc} + */ + public function renameColumn($tableName, $columnName, $newColumnName) + { + $adapterTableName = $this->getAdapterTableName($tableName); + return parent::renameColumn($adapterTableName, $columnName, $newColumnName); + } + + /** + * {@inheritdoc} + */ + public function changeColumn($tableName, $columnName, Column $newColumn) + { + $adapterTableName = $this->getAdapterTableName($tableName); + return parent::changeColumn($adapterTableName, $columnName, $newColumn); + } + + /** + * {@inheritdoc} + */ + public function dropColumn($tableName, $columnName) + { + $adapterTableName = $this->getAdapterTableName($tableName); + return parent::dropColumn($adapterTableName, $columnName); + } + + /** + * {@inheritdoc} + */ + public function hasIndex($tableName, $columns) + { + $adapterTableName = $this->getAdapterTableName($tableName); + return parent::hasIndex($adapterTableName, $columns); + } + + /** + * {@inheritdoc} + */ + public function hasIndexByName($tableName, $indexName) + { + $adapterTableName = $this->getAdapterTableName($tableName); + return parent::hasIndexByName($adapterTableName, $indexName); + } + + /** + * {@inheritdoc} + */ + public function addIndex(Table $table, Index $index) + { + $adapterTable = clone $table; + $adapterTableName = $this->getAdapterTableName($table->getName()); + $adapterTable->setName($adapterTableName); + return parent::addIndex($adapterTable, $index); + } + + /** + * {@inheritdoc} + */ + public function dropIndex($tableName, $columns, $options = array()) + { + $adapterTableName = $this->getAdapterTableName($tableName); + return parent::dropIndex($adapterTableName, $columns, $options); + } + + /** + * {@inheritdoc} + */ + public function dropIndexByName($tableName, $indexName) + { + $adapterTableName = $this->getAdapterTableName($tableName); + return parent::dropIndexByName($adapterTableName, $indexName); + } + + /** + * {@inheritdoc} + */ + public function hasForeignKey($tableName, $columns, $constraint = null) + { + $adapterTableName = $this->getAdapterTableName($tableName); + return parent::hasForeignKey($adapterTableName, $columns, $constraint); + } + + /** + * {@inheritdoc} + */ + public function addForeignKey(Table $table, ForeignKey $foreignKey) + { + $adapterTable = clone $table; + $adapterTableName = $this->getAdapterTableName($table->getName()); + $adapterTable->setName($adapterTableName); + return parent::addForeignKey($adapterTable, $foreignKey); + } + + /** + * {@inheritdoc} + */ + public function dropForeignKey($tableName, $columns, $constraint = null) + { + $adapterTableName = $this->getAdapterTableName($tableName); + return parent::dropForeignKey($adapterTableName, $columns, $constraint); + } + + /** + * {@inheritdoc} + */ + public function insert(Table $table, $row) + { + $adapterTable = clone $table; + $adapterTableName = $this->getAdapterTableName($table->getName()); + $adapterTable->setName($adapterTableName); + return parent::insert($adapterTable, $row); + } + + /** + * Gets the table prefix. + * + * @return string + */ + public function getPrefix() + { + return (string) $this->getOption('table_prefix'); + } + + /** + * Gets the table suffix. + * + * @return string + */ + public function getSuffix() + { + return (string) $this->getOption('table_suffix'); + } + + /** + * Applies the prefix and suffix to the table name. + * + * @param string $tableName + * @return string + */ + public function getAdapterTableName($tableName) + { + return $this->getPrefix() . $tableName . $this->getSuffix(); + } +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/WrapperInterface.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/WrapperInterface.php new file mode 100644 index 0000000..b8181d4 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Adapter/WrapperInterface.php @@ -0,0 +1,60 @@ + + */ +interface WrapperInterface +{ + /** + * Class constructor, must always wrap another adapter. + * + * @param AdapterInterface $adapter + */ + public function __construct(AdapterInterface $adapter); + + /** + * Sets the database adapter to proxy commands to. + * + * @param AdapterInterface $adapter + * @return AdapterInterface + */ + public function setAdapter(AdapterInterface $adapter); + + /** + * Gets the database adapter. + * + * @throws \RuntimeException if the adapter has not been set + * @return AdapterInterface + */ + public function getAdapter(); +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Table.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Table.php new file mode 100644 index 0000000..b0e7202 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Table.php @@ -0,0 +1,674 @@ +setName($name); + $this->setOptions($options); + + if (null !== $adapter) { + $this->setAdapter($adapter); + } + } + + /** + * Sets the table name. + * + * @param string $name Table Name + * @return Table + */ + public function setName($name) + { + $this->name = $name; + return $this; + } + + /** + * Gets the table name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Sets the table options. + * + * @param array $options + * @return Table + */ + public function setOptions($options) + { + $this->options = $options; + return $this; + } + + /** + * Gets the table options. + * + * @return array + */ + public function getOptions() + { + return $this->options; + } + + /** + * Sets the database adapter. + * + * @param AdapterInterface $adapter Database Adapter + * @return Table + */ + public function setAdapter(AdapterInterface $adapter) + { + $this->adapter = $adapter; + return $this; + } + + /** + * Gets the database adapter. + * + * @return AdapterInterface + */ + public function getAdapter() + { + return $this->adapter; + } + + /** + * Does the table exist? + * + * @return boolean + */ + public function exists() + { + return $this->getAdapter()->hasTable($this->getName()); + } + + /** + * Drops the database table. + * + * @return void + */ + public function drop() + { + $this->getAdapter()->dropTable($this->getName()); + } + + /** + * Renames the database table. + * + * @param string $newTableName New Table Name + * @return Table + */ + public function rename($newTableName) + { + $this->getAdapter()->renameTable($this->getName(), $newTableName); + $this->setName($newTableName); + return $this; + } + + /** + * Sets an array of columns waiting to be committed. + * Use setPendingColumns + * + * @deprecated + * @param array $columns Columns + * @return Table + */ + public function setColumns($columns) + { + $this->setPendingColumns($columns); + } + + /** + * Gets an array of the table columns. + * + * @return Column[] + */ + public function getColumns() + { + return $this->getAdapter()->getColumns($this->getName()); + } + + /** + * Sets an array of columns waiting to be committed. + * + * @param array $columns Columns + * @return Table + */ + public function setPendingColumns($columns) + { + $this->columns = $columns; + return $this; + } + + /** + * Gets an array of columns waiting to be committed. + * + * @return Column[] + */ + public function getPendingColumns() + { + return $this->columns; + } + + /** + * Sets an array of columns waiting to be indexed. + * + * @param array $indexes Indexes + * @return Table + */ + public function setIndexes($indexes) + { + $this->indexes = $indexes; + return $this; + } + + /** + * Gets an array of indexes waiting to be committed. + * + * @return array + */ + public function getIndexes() + { + return $this->indexes; + } + + /** + * Sets an array of foreign keys waiting to be commited. + * + * @param ForeignKey[] $foreignKeys foreign keys + * @return Table + */ + public function setForeignKeys($foreignKeys) + { + $this->foreignKeys = $foreignKeys; + return $this; + } + + /** + * Gets an array of foreign keys waiting to be commited. + * + * @return array|ForeignKey[] + */ + public function getForeignKeys() + { + return $this->foreignKeys; + } + + /** + * Sets an array of data to be inserted. + * + * @param array $data Data + * @return Table + */ + public function setData($data) + { + $this->data = $data; + return $this; + } + + /** + * Gets the data waiting to be inserted. + * + * @return array + */ + public function getData() + { + return $this->data; + } + + /** + * Resets all of the pending table changes. + * + * @return void + */ + public function reset() + { + $this->setPendingColumns(array()); + $this->setIndexes(array()); + $this->setForeignKeys(array()); + $this->setData(array()); + } + + /** + * Add a table column. + * + * Type can be: string, text, integer, float, decimal, datetime, timestamp, + * time, date, binary, boolean. + * + * Valid options can be: limit, default, null, precision or scale. + * + * @param string|Column $columnName Column Name + * @param string $type Column Type + * @param array $options Column Options + * @throws \RuntimeException + * @throws \InvalidArgumentException + * @return Table + */ + public function addColumn($columnName, $type = null, $options = array()) + { + // we need an adapter set to add a column + if (null === $this->getAdapter()) { + throw new \RuntimeException('An adapter must be specified to add a column.'); + } + + // create a new column object if only strings were supplied + if (!$columnName instanceof Column) { + $column = new Column(); + $column->setName($columnName); + $column->setType($type); + $column->setOptions($options); // map options to column methods + } else { + $column = $columnName; + } + + // Delegate to Adapters to check column type + if (!$this->getAdapter()->isValidColumnType($column)) { + throw new \InvalidArgumentException(sprintf( + 'An invalid column type "%s" was specified for column "%s".', + $column->getType(), + $column->getName() + )); + } + + $this->columns[] = $column; + return $this; + } + + /** + * Remove a table column. + * + * @param string $columnName Column Name + * @return Table + */ + public function removeColumn($columnName) + { + $this->getAdapter()->dropColumn($this->getName(), $columnName); + return $this; + } + + /** + * Rename a table column. + * + * @param string $oldName Old Column Name + * @param string $newName New Column Name + * @return Table + */ + public function renameColumn($oldName, $newName) + { + $this->getAdapter()->renameColumn($this->getName(), $oldName, $newName); + return $this; + } + + /** + * Change a table column type. + * + * @param string $columnName Column Name + * @param string|Column $newColumnType New Column Type + * @param array $options Options + * @return Table + */ + public function changeColumn($columnName, $newColumnType, $options = array()) + { + // create a column object if one wasn't supplied + if (!$newColumnType instanceof Column) { + $newColumn = new Column(); + $newColumn->setType($newColumnType); + $newColumn->setOptions($options); + } else { + $newColumn = $newColumnType; + } + + // if the name was omitted use the existing column name + if (null === $newColumn->getName() || strlen($newColumn->getName()) === 0) { + $newColumn->setName($columnName); + } + + $this->getAdapter()->changeColumn($this->getName(), $columnName, $newColumn); + return $this; + } + + /** + * Checks to see if a column exists. + * + * @param string $columnName Column Name + * @param array $options Options + * @return boolean + */ + public function hasColumn($columnName, $options = array()) + { + return $this->getAdapter()->hasColumn($this->getName(), $columnName, $options); + } + + /** + * Add an index to a database table. + * + * In $options you can specific unique = true/false or name (index name). + * + * @param string|array|Index $columns Table Column(s) + * @param array $options Index Options + * @return Table + */ + public function addIndex($columns, $options = array()) + { + // create a new index object if strings or an array of strings were supplied + if (!$columns instanceof Index) { + $index = new Index(); + if (is_string($columns)) { + $columns = array($columns); // str to array + } + $index->setColumns($columns); + $index->setOptions($options); + } else { + $index = $columns; + } + + $this->indexes[] = $index; + return $this; + } + + /** + * Removes the given index from a table. + * + * @param array $columns Columns + * @param array $options Options + * @return Table + */ + public function removeIndex($columns, $options = array()) + { + $this->getAdapter()->dropIndex($this->getName(), $columns, $options); + return $this; + } + + /** + * Removes the given index identified by its name from a table. + * + * @param string $name Index name + * @return Table + */ + public function removeIndexByName($name) + { + $this->getAdapter()->dropIndexByName($this->getName(), $name); + return $this; + } + + /** + * Checks to see if an index exists. + * + * @param string|array $columns Columns + * @param array $options Options + * @return boolean + */ + public function hasIndex($columns, $options = array()) + { + return $this->getAdapter()->hasIndex($this->getName(), $columns, $options); + } + + /** + * Add a foreign key to a database table. + * + * In $options you can specify on_delete|on_delete = cascade|no_action .., + * on_update, constraint = constraint name. + * + * @param string|array $columns Columns + * @param string|Table $referencedTable Referenced Table + * @param string|array $referencedColumns Referenced Columns + * @param array $options Options + * @return Table + */ + public function addForeignKey($columns, $referencedTable, $referencedColumns = array('id'), $options = array()) + { + if (is_string($referencedColumns)) { + $referencedColumns = array($referencedColumns); // str to array + } + $fk = new ForeignKey(); + if ($referencedTable instanceof Table) { + $fk->setReferencedTable($referencedTable); + } else { + $fk->setReferencedTable(new Table($referencedTable, array(), $this->adapter)); + } + $fk->setColumns($columns) + ->setReferencedColumns($referencedColumns) + ->setOptions($options); + $this->foreignKeys[] = $fk; + + return $this; + } + + /** + * Removes the given foreign key from the table. + * + * @param string|array $columns Column(s) + * @param null|string $constraint Constraint names + * @return Table + */ + public function dropForeignKey($columns, $constraint = null) + { + if (is_string($columns)) { + $columns = array($columns); + } + if ($constraint) { + $this->getAdapter()->dropForeignKey($this->getName(), array(), $constraint); + } else { + $this->getAdapter()->dropForeignKey($this->getName(), $columns); + } + + return $this; + } + + /** + * Checks to see if a foreign key exists. + * + * @param string|array $columns Column(s) + * @param null|string $constraint Constraint names + * @return boolean + */ + public function hasForeignKey($columns, $constraint = null) + { + return $this->getAdapter()->hasForeignKey($this->getName(), $columns, $constraint); + } + + /** + * Add timestamp columns created_at and updated_at to the table. + * + * @param string $createdAtColumnName + * @param string $updatedAtColumnName + * + * @return Table + */ + public function addTimestamps($createdAtColumnName = 'created_at', $updatedAtColumnName = 'updated_at') + { + $createdAtColumnName = is_null($createdAtColumnName) ? 'created_at' : $createdAtColumnName; + $updatedAtColumnName = is_null($updatedAtColumnName) ? 'updated_at' : $updatedAtColumnName; + $this->addColumn($createdAtColumnName, 'timestamp', array( + 'default' => 'CURRENT_TIMESTAMP', + 'update' => '' + )) + ->addColumn($updatedAtColumnName, 'timestamp', array( + 'null' => true, + 'default' => null + )); + + return $this; + } + + /** + * Insert data into the table. + * + * @param $data array of data in the form: + * array( + * array("col1" => "value1", "col2" => "anotherValue1"), + * array("col2" => "value2", "col2" => "anotherValue2"), + * ) + * or array("col1" => "value1", "col2" => "anotherValue1") + * + * @return Table + */ + public function insert($data) + { + // handle array of array situations + if (isset($data[0]) && is_array($data[0])) { + foreach ($data as $row) { + $this->data[] = $row; + } + return $this; + } + $this->data[] = $data; + return $this; + } + + /** + * Creates a table from the object instance. + * + * @return void + */ + public function create() + { + $this->getAdapter()->createTable($this); + $this->saveData(); + $this->reset(); // reset pending changes + } + + /** + * Updates a table from the object instance. + * + * @throws \RuntimeException + * @return void + */ + public function update() + { + if (!$this->exists()) { + throw new \RuntimeException('Cannot update a table that doesn\'t exist!'); + } + + // update table + foreach ($this->getPendingColumns() as $column) { + $this->getAdapter()->addColumn($this, $column); + } + + foreach ($this->getIndexes() as $index) { + $this->getAdapter()->addIndex($this, $index); + } + + foreach ($this->getForeignKeys() as $foreignKey) { + $this->getAdapter()->addForeignKey($this, $foreignKey); + } + + $this->saveData(); + $this->reset(); // reset pending changes + } + + /** + * Commit the pending data waiting for insertion. + * + * @return void + */ + public function saveData() + { + foreach ($this->getData() as $row) { + $this->getAdapter()->insert($this, $row); + } + } + + /** + * Commits the table changes. + * + * If the table doesn't exist it is created otherwise it is updated. + * + * @return void + */ + public function save() + { + if ($this->exists()) { + $this->update(); // update the table + } else { + $this->create(); // create the table + } + + $this->reset(); // reset pending changes + } +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Table/Column.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Table/Column.php new file mode 100644 index 0000000..874341e --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Table/Column.php @@ -0,0 +1,550 @@ +name = $name; + return $this; + } + + /** + * Gets the column name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Sets the column type. + * + * @param string $type + * @return $this + */ + public function setType($type) + { + $this->type = $type; + return $this; + } + + /** + * Gets the column type. + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Sets the column limit. + * + * @param integer $limit + * @return $this + */ + public function setLimit($limit) + { + $this->limit = $limit; + return $this; + } + + /** + * Gets the column limit. + * + * @return integer + */ + public function getLimit() + { + return $this->limit; + } + + /** + * Sets whether the column allows nulls. + * + * @param boolean $null + * @return $this + */ + public function setNull($null) + { + $this->null = (bool) $null; + return $this; + } + + /** + * Gets whether the column allows nulls. + * + * @return boolean + */ + public function getNull() + { + return $this->null; + } + + /** + * Does the column allow nulls? + * + * @return boolean + */ + public function isNull() + { + return $this->getNull(); + } + + /** + * Sets the default column value. + * + * @param mixed $default + * @return $this + */ + public function setDefault($default) + { + $this->default = $default; + return $this; + } + + /** + * Gets the default column value. + * + * @return mixed + */ + public function getDefault() + { + return $this->default; + } + + /** + * Sets whether or not the column is an identity column. + * + * @param boolean $identity + * @return $this + */ + public function setIdentity($identity) + { + $this->identity = $identity; + return $this; + } + + /** + * Gets whether or not the column is an identity column. + * + * @return boolean + */ + public function getIdentity() + { + return $this->identity; + } + + /** + * Is the column an identity column? + * + * @return boolean + */ + public function isIdentity() + { + return $this->getIdentity(); + } + + /** + * Sets the name of the column to add this column after. + * + * @param string $after After + * @return $this + */ + public function setAfter($after) + { + $this->after = $after; + return $this; + } + + /** + * Returns the name of the column to add this column after. + * + * @return string + */ + public function getAfter() + { + return $this->after; + } + + /** + * Sets the 'ON UPDATE' mysql column function. + * + * @param string $update On Update function + * @return $this + */ + public function setUpdate($update) + { + $this->update = $update; + return $this; + } + + /** + * Returns the value of the ON UPDATE column function. + * + * @return string + */ + public function getUpdate() + { + return $this->update; + } + + /** + * Sets the column precision for decimal. + * + * @param integer $precision + * @return $this + */ + public function setPrecision($precision) + { + $this->precision = $precision; + return $this; + } + + /** + * Gets the column precision for decimal. + * + * @return integer + */ + public function getPrecision() + { + return $this->precision; + } + + /** + * Sets the column scale for decimal. + * + * @param integer $scale + * @return $this + */ + public function setScale($scale) + { + $this->scale = $scale; + return $this; + } + + /** + * Gets the column scale for decimal. + * + * @return integer + */ + public function getScale() + { + return $this->scale; + } + + /** + * Sets the column comment. + * + * @param string $comment + * @return $this + */ + public function setComment($comment) + { + $this->comment = $comment; + return $this; + } + + /** + * Gets the column comment. + * + * @return string + */ + public function getComment() + { + return $this->comment; + } + + /** + * Sets whether field should be signed. + * + * @param bool $signed + * @return $this + */ + public function setSigned($signed) + { + $this->signed = (bool) $signed; + return $this; + } + + /** + * Gets whether field should be signed. + * + * @return string + */ + public function getSigned() + { + return $this->signed; + } + + /** + * Should the column be signed? + * + * @return boolean + */ + public function isSigned() + { + return $this->getSigned(); + } + + /** + * Sets whether the field should have a timezone identifier. + * Used for date/time columns only! + * + * @param bool $timezone + * @return $this + */ + public function setTimezone($timezone) + { + $this->timezone = (bool) $timezone; + return $this; + } + + /** + * Gets whether field has a timezone identifier. + * + * @return boolean + */ + public function getTimezone() + { + return $this->timezone; + } + + /** + * Should the column have a timezone? + * + * @return boolean + */ + public function isTimezone() + { + return $this->getTimezone(); + } + + /** + * Sets field properties. + * + * @param array $properties + * + * @return $this + */ + public function setProperties($properties) + { + $this->properties = $properties; + return $this; + } + + /** + * Gets field properties + * + * @return array + */ + public function getProperties() + { + return $this->properties; + } + + /** + * Sets field values. + * + * @param mixed (array|string) $values + * + * @return $this + */ + public function setValues($values) + { + if (!is_array($values)) { + $values = preg_split('/,\s*/', $values); + } + $this->values = $values; + return $this; + } + + /** + * Gets field values + * + * @return string + */ + public function getValues() + { + return $this->values; + } + + /** + * Gets all allowed options. Each option must have a corresponding `setFoo` method. + * + * @return array + */ + protected function getValidOptions() + { + return array( + 'limit', + 'default', + 'null', + 'identity', + 'precision', + 'scale', + 'after', + 'update', + 'comment', + 'signed', + 'timezone', + 'properties', + 'values', + ); + } + + /** + * Gets all aliased options. Each alias must reference a valid option. + * + * @return array + */ + protected function getAliasedOptions() + { + return array( + 'length' => 'limit', + ); + } + + /** + * Utility method that maps an array of column options to this objects methods. + * + * @param array $options Options + * @return $this + */ + public function setOptions($options) + { + $validOptions = $this->getValidOptions(); + $aliasOptions = $this->getAliasedOptions(); + + foreach ($options as $option => $value) { + if (isset($aliasOptions[$option])) { + // proxy alias -> option + $option = $aliasOptions[$option]; + } + + if (!in_array($option, $validOptions, true)) { + throw new \RuntimeException(sprintf('"%s" is not a valid column option.', $option)); + } + + $method = 'set' . ucfirst($option); + $this->$method($value); + } + return $this; + } +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Table/ForeignKey.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Table/ForeignKey.php new file mode 100644 index 0000000..3033503 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Table/ForeignKey.php @@ -0,0 +1,252 @@ + + */ +namespace Phinx\Db\Table; + +use Phinx\Db\Table; + +class ForeignKey +{ + const CASCADE = 'CASCADE'; + const RESTRICT = 'RESTRICT'; + const SET_NULL = 'SET NULL'; + const NO_ACTION = 'NO ACTION'; + + /** + * @var array + */ + protected $columns = array(); + + /** + * @var Table + */ + protected $referencedTable; + + /** + * @var array + */ + protected $referencedColumns = array(); + + /** + * @var string + */ + protected $onDelete; + + /** + * @var string + */ + protected $onUpdate; + + /** + * @var string|boolean + */ + protected $constraint; + + /** + * Sets the foreign key columns. + * + * @param array|string $columns + * @return ForeignKey + */ + public function setColumns($columns) + { + if (is_string($columns)) { + $columns = array($columns); + } + $this->columns = $columns; + return $this; + } + + /** + * Gets the foreign key columns. + * + * @return array + */ + public function getColumns() + { + return $this->columns; + } + + /** + * Sets the foreign key referenced table. + * + * @param Table $table + * @return ForeignKey + */ + public function setReferencedTable(Table $table) + { + $this->referencedTable = $table; + return $this; + } + + /** + * Gets the foreign key referenced table. + * + * @return Table + */ + public function getReferencedTable() + { + return $this->referencedTable; + } + + /** + * Sets the foreign key referenced columns. + * + * @param array $referencedColumns + * @return ForeignKey + */ + public function setReferencedColumns(array $referencedColumns) + { + $this->referencedColumns = $referencedColumns; + return $this; + } + + /** + * Gets the foreign key referenced columns. + * + * @return array + */ + public function getReferencedColumns() + { + return $this->referencedColumns; + } + + /** + * Sets ON DELETE action for the foreign key. + * + * @param string $onDelete + * @return ForeignKey + */ + public function setOnDelete($onDelete) + { + $this->onDelete = $this->normalizeAction($onDelete); + return $this; + } + + /** + * Gets ON DELETE action for the foreign key. + * + * @return string + */ + public function getOnDelete() + { + return $this->onDelete; + } + + /** + * Gets ON UPDATE action for the foreign key. + * + * @return string + */ + public function getOnUpdate() + { + return $this->onUpdate; + } + + /** + * Sets ON UPDATE action for the foreign key. + * + * @param string $onUpdate + * @return ForeignKey + */ + public function setOnUpdate($onUpdate) + { + $this->onUpdate = $this->normalizeAction($onUpdate); + return $this; + } + + /** + * Sets constraint for the foreign key. + * + * @param string $constraint + * @return ForeignKey + */ + public function setConstraint($constraint) + { + $this->constraint = $constraint; + return $this; + } + + /** + * Gets constraint name for the foreign key. + * + * @return string + */ + public function getConstraint() + { + return $this->constraint; + } + + /** + * Utility method that maps an array of index options to this objects methods. + * + * @param array $options Options + * @throws \RuntimeException + * @throws \InvalidArgumentException + * @return ForeignKey + */ + public function setOptions($options) + { + // Valid Options + $validOptions = array('delete', 'update', 'constraint'); + foreach ($options as $option => $value) { + if (!in_array($option, $validOptions, true)) { + throw new \RuntimeException(sprintf('"%s" is not a valid foreign key option.', $option)); + } + + // handle $options['delete'] as $options['update'] + if ('delete' === $option) { + $this->setOnDelete($value); + } elseif ('update' === $option) { + $this->setOnUpdate($value); + } else { + $method = 'set' . ucfirst($option); + $this->$method($value); + } + } + + return $this; + } + + /** + * From passed value checks if it's correct and fixes if needed + * + * @param string $action + * @throws \InvalidArgumentException + * @return string + */ + protected function normalizeAction($action) + { + $constantName = 'static::' . str_replace(' ', '_', strtoupper(trim($action))); + if (!defined($constantName)) { + throw new \InvalidArgumentException('Unknown action passed: ' . $action); + } + return constant($constantName); + } +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Table/Index.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Table/Index.php new file mode 100644 index 0000000..82404cb --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Db/Table/Index.php @@ -0,0 +1,185 @@ +columns = $columns; + return $this; + } + + /** + * Gets the index columns. + * + * @return array + */ + public function getColumns() + { + return $this->columns; + } + + /** + * Sets the index type. + * + * @param string $type + * @return Index + */ + public function setType($type) + { + $this->type = $type; + return $this; + } + + /** + * Gets the index type. + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Sets the index name. + * + * @param string $name + * @return Index + */ + public function setName($name) + { + $this->name = $name; + return $this; + } + + /** + * Gets the index name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Sets the index limit. + * + * @param integer $limit + * @return Index + */ + public function setLimit($limit) + { + $this->limit = $limit; + return $this; + } + + /** + * Gets the index limit. + * + * @return integer + */ + public function getLimit() + { + return $this->limit; + } + + /** + * Utility method that maps an array of index options to this objects methods. + * + * @param array $options Options + * @throws \RuntimeException + * @return Index + */ + public function setOptions($options) + { + // Valid Options + $validOptions = array('type', 'unique', 'name', 'limit'); + foreach ($options as $option => $value) { + if (!in_array($option, $validOptions, true)) { + throw new \RuntimeException(sprintf('"%s" is not a valid index option.', $option)); + } + + // handle $options['unique'] + if (strcasecmp($option, self::UNIQUE) === 0) { + if ((bool) $value) { + $this->setType(self::UNIQUE); + } + continue; + } + + $method = 'set' . ucfirst($option); + $this->$method($value); + } + return $this; + } +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Migration/AbstractMigration.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Migration/AbstractMigration.php new file mode 100644 index 0000000..1598cfb --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Migration/AbstractMigration.php @@ -0,0 +1,273 @@ + + */ +abstract class AbstractMigration implements MigrationInterface +{ + /** + * @var float + */ + protected $version; + + /** + * @var AdapterInterface + */ + protected $adapter; + + /** + * @var OutputInterface + */ + protected $output; + + /** + * @var InputInterface + */ + protected $input; + + /** + * Class Constructor. + * + * @param int $version Migration Version + * @param InputInterface|null $input + * @param OutputInterface|null $output + */ + final public function __construct($version, InputInterface $input = null, OutputInterface $output = null) + { + $this->version = $version; + if (!is_null($input)){ + $this->setInput($input); + } + if (!is_null($output)){ + $this->setOutput($output); + } + + $this->init(); + } + + /** + * Initialize method. + * + * @return void + */ + protected function init() + { + } + + /** + * {@inheritdoc} + */ + public function up() + { + } + + /** + * {@inheritdoc} + */ + public function down() + { + } + + /** + * {@inheritdoc} + */ + public function setAdapter(AdapterInterface $adapter) + { + $this->adapter = $adapter; + return $this; + } + + /** + * {@inheritdoc} + */ + public function getAdapter() + { + return $this->adapter; + } + + /** + * {@inheritdoc} + */ + public function setInput(InputInterface $input) + { + $this->input = $input; + return $this; + } + + /** + * {@inheritdoc} + */ + public function getInput() + { + return $this->input; + } + + /** + * {@inheritdoc} + */ + public function setOutput(OutputInterface $output) + { + $this->output = $output; + return $this; + } + + /** + * {@inheritdoc} + */ + public function getOutput() + { + return $this->output; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return get_class($this); + } + + /** + * {@inheritdoc} + */ + public function setVersion($version) + { + $this->version = $version; + return $this; + } + + /** + * {@inheritdoc} + */ + public function getVersion() + { + return $this->version; + } + + /** + * {@inheritdoc} + */ + public function execute($sql) + { + return $this->getAdapter()->execute($sql); + } + + /** + * {@inheritdoc} + */ + public function query($sql) + { + return $this->getAdapter()->query($sql); + } + + /** + * {@inheritdoc} + */ + public function fetchRow($sql) + { + return $this->getAdapter()->fetchRow($sql); + } + + /** + * {@inheritdoc} + */ + public function fetchAll($sql) + { + return $this->getAdapter()->fetchAll($sql); + } + + /** + * {@inheritdoc} + */ + public function insert($table, $data) + { + // convert to table object + if (is_string($table)) { + $table = new Table($table, array(), $this->getAdapter()); + } + return $table->insert($data)->save(); + } + + /** + * {@inheritdoc} + */ + public function createDatabase($name, $options) + { + $this->getAdapter()->createDatabase($name, $options); + } + + /** + * {@inheritdoc} + */ + public function dropDatabase($name) + { + $this->getAdapter()->dropDatabase($name); + } + + /** + * {@inheritdoc} + */ + public function hasTable($tableName) + { + return $this->getAdapter()->hasTable($tableName); + } + + /** + * {@inheritdoc} + */ + public function table($tableName, $options = array()) + { + return new Table($tableName, $options, $this->getAdapter()); + } + + /** + * A short-hand method to drop the given database table. + * + * @param string $tableName Table Name + * @return void + */ + public function dropTable($tableName) + { + $this->table($tableName)->drop(); + } +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Migration/AbstractTemplateCreation.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Migration/AbstractTemplateCreation.php new file mode 100644 index 0000000..589a5f7 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Migration/AbstractTemplateCreation.php @@ -0,0 +1,97 @@ +setInput($input); + } + if (!is_null($output)) { + $this->setOutput($output); + } + } + + /** + * {@inheritdoc} + */ + public function getInput() + { + return $this->input; + } + + /** + * {@inheritdoc} + */ + public function setInput(InputInterface $input) + { + $this->input = $input; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getOutput() + { + return $this->output; + } + + /** + * {@inheritdoc} + */ + public function setOutput(OutputInterface $output) + { + $this->output = $output; + + return $this; + } +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Migration/CreationInterface.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Migration/CreationInterface.php new file mode 100644 index 0000000..b60c889 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Migration/CreationInterface.php @@ -0,0 +1,94 @@ + + */ +interface CreationInterface +{ + /** + * CreationInterface constructor. + * + * @param InputInterface|null $input + * @param OutputInterface|null $output + */ + public function __construct(InputInterface $input = null, OutputInterface $output = null); + + /** + * @param InputInterface $input + * + * @return CreationInterface + */ + public function setInput(InputInterface $input); + + /** + * @param OutputInterface $output + * + * @return CreationInterface + */ + public function setOutput(OutputInterface $output); + + /** + * @return InputInterface + */ + public function getInput(); + + /** + * @return OutputInterface + */ + public function getOutput(); + + /** + * Get the migration template. + * + * This will be the content that Phinx will amend to generate the migration file. + * + * @return string The content of the template for Phinx to amend. + */ + public function getMigrationTemplate(); + + /** + * Post Migration Creation. + * + * Once the migration file has been created, this method will be called, allowing any additional + * processing, specific to the template to be performed. + * + * @param string $migrationFilename The name of the newly created migration. + * @param string $className The class name. + * @param string $baseClassName The name of the base class. + * @return void + */ + public function postMigrationCreation($migrationFilename, $className, $baseClassName); +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Migration/IrreversibleMigrationException.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Migration/IrreversibleMigrationException.php new file mode 100644 index 0000000..9c2a8d2 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Migration/IrreversibleMigrationException.php @@ -0,0 +1,39 @@ + + */ +class IrreversibleMigrationException extends \Exception +{ +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Migration/Migration.template.php.dist b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Migration/Migration.template.php.dist new file mode 100644 index 0000000..9f4d677 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Migration/Migration.template.php.dist @@ -0,0 +1,48 @@ + + */ +interface MigrationInterface +{ + /** + * @var string + */ + const CHANGE = 'change'; + + /** + * @var string + */ + const UP = 'up'; + + /** + * @var string + */ + const DOWN = 'down'; + + /** + * Migrate Up + * + * @return void + */ + public function up(); + + /** + * Migrate Down + * + * @return void + */ + public function down(); + + /** + * Sets the database adapter. + * + * @param AdapterInterface $adapter Database Adapter + * @return MigrationInterface + */ + public function setAdapter(AdapterInterface $adapter); + + /** + * Gets the database adapter. + * + * @return AdapterInterface + */ + public function getAdapter(); + + /** + * Sets the input object to be used in migration object + * + * @param InputInterface $input + * @return MigrationInterface + */ + public function setInput(InputInterface $input); + + /** + * Gets the input object to be used in migration object + * + * @return InputInterface + */ + public function getInput(); + + /** + * Sets the output object to be used in migration object + * + * @param OutputInterface $output + * @return MigrationInterface + */ + public function setOutput(OutputInterface $output); + + /** + * Gets the output object to be used in migration object + * + * @return OutputInterface + */ + public function getOutput(); + + /** + * Gets the name. + * + * @return string + */ + public function getName(); + + /** + * Sets the migration version number. + * + * @param float $version Version + * @return MigrationInterface + */ + public function setVersion($version); + + /** + * Gets the migration version number. + * + * @return float + */ + public function getVersion(); + + /** + * Executes a SQL statement and returns the number of affected rows. + * + * @param string $sql SQL + * @return int + */ + public function execute($sql); + + /** + * Executes a SQL statement and returns the result as an array. + * + * @param string $sql SQL + * @return array + */ + public function query($sql); + + /** + * Executes a query and returns only one row as an array. + * + * @param string $sql SQL + * @return array + */ + public function fetchRow($sql); + + /** + * Executes a query and returns an array of rows. + * + * @param string $sql SQL + * @return array + */ + public function fetchAll($sql); + + /** + * Insert data into a table. + * + * @param string $tableName + * @param array $data + * @return void + */ + public function insert($tableName, $data); + + /** + * Create a new database. + * + * @param string $name Database Name + * @param array $options Options + * @return void + */ + public function createDatabase($name, $options); + + /** + * Drop a database. + * + * @param string $name Database Name + * @return void + */ + public function dropDatabase($name); + + /** + * Checks to see if a table exists. + * + * @param string $tableName Table Name + * @return boolean + */ + public function hasTable($tableName); + + /** + * Returns an instance of the \Table class. + * + * You can use this class to create and manipulate tables. + * + * @param string $tableName Table Name + * @param array $options Options + * @return Table + */ + public function table($tableName, $options); +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Seed/AbstractSeed.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Seed/AbstractSeed.php new file mode 100644 index 0000000..4d631f5 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Seed/AbstractSeed.php @@ -0,0 +1,215 @@ + + */ +abstract class AbstractSeed implements SeedInterface +{ + /** + * @var AdapterInterface + */ + protected $adapter; + + /** + * @var InputInterface + */ + protected $input; + + /** + * @var OutputInterface + */ + protected $output; + + /** + * Class Constructor. + * + * @param InputInterface $input + * @param OutputInterface $output + */ + final public function __construct(InputInterface $input = null, OutputInterface $output = null) + { + if (!is_null($input)){ + $this->setInput($input); + } + if (!is_null($output)){ + $this->setOutput($output); + } + + $this->init(); + } + + /** + * Initialize method. + * + * @return void + */ + protected function init() + { + } + + /** + * {@inheritdoc} + */ + public function run() + { + } + + /** + * {@inheritdoc} + */ + public function setAdapter(AdapterInterface $adapter) + { + $this->adapter = $adapter; + return $this; + } + + /** + * {@inheritdoc} + */ + public function getAdapter() + { + return $this->adapter; + } + + /** + * {@inheritdoc} + */ + public function setInput(InputInterface $input) + { + $this->input = $input; + return $this; + } + + /** + * {@inheritdoc} + */ + public function getInput() + { + return $this->input; + } + + /** + * {@inheritdoc} + */ + public function setOutput(OutputInterface $output) + { + $this->output = $output; + return $this; + } + + /** + * {@inheritdoc} + */ + public function getOutput() + { + return $this->output; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return get_class($this); + } + + /** + * {@inheritdoc} + */ + public function execute($sql) + { + return $this->getAdapter()->execute($sql); + } + + /** + * {@inheritdoc} + */ + public function query($sql) + { + return $this->getAdapter()->query($sql); + } + + /** + * {@inheritdoc} + */ + public function fetchRow($sql) + { + return $this->getAdapter()->fetchRow($sql); + } + + /** + * {@inheritdoc} + */ + public function fetchAll($sql) + { + return $this->getAdapter()->fetchAll($sql); + } + + /** + * {@inheritdoc} + */ + public function insert($table, $data) + { + // convert to table object + if (is_string($table)) { + $table = new Table($table, array(), $this->getAdapter()); + } + return $table->insert($data)->save(); + } + + /** + * {@inheritdoc} + */ + public function hasTable($tableName) + { + return $this->getAdapter()->hasTable($tableName); + } + + /** + * {@inheritdoc} + */ + public function table($tableName, $options = array()) + { + return new Table($tableName, $options, $this->getAdapter()); + } +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Seed/Seed.template.php.dist b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Seed/Seed.template.php.dist new file mode 100644 index 0000000..698ae26 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Seed/Seed.template.php.dist @@ -0,0 +1,19 @@ + + */ +interface SeedInterface +{ + /** + * @var string + */ + const RUN = 'run'; + + /** + * Run the seeder. + * + * @return void + */ + public function run(); + + /** + * Sets the database adapter. + * + * @param AdapterInterface $adapter Database Adapter + * @return MigrationInterface + */ + public function setAdapter(AdapterInterface $adapter); + + /** + * Gets the database adapter. + * + * @return AdapterInterface + */ + public function getAdapter(); + + /** + * Sets the input object to be used in migration object + * + * @param InputInterface $input + * @return MigrationInterface + */ + public function setInput(InputInterface $input); + + /** + * Gets the input object to be used in migration object + * + * @return InputInterface + */ + public function getInput(); + + /** + * Sets the output object to be used in migration object + * + * @param OutputInterface $output + * @return MigrationInterface + */ + public function setOutput(OutputInterface $output); + + /** + * Gets the output object to be used in migration object + * + * @return OutputInterface + */ + public function getOutput(); + + /** + * Gets the name. + * + * @return string + */ + public function getName(); + + /** + * Executes a SQL statement and returns the number of affected rows. + * + * @param string $sql SQL + * @return int + */ + public function execute($sql); + + /** + * Executes a SQL statement and returns the result as an array. + * + * @param string $sql SQL + * @return array + */ + public function query($sql); + + /** + * Executes a query and returns only one row as an array. + * + * @param string $sql SQL + * @return array + */ + public function fetchRow($sql); + + /** + * Executes a query and returns an array of rows. + * + * @param string $sql SQL + * @return array + */ + public function fetchAll($sql); + + /** + * Insert data into a table. + * + * @param string $tableName + * @param array $data + * @return void + */ + public function insert($tableName, $data); + + /** + * Checks to see if a table exists. + * + * @param string $tableName Table Name + * @return boolean + */ + public function hasTable($tableName); + + /** + * Returns an instance of the \Table class. + * + * You can use this class to create and manipulate tables. + * + * @param string $tableName Table Name + * @param array $options Options + * @return Table + */ + public function table($tableName, $options); +} diff --git a/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Util/Util.php b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Util/Util.php new file mode 100644 index 0000000..f76d4ab --- /dev/null +++ b/tp5/vendor/topthink/think-migration/phinx/src/Phinx/Util/Util.php @@ -0,0 +1,190 @@ +format(static::DATE_FORMAT); + } + + /** + * Gets an array of all the existing migration class names. + * + * @return string + */ + public static function getExistingMigrationClassNames($path) + { + $classNames = array(); + + if (!is_dir($path)) { + return $classNames; + } + + // filter the files to only get the ones that match our naming scheme + $phpFiles = glob($path . DIRECTORY_SEPARATOR . '*.php'); + + foreach ($phpFiles as $filePath) { + if (preg_match('/([0-9]+)_([_a-z0-9]*).php/', basename($filePath))) { + $classNames[] = static::mapFileNameToClassName(basename($filePath)); + } + } + + return $classNames; + } + + /** + * Get the version from the beginning of a file name. + * + * @param string $fileName File Name + * @return string + */ + public static function getVersionFromFileName($fileName) + { + $matches = array(); + preg_match('/^[0-9]+/', basename($fileName), $matches); + return $matches[0]; + } + + /** + * Turn migration names like 'CreateUserTable' into file names like + * '12345678901234_create_user_table.php' or 'LimitResourceNamesTo30Chars' into + * '12345678901234_limit_resource_names_to_30_chars.php'. + * + * @param string $className Class Name + * @return string + */ + public static function mapClassNameToFileName($className) + { + $arr = preg_split('/(?=[A-Z])/', $className); + unset($arr[0]); // remove the first element ('') + $fileName = static::getCurrentTimestamp() . '_' . strtolower(implode($arr, '_')) . '.php'; + return $fileName; + } + + /** + * Turn file names like '12345678901234_create_user_table.php' into class + * names like 'CreateUserTable'. + * + * @param string $fileName File Name + * @return string + */ + public static function mapFileNameToClassName($fileName) + { + $matches = array(); + if (preg_match(static::MIGRATION_FILE_NAME_PATTERN, $fileName, $matches)) { + $fileName = $matches[1]; + } + + return str_replace(' ', '', ucwords(str_replace('_', ' ', $fileName))); + } + + /** + * Check if a migration class name is unique regardless of the + * timestamp. + * + * This method takes a class name and a path to a migrations directory. + * + * Migration class names must be in CamelCase format. + * e.g: CreateUserTable or AddIndexToPostsTable. + * + * Single words are not allowed on their own. + * + * @param string $className Class Name + * @param string $path Path + * @return boolean + */ + public static function isUniqueMigrationClassName($className, $path) + { + $existingClassNames = static::getExistingMigrationClassNames($path); + return !(in_array($className, $existingClassNames)); + } + + /** + * Check if a migration/seed class name is valid. + * + * Migration & Seed class names must be in CamelCase format. + * e.g: CreateUserTable, AddIndexToPostsTable or UserSeeder. + * + * Single words are not allowed on their own. + * + * @param string $className Class Name + * @return boolean + */ + public static function isValidPhinxClassName($className) + { + return (bool) preg_match('/^([A-Z][a-z0-9]+)+$/', $className); + } + + /** + * Check if a migration file name is valid. + * + * @param string $fileName File Name + * @return boolean + */ + public static function isValidMigrationFileName($fileName) + { + $matches = array(); + return preg_match(static::MIGRATION_FILE_NAME_PATTERN, $fileName, $matches); + } + + /** + * Check if a seed file name is valid. + * + * @param string $fileName File Name + * @return boolean + */ + public static function isValidSeedFileName($fileName) + { + $matches = array(); + return preg_match(static::SEED_FILE_NAME_PATTERN, $fileName, $matches); + } +} diff --git a/tp5/vendor/topthink/think-migration/src/Command.php b/tp5/vendor/topthink/think-migration/src/Command.php new file mode 100644 index 0000000..862f335 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/src/Command.php @@ -0,0 +1,101 @@ + +// +---------------------------------------------------------------------- +namespace think\migration; + +use InvalidArgumentException; +use Phinx\Db\Adapter\AdapterFactory; +use think\Db; +use think\facade\Config; + +abstract class Command extends \think\console\Command +{ + + public function getAdapter() + { + if (isset($this->adapter)) { + return $this->adapter; + } + + $options = $this->getDbConfig(); + + $adapter = AdapterFactory::instance()->getAdapter($options['adapter'], $options); + + if ($adapter->hasOption('table_prefix') || $adapter->hasOption('table_suffix')) { + $adapter = AdapterFactory::instance()->getWrapper('prefix', $adapter); + } + + $this->adapter = $adapter; + + return $adapter; + } + + /** + * 获取数据库配置 + * @return array + */ + protected function getDbConfig() + { + $config = Db::connect()->getConfig(); + if ('sqlite' == $config['type']) { + $dbConfig = [ + 'adapter' => $config['type'], + 'name' => str_ireplace('sqlite:', '', $config['dsn']), + 'charset' => $config['charset'], + 'table_prefix' => $config['prefix'], + ]; + + } else { + if (0 == $config['deploy']) { + $dbConfig = [ + 'adapter' => $config['type'], + 'host' => $config['hostname'], + 'name' => $config['database'], + 'user' => $config['username'], + 'pass' => $config['password'], + 'port' => $config['hostport'], + 'charset' => $config['charset'], + 'table_prefix' => $config['prefix'], + ]; + } else { + $dbConfig = [ + 'adapter' => explode(',', $config['type'])[0], + 'host' => explode(',', $config['hostname'])[0], + 'name' => explode(',', $config['database'])[0], + 'user' => explode(',', $config['username'])[0], + 'pass' => explode(',', $config['password'])[0], + 'port' => explode(',', $config['hostport'])[0], + 'charset' => explode(',', $config['charset'])[0], + 'table_prefix' => explode(',', $config['prefix'])[0], + ]; + } + } + + $dbConfig['default_migration_table'] = $this->getConfig('table', $dbConfig['table_prefix'] . 'migrations'); + return $dbConfig; + } + + protected function getConfig($name, $default = null) + { + $config = Config::pull('migration'); + return isset($config[$name]) ? $config[$name] : $default; + } + + protected function verifyMigrationDirectory($path) + { + if (!is_dir($path)) { + throw new InvalidArgumentException(sprintf('Migration directory "%s" does not exist', $path)); + } + + if (!is_writable($path)) { + throw new InvalidArgumentException(sprintf('Migration directory "%s" is not writable', $path)); + } + } +} diff --git a/tp5/vendor/topthink/think-migration/src/Migrator.php b/tp5/vendor/topthink/think-migration/src/Migrator.php new file mode 100644 index 0000000..1965953 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/src/Migrator.php @@ -0,0 +1,27 @@ + +// +---------------------------------------------------------------------- +namespace think\migration; + +use Phinx\Migration\AbstractMigration; +use think\migration\db\Table; + +class Migrator extends AbstractMigration +{ + /** + * @param string $tableName + * @param array $options + * @return Table + */ + public function table($tableName, $options = []) + { + return new Table($tableName, $options, $this->getAdapter()); + } +} diff --git a/tp5/vendor/topthink/think-migration/src/Seeder.php b/tp5/vendor/topthink/think-migration/src/Seeder.php new file mode 100644 index 0000000..a1c46db --- /dev/null +++ b/tp5/vendor/topthink/think-migration/src/Seeder.php @@ -0,0 +1,18 @@ + +// +---------------------------------------------------------------------- +namespace think\migration; + +use Phinx\Seed\AbstractSeed; + +class Seeder extends AbstractSeed +{ + +} diff --git a/tp5/vendor/topthink/think-migration/src/command/Migrate.php b/tp5/vendor/topthink/think-migration/src/command/Migrate.php new file mode 100644 index 0000000..0659b8e --- /dev/null +++ b/tp5/vendor/topthink/think-migration/src/command/Migrate.php @@ -0,0 +1,149 @@ + +// +---------------------------------------------------------------------- + +namespace think\migration\command; + +use Phinx\Db\Adapter\AdapterFactory; +use Phinx\Db\Adapter\ProxyAdapter; +use Phinx\Migration\AbstractMigration; +use Phinx\Migration\MigrationInterface; +use Phinx\Util\Util; +use think\console\Input; +use think\console\Output; +use think\facade\Env; +use think\migration\Command; +use think\migration\Migrator; + +abstract class Migrate extends Command +{ + /** + * @var array + */ + protected $migrations; + + protected function getPath() + { + return Env::get('root_path') . 'database' . DIRECTORY_SEPARATOR . 'migrations'; + } + + protected function executeMigration(MigrationInterface $migration, $direction = MigrationInterface::UP) + { + $this->output->writeln(''); + $this->output->writeln(' ==' . ' ' . $migration->getVersion() . ' ' . $migration->getName() . ':' . ' ' . (MigrationInterface::UP === $direction ? 'migrating' : 'reverting') . ''); + + // Execute the migration and log the time elapsed. + $start = microtime(true); + + $startTime = time(); + $direction = (MigrationInterface::UP === $direction) ? MigrationInterface::UP : MigrationInterface::DOWN; + $migration->setAdapter($this->getAdapter()); + + // begin the transaction if the adapter supports it + if ($this->getAdapter()->hasTransactions()) { + $this->getAdapter()->beginTransaction(); + } + + // Run the migration + if (method_exists($migration, MigrationInterface::CHANGE)) { + if (MigrationInterface::DOWN === $direction) { + // Create an instance of the ProxyAdapter so we can record all + // of the migration commands for reverse playback + /** @var ProxyAdapter $proxyAdapter */ + $proxyAdapter = AdapterFactory::instance()->getWrapper('proxy', $this->getAdapter()); + $migration->setAdapter($proxyAdapter); + /** @noinspection PhpUndefinedMethodInspection */ + $migration->change(); + $proxyAdapter->executeInvertedCommands(); + $migration->setAdapter($this->getAdapter()); + } else { + /** @noinspection PhpUndefinedMethodInspection */ + $migration->change(); + } + } else { + $migration->{$direction}(); + } + + // commit the transaction if the adapter supports it + if ($this->getAdapter()->hasTransactions()) { + $this->getAdapter()->commitTransaction(); + } + + // Record it in the database + $this->getAdapter() + ->migrated($migration, $direction, date('Y-m-d H:i:s', $startTime), date('Y-m-d H:i:s', time())); + + $end = microtime(true); + + $this->output->writeln(' ==' . ' ' . $migration->getVersion() . ' ' . $migration->getName() . ':' . ' ' . (MigrationInterface::UP === $direction ? 'migrated' : 'reverted') . ' ' . sprintf('%.4fs', $end - $start) . ''); + } + + protected function getVersionLog() + { + return $this->getAdapter()->getVersionLog(); + } + + protected function getVersions() + { + return $this->getAdapter()->getVersions(); + } + + protected function getMigrations() + { + if (null === $this->migrations) { + $phpFiles = glob($this->getPath() . DIRECTORY_SEPARATOR . '*.php', defined('GLOB_BRACE') ? GLOB_BRACE : 0); + + // filter the files to only get the ones that match our naming scheme + $fileNames = []; + /** @var Migrator[] $versions */ + $versions = []; + + foreach ($phpFiles as $filePath) { + if (Util::isValidMigrationFileName(basename($filePath))) { + $version = Util::getVersionFromFileName(basename($filePath)); + + if (isset($versions[$version])) { + throw new \InvalidArgumentException(sprintf('Duplicate migration - "%s" has the same version as "%s"', $filePath, $versions[$version]->getVersion())); + } + + // convert the filename to a class name + $class = Util::mapFileNameToClassName(basename($filePath)); + + if (isset($fileNames[$class])) { + throw new \InvalidArgumentException(sprintf('Migration "%s" has the same name as "%s"', basename($filePath), $fileNames[$class])); + } + + $fileNames[$class] = basename($filePath); + + // load the migration file + /** @noinspection PhpIncludeInspection */ + require_once $filePath; + if (!class_exists($class)) { + throw new \InvalidArgumentException(sprintf('Could not find class "%s" in file "%s"', $class, $filePath)); + } + + // instantiate it + $migration = new $class($version, $this->input, $this->output); + + if (!($migration instanceof AbstractMigration)) { + throw new \InvalidArgumentException(sprintf('The class "%s" in file "%s" must extend \Phinx\Migration\AbstractMigration', $class, $filePath)); + } + + $versions[$version] = $migration; + } + } + + ksort($versions); + $this->migrations = $versions; + } + + return $this->migrations; + } +} diff --git a/tp5/vendor/topthink/think-migration/src/command/Seed.php b/tp5/vendor/topthink/think-migration/src/command/Seed.php new file mode 100644 index 0000000..8639dda --- /dev/null +++ b/tp5/vendor/topthink/think-migration/src/command/Seed.php @@ -0,0 +1,73 @@ + +// +---------------------------------------------------------------------- + +namespace think\migration\command; + +use Phinx\Seed\AbstractSeed; +use Phinx\Util\Util; +use think\facade\Env; +use think\migration\Command; +use think\migration\Seeder; + +abstract class Seed extends Command +{ + + /** + * @var array + */ + protected $seeds; + + protected function getPath() + { + return Env::get('root_path') . 'database' . DIRECTORY_SEPARATOR . 'seeds'; + } + + public function getSeeds() + { + if (null === $this->seeds) { + $phpFiles = glob($this->getPath() . DIRECTORY_SEPARATOR . '*.php', defined('GLOB_BRACE') ? GLOB_BRACE : 0); + + // filter the files to only get the ones that match our naming scheme + $fileNames = []; + /** @var Seeder[] $seeds */ + $seeds = []; + + foreach ($phpFiles as $filePath) { + if (Util::isValidSeedFileName(basename($filePath))) { + // convert the filename to a class name + $class = pathinfo($filePath, PATHINFO_FILENAME); + $fileNames[$class] = basename($filePath); + + // load the seed file + /** @noinspection PhpIncludeInspection */ + require_once $filePath; + if (!class_exists($class)) { + throw new \InvalidArgumentException(sprintf('Could not find class "%s" in file "%s"', $class, $filePath)); + } + + // instantiate it + $seed = new $class($this->input, $this->output); + + if (!($seed instanceof AbstractSeed)) { + throw new \InvalidArgumentException(sprintf('The class "%s" in file "%s" must extend \Phinx\Seed\AbstractSeed', $class, $filePath)); + } + + $seeds[$class] = $seed; + } + } + + ksort($seeds); + $this->seeds = $seeds; + } + + return $this->seeds; + } +} diff --git a/tp5/vendor/topthink/think-migration/src/command/migrate/Breakpoint.php b/tp5/vendor/topthink/think-migration/src/command/migrate/Breakpoint.php new file mode 100644 index 0000000..0010080 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/src/command/migrate/Breakpoint.php @@ -0,0 +1,92 @@ + +// +---------------------------------------------------------------------- + +namespace think\migration\command\migrate; + +use think\console\Input; +use think\console\input\Option as InputOption; +use think\console\Output; +use think\migration\command\Migrate; + +class Breakpoint extends Migrate +{ + protected function configure() + { + $this->setName('migrate:breakpoint') + ->setDescription('Manage breakpoints') + ->addOption('--target', '-t', InputOption::VALUE_REQUIRED, 'The version number to set or clear a breakpoint against') + ->addOption('--remove-all', '-r', InputOption::VALUE_NONE, 'Remove all breakpoints') + ->setHelp(<<breakpoint command allows you to set or clear a breakpoint against a specific target to inhibit rollbacks beyond a certain target. +If no target is supplied then the most recent migration will be used. +You cannot specify un-migrated targets + +phinx breakpoint +phinx breakpoint -t 20110103081132 +phinx breakpoint -r +EOT + ); + } + + protected function execute(Input $input, Output $output) + { + $version = $input->getOption('target'); + $removeAll = $input->getOption('remove-all'); + + if ($version && $removeAll) { + throw new \InvalidArgumentException('Cannot toggle a breakpoint and remove all breakpoints at the same time.'); + } + + // Remove all breakpoints + if ($removeAll) { + $this->removeBreakpoints(); + } else { + // Toggle the breakpoint. + $this->toggleBreakpoint($version); + } + } + + protected function toggleBreakpoint($version) + { + $migrations = $this->getMigrations(); + $versions = $this->getVersionLog(); + + if (empty($versions) || empty($migrations)) { + return; + } + + if (null === $version) { + $lastVersion = end($versions); + $version = $lastVersion['version']; + } + + if (0 != $version && !isset($migrations[$version])) { + $this->output->writeln(sprintf('warning %s is not a valid version', $version)); + return; + } + + $this->getAdapter()->toggleBreakpoint($migrations[$version]); + + $versions = $this->getVersionLog(); + + $this->output->writeln(' Breakpoint ' . ($versions[$version]['breakpoint'] ? 'set' : 'cleared') . ' for ' . $version . '' . ' ' . $migrations[$version]->getName() . ''); + } + + /** + * Remove all breakpoints + * + * @return void + */ + protected function removeBreakpoints() + { + $this->output->writeln(sprintf(' %d breakpoints cleared.', $this->getAdapter()->resetAllBreakpoints())); + } +} diff --git a/tp5/vendor/topthink/think-migration/src/command/migrate/Create.php b/tp5/vendor/topthink/think-migration/src/command/migrate/Create.php new file mode 100644 index 0000000..24fb62a --- /dev/null +++ b/tp5/vendor/topthink/think-migration/src/command/migrate/Create.php @@ -0,0 +1,95 @@ + +// +---------------------------------------------------------------------- + +namespace think\migration\command\migrate; + +use Phinx\Util\Util; +use think\console\input\Argument as InputArgument; +use think\console\Input; +use think\console\Output; +use think\migration\command\Migrate; + +class Create extends Migrate +{ + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('migrate:create') + ->setDescription('Create a new migration') + ->addArgument('name', InputArgument::REQUIRED, 'What is the name of the migration?') + ->setHelp(sprintf('%sCreates a new database migration%s', PHP_EOL, PHP_EOL)); + } + + /** + * Create the new migration. + * + * @param Input $input + * @param Output $output + * @throws \RuntimeException + * @throws \InvalidArgumentException + * @return void + */ + protected function execute(Input $input, Output $output) + { + $path = $this->getPath(); + + if (!file_exists($path)) { + if ($this->output->confirm($this->input, 'Create migrations directory? [y]/n')) { + mkdir($path, 0755, true); + } + } + + $this->verifyMigrationDirectory($path); + + $path = realpath($path); + $className = $input->getArgument('name'); + + if (!Util::isValidPhinxClassName($className)) { + throw new \InvalidArgumentException(sprintf('The migration class name "%s" is invalid. Please use CamelCase format.', $className)); + } + + if (!Util::isUniqueMigrationClassName($className, $path)) { + throw new \InvalidArgumentException(sprintf('The migration class name "%s" already exists', $className)); + } + + // Compute the file path + $fileName = Util::mapClassNameToFileName($className); + $filePath = $path . DIRECTORY_SEPARATOR . $fileName; + + if (is_file($filePath)) { + throw new \InvalidArgumentException(sprintf('The file "%s" already exists', $filePath)); + } + + // Verify that the template creation class (or the aliased class) exists and that it implements the required interface. + $aliasedClassName = null; + + // Load the alternative template if it is defined. + $contents = file_get_contents($this->getTemplate()); + + // inject the class names appropriate to this migration + $contents = strtr($contents, [ + '$className' => $className, + ]); + + if (false === file_put_contents($filePath, $contents)) { + throw new \RuntimeException(sprintf('The file "%s" could not be written to', $path)); + } + + $output->writeln('created .' . str_replace(getcwd(), '', $filePath)); + } + + protected function getTemplate() + { + return __DIR__ . '/../stubs/migrate.stub'; + } + +} diff --git a/tp5/vendor/topthink/think-migration/src/command/migrate/Rollback.php b/tp5/vendor/topthink/think-migration/src/command/migrate/Rollback.php new file mode 100644 index 0000000..07826a6 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/src/command/migrate/Rollback.php @@ -0,0 +1,146 @@ + +// +---------------------------------------------------------------------- + +namespace think\migration\command\migrate; + +use Phinx\Migration\MigrationInterface; +use think\console\input\Option as InputOption; +use think\console\Input; +use think\console\Output; +use think\migration\command\Migrate; + +class Rollback extends Migrate +{ + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('migrate:rollback') + ->setDescription('Rollback the last or to a specific migration') + ->addOption('--target', '-t', InputOption::VALUE_REQUIRED, 'The version number to rollback to') + ->addOption('--date', '-d', InputOption::VALUE_REQUIRED, 'The date to rollback to') + ->addOption('--force', '-f', InputOption::VALUE_NONE, 'Force rollback to ignore breakpoints') + ->setHelp(<<migrate:rollback command reverts the last migration, or optionally up to a specific version + +php console migrate:rollback +php console migrate:rollback -t 20111018185412 +php console migrate:rollback -d 20111018 +php console migrate:rollback -v + +EOT + ); + } + + /** + * Rollback the migration. + * + * @param Input $input + * @param Output $output + * @return void + */ + protected function execute(Input $input, Output $output) + { + $version = $input->getOption('target'); + $date = $input->getOption('date'); + $force = !!$input->getOption('force'); + + // rollback the specified environment + $start = microtime(true); + if (null !== $date) { + $this->rollbackToDateTime(new \DateTime($date), $force); + } else { + $this->rollback($version, $force); + } + $end = microtime(true); + + $output->writeln(''); + $output->writeln('All Done. Took ' . sprintf('%.4fs', $end - $start) . ''); + } + + protected function rollback($version = null, $force = false) + { + $migrations = $this->getMigrations(); + $versionLog = $this->getVersionLog(); + $versions = array_keys($versionLog); + + ksort($migrations); + sort($versions); + + // Check we have at least 1 migration to revert + if (empty($versions) || $version == end($versions)) { + $this->output->writeln('No migrations to rollback'); + return; + } + + // If no target version was supplied, revert the last migration + if (null === $version) { + // Get the migration before the last run migration + $prev = count($versions) - 2; + $version = $prev < 0 ? 0 : $versions[$prev]; + } else { + // Get the first migration number + $first = $versions[0]; + + // If the target version is before the first migration, revert all migrations + if ($version < $first) { + $version = 0; + } + } + + // Check the target version exists + if (0 !== $version && !isset($migrations[$version])) { + $this->output->writeln("Target version ($version) not found"); + return; + } + + // Revert the migration(s) + krsort($migrations); + foreach ($migrations as $migration) { + if ($migration->getVersion() <= $version) { + break; + } + + if (in_array($migration->getVersion(), $versions)) { + if (isset($versionLog[$migration->getVersion()]) && 0 != $versionLog[$migration->getVersion()]['breakpoint'] && !$force) { + $this->output->writeln('Breakpoint reached. Further rollbacks inhibited.'); + break; + } + $this->executeMigration($migration, MigrationInterface::DOWN); + } + } + } + + protected function rollbackToDateTime(\DateTime $dateTime, $force = false) + { + $versions = $this->getVersions(); + $dateString = $dateTime->format('YmdHis'); + sort($versions); + + $earlierVersion = null; + $availableMigrations = array_filter($versions, function ($version) use ($dateString, &$earlierVersion) { + if ($version <= $dateString) { + $earlierVersion = $version; + } + return $version >= $dateString; + }); + + if (count($availableMigrations) > 0) { + if (is_null($earlierVersion)) { + $this->output->writeln('Rolling back all migrations'); + $migration = 0; + } else { + $this->output->writeln('Rolling back to version ' . $earlierVersion); + $migration = $earlierVersion; + } + $this->rollback($migration, $force); + } + } +} diff --git a/tp5/vendor/topthink/think-migration/src/command/migrate/Run.php b/tp5/vendor/topthink/think-migration/src/command/migrate/Run.php new file mode 100644 index 0000000..c0fbeec --- /dev/null +++ b/tp5/vendor/topthink/think-migration/src/command/migrate/Run.php @@ -0,0 +1,141 @@ + +// +---------------------------------------------------------------------- + +namespace think\migration\command\migrate; + +use Phinx\Migration\MigrationInterface; +use think\console\Input; +use think\console\input\Option as InputOption; +use think\console\Output; +use think\migration\command\Migrate; + +class Run extends Migrate +{ + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('migrate:run') + ->setDescription('Migrate the database') + ->addOption('--target', '-t', InputOption::VALUE_REQUIRED, 'The version number to migrate to') + ->addOption('--date', '-d', InputOption::VALUE_REQUIRED, 'The date to migrate to') + ->setHelp(<<migrate:run command runs all available migrations, optionally up to a specific version + +php console migrate:run +php console migrate:run -t 20110103081132 +php console migrate:run -d 20110103 +php console migrate:run -v + +EOT + ); + } + + /** + * Migrate the database. + * + * @param Input $input + * @param Output $output + * @return integer integer 0 on success, or an error code. + */ + protected function execute(Input $input, Output $output) + { + $version = $input->getOption('target'); + $date = $input->getOption('date'); + + // run the migrations + $start = microtime(true); + if (null !== $date) { + $this->migrateToDateTime(new \DateTime($date)); + } else { + $this->migrate($version); + } + $end = microtime(true); + + $output->writeln(''); + $output->writeln('All Done. Took ' . sprintf('%.4fs', $end - $start) . ''); + } + + public function migrateToDateTime(\DateTime $dateTime) + { + $versions = array_keys($this->getMigrations()); + $dateString = $dateTime->format('YmdHis'); + + $outstandingMigrations = array_filter($versions, function ($version) use ($dateString) { + return $version <= $dateString; + }); + + if (count($outstandingMigrations) > 0) { + $migration = max($outstandingMigrations); + $this->output->writeln('Migrating to version ' . $migration); + $this->migrate($migration); + } + } + + protected function migrate($version = null) + { + $migrations = $this->getMigrations(); + $versions = $this->getVersions(); + $current = $this->getCurrentVersion(); + + if (empty($versions) && empty($migrations)) { + return; + } + + if (null === $version) { + $version = max(array_merge($versions, array_keys($migrations))); + } else { + if (0 != $version && !isset($migrations[$version])) { + $this->output->writeln(sprintf('warning %s is not a valid version', $version)); + return; + } + } + + // are we migrating up or down? + $direction = $version > $current ? MigrationInterface::UP : MigrationInterface::DOWN; + + if ($direction === MigrationInterface::DOWN) { + // run downs first + krsort($migrations); + foreach ($migrations as $migration) { + if ($migration->getVersion() <= $version) { + break; + } + + if (in_array($migration->getVersion(), $versions)) { + $this->executeMigration($migration, MigrationInterface::DOWN); + } + } + } + + ksort($migrations); + foreach ($migrations as $migration) { + if ($migration->getVersion() > $version) { + break; + } + + if (!in_array($migration->getVersion(), $versions)) { + $this->executeMigration($migration, MigrationInterface::UP); + } + } + } + + protected function getCurrentVersion() + { + $versions = $this->getVersions(); + $version = 0; + + if (!empty($versions)) { + $version = end($versions); + } + + return $version; + } +} diff --git a/tp5/vendor/topthink/think-migration/src/command/migrate/Status.php b/tp5/vendor/topthink/think-migration/src/command/migrate/Status.php new file mode 100644 index 0000000..5bad619 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/src/command/migrate/Status.php @@ -0,0 +1,124 @@ + +// +---------------------------------------------------------------------- + +namespace think\migration\command\migrate; + +use think\console\input\Option as InputOption; +use think\console\Input; +use think\console\Output; +use think\migration\command\Migrate; + +class Status extends Migrate +{ + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('migrate:status') + ->setDescription('Show migration status') + ->addOption('--format', '-f', InputOption::VALUE_REQUIRED, 'The output format: text or json. Defaults to text.') + ->setHelp(<<migrate:status command prints a list of all migrations, along with their current status + +php console migrate:status +php console migrate:status -f json +EOT + ); + } + + /** + * Show the migration status. + * + * @param Input $input + * @param Output $output + * @return integer 0 if all migrations are up, or an error code + */ + protected function execute(Input $input, Output $output) + { + $format = $input->getOption('format'); + + if (null !== $format) { + $output->writeln('using format ' . $format); + } + + // print the status + return $this->printStatus($format); + } + + protected function printStatus($format = null) + { + $output = $this->output; + $migrations = []; + if (count($this->getMigrations())) { + // TODO - rewrite using Symfony Table Helper as we already have this library + // included and it will fix formatting issues (e.g drawing the lines) + $output->writeln(''); + $output->writeln(' Status Migration ID Started Finished Migration Name '); + $output->writeln('----------------------------------------------------------------------------------'); + + $versions = $this->getVersionLog(); + $maxNameLength = $versions ? max(array_map(function ($version) { + return strlen($version['migration_name']); + }, $versions)) : 0; + + foreach ($this->getMigrations() as $migration) { + $version = array_key_exists($migration->getVersion(), $versions) ? $versions[$migration->getVersion()] : false; + if ($version) { + $status = ' up '; + } else { + $status = ' down '; + } + $maxNameLength = max($maxNameLength, strlen($migration->getName())); + + $output->writeln(sprintf('%s %14.0f %19s %19s %s', $status, $migration->getVersion(), $version['start_time'], $version['end_time'], $migration->getName())); + + if ($version && $version['breakpoint']) { + $output->writeln(' BREAKPOINT SET'); + } + + $migrations[] = [ + 'migration_status' => trim(strip_tags($status)), + 'migration_id' => sprintf('%14.0f', $migration->getVersion()), + 'migration_name' => $migration->getName() + ]; + unset($versions[$migration->getVersion()]); + } + + if (count($versions)) { + foreach ($versions as $missing => $version) { + $output->writeln(sprintf(' up %14.0f %19s %19s %s ** MISSING **', $missing, $version['start_time'], $version['end_time'], str_pad($version['migration_name'], $maxNameLength, ' '))); + + if ($version && $version['breakpoint']) { + $output->writeln(' BREAKPOINT SET'); + } + } + } + } else { + // there are no migrations + $output->writeln(''); + $output->writeln('There are no available migrations. Try creating one using the create command.'); + } + + // write an empty line + $output->writeln(''); + if ($format !== null) { + switch ($format) { + case 'json': + $output->writeln(json_encode([ + 'pending_count' => count($this->getMigrations()), + 'migrations' => $migrations + ])); + break; + default: + $output->writeln('Unsupported format: ' . $format . ''); + } + } + } +} diff --git a/tp5/vendor/topthink/think-migration/src/command/seed/Create.php b/tp5/vendor/topthink/think-migration/src/command/seed/Create.php new file mode 100644 index 0000000..16c83b4 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/src/command/seed/Create.php @@ -0,0 +1,85 @@ + +// +---------------------------------------------------------------------- + +namespace think\migration\command\seed; + +use Phinx\Util\Util; +use think\console\Input; +use think\console\input\Argument as InputArgument; +use think\console\Output; +use think\migration\command\Seed; + +class Create extends Seed +{ + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('seed:create') + ->setDescription('Create a new database seeder') + ->addArgument('name', InputArgument::REQUIRED, 'What is the name of the seeder?') + ->setHelp(sprintf('%sCreates a new database seeder%s', PHP_EOL, PHP_EOL)); + } + + /** + * Create the new seeder. + * + * @param Input $input + * @param Output $output + * @throws \RuntimeException + * @throws \InvalidArgumentException + * @return void + */ + protected function execute(Input $input, Output $output) + { + $path = $this->getPath(); + + if (!file_exists($path)) { + if ($this->output->confirm($this->input, 'Create seeds directory? [y]/n')) { + mkdir($path, 0755, true); + } + } + + $this->verifyMigrationDirectory($path); + + $path = realpath($path); + + $className = $input->getArgument('name'); + + if (!Util::isValidPhinxClassName($className)) { + throw new \InvalidArgumentException(sprintf('The seed class name "%s" is invalid. Please use CamelCase format', $className)); + } + + // Compute the file path + $filePath = $path . DIRECTORY_SEPARATOR . $className . '.php'; + + if (is_file($filePath)) { + throw new \InvalidArgumentException(sprintf('The file "%s" already exists', basename($filePath))); + } + + // inject the class names appropriate to this seeder + $contents = file_get_contents($this->getTemplate()); + $classes = [ + '$className' => $className, + ]; + $contents = strtr($contents, $classes); + + if (false === file_put_contents($filePath, $contents)) { + throw new \RuntimeException(sprintf('The file "%s" could not be written to', $path)); + } + + $output->writeln('created .' . str_replace(getcwd(), '', $filePath)); + } + + protected function getTemplate() + { + return __DIR__ . '/../stubs/seed.stub'; + } +} diff --git a/tp5/vendor/topthink/think-migration/src/command/seed/Run.php b/tp5/vendor/topthink/think-migration/src/command/seed/Run.php new file mode 100644 index 0000000..ee7ced9 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/src/command/seed/Run.php @@ -0,0 +1,107 @@ + +// +---------------------------------------------------------------------- + +namespace think\migration\command\seed; + +use Phinx\Seed\SeedInterface; +use think\console\Input; +use think\console\input\Option as InputOption; +use think\console\Output; +use think\migration\command\Seed; + +class Run extends Seed +{ + /** + * {@inheritdoc} + */ + protected function configure() + { + $this->setName('seed:run') + ->setDescription('Run database seeders') + ->addOption('--seed', '-s', InputOption::VALUE_REQUIRED, 'What is the name of the seeder?') + ->setHelp(<<seed:run command runs all available or individual seeders + +php console seed:run +php console seed:run -s UserSeeder +php console seed:run -v + +EOT + ); + } + + /** + * Run database seeders. + * + * @param Input $input + * @param Output $output + * @return void + */ + protected function execute(Input $input, Output $output) + { + $seed = $input->getOption('seed'); + + // run the seed(ers) + $start = microtime(true); + $this->seed($seed); + $end = microtime(true); + + $output->writeln(''); + $output->writeln('All Done. Took ' . sprintf('%.4fs', $end - $start) . ''); + } + + public function seed($seed = null) + { + $seeds = $this->getSeeds(); + + if (null === $seed) { + // run all seeders + foreach ($seeds as $seeder) { + if (array_key_exists($seeder->getName(), $seeds)) { + $this->executeSeed($seeder); + } + } + } else { + // run only one seeder + if (array_key_exists($seed, $seeds)) { + $this->executeSeed($seeds[$seed]); + } else { + throw new \InvalidArgumentException(sprintf('The seed class "%s" does not exist', $seed)); + } + } + } + + protected function executeSeed(SeedInterface $seed) + { + $this->output->writeln(''); + $this->output->writeln(' ==' . ' ' . $seed->getName() . ':' . ' seeding'); + + // Execute the seeder and log the time elapsed. + $start = microtime(true); + $seed->setAdapter($this->getAdapter()); + + // begin the transaction if the adapter supports it + if ($this->getAdapter()->hasTransactions()) { + $this->getAdapter()->beginTransaction(); + } + + // Run the seeder + if (method_exists($seed, SeedInterface::RUN)) { + $seed->run(); + } + + // commit the transaction if the adapter supports it + if ($this->getAdapter()->hasTransactions()) { + $this->getAdapter()->commitTransaction(); + } + $end = microtime(true); + + $this->output->writeln(' ==' . ' ' . $seed->getName() . ':' . ' seeded' . ' ' . sprintf('%.4fs', $end - $start) . ''); + } +} diff --git a/tp5/vendor/topthink/think-migration/src/command/stubs/migrate.stub b/tp5/vendor/topthink/think-migration/src/command/stubs/migrate.stub new file mode 100644 index 0000000..88d16e2 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/src/command/stubs/migrate.stub @@ -0,0 +1,33 @@ + +// +---------------------------------------------------------------------- + +\think\Console::addDefaultCommands([ + "think\\migration\\command\\migrate\\Create", + "think\\migration\\command\\migrate\\Run", + "think\\migration\\command\\migrate\\Rollback", + "think\\migration\\command\\migrate\\Breakpoint", + "think\\migration\\command\\migrate\\Status", + "think\\migration\\command\\seed\\Create", + "think\\migration\\command\\seed\\Run", +]); diff --git a/tp5/vendor/topthink/think-migration/src/db/Column.php b/tp5/vendor/topthink/think-migration/src/db/Column.php new file mode 100644 index 0000000..3b5cb04 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/src/db/Column.php @@ -0,0 +1,171 @@ + +// +---------------------------------------------------------------------- + +namespace think\migration\db; + +use Phinx\Db\Adapter\AdapterInterface; +use Phinx\Db\Adapter\MysqlAdapter; + +class Column extends \Phinx\Db\Table\Column +{ + protected $unique = false; + + public function setNullable() + { + return $this->setNull(true); + } + + public function setUnsigned() + { + return $this->setSigned(false); + } + + public function setUnique() + { + $this->unique = true; + return $this; + } + + public function getUnique() + { + return $this->unique; + } + + public function isUnique() + { + return $this->getUnique(); + } + + public static function make($name, $type, $options = []) + { + $column = new self(); + $column->setName($name); + $column->setType($type); + $column->setOptions($options); + return $column; + } + + public static function bigInteger($name) + { + return self::make($name, AdapterInterface::PHINX_TYPE_BIG_INTEGER); + } + + public static function binary($name) + { + return self::make($name, AdapterInterface::PHINX_TYPE_BLOB); + } + + public static function boolean($name) + { + return self::make($name, AdapterInterface::PHINX_TYPE_BOOLEAN); + } + + public static function char($name, $length = 255) + { + return self::make($name, AdapterInterface::PHINX_TYPE_CHAR, compact('length')); + } + + public static function date($name) + { + return self::make($name, AdapterInterface::PHINX_TYPE_DATE); + } + + public static function dateTime($name) + { + return self::make($name, AdapterInterface::PHINX_TYPE_DATETIME); + } + + public static function decimal($name, $precision = 8, $scale = 2) + { + return self::make($name, AdapterInterface::PHINX_TYPE_DECIMAL, compact('precision', 'scale')); + } + + public static function enum($name, array $values) + { + return self::make($name, AdapterInterface::PHINX_TYPE_ENUM, compact('values')); + } + + public static function float($name) + { + return self::make($name, AdapterInterface::PHINX_TYPE_FLOAT); + } + + public static function integer($name) + { + return self::make($name, AdapterInterface::PHINX_TYPE_INTEGER); + } + + public static function json($name) + { + return self::make($name, AdapterInterface::PHINX_TYPE_JSON); + } + + public static function jsonb($name) + { + return self::make($name, AdapterInterface::PHINX_TYPE_JSONB); + } + + public static function longText($name) + { + return self::make($name, AdapterInterface::PHINX_TYPE_TEXT, ['length' => MysqlAdapter::TEXT_LONG]); + } + + public static function mediumInteger($name) + { + return self::make($name, AdapterInterface::PHINX_TYPE_INTEGER, ['length' => MysqlAdapter::INT_MEDIUM]); + } + + public static function mediumText($name) + { + return self::make($name, AdapterInterface::PHINX_TYPE_TEXT, ['length' => MysqlAdapter::TEXT_MEDIUM]); + } + + public static function smallInteger($name) + { + return self::make($name, AdapterInterface::PHINX_TYPE_INTEGER, ['length' => MysqlAdapter::INT_SMALL]); + } + + public static function string($name, $length = 255) + { + return self::make($name, AdapterInterface::PHINX_TYPE_STRING, compact('length')); + } + + public static function text($name) + { + return self::make($name, AdapterInterface::PHINX_TYPE_TEXT); + } + + public static function time($name) + { + return self::make($name, AdapterInterface::PHINX_TYPE_TIME); + } + + public static function tinyInteger($name) + { + return self::make($name, AdapterInterface::PHINX_TYPE_INTEGER, ['length' => MysqlAdapter::INT_TINY]); + } + + public static function unsignedInteger($name) + { + return self::integer($name)->setUnSigned(); + } + + public static function timestamp($name) + { + return self::make($name, AdapterInterface::PHINX_TYPE_TIMESTAMP); + } + + public static function uuid($name) + { + return self::make($name, AdapterInterface::PHINX_TYPE_UUID); + } + +} diff --git a/tp5/vendor/topthink/think-migration/src/db/Table.php b/tp5/vendor/topthink/think-migration/src/db/Table.php new file mode 100644 index 0000000..cf4daa9 --- /dev/null +++ b/tp5/vendor/topthink/think-migration/src/db/Table.php @@ -0,0 +1,135 @@ + +// +---------------------------------------------------------------------- + +namespace think\migration\db; + +use Phinx\Db\Table\Index; + +class Table extends \Phinx\Db\Table +{ + /** + * 设置id + * @param $id + * @return $this + */ + public function setId($id) + { + $this->options['id'] = $id; + return $this; + } + + /** + * 设置主键 + * @param $key + * @return $this + */ + public function setPrimaryKey($key) + { + $this->options['primary_key'] = $key; + return $this; + } + + /** + * 设置引擎 + * @param $engine + * @return $this + */ + public function setEngine($engine) + { + $this->options['engine'] = $engine; + return $this; + } + + /** + * 设置表注释 + * @param $comment + * @return $this + */ + public function setComment($comment) + { + $this->options['comment'] = $comment; + return $this; + } + + /** + * 设置排序比对方法 + * @param $collation + * @return $this + */ + public function setCollation($collation) + { + $this->options['collation'] = $collation; + return $this; + } + + public function addSoftDelete() + { + $this->addColumn(Column::timestamp('delete_time')->setNullable()); + return $this; + } + + public function addMorphs($name, $indexName = null) + { + $this->addColumn(Column::unsignedInteger("{$name}_id")); + $this->addColumn(Column::string("{$name}_type")); + $this->addIndex(["{$name}_id", "{$name}_type"], ['name' => $indexName]); + return $this; + } + + public function addNullableMorphs($name, $indexName = null) + { + $this->addColumn(Column::unsignedInteger("{$name}_id")->setNullable()); + $this->addColumn(Column::string("{$name}_type")->setNullable()); + $this->addIndex(["{$name}_id", "{$name}_type"], ['name' => $indexName]); + return $this; + } + + /** + * @param string $createdAtColumnName + * @param string $updatedAtColumnName + * @return \Phinx\Db\Table|Table + */ + public function addTimestamps($createdAtColumnName = 'create_time', $updatedAtColumnName = 'update_time') + { + return parent::addTimestamps($createdAtColumnName, $updatedAtColumnName); + } + + /** + * @param \Phinx\Db\Table\Column|string $columnName + * @param null $type + * @param array $options + * @return \Phinx\Db\Table|Table + */ + public function addColumn($columnName, $type = null, $options = []) + { + if ($columnName instanceof Column && $columnName->getUnique()) { + $index = new Index(); + $index->setColumns([$columnName->getName()]); + $index->setType(Index::UNIQUE); + $this->addIndex($index); + } + return parent::addColumn($columnName, $type, $options); + } + + /** + * @param string $columnName + * @param null $newColumnType + * @param array $options + * @return \Phinx\Db\Table|Table + */ + public function changeColumn($columnName, $newColumnType = null, $options = []) + { + if ($columnName instanceof \Phinx\Db\Table\Column) { + return parent::changeColumn($columnName->getName(), $columnName, $options); + } + return parent::changeColumn($columnName, $newColumnType, $options); + } +} diff --git a/tpl.sublime-completions b/tpl.sublime-completions index 2c67847..24845be 100644 --- a/tpl.sublime-completions +++ b/tpl.sublime-completions @@ -3,19 +3,19 @@ "completions": [ - { "trigger": "bl", "contents": "$0" }, - { "trigger": "emp", "contents": "${2:name为空} ${3:name不为空}$0" }, - { "trigger": "eq", "contents": "$0" }, - { "trigger": "extend", "contents": "$0" }, - { "trigger": "if", "contents": "\n ${2:do}\n$0" }, - { "trigger": "inc", "contents": "$0" }, - { "trigger": "layout", "contents": "\n{__CONTENT__}\n$0" }, - { "trigger": "lit", "contents": "\n ${1:content}\n$0" }, + { "trigger": "bl", "contents": "{block name=\"${1:name}\"}$0{/block}" }, + { "trigger": "emp", "contents": "{empty name=\"${1:name}\"}${2:name为空}{else /} ${3:name不为空}{/empty}$0" }, + { "trigger": "eq", "contents": "{eq name=\"${1:name}\" value=\"${2:value}\"}$0{/eq}" }, + { "trigger": "extend", "contents": "{extend name=\"${1:name}\" /}$0" }, + { "trigger": "if", "contents": "{if condition=\"${1:conditon}\"}\n\t${2:do}\n{/if}$0" }, + { "trigger": "inc", "contents": "{include file=\"${1:Public:header}\" /}$0" }, + { "trigger": "layout", "contents": "{include file=\"${1:Public:header}\"/}\n{__CONTENT__}\n{include file=\"${2:Public:footer}\"/}$0" }, + { "trigger": "lit", "contents": "{literal}\n\t${1:content}\n{/literal}$0" }, { "trigger": "nolayout", "contents": "{__NOLAYOUT__}\n$0" }, - { "trigger": "php", "contents": "${1:echo 'Hello,world!';}$0" }, - { "trigger": "pres", "contents": "${2:name已经赋值}${3:name还没有赋值}$0" }, - { "trigger": "sw", "contents": "\n ${3:value1}\n ${5:value2}\n ${6:default}$0" }, - { "trigger": "vo", "contents": "\n ${3:{\\$vo\\}}\n$0" }, + { "trigger": "php", "contents": "{php}${1:echo 'Hello,world!';}{/php}$0" }, + { "trigger": "pres", "contents": "{present name=\"${1:name}\"}${2:name已经赋值}{else /}${3:name还没有赋值}{/present}$0" }, + { "trigger": "sw", "contents": "{switch name=\"${1:level}\"}\n\t{case value=\"${2:1}\"}${3:value1}{/case}\n\t{case value=\"${4:2}\"}${5:value2}{/case}\n\t{default /}${6:default}{/switch}$0" }, + { "trigger": "vo", "contents": "{volist name=\"${1:list}\" id=\"${2:vo}\"}\n\t${3:{\\$vo\\}}\n{/volist}$0" }, { "trigger": "|fun", "contents": "{\\$${1:name}|${2:fun}=${3:arg1,###}}$0" }, { "trigger": "|def", "contents": "{\\$${1:name}|default=\"${2:***}\"}$0" } ]