php: new php plugin

This plugin requires PHP >= 7.0.
v2.8-utf8proc
Adam Saponara 2017-09-03 12:17:26 +02:00 committed by Sébastien Helleu
parent 8c046d9be9
commit d032ee2159
13 changed files with 5842 additions and 1 deletions

View File

@ -19,10 +19,12 @@ before_script:
# Workaround travis-ci/travis-ci#5326
- export PATH=$(echo $PATH | tr ':' "\n" | sed '/\/opt\/python/d' | tr "\n" ":" | sed "s|::|:|g")
- echo 'APT::Install-Recommends "false";' | sudo tee -a /etc/apt/apt.conf
- sudo add-apt-repository -y ppa:ondrej/php
- sudo apt-get update -qq
- sudo apt-get -y install devscripts equivs python-pip libenchant-dev autopoint cmake pkg-config libncursesw5-dev gem2deb libperl-dev python-dev python3-dev libaspell-dev liblua5.1-0-dev tcl8.5-dev guile-2.0-dev libv8-dev libcurl4-gnutls-dev libgcrypt11-dev libgnutls-dev zlib1g-dev curl libcpputest-dev
- sudo apt-get -y install devscripts equivs python-pip libenchant-dev autopoint cmake pkg-config libncursesw5-dev gem2deb libperl-dev python-dev python3-dev libaspell-dev liblua5.1-0-dev tcl8.5-dev guile-2.0-dev libv8-dev libcurl4-gnutls-dev libgcrypt11-dev libgnutls-dev zlib1g-dev curl libcpputest-dev php7.0-dev libphp7.0-embed
- sudo gem install asciidoctor
- sudo pip install msgcheck pylint
- phpenv local system
script:
- ./tools/build-test.sh

View File

@ -107,6 +107,7 @@ option(ENABLE_LUA "Enable Lua scripting language" ON)
option(ENABLE_TCL "Enable Tcl scripting language" ON)
option(ENABLE_GUILE "Enable Scheme (guile) scripting language" ON)
option(ENABLE_JAVASCRIPT "Enable JavaScript scripting language" ON)
option(ENABLE_PHP "Enable PHP scripting language" ON)
option(ENABLE_TRIGGER "Enable Trigger plugin" ON)
option(ENABLE_XFER "Enable Xfer plugin" ON)
option(ENABLE_MAN "Enable build of man page" OFF)

View File

