php_embed 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/php_embed/php.c +22 -0
- data/lib/php_embed/version.rb +1 -1
- data/spec/php_spec.rb +6 -0
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14fb3fbcb633dcb0fd5b4753668a4f6ef34a68a0
|
4
|
+
data.tar.gz: 5ab251e93350e4f83b1d75aacc9f87e6ad9b2dd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45b9d53bb7d5fbeda3bfa4af3e9b219dbc04b6d9b139932fe25b83de071b9ecdee2be59311f94bae1723f54cc4aaa673935b62bc224b1eb3d43d6e87e54abad4
|
7
|
+
data.tar.gz: 1439b3a71a587f6a38cff17850cbc6ed2917d40565c82a676a93a87b6b71c054a2743425025308ed8dff70e9bafefcb2a817ba574228b62e413654c90b9aa0a4
|
data/ext/php_embed/php.c
CHANGED
@@ -77,6 +77,25 @@ VALUE php_eval(VALUE self, VALUE code) {
|
|
77
77
|
return Qnil;
|
78
78
|
}
|
79
79
|
|
80
|
+
VALUE php_const(VALUE self, VALUE name) {
|
81
|
+
|
82
|
+
int ret = 0, name_len;
|
83
|
+
char * name_c = StringValuePtr(name);
|
84
|
+
zval c;
|
85
|
+
VALUE retval = Qnil;
|
86
|
+
|
87
|
+
name_len = strlen(name_c);
|
88
|
+
|
89
|
+
zend_try {
|
90
|
+
if (zend_get_constant_ex(name_c, name_len, &c, NULL, ZEND_FETCH_CLASS_SILENT TSRMLS_CC)) {
|
91
|
+
retval = new_php_embed_value(&c);
|
92
|
+
}
|
93
|
+
} zend_catch {
|
94
|
+
|
95
|
+
} zend_end_try();
|
96
|
+
|
97
|
+
return retval;
|
98
|
+
}
|
80
99
|
|
81
100
|
zend_function *php_find_function(char *name) {
|
82
101
|
char *lcname;
|
@@ -225,6 +244,8 @@ VALUE php_set_error_handler(VALUE self, VALUE callback) {
|
|
225
244
|
return Qnil;
|
226
245
|
}
|
227
246
|
|
247
|
+
|
248
|
+
|
228
249
|
void initialize_php_embed() {
|
229
250
|
const char *argv[2] = {"ruby", NULL};
|
230
251
|
php_embed_init(1, (char **)argv PTSRMLS_CC);
|
@@ -242,6 +263,7 @@ Init_php() {
|
|
242
263
|
|
243
264
|
rb_define_singleton_method(mPhpEmbed, "eval", php_eval, 1);
|
244
265
|
rb_define_singleton_method(mPhpEmbed, "call", php_call, -1);
|
266
|
+
rb_define_singleton_method(mPhpEmbed, "const", php_const, 1);
|
245
267
|
rb_define_singleton_method(mPhpEmbed, "require", php_require, 1);
|
246
268
|
rb_define_singleton_method(mPhpEmbed, "fetchVariable", php_fetch_variable, 1);
|
247
269
|
rb_define_singleton_method(mPhpEmbed, "setOutputHandler", php_set_output_handler, 1);
|
data/lib/php_embed/version.rb
CHANGED
data/spec/php_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: php_embed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- do_aki
|
@@ -14,28 +14,28 @@ dependencies:
|
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: execute PHP code in Ruby code
|
@@ -46,7 +46,7 @@ extensions:
|
|
46
46
|
- ext/php_embed/extconf.rb
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
|
-
- .gitignore
|
49
|
+
- ".gitignore"
|
50
50
|
- Gemfile
|
51
51
|
- LICENSE
|
52
52
|
- README.md
|
@@ -75,17 +75,17 @@ require_paths:
|
|
75
75
|
- ext
|
76
76
|
required_ruby_version: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
|
-
- -
|
78
|
+
- - ">="
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
|
-
- -
|
83
|
+
- - ">="
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '0'
|
86
86
|
requirements: []
|
87
87
|
rubyforge_project:
|
88
|
-
rubygems_version: 2.
|
88
|
+
rubygems_version: 2.2.2
|
89
89
|
signing_key:
|
90
90
|
specification_version: 4
|
91
91
|
summary: execute PHP code in Ruby code
|
@@ -93,4 +93,3 @@ test_files:
|
|
93
93
|
- spec/php_spec.rb
|
94
94
|
- spec/require.php
|
95
95
|
- spec/value_spec.rb
|
96
|
-
has_rdoc:
|