本文整理汇总了C++中zephir_check_call_status函数的典型用法代码示例。如果您正苦于以下问题:C++ zephir_check_call_status函数的具体用法?C++ zephir_check_call_status怎么用?C++ zephir_check_call_status使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zephir_check_call_status函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
//.........这里部分代码省略.........
ZVAL_UNDEF(&_39$$9);
ZVAL_UNDEF(&_40$$9);
ZVAL_UNDEF(&_41$$9);
ZVAL_UNDEF(&_43$$10);
ZVAL_UNDEF(&_44$$13);
ZVAL_UNDEF(&_45$$13);
ZVAL_UNDEF(&_46$$15);
ZVAL_UNDEF(&_47$$15);
ZVAL_UNDEF(&_48$$15);
ZVAL_UNDEF(&_52$$16);
ZVAL_UNDEF(&_53$$16);
ZVAL_UNDEF(&_54$$16);
ZVAL_UNDEF(&_61$$16);
ZVAL_UNDEF(&_55$$17);
ZVAL_UNDEF(&_56$$18);
ZVAL_UNDEF(&_58$$20);
ZVAL_UNDEF(&_59$$20);
ZVAL_UNDEF(&_60$$20);
ZVAL_UNDEF(&_62$$21);
ZVAL_UNDEF(&_63$$22);
ZVAL_UNDEF(&_65$$23);
ZVAL_UNDEF(&_66$$23);
ZVAL_UNDEF(&_67$$23);
ZEPHIR_MM_GROW();
zephir_get_global(&_FILES, SL("_FILES"));
zephir_get_global(&_POST, SL("_POST"));
zephir_get_global(&_SERVER, SL("_SERVER"));
zephir_fetch_params(1, 2, 0, &validation, &field);
ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&label, this_ptr, "preparelabel", NULL, 0, validation, field);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&code, this_ptr, "preparecode", NULL, 0, field);
zephir_check_call_status();
zephir_array_fetch_string(&_0, _SERVER, SL("REQUEST_METHOD"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 103 TSRMLS_CC);
_1 = ZEPHIR_IS_STRING(&_0, "POST");
if (_1) {
_1 = ZEPHIR_IS_EMPTY(_POST);
}
_2 = _1;
if (_2) {
_2 = ZEPHIR_IS_EMPTY(_FILES);
}
_3 = _2;
if (_3) {
zephir_array_fetch_string(&_4, _SERVER, SL("CONTENT_LENGTH"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 103 TSRMLS_CC);
_3 = ZEPHIR_GT_LONG(&_4, 0);
}
_5 = _3;
if (!(_5)) {
_6 = zephir_array_isset_string(&value, SL("error"));
if (_6) {
zephir_array_fetch_string(&_7, &value, SL("error"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 103 TSRMLS_CC);
_6 = ZEPHIR_IS_LONG_IDENTICAL(&_7, 1);
}
_5 = _6;
}
if (_5) {
ZEPHIR_INIT_VAR(&_8$$3);
ZVAL_STRING(&_8$$3, "FileIniSize");
ZEPHIR_INIT_VAR(&_9$$3);
ZVAL_STRING(&_9$$3, "messageIniSize");
示例2: PHP_METHOD
/**
* Renders a view
*
* @param string path
* @param array params
*/
PHP_METHOD(Phalcon_Mvc_View_Simple, render) {
zend_bool _3$$12;
zend_long ZEPHIR_LAST_CALL_STATUS;
zval *path_param = NULL, *params = NULL, *cache = NULL, *key = NULL, *lifetime = NULL, *cacheOptions = NULL, *content = NULL, *viewParams = NULL, *mergedParams = NULL, *_1, *_0$$3 = NULL, *_2$$12 = NULL, *_4$$12 = NULL;
zval *path = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &path_param, ¶ms);
if (UNEXPECTED(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (EXPECTED(Z_TYPE_P(path_param) == IS_STRING)) {
zephir_get_strval(path, path_param);
} else {
ZEPHIR_INIT_VAR(path);
ZVAL_EMPTY_STRING(path);
}
if (!params) {
params = ZEPHIR_GLOBAL(global_null);
}
ZEPHIR_CALL_METHOD(&cache, this_ptr, "getcache", NULL, 0);
zephir_check_call_status();
if (Z_TYPE_P(cache) == IS_OBJECT) {
ZEPHIR_CALL_METHOD(&_0$$3, cache, "isstarted", NULL, 0);
zephir_check_call_status();
if (ZEPHIR_IS_FALSE_IDENTICAL(_0$$3)) {
ZEPHIR_INIT_VAR(key);
ZVAL_NULL(key);
ZEPHIR_INIT_VAR(lifetime);
ZVAL_NULL(lifetime);
ZEPHIR_OBS_VAR(cacheOptions);
zephir_read_property_this(&cacheOptions, this_ptr, SL("_cacheOptions"), PH_NOISY_CC);
if (Z_TYPE_P(cacheOptions) == IS_ARRAY) {
ZEPHIR_OBS_NVAR(key);
zephir_array_isset_string_fetch(&key, cacheOptions, SS("key"), 0 TSRMLS_CC);
ZEPHIR_OBS_NVAR(lifetime);
zephir_array_isset_string_fetch(&lifetime, cacheOptions, SS("lifetime"), 0 TSRMLS_CC);
}
if (Z_TYPE_P(key) == IS_NULL) {
ZEPHIR_INIT_NVAR(key);
zephir_md5(key, path);
}
ZEPHIR_CALL_METHOD(&content, cache, "start", NULL, 0, key, lifetime);
zephir_check_call_status();
if (Z_TYPE_P(content) != IS_NULL) {
zephir_update_property_this(getThis(), SL("_content"), content TSRMLS_CC);
RETURN_CCTOR(content);
}
}
}
ZEPHIR_INIT_VAR(_1);
zephir_create_symbol_table(TSRMLS_C);
ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 134);
zephir_check_call_status();
ZEPHIR_OBS_VAR(viewParams);
zephir_read_property_this(&viewParams, this_ptr, SL("_viewParams"), PH_NOISY_CC);
if (Z_TYPE_P(params) == IS_ARRAY) {
if (Z_TYPE_P(viewParams) == IS_ARRAY) {
ZEPHIR_INIT_VAR(mergedParams);
zephir_fast_array_merge(mergedParams, &(viewParams), &(params) TSRMLS_CC);
} else {
ZEPHIR_CPY_WRT(mergedParams, params);
}
} else {
ZEPHIR_CPY_WRT(mergedParams, viewParams);
}
ZEPHIR_CALL_METHOD(NULL, this_ptr, "_internalrender", NULL, 412, path, mergedParams);
zephir_check_call_status();
if (Z_TYPE_P(cache) == IS_OBJECT) {
ZEPHIR_CALL_METHOD(&_2$$12, cache, "isstarted", NULL, 0);
zephir_check_call_status();
_3$$12 = zephir_is_true(_2$$12);
if (_3$$12) {
ZEPHIR_CALL_METHOD(&_4$$12, cache, "isfresh", NULL, 0);
zephir_check_call_status();
_3$$12 = zephir_is_true(_4$$12);
}
if (_3$$12) {
ZEPHIR_CALL_METHOD(NULL, cache, "save", NULL, 0);
zephir_check_call_status();
} else {
ZEPHIR_CALL_METHOD(NULL, cache, "stop", NULL, 0);
zephir_check_call_status();
}
}
ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 136);
zephir_check_call_status();
RETURN_MM_MEMBER(getThis(), "_content");
//.........这里部分代码省略.........
示例3: PHP_METHOD
/**
* The plural version of gettext().
* Some languages have more than one form for plural messages dependent on the count.
*/
PHP_METHOD(Phalcon_Translate_Adapter_Gettext, nquery) {
zend_long count, ZEPHIR_LAST_CALL_STATUS;
zval *msgid1_param = NULL, *msgid2_param = NULL, *count_param = NULL, *placeholders = NULL, *domain_param = NULL, *translation = NULL, _0$$3, _1$$4;
zval *msgid1 = NULL, *msgid2 = NULL, *domain = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 3, 2, &msgid1_param, &msgid2_param, &count_param, &placeholders, &domain_param);
if (UNEXPECTED(Z_TYPE_P(msgid1_param) != IS_STRING && Z_TYPE_P(msgid1_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'msgid1' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (EXPECTED(Z_TYPE_P(msgid1_param) == IS_STRING)) {
zephir_get_strval(msgid1, msgid1_param);
} else {
ZEPHIR_INIT_VAR(msgid1);
ZVAL_EMPTY_STRING(msgid1);
}
if (UNEXPECTED(Z_TYPE_P(msgid2_param) != IS_STRING && Z_TYPE_P(msgid2_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'msgid2' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (EXPECTED(Z_TYPE_P(msgid2_param) == IS_STRING)) {
zephir_get_strval(msgid2, msgid2_param);
} else {
ZEPHIR_INIT_VAR(msgid2);
ZVAL_EMPTY_STRING(msgid2);
}
if (UNEXPECTED(Z_TYPE_P(count_param) != IS_LONG)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'count' must be a int") TSRMLS_CC);
RETURN_MM_NULL();
}
count = Z_LVAL_P(count_param);
if (!placeholders) {
placeholders = ZEPHIR_GLOBAL(global_null);
}
if (!domain_param) {
ZEPHIR_INIT_VAR(domain);
ZVAL_EMPTY_STRING(domain);
} else {
if (UNEXPECTED(Z_TYPE_P(domain_param) != IS_STRING && Z_TYPE_P(domain_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'domain' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (EXPECTED(Z_TYPE_P(domain_param) == IS_STRING)) {
zephir_get_strval(domain, domain_param);
} else {
ZEPHIR_INIT_VAR(domain);
ZVAL_EMPTY_STRING(domain);
}
}
if (!(!(!domain) && Z_STRLEN_P(domain))) {
ZEPHIR_SINIT_VAR(_0$$3);
ZVAL_LONG(&_0$$3, count);
ZEPHIR_CALL_FUNCTION(&translation, "ngettext", NULL, 470, msgid1, msgid2, &_0$$3);
zephir_check_call_status();
} else {
ZEPHIR_SINIT_VAR(_1$$4);
ZVAL_LONG(&_1$$4, count);
ZEPHIR_CALL_FUNCTION(&translation, "dngettext", NULL, 471, domain, msgid1, msgid2, &_1$$4);
zephir_check_call_status();
}
ZEPHIR_RETURN_CALL_METHOD(this_ptr, "replaceplaceholders", NULL, 0, translation, placeholders);
zephir_check_call_status();
RETURN_MM();
}
示例4: PHP_METHOD
/**
* Matches a user submitted path with a previously defined route.
* Assigns and returns an array of defaults on a successful match.
*
* @param string $path Path used to match against this routing map
* @return array|false An array of assigned values or a false on a mismatch
*/
PHP_METHOD(Yaf_Route_Rewrite, route) {
zephir_nts_static zephir_fcall_cache_entry *_3 = NULL, *_6 = NULL;
zend_bool _0, _1;
int ZEPHIR_LAST_CALL_STATUS;
zval *request, *requestUri = NULL, *baseuri = NULL, *path = NULL, *values = NULL, *_2 = NULL, _4 = zval_used_for_init, *_5 = NULL, *_7, *_8, *_9, *_10;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &request);
ZEPHIR_CALL_METHOD(&requestUri, request, "getrequesturi", NULL);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&baseuri, request, "getbaseuri", NULL);
zephir_check_call_status();
_0 = !ZEPHIR_IS_STRING(requestUri, "");
if (_0) {
_0 = !ZEPHIR_IS_STRING(baseuri, "");
}
_1 = _0;
if (_1) {
ZEPHIR_CALL_FUNCTION(&_2, "stripos", &_3, requestUri, baseuri);
zephir_check_call_status();
_1 = !ZEPHIR_IS_FALSE_IDENTICAL(_2);
}
if (_1) {
ZEPHIR_SINIT_VAR(_4);
ZVAL_LONG(&_4, zephir_fast_strlen_ev(baseuri));
ZEPHIR_INIT_VAR(path);
zephir_substr(path, requestUri, zephir_get_intval(&_4), 0, ZEPHIR_SUBSTR_NO_LENGTH);
} else {
ZEPHIR_CPY_WRT(path, requestUri);
}
ZEPHIR_INIT_NVAR(path);
ZEPHIR_CALL_FUNCTION(&_5, "urldecode", &_6, path);
zephir_check_call_status();
ZEPHIR_SINIT_NVAR(_4);
ZVAL_STRING(&_4, "/", 0);
zephir_fast_trim(path, _5, &_4, ZEPHIR_TRIM_BOTH TSRMLS_CC);
ZEPHIR_CALL_METHOD(&values, this_ptr, "_match", NULL, path);
zephir_check_call_status();
if (Z_TYPE_P(values) == IS_NULL) {
RETURN_MM_BOOL(0);
}
_7 = zephir_fetch_nproperty_this(this_ptr, SL("_default"), PH_NOISY_CC);
if (zephir_array_isset_string(_7, SS("module"))) {
_8 = zephir_fetch_nproperty_this(this_ptr, SL("_default"), PH_NOISY_CC);
zephir_array_fetch_string(&_9, _8, SL("module"), PH_NOISY | PH_READONLY, "yaf/Route/rewrite.zep", 77 TSRMLS_CC);
ZEPHIR_CALL_METHOD(NULL, request, "setmodulename", NULL, _9);
zephir_check_call_status();
}
_8 = zephir_fetch_nproperty_this(this_ptr, SL("_default"), PH_NOISY_CC);
if (zephir_array_isset_string(_8, SS("controller"))) {
_10 = zephir_fetch_nproperty_this(this_ptr, SL("_default"), PH_NOISY_CC);
zephir_array_fetch_string(&_9, _10, SL("controller"), PH_NOISY | PH_READONLY, "yaf/Route/rewrite.zep", 81 TSRMLS_CC);
ZEPHIR_CALL_METHOD(NULL, request, "setcontrollername", NULL, _9);
zephir_check_call_status();
}
_8 = zephir_fetch_nproperty_this(this_ptr, SL("_default"), PH_NOISY_CC);
if (zephir_array_isset_string(_8, SS("action"))) {
_10 = zephir_fetch_nproperty_this(this_ptr, SL("_default"), PH_NOISY_CC);
zephir_array_fetch_string(&_9, _10, SL("action"), PH_NOISY | PH_READONLY, "yaf/Route/rewrite.zep", 85 TSRMLS_CC);
ZEPHIR_CALL_METHOD(NULL, request, "setactionname", NULL, _9);
zephir_check_call_status();
}
ZEPHIR_CALL_METHOD(NULL, request, "setparam", NULL, values);
zephir_check_call_status();
RETURN_MM_BOOL(1);
}
示例5: PHP_METHOD
/**
* Changes the fetching mode affecting Phalcon\Db\Result\Pdo::fetch()
*
*<code>
* //Return array with integer indexes
* $result->setFetchMode(\Phalcon\Db::FETCH_NUM);
*
* //Return associative array without integer indexes
* $result->setFetchMode(\Phalcon\Db::FETCH_ASSOC);
*
* //Return associative array together with integer indexes
* $result->setFetchMode(\Phalcon\Db::FETCH_BOTH);
*
* //Return an object
* $result->setFetchMode(\Phalcon\Db::FETCH_OBJ);
*</code>
*/
PHP_METHOD(Phalcon_Db_Result_Pdo, setFetchMode) {
zval *fetchMode_param = NULL, *colNoOrClassNameOrObject = NULL, *ctorargs = NULL, *pdoStatement = NULL, *_9 = NULL, *_10, *_0$$3 = NULL, *_1$$3, *_2$$4, *_3$$5 = NULL, *_4$$5, *_5$$6, *_6$$7 = NULL, *_7$$7, *_8$$8, *_11$$9;
int fetchMode, ZEPHIR_LAST_CALL_STATUS;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 2, &fetchMode_param, &colNoOrClassNameOrObject, &ctorargs);
fetchMode = zephir_get_intval(fetchMode_param);
if (!colNoOrClassNameOrObject) {
colNoOrClassNameOrObject = ZEPHIR_GLOBAL(global_null);
}
if (!ctorargs) {
ctorargs = ZEPHIR_GLOBAL(global_null);
}
ZEPHIR_OBS_VAR(pdoStatement);
zephir_read_property_this(&pdoStatement, this_ptr, SL("_pdoStatement"), PH_NOISY_CC);
if (fetchMode == 8) {
ZEPHIR_INIT_VAR(_1$$3);
ZVAL_LONG(_1$$3, fetchMode);
ZEPHIR_CALL_METHOD(&_0$$3, pdoStatement, "setfetchmode", NULL, 0, _1$$3, colNoOrClassNameOrObject, ctorargs);
zephir_check_call_status();
if (zephir_is_true(_0$$3)) {
ZEPHIR_INIT_ZVAL_NREF(_2$$4);
ZVAL_LONG(_2$$4, fetchMode);
zephir_update_property_this(this_ptr, SL("_fetchMode"), _2$$4 TSRMLS_CC);
RETURN_MM_BOOL(1);
}
RETURN_MM_BOOL(0);
}
if (fetchMode == 9) {
ZEPHIR_INIT_VAR(_4$$5);
ZVAL_LONG(_4$$5, fetchMode);
ZEPHIR_CALL_METHOD(&_3$$5, pdoStatement, "setfetchmode", NULL, 0, _4$$5, colNoOrClassNameOrObject);
zephir_check_call_status();
if (zephir_is_true(_3$$5)) {
ZEPHIR_INIT_ZVAL_NREF(_5$$6);
ZVAL_LONG(_5$$6, fetchMode);
zephir_update_property_this(this_ptr, SL("_fetchMode"), _5$$6 TSRMLS_CC);
RETURN_MM_BOOL(1);
}
RETURN_MM_BOOL(0);
}
if (fetchMode == 7) {
ZEPHIR_INIT_VAR(_7$$7);
ZVAL_LONG(_7$$7, fetchMode);
ZEPHIR_CALL_METHOD(&_6$$7, pdoStatement, "setfetchmode", NULL, 0, _7$$7, colNoOrClassNameOrObject);
zephir_check_call_status();
if (zephir_is_true(_6$$7)) {
ZEPHIR_INIT_ZVAL_NREF(_8$$8);
ZVAL_LONG(_8$$8, fetchMode);
zephir_update_property_this(this_ptr, SL("_fetchMode"), _8$$8 TSRMLS_CC);
RETURN_MM_BOOL(1);
}
RETURN_MM_BOOL(0);
}
ZEPHIR_INIT_VAR(_10);
ZVAL_LONG(_10, fetchMode);
ZEPHIR_CALL_METHOD(&_9, pdoStatement, "setfetchmode", NULL, 0, _10);
zephir_check_call_status();
if (zephir_is_true(_9)) {
ZEPHIR_INIT_ZVAL_NREF(_11$$9);
ZVAL_LONG(_11$$9, fetchMode);
zephir_update_property_this(this_ptr, SL("_fetchMode"), _11$$9 TSRMLS_CC);
RETURN_MM_BOOL(1);
}
RETURN_MM_BOOL(0);
}
示例6: PHP_METHOD
/**
* Reconfigure the route adding a new pattern and a set of paths
*
* @param string pattern
* @param array paths
*/
PHP_METHOD(Test_Router_Route, reConfigure) {
int _0, ZEPHIR_LAST_CALL_STATUS;
zval *pattern, *paths = NULL, *moduleName = NULL, *controllerName = NULL, *actionName = NULL, *parts, *routePaths = NULL, *realClassName = NULL, *namespaceName, *pcrePattern = NULL, *compiledPattern = NULL, *extracted = NULL, *_1 = NULL, *_2;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &pattern, &paths);
if (!paths) {
paths = ZEPHIR_GLOBAL(global_null);
}
if (Z_TYPE_P(pattern) != IS_STRING) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(test_router_exception_ce, "The pattern must be string", "test/router/route.zep", 270);
return;
}
if (Z_TYPE_P(paths) != IS_NULL) {
if (Z_TYPE_P(paths) == IS_STRING) {
ZEPHIR_INIT_VAR(moduleName);
ZVAL_NULL(moduleName);
ZEPHIR_INIT_VAR(controllerName);
ZVAL_NULL(controllerName);
ZEPHIR_INIT_VAR(actionName);
ZVAL_NULL(actionName);
ZEPHIR_INIT_VAR(parts);
zephir_fast_explode_str(parts, SL("::"), paths, LONG_MAX TSRMLS_CC);
do {
_0 = zephir_fast_count_int(parts TSRMLS_CC);
if (_0 == 3) {
ZEPHIR_OBS_NVAR(moduleName);
zephir_array_fetch_long(&moduleName, parts, 0, PH_NOISY, "test/router/route.zep", 286 TSRMLS_CC);
ZEPHIR_OBS_NVAR(controllerName);
zephir_array_fetch_long(&controllerName, parts, 1, PH_NOISY, "test/router/route.zep", 287 TSRMLS_CC);
ZEPHIR_OBS_NVAR(actionName);
zephir_array_fetch_long(&actionName, parts, 2, PH_NOISY, "test/router/route.zep", 288 TSRMLS_CC);
break;
}
if (_0 == 2) {
ZEPHIR_OBS_NVAR(controllerName);
zephir_array_fetch_long(&controllerName, parts, 0, PH_NOISY, "test/router/route.zep", 291 TSRMLS_CC);
ZEPHIR_OBS_NVAR(actionName);
zephir_array_fetch_long(&actionName, parts, 1, PH_NOISY, "test/router/route.zep", 292 TSRMLS_CC);
break;
}
if (_0 == 1) {
ZEPHIR_OBS_NVAR(controllerName);
zephir_array_fetch_long(&controllerName, parts, 0, PH_NOISY, "test/router/route.zep", 295 TSRMLS_CC);
break;
}
} while(0);
ZEPHIR_INIT_VAR(routePaths);
array_init(routePaths);
if (Z_TYPE_P(moduleName) != IS_NULL) {
zephir_array_update_string(&routePaths, SL("module"), &moduleName, PH_COPY | PH_SEPARATE);
}
if (Z_TYPE_P(controllerName) != IS_NULL) {
if (zephir_memnstr_str(controllerName, SL("\\"), "test/router/route.zep", 310)) {
ZEPHIR_INIT_VAR(realClassName);
zephir_get_class_ns(realClassName, controllerName, 0 TSRMLS_CC);
ZEPHIR_INIT_VAR(namespaceName);
zephir_get_ns_class(namespaceName, controllerName, 0 TSRMLS_CC);
if (zephir_is_true(namespaceName)) {
zephir_array_update_string(&routePaths, SL("namespace"), &namespaceName, PH_COPY | PH_SEPARATE);
}
} else {
ZEPHIR_CPY_WRT(realClassName, controllerName);
}
ZEPHIR_INIT_VAR(_1);
zephir_uncamelize(_1, realClassName);
zephir_array_update_string(&routePaths, SL("controller"), &_1, PH_COPY | PH_SEPARATE);
}
if (Z_TYPE_P(actionName) != IS_NULL) {
zephir_array_update_string(&routePaths, SL("action"), &actionName, PH_COPY | PH_SEPARATE);
}
} else {
ZEPHIR_CPY_WRT(routePaths, paths);
}
} else {
ZEPHIR_INIT_NVAR(routePaths);
array_init(routePaths);
}
if (Z_TYPE_P(routePaths) != IS_ARRAY) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(test_router_exception_ce, "The route contains invalid paths", "test/router/route.zep", 342);
return;
}
if (!(zephir_start_with_str(pattern, SL("#")))) {
if (zephir_memnstr_str(pattern, SL("{"), "test/router/route.zep", 348)) {
ZEPHIR_CALL_METHOD(&extracted, this_ptr, "extractnamedparams", NULL, pattern);
zephir_check_call_status();
ZEPHIR_OBS_VAR(pcrePattern);
zephir_array_fetch_long(&pcrePattern, extracted, 0, PH_NOISY, "test/router/route.zep", 351 TSRMLS_CC);
ZEPHIR_INIT_NVAR(_1);
//.........这里部分代码省略.........
示例7: PHP_METHOD
/**
* Generates random text in accordance with the template
*
* <code>
* echo Phalcon\Text::dynamic("{Hi|Hello}, my name is a {Bob|Mark|Jon}!"); // Hi my name is a Bob
* echo Phalcon\Text::dynamic("{Hi|Hello}, my name is a {Bob|Mark|Jon}!"); // Hi my name is a Jon
* echo Phalcon\Text::dynamic("{Hi|Hello}, my name is a {Bob|Mark|Jon}!"); // Hello my name is a Bob
* </code>
*/
PHP_METHOD(Phalcon_Text, dynamic) {
int ZEPHIR_LAST_CALL_STATUS;
zephir_fcall_cache_entry *_1 = NULL, *_5 = NULL, *_8 = NULL;
zval *text_param = NULL, *leftDelimiter_param = NULL, *rightDelimiter_param = NULL, *separator_param = NULL, *ldS = NULL, *rdS = NULL, *result = NULL, *pattern = NULL, *_0 = NULL, *_2 = NULL, *_3$$3, *_6$$4 = NULL, *_7$$4 = NULL;
zval *text = NULL, *leftDelimiter = NULL, *rightDelimiter = NULL, *separator = NULL, *_4$$3;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 3, &text_param, &leftDelimiter_param, &rightDelimiter_param, &separator_param);
if (unlikely(Z_TYPE_P(text_param) != IS_STRING && Z_TYPE_P(text_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'text' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(text_param) == IS_STRING)) {
zephir_get_strval(text, text_param);
} else {
ZEPHIR_INIT_VAR(text);
ZVAL_EMPTY_STRING(text);
}
if (!leftDelimiter_param) {
ZEPHIR_INIT_VAR(leftDelimiter);
ZVAL_STRING(leftDelimiter, "{", 1);
} else {
if (unlikely(Z_TYPE_P(leftDelimiter_param) != IS_STRING && Z_TYPE_P(leftDelimiter_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'leftDelimiter' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(leftDelimiter_param) == IS_STRING)) {
zephir_get_strval(leftDelimiter, leftDelimiter_param);
} else {
ZEPHIR_INIT_VAR(leftDelimiter);
ZVAL_EMPTY_STRING(leftDelimiter);
}
}
if (!rightDelimiter_param) {
ZEPHIR_INIT_VAR(rightDelimiter);
ZVAL_STRING(rightDelimiter, "}", 1);
} else {
if (unlikely(Z_TYPE_P(rightDelimiter_param) != IS_STRING && Z_TYPE_P(rightDelimiter_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'rightDelimiter' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(rightDelimiter_param) == IS_STRING)) {
zephir_get_strval(rightDelimiter, rightDelimiter_param);
} else {
ZEPHIR_INIT_VAR(rightDelimiter);
ZVAL_EMPTY_STRING(rightDelimiter);
}
}
if (!separator_param) {
ZEPHIR_INIT_VAR(separator);
ZVAL_STRING(separator, "|", 1);
} else {
if (unlikely(Z_TYPE_P(separator_param) != IS_STRING && Z_TYPE_P(separator_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'separator' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(separator_param) == IS_STRING)) {
zephir_get_strval(separator, separator_param);
} else {
ZEPHIR_INIT_VAR(separator);
ZVAL_EMPTY_STRING(separator);
}
}
ZEPHIR_CALL_FUNCTION(&_0, "substr_count", &_1, 420, text, leftDelimiter);
zephir_check_call_status();
ZEPHIR_CALL_FUNCTION(&_2, "substr_count", &_1, 420, text, rightDelimiter);
zephir_check_call_status();
if (!ZEPHIR_IS_IDENTICAL(_0, _2)) {
ZEPHIR_INIT_VAR(_3$$3);
object_init_ex(_3$$3, spl_ce_RuntimeException);
ZEPHIR_INIT_VAR(_4$$3);
ZEPHIR_CONCAT_SVS(_4$$3, "Syntax error in string \"", text, "\"");
ZEPHIR_CALL_METHOD(NULL, _3$$3, "__construct", NULL, 421, _4$$3);
zephir_check_call_status();
zephir_throw_exception_debug(_3$$3, "phalcon/text.zep", 261 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
ZEPHIR_CALL_FUNCTION(&ldS, "preg_quote", &_5, 422, leftDelimiter);
zephir_check_call_status();
ZEPHIR_CALL_FUNCTION(&rdS, "preg_quote", &_5, 422, rightDelimiter);
zephir_check_call_status();
ZEPHIR_INIT_VAR(pattern);
ZEPHIR_CONCAT_SVSVVSVS(pattern, "/", ldS, "([^", ldS, rdS, "]+)", rdS, "/");
ZEPHIR_CPY_WRT(result, text);
while (1) {
if (!(zephir_memnstr(result, leftDelimiter, "phalcon/text.zep", 269))) {
//.........这里部分代码省略.........
示例8: PHP_METHOD
/**
* Executes the validation
*/
PHP_METHOD(Phalcon_Validation_Validator_Callback, validate) {
zend_bool _1$$3;
zend_long ZEPHIR_LAST_CALL_STATUS;
zval *field = NULL;
zval *validation, *field_param = NULL, *message = NULL, *label = NULL, *replacePairs = NULL, *code = NULL, *callback = NULL, *returnedValue = NULL, *data = NULL, *_0, *_2$$6 = NULL, *_3$$6 = NULL, *_4$$6;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 2, 0, &validation, &field_param);
if (UNEXPECTED(Z_TYPE_P(field_param) != IS_STRING && Z_TYPE_P(field_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'field' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (EXPECTED(Z_TYPE_P(field_param) == IS_STRING)) {
zephir_get_strval(field, field_param);
} else {
ZEPHIR_INIT_VAR(field);
ZVAL_EMPTY_STRING(field);
}
ZEPHIR_INIT_VAR(_0);
ZVAL_STRING(_0, "callback", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&callback, this_ptr, "getoption", NULL, 0, _0);
zephir_check_temp_parameter(_0);
zephir_check_call_status();
if (zephir_is_callable(callback TSRMLS_CC)) {
ZEPHIR_CALL_METHOD(&data, validation, "getentity", NULL, 0);
zephir_check_call_status();
if (ZEPHIR_IS_EMPTY(data)) {
ZEPHIR_CALL_METHOD(&data, validation, "getdata", NULL, 0);
zephir_check_call_status();
}
ZEPHIR_CALL_FUNCTION(&returnedValue, "call_user_func", NULL, 403, callback, data);
zephir_check_call_status();
_1$$3 = Z_TYPE_P(returnedValue) == IS_OBJECT;
if (_1$$3) {
_1$$3 = zephir_instance_of_ev(returnedValue, phalcon_validation_validator_ce TSRMLS_CC);
}
if (Z_TYPE_P(returnedValue) == IS_BOOL) {
if (!(zephir_is_true(returnedValue))) {
ZEPHIR_CALL_METHOD(&label, this_ptr, "preparelabel", NULL, 0, validation, field);
zephir_check_call_status();
ZEPHIR_INIT_VAR(_2$$6);
ZVAL_STRING(_2$$6, "Callback", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&message, this_ptr, "preparemessage", NULL, 0, validation, field, _2$$6);
zephir_check_temp_parameter(_2$$6);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&code, this_ptr, "preparecode", NULL, 0, field);
zephir_check_call_status();
ZEPHIR_INIT_VAR(replacePairs);
zephir_create_array(replacePairs, 1, 0 TSRMLS_CC);
zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
ZEPHIR_INIT_NVAR(_2$$6);
object_init_ex(_2$$6, phalcon_validation_message_ce);
ZEPHIR_CALL_FUNCTION(&_3$$6, "strtr", NULL, 27, message, replacePairs);
zephir_check_call_status();
ZEPHIR_INIT_VAR(_4$$6);
ZVAL_STRING(_4$$6, "Callback", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(NULL, _2$$6, "__construct", NULL, 470, _3$$6, field, _4$$6, code);
zephir_check_temp_parameter(_4$$6);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _2$$6);
zephir_check_call_status();
RETURN_MM_BOOL(0);
}
RETURN_MM_BOOL(1);
} else if (_1$$3) {
ZEPHIR_RETURN_CALL_METHOD(returnedValue, "validate", NULL, 0, validation, field);
zephir_check_call_status();
RETURN_MM();
}
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_validator_exception_ce, "Callback must return boolean or Phalcon\\Validation\\Validator object", "phalcon/validation/validator/callback.zep", 114);
return;
}
RETURN_MM_BOOL(1);
}
示例9: PHP_METHOD
/**
* Executes the validation
*/
PHP_METHOD(Phalcon_Validation_Validator_StringLength, validate) {
zend_bool _1, _3;
zephir_fcall_cache_entry *_8 = NULL, *_10 = NULL;
int ZEPHIR_LAST_CALL_STATUS;
zval *field = NULL;
zval *validation, *field_param = NULL, *isSetMin = NULL, *isSetMax = NULL, *value = NULL, *length = NULL, *message = NULL, *minimum = NULL, *maximum = NULL, *label = NULL, *replacePairs = NULL, *_0 = NULL, *_2 = NULL, *_4$$8, *_5$$9 = NULL, *_7$$9 = NULL, *_9$$9, *_6$$10, *_11$$11, *_12$$12 = NULL, *_14$$12 = NULL, *_15$$12, *_13$$13;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 2, 0, &validation, &field_param);
if (unlikely(Z_TYPE_P(field_param) != IS_STRING && Z_TYPE_P(field_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'field' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(field_param) == IS_STRING)) {
zephir_get_strval(field, field_param);
} else {
ZEPHIR_INIT_VAR(field);
ZVAL_EMPTY_STRING(field);
}
ZEPHIR_INIT_VAR(_0);
ZVAL_STRING(_0, "min", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&isSetMin, this_ptr, "issetoption", NULL, 0, _0);
zephir_check_temp_parameter(_0);
zephir_check_call_status();
ZEPHIR_INIT_NVAR(_0);
ZVAL_STRING(_0, "max", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&isSetMax, this_ptr, "issetoption", NULL, 0, _0);
zephir_check_temp_parameter(_0);
zephir_check_call_status();
_1 = !zephir_is_true(isSetMin);
if (_1) {
_1 = !zephir_is_true(isSetMax);
}
if (_1) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_exception_ce, "A minimum or maximum must be set", "phalcon/validation/validator/stringlength.zep", 62);
return;
}
ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field);
zephir_check_call_status();
ZEPHIR_INIT_NVAR(_0);
ZVAL_STRING(_0, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&_2, this_ptr, "issetoption", NULL, 0, _0);
zephir_check_temp_parameter(_0);
zephir_check_call_status();
_3 = zephir_is_true(_2);
if (_3) {
_3 = ZEPHIR_IS_EMPTY(value);
}
if (_3) {
RETURN_MM_BOOL(1);
}
ZEPHIR_INIT_NVAR(_0);
ZVAL_STRING(_0, "label", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&label, this_ptr, "getoption", NULL, 0, _0);
zephir_check_temp_parameter(_0);
zephir_check_call_status();
if (ZEPHIR_IS_EMPTY(label)) {
ZEPHIR_CALL_METHOD(&label, validation, "getlabel", NULL, 0, field);
zephir_check_call_status();
}
if ((zephir_function_exists_ex(SS("mb_strlen") TSRMLS_CC) == SUCCESS)) {
ZEPHIR_CALL_FUNCTION(&length, "mb_strlen", NULL, 357, value);
zephir_check_call_status();
} else {
ZEPHIR_INIT_NVAR(length);
ZVAL_LONG(length, zephir_fast_strlen_ev(value));
}
if (zephir_is_true(isSetMax)) {
ZEPHIR_INIT_VAR(_4$$8);
ZVAL_STRING(_4$$8, "max", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&maximum, this_ptr, "getoption", NULL, 0, _4$$8);
zephir_check_temp_parameter(_4$$8);
zephir_check_call_status();
if (ZEPHIR_GT(length, maximum)) {
ZEPHIR_INIT_VAR(_5$$9);
ZVAL_STRING(_5$$9, "messageMaximum", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _5$$9);
zephir_check_temp_parameter(_5$$9);
zephir_check_call_status();
ZEPHIR_INIT_VAR(replacePairs);
zephir_create_array(replacePairs, 2, 0 TSRMLS_CC);
zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
zephir_array_update_string(&replacePairs, SL(":max"), &maximum, PH_COPY | PH_SEPARATE);
if (ZEPHIR_IS_EMPTY(message)) {
ZEPHIR_INIT_VAR(_6$$10);
ZVAL_STRING(_6$$10, "TooLong", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _6$$10);
zephir_check_temp_parameter(_6$$10);
zephir_check_call_status();
}
ZEPHIR_INIT_NVAR(_5$$9);
object_init_ex(_5$$9, phalcon_validation_message_ce);
ZEPHIR_CALL_FUNCTION(&_7$$9, "strtr", &_8, 55, message, replacePairs);
//.........这里部分代码省略.........
示例10: PHP_METHOD
/**
* Logs messages to the internal logger. Appends logs to the logger
*/
PHP_METHOD(Phalcon_Logger_Adapter, log) {
zend_bool _0, _1$$4;
zend_long ZEPHIR_LAST_CALL_STATUS;
zval *context = NULL;
zval *type, *message = NULL, *context_param = NULL, *timestamp = NULL, *toggledMessage = NULL, *toggledType = NULL, *_2, *_3$$8, *_4$$9;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 2, &type, &message, &context_param);
if (!message) {
message = ZEPHIR_GLOBAL(global_null);
}
if (!context_param) {
ZEPHIR_INIT_VAR(context);
array_init(context);
} else {
context = context_param;
}
_0 = Z_TYPE_P(type) == IS_STRING;
if (_0) {
_0 = Z_TYPE_P(message) == IS_LONG;
}
if (_0) {
ZEPHIR_CPY_WRT(toggledMessage, type);
ZEPHIR_CPY_WRT(toggledType, message);
} else {
_1$$4 = Z_TYPE_P(type) == IS_STRING;
if (_1$$4) {
_1$$4 = Z_TYPE_P(message) == IS_NULL;
}
if (_1$$4) {
ZEPHIR_CPY_WRT(toggledMessage, type);
ZEPHIR_CPY_WRT(toggledType, message);
} else {
ZEPHIR_CPY_WRT(toggledMessage, message);
ZEPHIR_CPY_WRT(toggledType, type);
}
}
if (Z_TYPE_P(toggledType) == IS_NULL) {
ZEPHIR_INIT_NVAR(toggledType);
ZVAL_LONG(toggledType, 7);
}
_2 = zephir_fetch_nproperty_this(this_ptr, SL("_logLevel"), PH_NOISY_CC);
if (ZEPHIR_GE(_2, toggledType)) {
ZEPHIR_INIT_VAR(timestamp);
zephir_time(timestamp);
_3$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_transaction"), PH_NOISY_CC);
if (zephir_is_true(_3$$8)) {
ZEPHIR_INIT_VAR(_4$$9);
object_init_ex(_4$$9, phalcon_logger_item_ce);
ZEPHIR_CALL_METHOD(NULL, _4$$9, "__construct", NULL, 23, toggledMessage, toggledType, timestamp, context);
zephir_check_call_status();
zephir_update_property_array_append(this_ptr, SL("_queue"), _4$$9 TSRMLS_CC);
} else {
ZEPHIR_CALL_METHOD(NULL, this_ptr, "loginternal", NULL, 0, toggledMessage, toggledType, timestamp, context);
zephir_check_call_status();
}
}
RETURN_THIS();
}
示例11: PHP_METHOD
/**
* Sets locale information
*
* <code>
* // Set locale to Dutch
* $gettext->setLocale(LC_ALL, "nl_NL");
*
* // Try different possible locale names for german
* $gettext->setLocale(LC_ALL, "[email protected]", "de_DE", "de", "ge");
* </code>
*/
PHP_METHOD(Phalcon_Translate_Adapter_Gettext, setLocale) {
zephir_fcall_cache_entry *_5 = NULL;
zval *locale = NULL;
zval *category_param = NULL, *locale_param = NULL, *_0, *_1 = NULL, _2, *_3, *_4, *_6, *_7, *_8, *_9, *_10, _11;
int category, ZEPHIR_LAST_CALL_STATUS;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 2, 0, &category_param, &locale_param);
if (unlikely(Z_TYPE_P(category_param) != IS_LONG)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'category' must be a int") TSRMLS_CC);
RETURN_MM_NULL();
}
category = Z_LVAL_P(category_param);
if (unlikely(Z_TYPE_P(locale_param) != IS_STRING && Z_TYPE_P(locale_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'locale' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(locale_param) == IS_STRING)) {
zephir_get_strval(locale, locale_param);
} else {
ZEPHIR_INIT_VAR(locale);
ZVAL_EMPTY_STRING(locale);
}
ZEPHIR_INIT_VAR(_0);
ZEPHIR_CALL_FUNCTION(&_1, "func_get_args", NULL, 176);
zephir_check_call_status();
ZEPHIR_SINIT_VAR(_2);
ZVAL_STRING(&_2, "setlocale", 0);
ZEPHIR_CALL_USER_FUNC_ARRAY(_0, &_2, _1);
zephir_check_call_status();
zephir_update_property_this(this_ptr, SL("_locale"), _0 TSRMLS_CC);
ZEPHIR_INIT_ZVAL_NREF(_3);
ZVAL_LONG(_3, category);
zephir_update_property_this(this_ptr, SL("_category"), _3 TSRMLS_CC);
_3 = zephir_fetch_nproperty_this(this_ptr, SL("_locale"), PH_NOISY_CC);
ZEPHIR_INIT_VAR(_4);
ZEPHIR_CONCAT_SV(_4, "LC_ALL=", _3);
ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 463, _4);
zephir_check_call_status();
_6 = zephir_fetch_nproperty_this(this_ptr, SL("_locale"), PH_NOISY_CC);
ZEPHIR_INIT_VAR(_7);
ZEPHIR_CONCAT_SV(_7, "LANG=", _6);
ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 463, _7);
zephir_check_call_status();
_8 = zephir_fetch_nproperty_this(this_ptr, SL("_locale"), PH_NOISY_CC);
ZEPHIR_INIT_VAR(_9);
ZEPHIR_CONCAT_SV(_9, "LANGUAGE=", _8);
ZEPHIR_CALL_FUNCTION(NULL, "putenv", &_5, 463, _9);
zephir_check_call_status();
_10 = zephir_fetch_nproperty_this(this_ptr, SL("_locale"), PH_NOISY_CC);
ZEPHIR_SINIT_VAR(_11);
ZVAL_LONG(&_11, 6);
ZEPHIR_CALL_FUNCTION(NULL, "setlocale", NULL, 442, &_11, _10);
zephir_check_call_status();
RETURN_MM_MEMBER(this_ptr, "_locale");
}
示例12: PHP_METHOD
/**
* Gets the column name in PostgreSQL
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, getColumnDefinition) {
zephir_nts_static zephir_fcall_cache_entry *_6 = NULL;
HashTable *_3;
HashPosition _2;
int ZEPHIR_LAST_CALL_STATUS;
zval *column, *size = NULL, *columnType = NULL, *columnSql, *typeValues = NULL, *_0 = NULL, *_1 = NULL, *value = NULL, *valueSql, **_4, _5 = zval_used_for_init, _7 = zval_used_for_init, *_8, *_9 = NULL, *_10 = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &column);
ZEPHIR_CALL_METHOD(&size, column, "getsize", NULL);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&columnType, column, "gettype", NULL);
zephir_check_call_status();
ZEPHIR_INIT_VAR(columnSql);
ZVAL_STRING(columnSql, "", 1);
if (Z_TYPE_P(columnType) == IS_STRING) {
zephir_concat_self(&columnSql, columnType TSRMLS_CC);
ZEPHIR_CALL_METHOD(&columnType, column, "gettypereference", NULL);
zephir_check_call_status();
}
do {
if (ZEPHIR_IS_LONG(columnType, 0)) {
if (ZEPHIR_IS_EMPTY(columnSql)) {
zephir_concat_self_str(&columnSql, SL("INT") TSRMLS_CC);
}
break;
}
if (ZEPHIR_IS_LONG(columnType, 1)) {
if (ZEPHIR_IS_EMPTY(columnSql)) {
zephir_concat_self_str(&columnSql, SL("DATE") TSRMLS_CC);
}
break;
}
if (ZEPHIR_IS_LONG(columnType, 2)) {
if (ZEPHIR_IS_EMPTY(columnSql)) {
zephir_concat_self_str(&columnSql, SL("CHARACTER VARYING") TSRMLS_CC);
}
ZEPHIR_INIT_VAR(_0);
ZEPHIR_CONCAT_SVS(_0, "(", size, ")");
zephir_concat_self(&columnSql, _0 TSRMLS_CC);
break;
}
if (ZEPHIR_IS_LONG(columnType, 3)) {
if (ZEPHIR_IS_EMPTY(columnSql)) {
zephir_concat_self_str(&columnSql, SL("NUMERIC") TSRMLS_CC);
}
ZEPHIR_CALL_METHOD(&_1, column, "getscale", NULL);
zephir_check_call_status();
ZEPHIR_INIT_LNVAR(_0);
ZEPHIR_CONCAT_SVSVS(_0, "(", size, ",", _1, ")");
zephir_concat_self(&columnSql, _0 TSRMLS_CC);
break;
}
if (ZEPHIR_IS_LONG(columnType, 4)) {
if (ZEPHIR_IS_EMPTY(columnSql)) {
zephir_concat_self_str(&columnSql, SL("TIMESTAMP") TSRMLS_CC);
}
break;
}
if (ZEPHIR_IS_LONG(columnType, 5)) {
if (ZEPHIR_IS_EMPTY(columnSql)) {
zephir_concat_self_str(&columnSql, SL("CHARACTER") TSRMLS_CC);
}
ZEPHIR_INIT_LNVAR(_0);
ZEPHIR_CONCAT_SVS(_0, "(", size, ")");
zephir_concat_self(&columnSql, _0 TSRMLS_CC);
break;
}
if (ZEPHIR_IS_LONG(columnType, 6)) {
if (ZEPHIR_IS_EMPTY(columnSql)) {
zephir_concat_self_str(&columnSql, SL("TEXT") TSRMLS_CC);
}
break;
}
if (ZEPHIR_IS_LONG(columnType, 7)) {
if (ZEPHIR_IS_EMPTY(columnSql)) {
zephir_concat_self_str(&columnSql, SL("FLOAT") TSRMLS_CC);
}
break;
}
if (ZEPHIR_IS_LONG(columnType, 8)) {
if (ZEPHIR_IS_EMPTY(columnSql)) {
zephir_concat_self_str(&columnSql, SL("SMALLINT(1)") TSRMLS_CC);
}
break;
}
if (ZEPHIR_IS_EMPTY(columnSql)) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Unrecognized PostgreSQL data type", "phalcon/db/dialect/postgresql.zep", 116);
return;
}
ZEPHIR_CALL_METHOD(&typeValues, column, "gettypevalues", NULL);
zephir_check_call_status();
if (!(ZEPHIR_IS_EMPTY(typeValues))) {
//.........这里部分代码省略.........
示例13: PHP_METHOD
/**
* Changes the fetching mode affecting Phalcon\Db\Result\Pdo::fetch()
*
*<code>
* //Return array with integer indexes
* $result->setFetchMode(Phalcon\Db::FETCH_NUM);
*
* //Return associative array without integer indexes
* $result->setFetchMode(Phalcon\Db::FETCH_ASSOC);
*
* //Return associative array together with integer indexes
* $result->setFetchMode(Phalcon\Db::FETCH_BOTH);
*
* //Return an object
* $result->setFetchMode(Phalcon\Db::FETCH_OBJ);
*</code>
*/
PHP_METHOD(Phalcon_Db_Result_Pdo, setFetchMode) {
zval *fetchMode_param = NULL, *colNoOrClassNameOrObject = NULL, *ctorargs = NULL, *pdoStatement, *_0 = NULL, *_1 = NULL, *_2;
int fetchMode, ZEPHIR_LAST_CALL_STATUS;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 2, &fetchMode_param, &colNoOrClassNameOrObject, &ctorargs);
fetchMode = zephir_get_intval(fetchMode_param);
if (!colNoOrClassNameOrObject) {
colNoOrClassNameOrObject = ZEPHIR_GLOBAL(global_null);
}
if (!ctorargs) {
ctorargs = ZEPHIR_GLOBAL(global_null);
}
ZEPHIR_OBS_VAR(pdoStatement);
zephir_read_property_this(&pdoStatement, this_ptr, SL("_pdoStatement"), PH_NOISY_CC);
if (((fetchMode & 7)) == 7) {
ZEPHIR_INIT_VAR(_1);
ZVAL_LONG(_1, fetchMode);
ZEPHIR_CALL_METHOD(&_0, pdoStatement, "setfetchmode", NULL, 0, _1, colNoOrClassNameOrObject);
zephir_check_call_status();
if (zephir_is_true(_0)) {
ZEPHIR_INIT_ZVAL_NREF(_2);
ZVAL_LONG(_2, fetchMode);
zephir_update_property_this(this_ptr, SL("_fetchMode"), _2 TSRMLS_CC);
RETURN_MM_BOOL(1);
}
RETURN_MM_BOOL(0);
}
if (((fetchMode & 8)) == 8) {
ZEPHIR_INIT_NVAR(_1);
ZVAL_LONG(_1, fetchMode);
ZEPHIR_CALL_METHOD(&_0, pdoStatement, "setfetchmode", NULL, 0, _1, colNoOrClassNameOrObject, ctorargs);
zephir_check_call_status();
if (zephir_is_true(_0)) {
ZEPHIR_INIT_ZVAL_NREF(_2);
ZVAL_LONG(_2, fetchMode);
zephir_update_property_this(this_ptr, SL("_fetchMode"), _2 TSRMLS_CC);
RETURN_MM_BOOL(1);
}
RETURN_MM_BOOL(0);
}
if (((fetchMode & 9)) == 9) {
ZEPHIR_INIT_NVAR(_1);
ZVAL_LONG(_1, fetchMode);
ZEPHIR_CALL_METHOD(&_0, pdoStatement, "setfetchmode", NULL, 0, _1, colNoOrClassNameOrObject);
zephir_check_call_status();
if (zephir_is_true(_0)) {
ZEPHIR_INIT_ZVAL_NREF(_2);
ZVAL_LONG(_2, fetchMode);
zephir_update_property_this(this_ptr, SL("_fetchMode"), _2 TSRMLS_CC);
RETURN_MM_BOOL(1);
}
RETURN_MM_BOOL(0);
}
ZEPHIR_INIT_NVAR(_1);
ZVAL_LONG(_1, fetchMode);
ZEPHIR_CALL_METHOD(&_0, pdoStatement, "setfetchmode", NULL, 0, _1);
zephir_check_call_status();
if (zephir_is_true(_0)) {
ZEPHIR_INIT_ZVAL_NREF(_2);
ZVAL_LONG(_2, fetchMode);
zephir_update_property_this(this_ptr, SL("_fetchMode"), _2 TSRMLS_CC);
RETURN_MM_BOOL(1);
}
RETURN_MM_BOOL(0);
}
示例14: PHP_METHOD
/**
* Handles routing information received from command-line arguments
*
* @param array arguments
*/
PHP_METHOD(Phalcon_Cli_Router, handle) {
zval *_16 = NULL;
zval *_6 = NULL, *_11 = NULL;
zephir_nts_static zephir_fcall_cache_entry *_5 = NULL, *_19 = NULL;
int ZEPHIR_LAST_CALL_STATUS;
HashTable *_3, *_8;
HashPosition _2, _7;
zend_bool _0;
zval *arguments = NULL, *moduleName = NULL, *taskName = NULL, *actionName = NULL, *params = NULL, *route = NULL, *parts = NULL, *pattern = NULL, *routeFound = NULL, *matches, *paths = NULL, *beforeMatch = NULL, *converters = NULL, *converter = NULL, *part = NULL, *position = NULL, *matchPosition = NULL, *strParams, *_1, **_4, **_9, *_10 = NULL, *_12, *_13, *_14, *_15, _17, *_18 = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 0, 1, &arguments);
if (!arguments) {
arguments = ZEPHIR_GLOBAL(global_null);
}
ZEPHIR_INIT_VAR(routeFound);
ZVAL_BOOL(routeFound, 0);
ZEPHIR_INIT_VAR(parts);
array_init(parts);
ZEPHIR_INIT_VAR(params);
array_init(params);
ZEPHIR_INIT_VAR(matches);
ZVAL_NULL(matches);
zephir_update_property_this(this_ptr, SL("_wasMatched"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("_matchedRoute"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC);
if (Z_TYPE_P(arguments) != IS_ARRAY) {
_0 = Z_TYPE_P(arguments) != IS_STRING;
if (_0) {
_0 = Z_TYPE_P(arguments) != IS_NULL;
}
if (_0) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cli_router_exception_ce, "Arguments must be an array or string", "phalcon/cli/router.zep", 223);
return;
}
_1 = zephir_fetch_nproperty_this(this_ptr, SL("_routes"), PH_NOISY_CC);
zephir_is_iterable(_1, &_3, &_2, 0, 1, "phalcon/cli/router.zep", 323);
for (
; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS
; zephir_hash_move_backwards_ex(_3, &_2)
) {
ZEPHIR_GET_HVALUE(route, _4);
ZEPHIR_CALL_METHOD(&pattern, route, "getcompiledpattern", NULL);
zephir_check_call_status();
if (zephir_memnstr_str(pattern, SL("^"), "phalcon/cli/router.zep", 233)) {
Z_SET_ISREF_P(matches);
ZEPHIR_CALL_FUNCTION(&routeFound, "preg_match", &_5, pattern, arguments, matches);
Z_UNSET_ISREF_P(matches);
zephir_check_call_status();
} else {
ZEPHIR_INIT_NVAR(routeFound);
ZVAL_BOOL(routeFound, ZEPHIR_IS_EQUAL(pattern, arguments));
}
if (zephir_is_true(routeFound)) {
ZEPHIR_CALL_METHOD(&beforeMatch, route, "getbeforematch", NULL);
zephir_check_call_status();
if (Z_TYPE_P(beforeMatch) != IS_NULL) {
if (!(zephir_is_callable(beforeMatch TSRMLS_CC))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cli_router_exception_ce, "Before-Match callback is not callable in matched route", "phalcon/cli/router.zep", 251);
return;
}
ZEPHIR_INIT_NVAR(routeFound);
ZEPHIR_INIT_NVAR(_6);
zephir_create_array(_6, 3, 0 TSRMLS_CC);
zephir_array_fast_append(_6, arguments);
zephir_array_fast_append(_6, route);
zephir_array_fast_append(_6, this_ptr);
ZEPHIR_CALL_USER_FUNC_ARRAY(routeFound, beforeMatch, _6);
zephir_check_call_status();
}
}
if (zephir_is_true(routeFound)) {
ZEPHIR_CALL_METHOD(&paths, route, "getpaths", NULL);
zephir_check_call_status();
ZEPHIR_CPY_WRT(parts, paths);
if (Z_TYPE_P(matches) == IS_ARRAY) {
ZEPHIR_CALL_METHOD(&converters, route, "getconverters", NULL);
zephir_check_call_status();
zephir_is_iterable(paths, &_8, &_7, 0, 0, "phalcon/cli/router.zep", 312);
for (
; zephir_hash_get_current_data_ex(_8, (void**) &_9, &_7) == SUCCESS
; zephir_hash_move_forward_ex(_8, &_7)
) {
ZEPHIR_GET_HMKEY(part, _8, _7);
ZEPHIR_GET_HVALUE(position, _9);
ZEPHIR_OBS_NVAR(matchPosition);
if (zephir_array_isset_fetch(&matchPosition, matches, position, 0 TSRMLS_CC)) {
if (Z_TYPE_P(converters) == IS_ARRAY) {
ZEPHIR_OBS_NVAR(converter);
if (zephir_array_isset_fetch(&converter, converters, part, 0 TSRMLS_CC)) {
ZEPHIR_INIT_NVAR(_10);
ZEPHIR_INIT_NVAR(_6);
//.........这里部分代码省略.........
示例15: PHP_METHOD
/**
* Executes the validation
*/
PHP_METHOD(Phalcon_Validation_Validator_Regex, validate) {
zend_bool failed = 0;
int ZEPHIR_LAST_CALL_STATUS;
zval *field = NULL;
zval *validation, *field_param = NULL, *matches = NULL, *message = NULL, *value = NULL, *label = NULL, *replacePairs = NULL, *code = NULL, *pattern = NULL, *_0 = NULL, *_1$$3, *_2$$4, *_3$$6 = NULL, *_8$$6 = NULL, *_9$$6, *_4$$7, *_5$$9, *_6$$10, *_7$$11;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 2, 0, &validation, &field_param);
if (unlikely(Z_TYPE_P(field_param) != IS_STRING && Z_TYPE_P(field_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'field' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(field_param) == IS_STRING)) {
zephir_get_strval(field, field_param);
} else {
ZEPHIR_INIT_VAR(field);
ZVAL_EMPTY_STRING(field);
}
ZEPHIR_INIT_VAR(matches);
ZVAL_NULL(matches);
ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field);
zephir_check_call_status();
ZEPHIR_INIT_VAR(_0);
ZVAL_STRING(_0, "pattern", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&pattern, this_ptr, "getoption", NULL, 0, _0);
zephir_check_temp_parameter(_0);
zephir_check_call_status();
if (Z_TYPE_P(pattern) == IS_ARRAY) {
zephir_array_fetch(&_1$$3, pattern, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/regex.zep", 81 TSRMLS_CC);
ZEPHIR_CPY_WRT(pattern, _1$$3);
}
ZEPHIR_INIT_NVAR(_0);
zephir_preg_match(_0, pattern, value, matches, 0, 0 , 0 TSRMLS_CC);
if (zephir_is_true(_0)) {
zephir_array_fetch_long(&_2$$4, matches, 0, PH_NOISY | PH_READONLY, "phalcon/validation/validator/regex.zep", 85 TSRMLS_CC);
failed = !ZEPHIR_IS_EQUAL(_2$$4, value);
} else {
failed = 1;
}
if (failed == 1) {
ZEPHIR_INIT_VAR(_3$$6);
ZVAL_STRING(_3$$6, "label", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&label, this_ptr, "getoption", NULL, 0, _3$$6);
zephir_check_temp_parameter(_3$$6);
zephir_check_call_status();
if (Z_TYPE_P(label) == IS_ARRAY) {
zephir_array_fetch(&_4$$7, label, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/regex.zep", 94 TSRMLS_CC);
ZEPHIR_CPY_WRT(label, _4$$7);
}
if (ZEPHIR_IS_EMPTY(label)) {
ZEPHIR_CALL_METHOD(&label, validation, "getlabel", NULL, 0, field);
zephir_check_call_status();
}
ZEPHIR_INIT_NVAR(_3$$6);
ZVAL_STRING(_3$$6, "message", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _3$$6);
zephir_check_temp_parameter(_3$$6);
zephir_check_call_status();
if (Z_TYPE_P(message) == IS_ARRAY) {
zephir_array_fetch(&_5$$9, message, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/regex.zep", 102 TSRMLS_CC);
ZEPHIR_CPY_WRT(message, _5$$9);
}
ZEPHIR_INIT_VAR(replacePairs);
zephir_create_array(replacePairs, 1, 0 TSRMLS_CC);
zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
if (ZEPHIR_IS_EMPTY(message)) {
ZEPHIR_INIT_VAR(_6$$10);
ZVAL_STRING(_6$$10, "Regex", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _6$$10);
zephir_check_temp_parameter(_6$$10);
zephir_check_call_status();
}
ZEPHIR_INIT_NVAR(_3$$6);
ZVAL_STRING(_3$$6, "code", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&code, this_ptr, "getoption", NULL, 0, _3$$6);
zephir_check_temp_parameter(_3$$6);
zephir_check_call_status();
if (Z_TYPE_P(code) == IS_ARRAY) {
zephir_array_fetch(&_7$$11, code, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/regex.zep", 111 TSRMLS_CC);
ZEPHIR_CPY_WRT(code, _7$$11);
}
ZEPHIR_INIT_NVAR(_3$$6);
object_init_ex(_3$$6, phalcon_validation_message_ce);
ZEPHIR_CALL_FUNCTION(&_8$$6, "strtr", NULL, 26, message, replacePairs);
zephir_check_call_status();
ZEPHIR_INIT_VAR(_9$$6);
ZVAL_STRING(_9$$6, "Regex", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(NULL, _3$$6, "__construct", NULL, 465, _8$$6, field, _9$$6, code);
zephir_check_temp_parameter(_9$$6);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _3$$6);
zephir_check_call_status();
RETURN_MM_BOOL(0);
//.........这里部分代码省略.........