/** * Encrypts a text returning the result as a base64 string */ PHP_METHOD(Phalcon_Crypt, encryptBase64) { zephir_nts_static zephir_fcall_cache_entry *_3 = NULL, *_6 = NULL; zephir_fcall_cache_entry *_1 = NULL; int ZEPHIR_LAST_CALL_STATUS; zend_bool safe; zval *text_param = NULL, *key = NULL, *safe_param = NULL, *_0 = NULL, *_2 = NULL, _4, _5; zval *text = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 2, &text_param, &key, &safe_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 (!key) { key = ZEPHIR_GLOBAL(global_null); } if (!safe_param) { safe = 0; } else { if (unlikely(Z_TYPE_P(safe_param) != IS_BOOL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'safe' must be a bool") TSRMLS_CC); RETURN_MM_NULL(); } safe = Z_BVAL_P(safe_param); } if (safe == 1) { ZEPHIR_CALL_METHOD(&_0, this_ptr, "encrypt", &_1, text, key); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_2, "base64_encode", &_3, _0); zephir_check_call_status(); ZEPHIR_SINIT_VAR(_4); ZVAL_STRING(&_4, "+/", 0); ZEPHIR_SINIT_VAR(_5); ZVAL_STRING(&_5, "-_", 0); ZEPHIR_RETURN_CALL_FUNCTION("strtr", &_6, _2, &_4, &_5); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_CALL_METHOD(&_0, this_ptr, "encrypt", &_1, text, key); zephir_check_call_status(); ZEPHIR_RETURN_CALL_FUNCTION("base64_encode", &_3, _0); zephir_check_call_status(); RETURN_MM(); }
PHP_METHOD(Test_Statements, test544Issue) { zephir_fcall_cache_entry *_8 = NULL; zval *step_param = NULL, *_0, *_1, *_2, *_3, *_4, *_5, _6 = zval_used_for_init, *_7 = NULL, *_9, *_10, *_11 = NULL; int step, filledWidth, unfilledWidth, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &step_param); if (unlikely(Z_TYPE_P(step_param) != IS_LONG)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'step' must be a long/integer") TSRMLS_CC); RETURN_MM_NULL(); } step = Z_LVAL_P(step_param); _0 = zephir_fetch_nproperty_this(this_ptr, SL("totalSteps"), PH_NOISY_CC); _1 = zephir_fetch_nproperty_this(this_ptr, SL("totalSteps"), PH_NOISY_CC); if (ZEPHIR_GT_LONG(_0, step)) { _2 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC); _3 = zephir_fetch_nproperty_this(this_ptr, SL("totalSteps"), PH_NOISY_CC); filledWidth = (long) ((zephir_safe_div_long_zval(((zephir_get_numberval(_2) - 1)), _3 TSRMLS_CC) * step)); _4 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC); unfilledWidth = (((zephir_get_numberval(_4) - 1)) - filledWidth); _5 = zephir_fetch_nproperty_this(this_ptr, SL("filledChar"), PH_NOISY_CC); ZEPHIR_SINIT_VAR(_6); ZVAL_LONG(&_6, filledWidth); ZEPHIR_CALL_FUNCTION(&_7, "str_repeat", &_8, 17, _5, &_6); zephir_check_call_status(); _9 = zephir_fetch_nproperty_this(this_ptr, SL("arrow"), PH_NOISY_CC); _10 = zephir_fetch_nproperty_this(this_ptr, SL("unfilledChar"), PH_NOISY_CC); ZEPHIR_SINIT_NVAR(_6); ZVAL_LONG(&_6, unfilledWidth); ZEPHIR_CALL_FUNCTION(&_11, "str_repeat", &_8, 17, _10, &_6); zephir_check_call_status(); ZEPHIR_CONCAT_VVV(return_value, _7, _9, _11); RETURN_MM(); } else if (ZEPHIR_IS_LONG_IDENTICAL(_1, step)) { _2 = zephir_fetch_nproperty_this(this_ptr, SL("filledChar"), PH_NOISY_CC); _3 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC); ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 17, _2, _3); zephir_check_call_status(); RETURN_MM(); } else { _2 = zephir_fetch_nproperty_this(this_ptr, SL("unfilledChar"), PH_NOISY_CC); _3 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC); ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 17, _2, _3); zephir_check_call_status(); RETURN_MM(); } }
PHP_METHOD(Test_Statements, test544IssueWithVariable) { zephir_fcall_cache_entry *_6 = NULL; zval *step_param = NULL, *_0, *_1$$3, *_2$$3, *_3$$3, _4$$3 = zval_used_for_init, *_5$$3 = NULL, *_7$$3, *_8$$3, *_9$$3 = NULL, *_10$$4, *_11$$4, *_12$$5, *_13$$5; int step, ZEPHIR_LAST_CALL_STATUS, filledWidth = 0, unfilledWidth = 0, totalSteps = 0; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &step_param); if (unlikely(Z_TYPE_P(step_param) != IS_LONG)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'step' must be a int") TSRMLS_CC); RETURN_MM_NULL(); } step = Z_LVAL_P(step_param); _0 = zephir_fetch_nproperty_this(this_ptr, SL("totalSteps"), PH_NOISY_CC); totalSteps = zephir_get_numberval(_0); if (step < totalSteps) { _1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC); filledWidth = (long) ((zephir_safe_div_long_long(((zephir_get_numberval(_1$$3) - 1)), totalSteps TSRMLS_CC) * step)); _2$$3 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC); unfilledWidth = (((zephir_get_numberval(_2$$3) - 1)) - filledWidth); _3$$3 = zephir_fetch_nproperty_this(this_ptr, SL("filledChar"), PH_NOISY_CC); ZEPHIR_SINIT_VAR(_4$$3); ZVAL_LONG(&_4$$3, filledWidth); ZEPHIR_CALL_FUNCTION(&_5$$3, "str_repeat", &_6, 17, _3$$3, &_4$$3); zephir_check_call_status(); _7$$3 = zephir_fetch_nproperty_this(this_ptr, SL("arrow"), PH_NOISY_CC); _8$$3 = zephir_fetch_nproperty_this(this_ptr, SL("unfilledChar"), PH_NOISY_CC); ZEPHIR_SINIT_NVAR(_4$$3); ZVAL_LONG(&_4$$3, unfilledWidth); ZEPHIR_CALL_FUNCTION(&_9$$3, "str_repeat", &_6, 17, _8$$3, &_4$$3); zephir_check_call_status(); ZEPHIR_CONCAT_VVV(return_value, _5$$3, _7$$3, _9$$3); RETURN_MM(); } else if (step == totalSteps) { _10$$4 = zephir_fetch_nproperty_this(this_ptr, SL("filledChar"), PH_NOISY_CC); _11$$4 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC); ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_6, 17, _10$$4, _11$$4); zephir_check_call_status(); RETURN_MM(); } else { _12$$5 = zephir_fetch_nproperty_this(this_ptr, SL("unfilledChar"), PH_NOISY_CC); _13$$5 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC); ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_6, 17, _12$$5, _13$$5); zephir_check_call_status(); RETURN_MM(); } }
/** * Returns the complete location where the joined/filtered collection must be written */ PHP_METHOD(Phalcon_Assets_Collection, getRealTargetPath) { int ZEPHIR_LAST_CALL_STATUS; zval *basePath_param = NULL, *targetPath, *completePath; zval *basePath = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &basePath_param); if (unlikely(Z_TYPE_P(basePath_param) != IS_STRING && Z_TYPE_P(basePath_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'basePath' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(basePath_param) == IS_STRING)) { zephir_get_strval(basePath, basePath_param); } else { ZEPHIR_INIT_VAR(basePath); ZVAL_EMPTY_STRING(basePath); } ZEPHIR_OBS_VAR(targetPath); zephir_read_property_this(&targetPath, this_ptr, SL("_targetPath"), PH_NOISY_CC); ZEPHIR_INIT_VAR(completePath); ZEPHIR_CONCAT_VV(completePath, basePath, targetPath); if ((zephir_file_exists(completePath TSRMLS_CC) == SUCCESS)) { ZEPHIR_RETURN_CALL_FUNCTION("realpath", NULL, 62, completePath); zephir_check_call_status(); RETURN_MM(); } RETURN_CCTOR(completePath); }
/** * Length filter. If an array/object is passed a count is performed otherwise a strlen/mb_strlen */ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, length) { zend_bool _0; int ZEPHIR_LAST_CALL_STATUS; zval *item; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &item); _0 = Z_TYPE_P(item) == IS_OBJECT; if (!(_0)) { _0 = Z_TYPE_P(item) == IS_ARRAY; } if (_0) { RETURN_MM_LONG(zephir_fast_count_int(item TSRMLS_CC)); } if ((zephir_function_exists_ex(SS("mb_strlen") TSRMLS_CC) == SUCCESS)) { ZEPHIR_RETURN_CALL_FUNCTION("mb_strlen", NULL, 380, item); zephir_check_call_status(); RETURN_MM(); } RETURN_MM_LONG(zephir_fast_strlen_ev(item)); }
/** * Checks whether the element has a given attribute. * * @param string name * @param mixed value [Optional] * @return \Xpl\HtmlElement */ PHP_METHOD(Xpl_HtmlElement, hasAttribute) { int ZEPHIR_LAST_CALL_STATUS; zval *name_param = NULL, *value = NULL, *_0, *_1, *_2; zval *name = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &name_param, &value); zephir_get_strval(name, name_param); if (!value) { value = ZEPHIR_GLOBAL(global_null); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_attributes"), PH_NOISY_CC); if (!(zephir_array_isset(_0, name))) { RETURN_MM_BOOL(0); } if (Z_TYPE_P(value) == IS_NULL) { RETURN_MM_BOOL(1); } _1 = zephir_fetch_nproperty_this(this_ptr, SL("_attributes"), PH_NOISY_CC); zephir_array_fetch(&_2, _1, name, PH_NOISY | PH_READONLY, "xpl/htmlelement.zep", 176 TSRMLS_CC); ZEPHIR_RETURN_CALL_FUNCTION("in_array", NULL, 2, value, _2, ZEPHIR_GLOBAL(global_true)); zephir_check_call_status(); RETURN_MM(); }
PHP_METHOD(Test_Pregmatch, testPregMatchFallback) { int ZEPHIR_LAST_CALL_STATUS; zval *pattern, *subject, *matches = NULL, *_0, *_1; ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(matches); ZVAL_NULL(matches); ZEPHIR_INIT_NVAR(matches); array_init(matches); ZEPHIR_INIT_VAR(pattern); ZVAL_STRING(pattern, "/def$/", 1); ZEPHIR_INIT_VAR(subject); ZVAL_STRING(subject, "abcdef", 1); ZEPHIR_INIT_VAR(_0); ZVAL_LONG(_0, 0); ZEPHIR_INIT_VAR(_1); ZVAL_LONG(_1, 0); Z_SET_ISREF_P(matches); ZEPHIR_RETURN_CALL_FUNCTION("preg_match", NULL, 49, pattern, subject, matches, _0, _1); Z_UNSET_ISREF_P(matches); zephir_check_call_status(); RETURN_MM(); }
/** * Makes an underscored or dashed phrase human-readable * * <code> * echo Phalcon\Text::humanize('start-a-horse'); // 'start a horse' * echo Phalcon\Text::humanize('five_cats'); // 'five cats' * </code> */ PHP_METHOD(Phalcon_Text, humanize) { int ZEPHIR_LAST_CALL_STATUS; zval *text_param = NULL, *_0, *_1, *_2; zval *text = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &text_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); } ZEPHIR_INIT_VAR(_0); zephir_fast_trim(_0, text, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC); ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "#[_-]+#", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_VAR(_2); ZVAL_STRING(_2, " ", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_RETURN_CALL_FUNCTION("preg_replace", NULL, 39, _1, _2, _0); zephir_check_temp_parameter(_1); zephir_check_temp_parameter(_2); zephir_check_call_status(); RETURN_MM(); }
/** * Moves the temporary file to a destination within the application */ PHP_METHOD(Phalcon_Http_Request_File, moveTo) { int ZEPHIR_LAST_CALL_STATUS; zval *destination_param = NULL, *_0; zval *destination = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &destination_param); if (unlikely(Z_TYPE_P(destination_param) != IS_STRING && Z_TYPE_P(destination_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'destination' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(destination_param) == IS_STRING)) { zephir_get_strval(destination, destination_param); } else { ZEPHIR_INIT_VAR(destination); ZVAL_EMPTY_STRING(destination); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_tmp"), PH_NOISY_CC); ZEPHIR_RETURN_CALL_FUNCTION("move_uploaded_file", NULL, 247, _0, destination); zephir_check_call_status(); RETURN_MM(); }
PHP_METHOD(PhalconPlus_Enum_AbstractEnum, validValues) { int ZEPHIR_LAST_CALL_STATUS; zval *assoc_param = NULL, *reflection = NULL, *consts = NULL, *_0; zend_bool assoc; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &assoc_param); if (!assoc_param) { assoc = 0; } else { assoc = zephir_get_boolval(assoc_param); } ZEPHIR_INIT_VAR(reflection); object_init_ex(reflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); ZEPHIR_INIT_VAR(_0); zephir_get_called_class(_0 TSRMLS_CC); ZEPHIR_CALL_METHOD(NULL, reflection, "__construct", NULL, 4, _0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&consts, reflection, "getconstants", NULL, 17); zephir_check_call_status(); zephir_array_unset_string(&consts, SS("__default"), PH_SEPARATE); if (assoc == 1) { RETURN_CCTOR(consts); } else { ZEPHIR_RETURN_CALL_FUNCTION("array_values", NULL, 18, consts); zephir_check_call_status(); RETURN_MM(); } }
/** * Escapes a string with htmlentities */ PHP_METHOD(Phalcon_Debug, _escapeString) { int ZEPHIR_LAST_CALL_STATUS; zephir_nts_static zephir_fcall_cache_entry *_5 = NULL; zval *value, *_0, _1, _2, _3, _4; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &value); if (Z_TYPE_P(value) == IS_STRING) { ZEPHIR_INIT_VAR(_0); ZEPHIR_SINIT_VAR(_1); ZVAL_STRING(&_1, "\n", 0); ZEPHIR_SINIT_VAR(_2); ZVAL_STRING(&_2, "\\n", 0); zephir_fast_str_replace(&_0, &_1, &_2, value TSRMLS_CC); ZEPHIR_SINIT_VAR(_3); ZVAL_LONG(&_3, 2); ZEPHIR_SINIT_VAR(_4); ZVAL_STRING(&_4, "utf-8", 0); ZEPHIR_RETURN_CALL_FUNCTION("htmlentities", &_5, _0, &_3, &_4); zephir_check_call_status(); RETURN_MM(); } RETVAL_ZVAL(value, 1, 0); RETURN_MM(); }
/** * Returns the complete location where the resource is located */ PHP_METHOD(Phalcon_Assets_Resource, getRealSourcePath) { zend_long ZEPHIR_LAST_CALL_STATUS; zval *basePath_param = NULL, *sourcePath = NULL, *_0, *_1$$4; zval *basePath = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &basePath_param); if (!basePath_param) { ZEPHIR_INIT_VAR(basePath); ZVAL_EMPTY_STRING(basePath); } else { zephir_get_strval(basePath, basePath_param); } ZEPHIR_OBS_VAR(sourcePath); zephir_read_property_this(&sourcePath, this_ptr, SL("_sourcePath"), PH_NOISY_CC); if (ZEPHIR_IS_EMPTY(sourcePath)) { ZEPHIR_OBS_NVAR(sourcePath); zephir_read_property_this(&sourcePath, this_ptr, SL("_path"), PH_NOISY_CC); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_local"), PH_NOISY_CC); if (zephir_is_true(_0)) { ZEPHIR_INIT_VAR(_1$$4); ZEPHIR_CONCAT_VV(_1$$4, basePath, sourcePath); ZEPHIR_RETURN_CALL_FUNCTION("realpath", NULL, 67, _1$$4); zephir_check_call_status(); RETURN_MM(); } RETURN_CCTOR(sourcePath); }
/** * Reads parsed annotations from APC * * @param string key * @return \Phalcon\Annotations\Reflection */ PHP_METHOD(Phalcon_Annotations_Adapter_Apc, read) { int ZEPHIR_LAST_CALL_STATUS; zval *key_param = NULL, *_0, *_1, *_2; zval *key = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &key_param); if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(key_param) == IS_STRING)) { zephir_get_strval(key, key_param); } else { ZEPHIR_INIT_VAR(key); ZVAL_EMPTY_STRING(key); } ZEPHIR_INIT_VAR(_0); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_2); ZEPHIR_CONCAT_SVV(_2, "_PHAN", _1, key); zephir_fast_strtolower(_0, _2); ZEPHIR_RETURN_CALL_FUNCTION("apc_fetch", NULL, 82, _0); zephir_check_call_status(); RETURN_MM(); }
PHP_METHOD(Test_Pregmatch, testPregMatchFallback) { zval pattern, subject, matches, _0, _1; int ZEPHIR_LAST_CALL_STATUS; ZEPHIR_INIT_THIS(); ZVAL_UNDEF(&pattern); ZVAL_UNDEF(&subject); ZVAL_UNDEF(&matches); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&matches); ZVAL_NULL(&matches); ZEPHIR_INIT_NVAR(&matches); array_init(&matches); ZEPHIR_INIT_VAR(&pattern); ZVAL_STRING(&pattern, "/def$/"); ZEPHIR_INIT_VAR(&subject); ZVAL_STRING(&subject, "abcdef"); ZVAL_LONG(&_0, 0); ZVAL_LONG(&_1, 0); ZEPHIR_MAKE_REF(&matches); ZEPHIR_RETURN_CALL_FUNCTION("preg_match", NULL, 52, &pattern, &subject, &matches, &_0, &_1); ZEPHIR_UNREF(&matches); zephir_check_call_status(); RETURN_MM(); }
/** * Decrement of a given key, by number $value * * @param string keyName */ PHP_METHOD(Phalcon_Cache_Backend_Apcu, decrement) { zend_long value, ZEPHIR_LAST_CALL_STATUS; zval *keyName = NULL, *value_param = NULL, *lastKey = NULL, *_0, *_1; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 2, &keyName, &value_param); if (!keyName) { keyName = ZEPHIR_GLOBAL(global_null); } if (!value_param) { value = 1; } else { value = zephir_get_intval(value_param); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC); ZEPHIR_INIT_VAR(lastKey); ZEPHIR_CONCAT_SVV(lastKey, "_PHCA", _0, keyName); zephir_update_property_this(getThis(), SL("_lastKey"), lastKey TSRMLS_CC); ZEPHIR_INIT_VAR(_1); ZVAL_LONG(_1, value); ZEPHIR_RETURN_CALL_FUNCTION("apcu_dec", NULL, 120, lastKey, _1); zephir_check_call_status(); RETURN_MM(); }
/** * Changes the current domain (i.e. the translation file). The passed domain must be one * of those passed to the constructor. * * @param string domain * * @return string Returns the new current domain. * @throws \InvalidArgumentException */ PHP_METHOD(Phalcon_Translate_Adapter_Gettext, setDomain) { int ZEPHIR_LAST_CALL_STATUS; zval *domain_param = NULL; zval *domain = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &domain_param); if (unlikely(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 (likely(Z_TYPE_P(domain_param) == IS_STRING)) { zephir_get_strval(domain, domain_param); } else { ZEPHIR_INIT_VAR(domain); ZVAL_EMPTY_STRING(domain); } ZEPHIR_RETURN_CALL_FUNCTION("textdomain", NULL, 437, domain); zephir_check_call_status(); RETURN_MM(); }
/** * Escapes a string with htmlentities */ PHP_METHOD(Phalcon_Debug, _escapeString) { int ZEPHIR_LAST_CALL_STATUS; zval *value, *_0$$3, _1$$3, _2$$3, _3$$3, _4$$3; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &value); if (Z_TYPE_P(value) == IS_STRING) { ZEPHIR_INIT_VAR(_0$$3); ZEPHIR_SINIT_VAR(_1$$3); ZVAL_STRING(&_1$$3, "\n", 0); ZEPHIR_SINIT_VAR(_2$$3); ZVAL_STRING(&_2$$3, "\\n", 0); zephir_fast_str_replace(&_0$$3, &_1$$3, &_2$$3, value TSRMLS_CC); ZEPHIR_SINIT_VAR(_3$$3); ZVAL_LONG(&_3$$3, 2); ZEPHIR_SINIT_VAR(_4$$3); ZVAL_STRING(&_4$$3, "utf-8", 0); ZEPHIR_RETURN_CALL_FUNCTION("htmlentities", NULL, 158, _0$$3, &_3$$3, &_4$$3); zephir_check_call_status(); RETURN_MM(); } RETVAL_ZVAL(value, 1, 0); RETURN_MM(); }
/** * Writes data to the socket. Performs a connection if none is available */ PHP_METHOD(Phalcon_Queue_Beanstalk, write) { int ZEPHIR_LAST_CALL_STATUS; zval *data_param = NULL, *connection = NULL, *packet = NULL, _1; zval *data = NULL, *_0; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &data_param); zephir_get_strval(data, data_param); ZEPHIR_OBS_VAR(connection); zephir_read_property_this(&connection, this_ptr, SL("_connection"), PH_NOISY_CC); if (Z_TYPE_P(connection) != IS_RESOURCE) { ZEPHIR_CALL_METHOD(&connection, this_ptr, "connect", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(connection) != IS_RESOURCE) { RETURN_MM_BOOL(0); } } ZEPHIR_INIT_VAR(_0); ZEPHIR_CONCAT_VS(_0, data, "\r\n"); ZEPHIR_CPY_WRT(packet, _0); ZEPHIR_SINIT_VAR(_1); ZVAL_LONG(&_1, zephir_fast_strlen_ev(packet)); ZEPHIR_RETURN_CALL_FUNCTION("fwrite", NULL, 388, connection, packet, &_1); zephir_check_call_status(); RETURN_MM(); }
/** * Utility to normalize a string's encoding to UTF-32. */ PHP_METHOD(Phalcon_Escaper, normalizeEncoding) { zend_long ZEPHIR_LAST_CALL_STATUS; zval *str_param = NULL, *_0 = NULL, _1; zval *str = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &str_param); zephir_get_strval(str, str_param); if (!((zephir_function_exists_ex(SS("mb_convert_encoding") TSRMLS_CC) == SUCCESS))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_escaper_exception_ce, "Extension 'mbstring' is required", "phalcon/escaper.zep", 144); return; } ZEPHIR_CALL_METHOD(&_0, this_ptr, "detectencoding", NULL, 193, str); zephir_check_call_status(); ZEPHIR_SINIT_VAR(_1); ZVAL_STRING(&_1, "UTF-32", 0); ZEPHIR_RETURN_CALL_FUNCTION("mb_convert_encoding", NULL, 194, str, &_1, _0); zephir_check_call_status(); RETURN_MM(); }
/** * @var mixed input The text to sanitize */ PHP_METHOD(Phalcon_Filter_Sanitize_LowerFirst, __invoke) { zend_long ZEPHIR_LAST_CALL_STATUS; zval *input_param = NULL; zval input; zval *this_ptr = getThis(); ZVAL_UNDEF(&input); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &input_param); if (UNEXPECTED(Z_TYPE_P(input_param) != IS_STRING && Z_TYPE_P(input_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'input' must be of the type string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(input_param) == IS_STRING)) { zephir_get_strval(&input, input_param); } else { ZEPHIR_INIT_VAR(&input); ZVAL_EMPTY_STRING(&input); } ZEPHIR_RETURN_CALL_FUNCTION("lcfirst", NULL, 53, &input); zephir_check_call_status(); RETURN_MM(); }
/** * Serializing a resultset will dump all related rows into a big array */ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, serialize) { zval *_1 = NULL, *_2 = NULL, *_3; zval *_0; int ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(_0); zephir_create_array(_0, 5, 0 TSRMLS_CC); ZEPHIR_OBS_VAR(_1); zephir_read_property_this(&_1, this_ptr, SL("_model"), PH_NOISY_CC); zephir_array_update_string(&_0, SL("model"), &_1, PH_COPY | PH_SEPARATE); ZEPHIR_OBS_NVAR(_1); zephir_read_property_this(&_1, this_ptr, SL("_cache"), PH_NOISY_CC); zephir_array_update_string(&_0, SL("cache"), &_1, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_VAR(_3); ZVAL_BOOL(_3, 0); ZEPHIR_CALL_METHOD(&_2, this_ptr, "toarray", NULL, 0, _3); zephir_check_call_status(); zephir_array_update_string(&_0, SL("rows"), &_2, PH_COPY | PH_SEPARATE); ZEPHIR_OBS_NVAR(_1); zephir_read_property_this(&_1, this_ptr, SL("_columnMap"), PH_NOISY_CC); zephir_array_update_string(&_0, SL("columnMap"), &_1, PH_COPY | PH_SEPARATE); ZEPHIR_OBS_NVAR(_1); zephir_read_property_this(&_1, this_ptr, SL("_hydrateMode"), PH_NOISY_CC); zephir_array_update_string(&_0, SL("hydrateMode"), &_1, PH_COPY | PH_SEPARATE); ZEPHIR_RETURN_CALL_FUNCTION("serialize", NULL, 65, _0); zephir_check_call_status(); RETURN_MM(); }
PHP_METHOD(Test_Optimizers_ACos, testIntParameter) { zval *a_param = NULL, _0; int a, ZEPHIR_LAST_CALL_STATUS; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &a_param); a = zephir_get_intval(a_param); ZVAL_LONG(&_0, a); ZEPHIR_RETURN_CALL_FUNCTION("acos", NULL, 10, &_0); zephir_check_call_status(); RETURN_MM(); }
/** * Encrypts a text returning the result as a base64 string */ PHP_METHOD(Phalcon_Crypt, encryptBase64) { zephir_fcall_cache_entry *_1 = NULL, *_3 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zend_bool safe; zval *text_param = NULL, *key = NULL, *safe_param = NULL, *_0$$3 = NULL, *_2$$3 = NULL, _4$$3 = zval_used_for_init, _5$$3, *_6$$3 = NULL, *_7 = NULL; zval *text = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 2, &text_param, &key, &safe_param); if (UNEXPECTED(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 (EXPECTED(Z_TYPE_P(text_param) == IS_STRING)) { zephir_get_strval(text, text_param); } else { ZEPHIR_INIT_VAR(text); ZVAL_EMPTY_STRING(text); } if (!key) { key = ZEPHIR_GLOBAL(global_null); } if (!safe_param) { safe = 0; } else { if (UNEXPECTED(Z_TYPE_P(safe_param) != IS_BOOL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'safe' must be a bool") TSRMLS_CC); RETURN_MM_NULL(); } safe = Z_BVAL_P(safe_param); } if (safe == 1) { ZEPHIR_CALL_METHOD(&_0$$3, this_ptr, "encrypt", &_1, 0, text, key); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_2$$3, "base64_encode", &_3, 132, _0$$3); zephir_check_call_status(); ZEPHIR_SINIT_VAR(_4$$3); ZVAL_STRING(&_4$$3, "+/", 0); ZEPHIR_SINIT_VAR(_5$$3); ZVAL_STRING(&_5$$3, "-_", 0); ZEPHIR_CALL_FUNCTION(&_6$$3, "strtr", NULL, 27, _2$$3, &_4$$3, &_5$$3); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_4$$3); ZVAL_STRING(&_4$$3, "=", 0); zephir_fast_trim(return_value, _6$$3, &_4$$3, ZEPHIR_TRIM_RIGHT TSRMLS_CC); RETURN_MM(); } ZEPHIR_CALL_METHOD(&_7, this_ptr, "encrypt", &_1, 0, text, key); zephir_check_call_status(); ZEPHIR_RETURN_CALL_FUNCTION("base64_encode", &_3, 132, _7); zephir_check_call_status(); RETURN_MM(); }
PHP_METHOD(Yb_Std, sizeToBytes) { unsigned char _6$$3; int ZEPHIR_LAST_CALL_STATUS; zval *size_param = NULL, *match = NULL, *_0, *_1 = NULL, *_2, _3, *_4$$3, *_7$$4, *_8$$5, *_9$$6, *_10$$7; zval *size = NULL, *unit = NULL, *_5$$3 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &size_param); zephir_get_strval(size, size_param); ZEPHIR_INIT_VAR(match); ZVAL_NULL(match); ZEPHIR_INIT_VAR(_0); ZEPHIR_INIT_VAR(_2); zephir_fast_strtoupper(_2, size); ZEPHIR_SINIT_VAR(_3); ZVAL_STRING(&_3, "/^([\\d\\.]+)([KMGT])B?$/", 0); zephir_preg_match(_0, &_3, _2, match, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_0)) { ZEPHIR_OBS_VAR(_4$$3); zephir_array_fetch_long(&_4$$3, match, 2, PH_NOISY, "yb/std.zep", 17 TSRMLS_CC); zephir_get_strval(_5$$3, _4$$3); ZEPHIR_CPY_WRT(unit, _5$$3); _6$$3 = ZEPHIR_STRING_OFFSET(unit, 0); do { if (_6$$3 == 'T') { ZEPHIR_OBS_VAR(_7$$4); zephir_array_fetch_long(&_7$$4, match, 1, PH_NOISY, "yb/std.zep", 20 TSRMLS_CC); RETURN_MM_DOUBLE((1099511627776.0 * zephir_get_doubleval(_7$$4))); } if (_6$$3 == 'G') { ZEPHIR_OBS_VAR(_8$$5); zephir_array_fetch_long(&_8$$5, match, 1, PH_NOISY, "yb/std.zep", 22 TSRMLS_CC); RETURN_MM_DOUBLE((1073741824.0 * zephir_get_doubleval(_8$$5))); } if (_6$$3 == 'M') { ZEPHIR_OBS_VAR(_9$$6); zephir_array_fetch_long(&_9$$6, match, 1, PH_NOISY, "yb/std.zep", 24 TSRMLS_CC); RETURN_MM_DOUBLE((1048576.0 * zephir_get_doubleval(_9$$6))); } if (_6$$3 == 'K') { ZEPHIR_OBS_VAR(_10$$7); zephir_array_fetch_long(&_10$$7, match, 1, PH_NOISY, "yb/std.zep", 26 TSRMLS_CC); RETURN_MM_DOUBLE((1024.0 * zephir_get_doubleval(_10$$7))); } } while(0); } ZEPHIR_RETURN_CALL_FUNCTION("floatval", NULL, 75, size); zephir_check_call_status(); RETURN_MM(); }
/** * Detect the character encoding of a string to be handled by an encoder * Special-handling for chr(172) and chr(128) to chr(159) which fail to be detected by mb_detect_encoding() */ PHP_METHOD(Phalcon_Escaper, detectEncoding) { HashTable *_3; HashPosition _2; zval *_0; zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_6 = NULL; zval *str_param = NULL, *charset = NULL, *_1 = NULL, **_4, *_5$$5 = NULL; zval *str = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &str_param); zephir_get_strval(str, str_param); ZEPHIR_INIT_VAR(charset); zephir_is_basic_charset(charset, str); if (Z_TYPE_P(charset) == IS_STRING) { RETURN_CCTOR(charset); } if (!((zephir_function_exists_ex(SS("mb_detect_encoding") TSRMLS_CC) == SUCCESS))) { RETURN_MM_NULL(); } ZEPHIR_INIT_VAR(_0); zephir_create_array(_0, 4, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "UTF-32", 1); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "UTF-8", 1); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "ISO-8859-1", 1); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "ASCII", 1); zephir_array_fast_append(_0, _1); zephir_is_iterable(_0, &_3, &_2, 0, 0, "phalcon/escaper.zep", 132); for ( ; zend_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS ; zend_hash_move_forward_ex(_3, &_2) ) { ZEPHIR_GET_HVALUE(charset, _4); ZEPHIR_CALL_FUNCTION(&_5$$5, "mb_detect_encoding", &_6, 192, str, charset, ZEPHIR_GLOBAL(global_true)); zephir_check_call_status(); if (zephir_is_true(_5$$5)) { RETURN_CCTOR(charset); } } ZEPHIR_RETURN_CALL_FUNCTION("mb_detect_encoding", &_6, 192, str); zephir_check_call_status(); RETURN_MM(); }
/** * Returns the object data as an array. * * @return array */ PHP_METHOD(Xpl_Collection_Stack, toArray) { int ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); ZEPHIR_RETURN_CALL_FUNCTION("iterator_to_array", NULL, 14, this_ptr); zephir_check_call_status(); RETURN_MM(); }
/** * Returns the instance as an array representation * * @return array */ PHP_METHOD(Phalcon_Mvc_Model_Row, toArray) { int ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); ZEPHIR_RETURN_CALL_FUNCTION("get_object_vars", NULL, 21, this_ptr); zephir_check_call_status(); RETURN_MM(); }
/** * Returns a list of available modes */ PHP_METHOD(Phalcon_Crypt, getAvailableModes) { int ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); ZEPHIR_RETURN_CALL_FUNCTION("mcrypt_list_modes", NULL); zephir_check_call_status(); RETURN_MM(); }
/** * Reads a packet from the socket. Prior to reading from the socket will * check for availability of the connection. */ PHP_METHOD(Phalcon_Queue_Beanstalk, read) { zephir_fcall_cache_entry *_1 = NULL; zval *length_param = NULL, *connection = NULL, *data = NULL, _4, _5, _0$$5 = zval_used_for_init, *_2$$5 = NULL, *_3$$5; int length, ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &length_param); if (!length_param) { length = 0; } else { length = zephir_get_intval(length_param); } ZEPHIR_OBS_VAR(connection); zephir_read_property_this(&connection, this_ptr, SL("_connection"), PH_NOISY_CC); if (Z_TYPE_P(connection) != IS_RESOURCE) { ZEPHIR_CALL_METHOD(&connection, this_ptr, "connect", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(connection) != IS_RESOURCE) { RETURN_MM_BOOL(0); } } if (length) { if (zephir_feof(connection TSRMLS_CC)) { RETURN_MM_BOOL(0); } ZEPHIR_SINIT_VAR(_0$$5); ZVAL_LONG(&_0$$5, (length + 2)); ZEPHIR_CALL_FUNCTION(&data, "stream_get_line", &_1, 386, connection, &_0$$5); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_2$$5, "stream_get_meta_data", NULL, 387, connection); zephir_check_call_status(); zephir_array_fetch_string(&_3$$5, _2$$5, SL("timed_out"), PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 373 TSRMLS_CC); if (zephir_is_true(_3$$5)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_queue_beanstalk_exception_ce, "Connection timed out", "phalcon/queue/beanstalk.zep", 374); return; } ZEPHIR_SINIT_NVAR(_0$$5); ZVAL_STRING(&_0$$5, "\r\n", 0); zephir_fast_trim(return_value, data, &_0$$5, ZEPHIR_TRIM_RIGHT TSRMLS_CC); RETURN_MM(); } ZEPHIR_SINIT_VAR(_4); ZVAL_LONG(&_4, 16384); ZEPHIR_SINIT_VAR(_5); ZVAL_STRING(&_5, "\r\n", 0); ZEPHIR_RETURN_CALL_FUNCTION("stream_get_line", &_1, 386, connection, &_4, &_5); zephir_check_call_status(); RETURN_MM(); }
/** * Returns a list of available cyphers */ PHP_METHOD(Phalcon_Crypt, getAvailableCiphers) { int ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); ZEPHIR_RETURN_CALL_FUNCTION("mcrypt_list_algorithms", NULL, 140); zephir_check_call_status(); RETURN_MM(); }