@ -26,6 +26,7 @@ New features::
* alias: add infolist "alias_default" (list of default aliases)
* buflist: add option buflist.look.add_newline (issue #1027)
* fset: new plugin "fset" (fast set of WeeChat and plugins options)
* php: new plugin "php" (issue #909)
Improvements::

44
cmake/FindPHP.cmake Normal file
View File

@ -0,0 +1,44 @@
#
# Copyright (C) 2003-2017 Adam Saponara <as@php.net>
#
# This file is part of WeeChat, the extensible chat client.
#
# WeeChat is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# WeeChat is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
#
if(PHP_FOUND)
set(PHP_FIND_QUIETLY TRUE)
endif()
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_search_module(php7 php)
endif()
if(NOT PHP_FOUND)
find_program(PHP_CONFIG_EXECUTABLE NAMES
php-config php-config7
php-config7.2 php-config72
php-config7.1 php-config71
php-config7.0 php-config70)
if (PHP_CONFIG_EXECUTABLE)
execute_process(COMMAND ${PHP_CONFIG_EXECUTABLE} --prefix OUTPUT_VARIABLE PHP_LIB_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${PHP_CONFIG_EXECUTABLE} --includes OUTPUT_VARIABLE PHP_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${PHP_CONFIG_EXECUTABLE} --libs OUTPUT_VARIABLE PHP_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "-I" "" PHP_INCLUDE_DIRS ${PHP_INCLUDE_DIRS})
SEPARATE_ARGUMENTS(PHP_INCLUDE_DIRS)
set(PHP_LDFLAGS "-L${PHP_LIB_PREFIX}/lib/ ${PHP_LIBS} -lphp7")
set(PHP_FOUND 1)
endif()
endif()

View File

@ -122,6 +122,7 @@ AH_VERBATIM([PLUGIN_PERL], [#undef PLUGIN_PERL])
AH_VERBATIM([PLUGIN_PYTHON], [#undef PLUGIN_PYTHON])
AH_VERBATIM([PLUGIN_RUBY], [#undef PLUGIN_RUBY])
AH_VERBATIM([PLUGIN_LUA], [#undef PLUGIN_LUA])
AH_VERBATIM([PLUGIN_PHP], [#undef PLUGIN_PHP])
AH_VERBATIM([PLUGIN_TCL], [#undef PLUGIN_TCL])
AH_VERBATIM([PLUGIN_GUILE], [#undef PLUGIN_GUILE])
AH_VERBATIM([PLUGIN_JAVASCRIPT], [#undef PLUGIN_JAVASCRIPT])
@ -159,6 +160,7 @@ AC_ARG_ENABLE(lua, [ --disable-lua turn off Lua script plugi
AC_ARG_ENABLE(tcl, [ --disable-tcl turn off Tcl script plugin (default=compiled if found)],enable_tcl=$enableval,enable_tcl=yes)
AC_ARG_ENABLE(guile, [ --disable-guile turn off Guile (scheme) script plugin (default=compiled if found)],enable_guile=$enableval,enable_guile=yes)
AC_ARG_ENABLE(javascript, [ --disable-javascript turn off Javascript script plugin (default=compiled if found)],enable_javascript=$enableval,enable_javascript=yes)
AC_ARG_ENABLE(php, [ --disable-php turn off PHP script plugin (default=compiled if found)],enable_php=$enableval,enable_php=yes)
AC_ARG_ENABLE(trigger, [ --disable-trigger turn off Trigger plugin (default=compiled)],enable_trigger=$enableval,enable_trigger=yes)
AC_ARG_ENABLE(xfer, [ --disable-xfer turn off Xfer (file transfer) plugin (default=compiled)],enable_xfer=$enableval,enable_xfer=yes)
AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR directory containing tcl configuration (tclConfig.sh)],tclconfig=$withval,tclconfig='')
@ -292,6 +294,7 @@ if test "x$enable_scripts" = "xno" ; then
enable_tcl="no"
enable_guile="no"
enable_javascript="no"
enable_php="no"
fi
# ---------------------------------- alias -------------------------------------
@ -928,6 +931,108 @@ fi
AC_LANG_POP
# ---------------------------------- php --------------------------------------
PHP_VERSION=
if test "x$enable_php" = "xyes" ; then
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_CFLAGS="$CFLAGS"
ac_save_LDFLAGS="$LDFLAGS"
PHP_CFLAGS=""
PHP_LFLAGS=""
if test -n "$php_inc"; then
CFLAGS="$CFLAGS -I$php_inc"
CPPFLAGS="$CPPFLAGS -I$php_inc"
fi
if test -n "$php_lib"; then
LDFLAGS="$LDFLAGS -L$php_lib"
fi
if test "x$PHP_CFLAGS" = "x" -o "x$PHP_LFLAGS" = "x" ; then
AC_MSG_CHECKING(for PHP headers and libraries with pkg-config)
echo
for l in "$php_suffix" "" "7" "7.2" "72" "7.1" "71" "7.0" "70" ; do
pkgconfig_php_found=`$PKGCONFIG --exists php$l 2>/dev/null`
if test "x$?" = "x0" ; then
PHP_VERSION=`$PKGCONFIG --modversion php$l`
PHP_CFLAGS="$PHP_CFLAGS "`$PKGCONFIG --cflags php$l`
PHP_LFLAGS="$PHP_LFLAGS "`$PKGCONFIG --libs php$l`
break
fi
done
fi
if test "x$PHP_CFLAGS" = "x" -o "x$PHP_LFLAGS" = "x" ; then
PHPCONFIG=""
AC_MSG_CHECKING(for PHP headers and libraries with php-config)
for l in "$php_suffix" "" "7" "7.2" "72" "7.1" "71" "7.0" "70" ; do
AC_CHECK_PROG(PHPCONFIG, "php-config$l", "php-config$l")
if test "x$PHPCONFIG" != "x" ; then
PHP_CFLAGS=`$PHPCONFIG --includes`
PHP_LFLAGS="-L$($PHPCONFIG --prefix)/lib/ $($PHPCONFIG --libs) -lphp7"
PHP_VERSION=`$PHPCONFIG --version`
break
fi
done
fi
if test "x$PHP_CFLAGS" = "x" -o "x$PHP_LFLAGS" = "x" ; then
AC_MSG_CHECKING(for PHP headers and libraries)
echo
AC_CHECK_HEADER(php.h,ac_found_php_header="yes",ac_found_php_header="no")
if test "x$ac_found_php_header" = "xyes" ; then
PHP_CFLAGS="$CFLAGS"
fi
for l in "$php_suffix" "" "7" "7.2" "72" "7.1" "71" "7.0" "70" ; do
AC_CHECK_LIB(php$l,php_execute_script,ac_found_php_lib="yes",ac_found_php_lib="no")
if test "x$ac_found_php_lib" = "xyes" ; then
PHP_VERSION=">=7.0.0"
PHP_LFLAGS="$LDFLAGS -lphp7 -lm"
ac2_save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -lphp7 -lm"
if echo "$host_os" | grep "^linux" 1>/dev/null 2>&1 ; then
LDFLAGS="$LDFLAGS -ldl"
fi
LDFLAGS="$ac2_save_LDFLAGS"
break
fi
done
fi
AC_MSG_CHECKING(for PHP compiling and linking)
PHP_TEST=`LT=phptest.c ; echo "#include <sapi/embed/php_embed.h>" > $LT; echo "int main() { php_embed_init(0, NULL); php_embed_shutdown(); return 0; }" >> $LT ; $CC -Wall $LT -o $LT.out $PHP_CFLAGS $PHP_LFLAGS $CFLAGS $LDFLAGS 1>/dev/null 2>&1 ; echo $?; rm -f $LT $LT.out 1>/dev/null 2>&1`
if test "x$PHP_TEST" != "x0" ; then
AC_MSG_RESULT(no)
AC_MSG_WARN([
*** PHP (>=7.0) headers and/or libraries couldn't be found on your system.
*** Try to install libphp-embed with your software package manager.
*** WeeChat will be built without PHP support.])
enable_php="no"
not_found="$not_found php"
else
AC_MSG_RESULT(yes)
fi
CFLAGS="$ac_save_CFLAGS"
CPPFLAGS="$ac_save_CPPFLAGS"
LDFLAGS="$ac_save_LDFLAGS"
else
not_asked="$not_asked php"
fi
if test "x$enable_php" = "xyes" ; then
AC_SUBST(PHP_CFLAGS)
AC_SUBST(PHP_LFLAGS)
AC_DEFINE(PLUGIN_PHP)
fi
# --------------------------------- trigger ------------------------------------
if test "x$enable_trigger" = "xyes" ; then
@ -1281,6 +1386,7 @@ AM_CONDITIONAL(PLUGIN_LUA, test "$enable_lua" = "yes")
AM_CONDITIONAL(PLUGIN_TCL, test "$enable_tcl" = "yes")
AM_CONDITIONAL(PLUGIN_GUILE, test "$enable_guile" = "yes")
AM_CONDITIONAL(PLUGIN_JAVASCRIPT, test "$enable_javascript" = "yes")
AM_CONDITIONAL(PLUGIN_PHP, test "$enable_php" = "yes")
AM_CONDITIONAL(PLUGIN_TRIGGER, test "$enable_trigger" = "yes")
AM_CONDITIONAL(PLUGIN_XFER, test "$enable_xfer" = "yes")
AM_CONDITIONAL(TESTS, test "$enable_tests" = "yes")
@ -1319,6 +1425,7 @@ AC_OUTPUT([Makefile
src/plugins/tcl/Makefile
src/plugins/guile/Makefile
src/plugins/javascript/Makefile
src/plugins/php/Makefile
src/plugins/trigger/Makefile
src/plugins/xfer/Makefile
src/gui/Makefile
@ -1397,6 +1504,9 @@ fi
if test "x$enable_javascript" = "xyes"; then
listplugins="$listplugins javascript/v8"
fi
if test "x$enable_php" = "xyes"; then
listplugins="$listplugins php($PHP_VERSION)"
fi
if test "x$enable_trigger" = "xyes"; then
listplugins="$listplugins trigger"
fi

View File

@ -155,6 +155,13 @@ if(ENABLE_SCRIPTS AND ENABLE_JAVASCRIPT)
endif()
endif()
if(ENABLE_SCRIPTS AND ENABLE_PHP)
find_package(PHP)
if(PHP_FOUND)
add_subdirectory(php)
endif()
endif()
if(ENABLE_TRIGGER)
add_subdirectory(trigger)
endif()

View File

@ -109,6 +109,10 @@ if PLUGIN_JAVASCRIPT
javascript_dir = javascript
endif
if PLUGIN_PHP
php_dir = php
endif
if PLUGIN_TRIGGER
trigger_dir = trigger
endif
@ -136,6 +140,7 @@ SUBDIRS = . \
$(tcl_dir) \
$(guile_dir) \
$(javascript_dir) \
$(php_dir) \
$(trigger_dir) \
$(xfer_dir)

View File

@ -0,0 +1,30 @@
#
# Copyright (C) 2006-2017 Adam Saponara <as@php.net>
#
# This file is part of WeeChat, the extensible chat client.
#
# WeeChat is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# WeeChat is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
#
add_library(php MODULE weechat-php.c weechat-php.h weechat-php-api.c
weechat-php-api.h)
set_target_properties(php PROPERTIES PREFIX "")
if(PHP_FOUND)
include_directories(${PHP_INCLUDE_DIRS})
target_link_libraries(php ${PHP_LDFLAGS} weechat_plugins_scripts)
endif()
install(TARGETS php LIBRARY DESTINATION ${LIBDIR}/plugins)

View File

@ -0,0 +1,33 @@
#
# Copyright (C) 2006-2017 Adam Saponara <as@php.net>
#
# This file is part of WeeChat, the extensible chat client.
#
# WeeChat is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# WeeChat is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
#
AM_CPPFLAGS = -DLOCALEDIR=\"$(datadir)/locale\" $(PHP_CFLAGS)
libdir = ${weechat_libdir}/plugins
lib_LTLIBRARIES = php.la
php_la_SOURCES = weechat-php.c \
weechat-php.h \
weechat-php-api.c \
weechat-php-api.h
php_la_LDFLAGS = -module -no-undefined
php_la_LIBADD = ../lib_weechat_plugins_scripts.la $(PHP_LFLAGS)
EXTRA_DIST = CMakeLists.txt

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,224 @@
/*
* Copyright (C) 2006-2017 Adam Saponara <as@php.net>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WEECHAT_PHP_API_H
#define WEECHAT_PHP_API_H 1
extern struct zval* weechat_php_api_funcs[];
extern struct t_php_const weechat_php_api_consts[];
extern int weechat_php_buffer_new_input_callback(const void *pointer, void *data, struct t_gui_buffer *buffer, const char *input_data);
extern int weechat_php_buffer_new_close_callback(const void *pointer, void *data, struct t_gui_buffer *buffer);
PHP_FUNCTION(weechat_bar_item_new);
PHP_FUNCTION(weechat_bar_item_remove);
PHP_FUNCTION(weechat_bar_item_search);
PHP_FUNCTION(weechat_bar_item_update);
PHP_FUNCTION(weechat_bar_new);
PHP_FUNCTION(weechat_bar_remove);
PHP_FUNCTION(weechat_bar_search);
PHP_FUNCTION(weechat_bar_set);
PHP_FUNCTION(weechat_bar_update);
PHP_FUNCTION(weechat_buffer_clear);
PHP_FUNCTION(weechat_buffer_close);
PHP_FUNCTION(weechat_buffer_get_integer);
PHP_FUNCTION(weechat_buffer_get_pointer);
PHP_FUNCTION(weechat_buffer_get_string);
PHP_FUNCTION(weechat_buffer_match_list);
PHP_FUNCTION(weechat_buffer_merge);
PHP_FUNCTION(weechat_buffer_new);
PHP_FUNCTION(weechat_buffer_search);
PHP_FUNCTION(weechat_buffer_search_main);
PHP_FUNCTION(weechat_buffer_set);
PHP_FUNCTION(weechat_buffer_string_replace_local_var);
PHP_FUNCTION(weechat_buffer_unmerge);
PHP_FUNCTION(weechat_charset_set);
PHP_FUNCTION(weechat_color);
PHP_FUNCTION(weechat_command);
PHP_FUNCTION(weechat_config_boolean);
PHP_FUNCTION(weechat_config_boolean_default);
PHP_FUNCTION(weechat_config_color);
PHP_FUNCTION(weechat_config_color_default);
PHP_FUNCTION(weechat_config_free);
PHP_FUNCTION(weechat_config_get);
PHP_FUNCTION(weechat_config_get_plugin);
PHP_FUNCTION(weechat_config_integer);
PHP_FUNCTION(weechat_config_integer_default);
PHP_FUNCTION(weechat_config_is_set_plugin);
PHP_FUNCTION(weechat_config_new);
PHP_FUNCTION(weechat_config_new_option);
PHP_FUNCTION(weechat_config_new_section);
PHP_FUNCTION(weechat_config_option_default_is_null);
PHP_FUNCTION(weechat_config_option_free);
PHP_FUNCTION(weechat_config_option_is_null);
PHP_FUNCTION(weechat_config_option_rename);
PHP_FUNCTION(weechat_config_option_reset);
PHP_FUNCTION(weechat_config_option_set);
PHP_FUNCTION(weechat_config_option_set_null);
PHP_FUNCTION(weechat_config_option_unset);
PHP_FUNCTION(weechat_config_read);
PHP_FUNCTION(weechat_config_reload);
PHP_FUNCTION(weechat_config_search_option);
PHP_FUNCTION(weechat_config_search_section);
PHP_FUNCTION(weechat_config_section_free);
PHP_FUNCTION(weechat_config_section_free_options);
PHP_FUNCTION(weechat_config_set_desc_plugin);
PHP_FUNCTION(weechat_config_set_plugin);
PHP_FUNCTION(weechat_config_string);
PHP_FUNCTION(weechat_config_string_default);
PHP_FUNCTION(weechat_config_string_to_boolean);
PHP_FUNCTION(weechat_config_unset_plugin);
PHP_FUNCTION(weechat_config_write);
PHP_FUNCTION(weechat_config_write_line);
PHP_FUNCTION(weechat_config_write_option);
PHP_FUNCTION(weechat_gettext);
PHP_FUNCTION(weechat_hdata_char);
PHP_FUNCTION(weechat_hdata_check_pointer);
PHP_FUNCTION(weechat_hdata_get);
PHP_FUNCTION(weechat_hdata_get_list);
PHP_FUNCTION(weechat_hdata_get_string);
PHP_FUNCTION(weechat_hdata_get_var);
PHP_FUNCTION(weechat_hdata_get_var_array_size);
PHP_FUNCTION(weechat_hdata_get_var_array_size_string);
PHP_FUNCTION(weechat_hdata_get_var_hdata);
PHP_FUNCTION(weechat_hdata_get_var_offset);
PHP_FUNCTION(weechat_hdata_get_var_type);
PHP_FUNCTION(weechat_hdata_get_var_type_string);
PHP_FUNCTION(weechat_hdata_hashtable);
PHP_FUNCTION(weechat_hdata_integer);
PHP_FUNCTION(weechat_hdata_long);
PHP_FUNCTION(weechat_hdata_move);
PHP_FUNCTION(weechat_hdata_pointer);
PHP_FUNCTION(weechat_hdata_search);
PHP_FUNCTION(weechat_hdata_string);
PHP_FUNCTION(weechat_hdata_time);
PHP_FUNCTION(weechat_hdata_update);
PHP_FUNCTION(weechat_hook_command);
PHP_FUNCTION(weechat_hook_command_run);
PHP_FUNCTION(weechat_hook_completion);
PHP_FUNCTION(weechat_hook_completion_get_string);
PHP_FUNCTION(weechat_hook_completion_list_add);
PHP_FUNCTION(weechat_hook_config);
PHP_FUNCTION(weechat_hook_connect);
PHP_FUNCTION(weechat_hook_fd);
PHP_FUNCTION(weechat_hook_focus);
PHP_FUNCTION(weechat_hook_hsignal);
PHP_FUNCTION(weechat_hook_hsignal_send);
PHP_FUNCTION(weechat_hook_info);
PHP_FUNCTION(weechat_hook_info_hashtable);
PHP_FUNCTION(weechat_hook_infolist);
PHP_FUNCTION(weechat_hook_modifier);
PHP_FUNCTION(weechat_hook_modifier_exec);
PHP_FUNCTION(weechat_hook_print);
PHP_FUNCTION(weechat_hook_process);
PHP_FUNCTION(weechat_hook_process_hashtable);
PHP_FUNCTION(weechat_hook_set);
PHP_FUNCTION(weechat_hook_signal);
PHP_FUNCTION(weechat_hook_signal_send);
PHP_FUNCTION(weechat_hook_timer);
PHP_FUNCTION(weechat_iconv_from_internal);
PHP_FUNCTION(weechat_iconv_to_internal);
PHP_FUNCTION(weechat_info_get);
PHP_FUNCTION(weechat_info_get_hashtable);
PHP_FUNCTION(weechat_infolist_fields);
PHP_FUNCTION(weechat_infolist_free);
PHP_FUNCTION(weechat_infolist_get);
PHP_FUNCTION(weechat_infolist_integer);
PHP_FUNCTION(weechat_infolist_new);
PHP_FUNCTION(weechat_infolist_new_item);
PHP_FUNCTION(weechat_infolist_new_var_integer);
PHP_FUNCTION(weechat_infolist_new_var_pointer);
PHP_FUNCTION(weechat_infolist_new_var_string);
PHP_FUNCTION(weechat_infolist_new_var_time);
PHP_FUNCTION(weechat_infolist_next);
PHP_FUNCTION(weechat_infolist_pointer);
PHP_FUNCTION(weechat_infolist_prev);
PHP_FUNCTION(weechat_infolist_reset_item_cursor);
PHP_FUNCTION(weechat_infolist_search_var);
PHP_FUNCTION(weechat_infolist_string);
PHP_FUNCTION(weechat_infolist_time);
PHP_FUNCTION(weechat_key_bind);
PHP_FUNCTION(weechat_key_unbind);
PHP_FUNCTION(weechat_list_add);
PHP_FUNCTION(weechat_list_casesearch);
PHP_FUNCTION(weechat_list_casesearch_pos);
PHP_FUNCTION(weechat_list_free);
PHP_FUNCTION(weechat_list_get);
PHP_FUNCTION(weechat_list_new);
PHP_FUNCTION(weechat_list_next);
PHP_FUNCTION(weechat_list_prev);
PHP_FUNCTION(weechat_list_remove);
PHP_FUNCTION(weechat_list_remove_all);
PHP_FUNCTION(weechat_list_search);
PHP_FUNCTION(weechat_list_search_pos);
PHP_FUNCTION(weechat_list_set);
PHP_FUNCTION(weechat_list_size);
PHP_FUNCTION(weechat_list_string);
PHP_FUNCTION(weechat_log_printf);
PHP_FUNCTION(weechat_mkdir);
PHP_FUNCTION(weechat_mkdir_home);
PHP_FUNCTION(weechat_mkdir_parents);
PHP_FUNCTION(weechat_ngettext);
PHP_FUNCTION(weechat_nicklist_add_group);
PHP_FUNCTION(weechat_nicklist_add_nick);
PHP_FUNCTION(weechat_nicklist_group_get_integer);
PHP_FUNCTION(weechat_nicklist_group_get_pointer);
PHP_FUNCTION(weechat_nicklist_group_get_string);
PHP_FUNCTION(weechat_nicklist_group_set);
PHP_FUNCTION(weechat_nicklist_nick_get_integer);
PHP_FUNCTION(weechat_nicklist_nick_get_pointer);
PHP_FUNCTION(weechat_nicklist_nick_get_string);
PHP_FUNCTION(weechat_nicklist_nick_set);
PHP_FUNCTION(weechat_nicklist_remove_all);
PHP_FUNCTION(weechat_nicklist_remove_group);
PHP_FUNCTION(weechat_nicklist_remove_nick);
PHP_FUNCTION(weechat_nicklist_search_group);
PHP_FUNCTION(weechat_nicklist_search_nick);
PHP_FUNCTION(weechat_plugin_get_name);
PHP_FUNCTION(weechat_prefix);
PHP_FUNCTION(weechat_printf);
PHP_FUNCTION(weechat_printf_date_tags);
PHP_FUNCTION(weechat_printf_y);
PHP_FUNCTION(weechat_register);
PHP_FUNCTION(weechat_string_eval_expression);
PHP_FUNCTION(weechat_string_eval_path_home);
PHP_FUNCTION(weechat_string_has_highlight);
PHP_FUNCTION(weechat_string_has_highlight_regex);
PHP_FUNCTION(weechat_string_input_for_buffer);
PHP_FUNCTION(weechat_string_is_command_char);
PHP_FUNCTION(weechat_string_mask_to_regex);
PHP_FUNCTION(weechat_string_match);
PHP_FUNCTION(weechat_string_remove_color);
PHP_FUNCTION(weechat_string_replace);
PHP_FUNCTION(weechat_strlen_screen);
PHP_FUNCTION(weechat_unhook);
PHP_FUNCTION(weechat_unhook_all);
PHP_FUNCTION(weechat_upgrade_close);
PHP_FUNCTION(weechat_upgrade_new);
PHP_FUNCTION(weechat_upgrade_read);
PHP_FUNCTION(weechat_upgrade_write_object);
PHP_FUNCTION(weechat_window_get_integer);
PHP_FUNCTION(weechat_window_get_pointer);
PHP_FUNCTION(weechat_window_get_string);
PHP_FUNCTION(weechat_window_search_with_buffer);
PHP_FUNCTION(weechat_window_set_title);
PHP_FUNCTION(forget_class);
PHP_FUNCTION(forget_function);
#endif /* WEECHAT_PHP_API_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,60 @@
/*
* Copyright (C) 2006-2017 Adam Saponara <as@php.net>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WEECHAT_PHP_H
#define WEECHAT_PHP_H 1
#define weechat_plugin weechat_php_plugin
#define PHP_PLUGIN_NAME "php"
#define PHP_WEECHAT_VERSION "0.1"
#define PHP_CURRENT_SCRIPT_NAME ((php_current_script) ? php_current_script->name : "-")
struct t_php_const
{
char *name;
int int_value;
char *str_value;
};
extern int php_quiet;
extern struct t_weechat_plugin *weechat_php_plugin;
extern struct t_hashtable *weechat_php_function_map;
extern struct t_plugin_script *php_scripts;
extern struct t_plugin_script *last_php_script;
extern struct t_plugin_script *php_current_script;
extern struct t_plugin_script *php_registered_script;
extern const char *php_current_script_filename;
extern void weechat_php_hashtable_to_array (struct t_hashtable *hashtable, zval *arr);
extern struct t_hashtable *weechat_php_array_to_hashtable (zval* arr,
int size,
const char *type_keys,
const char *type_values);
extern void *weechat_php_exec (struct t_plugin_script *script,
int ret_type,
const char *function,
const char *format, void **argv);
extern zval *weechat_php_func_map_get (const char *func_name);
extern char *weechat_php_func_map_add (zval *ofunc);
#endif /* WEECHAT_PHP_H */