@@ -68,6 +68,8 @@ function_entry pspell_functions[] = {
68
68
PHP_FE (pspell_config_mode , NULL )
69
69
PHP_FE (pspell_config_ignore , NULL )
70
70
PHP_FE (pspell_config_personal , NULL )
71
+ PHP_FE (pspell_config_dict_dir , NULL )
72
+ PHP_FE (pspell_config_data_dir , NULL )
71
73
PHP_FE (pspell_config_repl , NULL )
72
74
PHP_FE (pspell_config_save_repl , NULL )
73
75
{NULL , NULL , NULL }
@@ -803,18 +805,15 @@ PHP_FUNCTION(pspell_config_ignore)
803
805
}
804
806
/* }}} */
805
807
806
- /* {{{ proto bool pspell_config_personal(int conf, string personal)
807
- Use a personal dictionary for this config */
808
- PHP_FUNCTION (pspell_config_personal )
809
- {
808
+ static int pspell_config_path ( INTERNAL_FUNCTION_PARAMETERS , char * option ) {
810
809
int type ;
811
- zval * * sccin , * * personal ;
810
+ zval * * sccin , * * value ;
812
811
int argc ;
813
812
814
813
PspellConfig * config ;
815
814
816
815
argc = ZEND_NUM_ARGS ();
817
- if (argc != 2 || zend_get_parameters_ex (argc ,& sccin ,& personal ) == FAILURE ) {
816
+ if (argc != 2 || zend_get_parameters_ex (argc ,& sccin ,& value ) == FAILURE ) {
818
817
WRONG_PARAM_COUNT ;
819
818
}
820
819
@@ -825,20 +824,45 @@ PHP_FUNCTION(pspell_config_personal)
825
824
RETURN_FALSE ;
826
825
}
827
826
828
- convert_to_string_ex (personal );
827
+ convert_to_string_ex (value );
829
828
830
- if (PG (safe_mode ) && (!php_checkuid (Z_STRVAL_PP (personal ), NULL , CHECKUID_CHECK_FILE_AND_DIR ))) {
829
+ if (PG (safe_mode ) && (!php_checkuid (Z_STRVAL_PP (value ), NULL , CHECKUID_CHECK_FILE_AND_DIR ))) {
831
830
RETURN_FALSE ;
832
831
}
833
832
834
- if (php_check_open_basedir (Z_STRVAL_PP (personal ) TSRMLS_CC )) {
833
+ if (php_check_open_basedir (Z_STRVAL_PP (value ) TSRMLS_CC )) {
835
834
RETURN_FALSE ;
836
835
}
837
836
838
- pspell_config_replace (config , "personal" , Z_STRVAL_PP (personal ));
837
+ pspell_config_replace (config , option , Z_STRVAL_PP (value ));
839
838
840
839
RETURN_TRUE ;
841
840
}
841
+
842
+ /* {{{ proto bool pspell_config_personal(int conf, string personal)
843
+ Use a personal dictionary for this config */
844
+ PHP_FUNCTION (pspell_config_personal )
845
+ {
846
+ pspell_config_path ( INTERNAL_FUNCTION_PARAM_PASSTHRU , "personal" );
847
+ }
848
+ /* }}} */
849
+
850
+ /* {{{ proto bool pspell_config_dict_dir(int conf, string directory)
851
+
852
+ location of the main word list */
853
+ PHP_FUNCTION (pspell_config_dict_dir )
854
+ {
855
+ pspell_config_path ( INTERNAL_FUNCTION_PARAM_PASSTHRU , "dict-dir" );
856
+ }
857
+
858
+ /* }}} */
859
+
860
+ /* {{{ proto bool pspell_config_data_dir(int conf, string directory)
861
+ location of language data files */
862
+ PHP_FUNCTION (pspell_config_data_dir )
863
+ {
864
+ pspell_config_path ( INTERNAL_FUNCTION_PARAM_PASSTHRU , "data-dir" );
865
+ }
842
866
/* }}} */
843
867
844
868
/* {{{ proto bool pspell_config_repl(int conf, string repl)
0 commit comments