summaryrefslogtreecommitdiff
path: root/ext/pspell/pspell.c
diff options
context:
space:
mode:
authorBrian France <bfrance@php.net>2004-02-11 18:50:16 +0000
committerBrian France <bfrance@php.net>2004-02-11 18:50:16 +0000
commite6ae5c331894ce19114f8783520b2060d6f96984 (patch)
treed60583b75fde7b6b48bdf37ac03f6ec74ab20f19 /ext/pspell/pspell.c
parent8b97d9d7f19d410872cad0971b0fddfaad2dfa74 (diff)
downloadphp-git-e6ae5c331894ce19114f8783520b2060d6f96984.tar.gz
Added two new functions to set the dict-dir and data-dir options.
Diffstat (limited to 'ext/pspell/pspell.c')
-rw-r--r--ext/pspell/pspell.c44
1 files changed, 34 insertions, 10 deletions
diff --git a/ext/pspell/pspell.c b/ext/pspell/pspell.c
index 8673e844dc..e29eccd322 100644
--- a/ext/pspell/pspell.c
+++ b/ext/pspell/pspell.c
@@ -68,6 +68,8 @@ function_entry pspell_functions[] = {
PHP_FE(pspell_config_mode, NULL)
PHP_FE(pspell_config_ignore, NULL)
PHP_FE(pspell_config_personal, NULL)
+ PHP_FE(pspell_config_dict_dir, NULL)
+ PHP_FE(pspell_config_data_dir, NULL)
PHP_FE(pspell_config_repl, NULL)
PHP_FE(pspell_config_save_repl, NULL)
{NULL, NULL, NULL}
@@ -803,18 +805,15 @@ PHP_FUNCTION(pspell_config_ignore)
}
/* }}} */
-/* {{{ proto bool pspell_config_personal(int conf, string personal)
- Use a personal dictionary for this config */
-PHP_FUNCTION(pspell_config_personal)
-{
+static int pspell_config_path( INTERNAL_FUNCTION_PARAMETERS, char *option ) {
int type;
- zval **sccin, **personal;
+ zval **sccin, **value;
int argc;
PspellConfig *config;
argc = ZEND_NUM_ARGS();
- if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&personal) == FAILURE) {
+ if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&value) == FAILURE) {
WRONG_PARAM_COUNT;
}
@@ -825,20 +824,45 @@ PHP_FUNCTION(pspell_config_personal)
RETURN_FALSE;
}
- convert_to_string_ex(personal);
+ convert_to_string_ex(value);
- if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(personal), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
+ if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(value), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
RETURN_FALSE;
}
- if (php_check_open_basedir(Z_STRVAL_PP(personal) TSRMLS_CC)) {
+ if (php_check_open_basedir(Z_STRVAL_PP(value) TSRMLS_CC)) {
RETURN_FALSE;
}
- pspell_config_replace(config, "personal", Z_STRVAL_PP(personal));
+ pspell_config_replace(config, option, Z_STRVAL_PP(value));
RETURN_TRUE;
}
+
+/* {{{ proto bool pspell_config_personal(int conf, string personal)
+ Use a personal dictionary for this config */
+PHP_FUNCTION(pspell_config_personal)
+{
+ pspell_config_path( INTERNAL_FUNCTION_PARAM_PASSTHRU, "personal");
+}
+/* }}} */
+
+/* {{{ proto bool pspell_config_dict_dir(int conf, string directory)
+
+ location of the main word list */
+PHP_FUNCTION(pspell_config_dict_dir)
+{
+ pspell_config_path( INTERNAL_FUNCTION_PARAM_PASSTHRU, "dict-dir");
+}
+
+/* }}} */
+
+/* {{{ proto bool pspell_config_data_dir(int conf, string directory)
+ location of language data files */
+PHP_FUNCTION(pspell_config_data_dir)
+{
+ pspell_config_path( INTERNAL_FUNCTION_PARAM_PASSTHRU, "data-dir");
+}
/* }}} */
/* {{{ proto bool pspell_config_repl(int conf, string repl)