本文整理汇总了C++中zephir_fast_trim函数的典型用法代码示例。如果您正苦于以下问题:C++ zephir_fast_trim函数的具体用法?C++ zephir_fast_trim怎么用?C++ zephir_fast_trim使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zephir_fast_trim函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* Generates the SQL for LIMIT clause
*/
PHP_METHOD(Phalcon_Db_Dialect_Oracle, limit) {
int limit, offset = 0;
zval *sqlQuery_param = NULL, *number, *_0 = NULL, *_1, _2 = zval_used_for_init, *_3, _4 = zval_used_for_init, _6;
zval *sqlQuery = NULL, *_5, *_7;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 2, 0, &sqlQuery_param, &number);
if (unlikely(Z_TYPE_P(sqlQuery_param) != IS_STRING && Z_TYPE_P(sqlQuery_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlQuery' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(sqlQuery_param) == IS_STRING)) {
zephir_get_strval(sqlQuery, sqlQuery_param);
} else {
ZEPHIR_INIT_VAR(sqlQuery);
ZVAL_EMPTY_STRING(sqlQuery);
}
if (Z_TYPE_P(number) == IS_ARRAY) {
if (zephir_array_isset_long(number, 1)) {
ZEPHIR_INIT_VAR(_0);
zephir_array_fetch_long(&_1, number, 1, PH_NOISY | PH_READONLY, "phalcon/db/dialect/oracle.zep", 51 TSRMLS_CC);
ZEPHIR_SINIT_VAR(_2);
ZVAL_STRING(&_2, "'", 0);
zephir_fast_trim(_0, _1, &_2, ZEPHIR_TRIM_BOTH TSRMLS_CC);
offset = zephir_get_intval(_0);
}
ZEPHIR_INIT_NVAR(_0);
zephir_array_fetch_long(&_1, number, 0, PH_NOISY | PH_READONLY, "phalcon/db/dialect/oracle.zep", 54 TSRMLS_CC);
ZEPHIR_SINIT_NVAR(_2);
ZVAL_STRING(&_2, "'", 0);
zephir_fast_trim(_0, _1, &_2, ZEPHIR_TRIM_BOTH TSRMLS_CC);
limit = (zephir_get_intval(_0) + offset);
} else {
ZEPHIR_INIT_VAR(_3);
ZEPHIR_SINIT_VAR(_4);
ZVAL_STRING(&_4, "'", 0);
zephir_fast_trim(_3, number, &_4, ZEPHIR_TRIM_BOTH TSRMLS_CC);
limit = zephir_get_intval(_3);
}
ZEPHIR_SINIT_NVAR(_4);
ZVAL_LONG(&_4, limit);
ZEPHIR_INIT_VAR(_5);
ZEPHIR_CONCAT_SVSVS(_5, "SELECT * FROM (SELECT Z1.*, ROWNUM PHALCON_RN FROM (", sqlQuery, ") Z1 WHERE ROWNUM <= ", &_4, ")");
ZEPHIR_CPY_WRT(sqlQuery, _5);
if (offset != 0) {
ZEPHIR_SINIT_VAR(_6);
ZVAL_LONG(&_6, offset);
ZEPHIR_INIT_VAR(_7);
ZEPHIR_CONCAT_SV(_7, " WHERE PHALCON_RN >= ", &_6);
zephir_concat_self(&sqlQuery, _7 TSRMLS_CC);
}
RETURN_CTOR(sqlQuery);
}
示例2: PHP_METHOD
PHP_METHOD(Test_Strings, issue1267) {
zval _1;
zephir_fcall_cache_entry *_5 = NULL;
zend_long ZEPHIR_LAST_CALL_STATUS;
zval *value = NULL, value_sub, x, _0, _2, _3, _4, _6, _7;
zval *this_ptr = getThis();
ZVAL_UNDEF(&value_sub);
ZVAL_UNDEF(&x);
ZVAL_UNDEF(&_0);
ZVAL_UNDEF(&_2);
ZVAL_UNDEF(&_3);
ZVAL_UNDEF(&_4);
ZVAL_UNDEF(&_6);
ZVAL_UNDEF(&_7);
ZVAL_UNDEF(&_1);
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &value);
ZEPHIR_SEPARATE_PARAM(value);
ZEPHIR_INIT_VAR(&_0);
ZEPHIR_INIT_VAR(&_1);
zephir_create_array(&_1, 3, 0 TSRMLS_CC);
ZEPHIR_INIT_VAR(&_2);
ZVAL_STRING(&_2, "\\");
zephir_array_fast_append(&_1, &_2);
ZEPHIR_INIT_NVAR(&_2);
ZVAL_STRING(&_2, "\"");
zephir_array_fast_append(&_1, &_2);
ZEPHIR_INIT_NVAR(&_2);
ZVAL_STRING(&_2, "'");
zephir_array_fast_append(&_1, &_2);
ZEPHIR_INIT_NVAR(&_2);
ZVAL_STRING(&_2, "");
zephir_fast_str_replace(&_0, &_1, &_2, value TSRMLS_CC);
ZEPHIR_CPY_WRT(value, &_0);
ZVAL_LONG(&_3, 513);
ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 79, value, &_3);
zephir_check_call_status();
ZEPHIR_CPY_WRT(value, &_4);
ZEPHIR_INIT_NVAR(&_0);
ZEPHIR_CALL_FUNCTION(&_4, "strip_tags", &_5, 80, value);
zephir_check_call_status();
zephir_stripslashes(&_0, &_4);
ZEPHIR_INIT_VAR(&x);
zephir_fast_trim(&x, &_0, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC);
ZEPHIR_INIT_VAR(&_6);
ZEPHIR_CALL_FUNCTION(&_7, "strip_tags", &_5, 80, value);
zephir_check_call_status();
zephir_stripcslashes(&_6, &_7);
zephir_fast_trim(return_value, &_6, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC);
RETURN_MM();
}
示例3: PHP_METHOD
/**
* Concatenates strings using the separator only once without duplication in places concatenation
*
* <code>
* $str = Phalcon\Text::concat("/", "/tmp/", "/folder_1/", "/folder_2", "folder_3/");
* echo $str; // /tmp/folder_1/folder_2/folder_3/
* </code>
*
* @param string separator
* @param string a
* @param string b
* @param string ...N
*/
PHP_METHOD(Phalcon_Text, concat) {
HashTable *_7$$3;
HashPosition _6$$3;
zval *separator = NULL, *a = NULL, *b = NULL, _0 = zval_used_for_init, *c = NULL, *_2 = NULL, *_12, *_13, *_3$$3 = NULL, _4$$3, *_5$$3 = NULL, **_8$$3, *_9$$4 = NULL, *_10$$4 = NULL, *_11$$4 = NULL;
int ZEPHIR_LAST_CALL_STATUS;
zephir_fcall_cache_entry *_1 = NULL;
ZEPHIR_MM_GROW();
ZEPHIR_SINIT_VAR(_0);
ZVAL_LONG(&_0, 0);
ZEPHIR_CALL_FUNCTION(&separator, "func_get_arg", &_1, 443, &_0);
zephir_check_call_status();
ZEPHIR_SINIT_NVAR(_0);
ZVAL_LONG(&_0, 1);
ZEPHIR_CALL_FUNCTION(&a, "func_get_arg", &_1, 443, &_0);
zephir_check_call_status();
ZEPHIR_SINIT_NVAR(_0);
ZVAL_LONG(&_0, 2);
ZEPHIR_CALL_FUNCTION(&b, "func_get_arg", &_1, 443, &_0);
zephir_check_call_status();
ZEPHIR_CALL_FUNCTION(&_2, "func_num_args", NULL, 444);
zephir_check_call_status();
if (ZEPHIR_GT_LONG(_2, 3)) {
ZEPHIR_CALL_FUNCTION(&_3$$3, "func_get_args", NULL, 172);
zephir_check_call_status();
ZEPHIR_SINIT_VAR(_4$$3);
ZVAL_LONG(&_4$$3, 3);
ZEPHIR_CALL_FUNCTION(&_5$$3, "array_slice", NULL, 391, _3$$3, &_4$$3);
zephir_check_call_status();
zephir_is_iterable(_5$$3, &_7$$3, &_6$$3, 0, 0, "phalcon/text.zep", 245);
for (
; zephir_hash_get_current_data_ex(_7$$3, (void**) &_8$$3, &_6$$3) == SUCCESS
; zephir_hash_move_forward_ex(_7$$3, &_6$$3)
) {
ZEPHIR_GET_HVALUE(c, _8$$3);
ZEPHIR_INIT_NVAR(_9$$4);
zephir_fast_trim(_9$$4, b, separator, ZEPHIR_TRIM_RIGHT TSRMLS_CC);
ZEPHIR_INIT_NVAR(_10$$4);
zephir_fast_trim(_10$$4, c, separator, ZEPHIR_TRIM_LEFT TSRMLS_CC);
ZEPHIR_INIT_LNVAR(_11$$4);
ZEPHIR_CONCAT_VVV(_11$$4, _9$$4, separator, _10$$4);
ZEPHIR_CPY_WRT(b, _11$$4);
}
}
ZEPHIR_INIT_VAR(_12);
zephir_fast_trim(_12, a, separator, ZEPHIR_TRIM_RIGHT TSRMLS_CC);
ZEPHIR_INIT_VAR(_13);
zephir_fast_trim(_13, b, separator, ZEPHIR_TRIM_LEFT TSRMLS_CC);
ZEPHIR_CONCAT_VVV(return_value, _12, separator, _13);
RETURN_MM();
}
示例4: PHP_METHOD
/**
* Concatenates strings using the separator only once without duplication in places concatenation
*
* <code>
* $str = Phalcon\Text::concat("/", "/tmp/", "/folder_1/", "/folder_2", "folder_3/");
* echo $str; // /tmp/folder_1/folder_2/folder_3/
* </code>
*
* @param string separator
* @param string a
* @param string b
* @param string ...N
*/
PHP_METHOD(Phalcon_Text, concat) {
HashTable *_6;
HashPosition _5;
int ZEPHIR_LAST_CALL_STATUS;
zephir_fcall_cache_entry *_1 = NULL;
zval *separator = NULL, *a = NULL, *b = NULL, _0 = zval_used_for_init, *c = NULL, *_2 = NULL, *_3 = NULL, *_4 = NULL, **_7, *_8 = NULL, *_9 = NULL, *_10 = NULL;
ZEPHIR_MM_GROW();
ZEPHIR_SINIT_VAR(_0);
ZVAL_LONG(&_0, 0);
ZEPHIR_CALL_FUNCTION(&separator, "func_get_arg", &_1, 418, &_0);
zephir_check_call_status();
ZEPHIR_SINIT_NVAR(_0);
ZVAL_LONG(&_0, 1);
ZEPHIR_CALL_FUNCTION(&a, "func_get_arg", &_1, 418, &_0);
zephir_check_call_status();
ZEPHIR_SINIT_NVAR(_0);
ZVAL_LONG(&_0, 2);
ZEPHIR_CALL_FUNCTION(&b, "func_get_arg", &_1, 418, &_0);
zephir_check_call_status();
ZEPHIR_CALL_FUNCTION(&_2, "func_num_args", NULL, 419);
zephir_check_call_status();
if (ZEPHIR_GT_LONG(_2, 3)) {
ZEPHIR_CALL_FUNCTION(&_3, "func_get_args", NULL, 165);
zephir_check_call_status();
ZEPHIR_SINIT_NVAR(_0);
ZVAL_LONG(&_0, 3);
ZEPHIR_CALL_FUNCTION(&_4, "array_slice", NULL, 377, _3, &_0);
zephir_check_call_status();
zephir_is_iterable(_4, &_6, &_5, 0, 0, "phalcon/text.zep", 246);
for (
; zephir_hash_get_current_data_ex(_6, (void**) &_7, &_5) == SUCCESS
; zephir_hash_move_forward_ex(_6, &_5)
) {
ZEPHIR_GET_HVALUE(c, _7);
ZEPHIR_INIT_NVAR(_8);
zephir_fast_trim(_8, b, separator, ZEPHIR_TRIM_RIGHT TSRMLS_CC);
ZEPHIR_INIT_NVAR(_9);
zephir_fast_trim(_9, c, separator, ZEPHIR_TRIM_LEFT TSRMLS_CC);
ZEPHIR_INIT_LNVAR(_10);
ZEPHIR_CONCAT_VVV(_10, _8, separator, _9);
ZEPHIR_CPY_WRT(b, _10);
}
}
ZEPHIR_INIT_NVAR(_8);
zephir_fast_trim(_8, a, separator, ZEPHIR_TRIM_RIGHT TSRMLS_CC);
ZEPHIR_INIT_NVAR(_9);
zephir_fast_trim(_9, b, separator, ZEPHIR_TRIM_LEFT TSRMLS_CC);
ZEPHIR_CONCAT_VVV(return_value, _8, separator, _9);
RETURN_MM();
}
示例5: PHP_METHOD
/**
* Concatenates strings using the separator only once without duplication in places concatenation
*
* <code>
* $str = Phalcon\Text::concat(
* "/",
* "/tmp/",
* "/folder_1/",
* "/folder_2",
* "folder_3/"
* );
*
* // /tmp/folder_1/folder_2/folder_3/
* echo $str;
* </code>
*
* @param string separator
* @param string a
* @param string b
* @param string ...N
*/
PHP_METHOD(Phalcon_Text, concat) {
HashTable *_7$$3;
HashPosition _6$$3;
zval *separator = NULL, *a = NULL, *b = NULL, _0, _1, _2, *c = NULL, *_12, *_13, *_3$$3, _4$$3, *_5$$3 = NULL, **_8$$3, *_9$$4 = NULL, *_10$$4 = NULL, *_11$$4 = NULL;
zend_long ZEPHIR_LAST_CALL_STATUS;
ZEPHIR_MM_GROW();
ZEPHIR_INIT_VAR(separator);
ZEPHIR_SINIT_VAR(_0);
ZVAL_LONG(&_0, 0);
zephir_get_arg(separator, zephir_get_intval(&_0) TSRMLS_CC);
ZEPHIR_INIT_VAR(a);
ZEPHIR_SINIT_VAR(_1);
ZVAL_LONG(&_1, 1);
zephir_get_arg(a, zephir_get_intval(&_1) TSRMLS_CC);
ZEPHIR_INIT_VAR(b);
ZEPHIR_SINIT_VAR(_2);
ZVAL_LONG(&_2, 2);
zephir_get_arg(b, zephir_get_intval(&_2) TSRMLS_CC);
if (ZEND_NUM_ARGS() > 3) {
ZEPHIR_INIT_VAR(_3$$3);
zephir_get_args(_3$$3 TSRMLS_CC);
ZEPHIR_SINIT_VAR(_4$$3);
ZVAL_LONG(&_4$$3, 3);
ZEPHIR_CALL_FUNCTION(&_5$$3, "array_slice", NULL, 406, _3$$3, &_4$$3);
zephir_check_call_status();
zephir_is_iterable(_5$$3, &_7$$3, &_6$$3, 0, 0, "phalcon/text.zep", 262);
for (
; zend_hash_get_current_data_ex(_7$$3, (void**) &_8$$3, &_6$$3) == SUCCESS
; zend_hash_move_forward_ex(_7$$3, &_6$$3)
) {
ZEPHIR_GET_HVALUE(c, _8$$3);
ZEPHIR_INIT_NVAR(_9$$4);
zephir_fast_trim(_9$$4, b, separator, ZEPHIR_TRIM_RIGHT TSRMLS_CC);
ZEPHIR_INIT_NVAR(_10$$4);
zephir_fast_trim(_10$$4, c, separator, ZEPHIR_TRIM_LEFT TSRMLS_CC);
ZEPHIR_INIT_LNVAR(_11$$4);
ZEPHIR_CONCAT_VVV(_11$$4, _9$$4, separator, _10$$4);
ZEPHIR_CPY_WRT(b, _11$$4);
}
}
ZEPHIR_INIT_VAR(_12);
zephir_fast_trim(_12, a, separator, ZEPHIR_TRIM_RIGHT TSRMLS_CC);
ZEPHIR_INIT_VAR(_13);
zephir_fast_trim(_13, b, separator, ZEPHIR_TRIM_LEFT TSRMLS_CC);
ZEPHIR_CONCAT_VVV(return_value, _12, separator, _13);
RETURN_MM();
}
示例6: PHP_METHOD
/**
* Sets the cache item key prefix.
*
* @param string prefix
*
* @return \Xpl\Cache\Cache
*/
PHP_METHOD(Xpl_Cache_Cache, setPrefix) {
zval *prefix_param = NULL, *_0, _1, *_2;
zval *prefix = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &prefix_param);
if (unlikely(Z_TYPE_P(prefix_param) != IS_STRING && Z_TYPE_P(prefix_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'prefix' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(prefix_param) == IS_STRING)) {
zephir_get_strval(prefix, prefix_param);
} else {
ZEPHIR_INIT_VAR(prefix);
ZVAL_EMPTY_STRING(prefix);
}
ZEPHIR_INIT_VAR(_0);
ZEPHIR_SINIT_VAR(_1);
ZVAL_STRING(&_1, ".", 0);
zephir_fast_trim(_0, prefix, &_1, ZEPHIR_TRIM_RIGHT TSRMLS_CC);
ZEPHIR_INIT_VAR(_2);
ZEPHIR_CONCAT_VS(_2, _0, ".");
zephir_update_property_this(this_ptr, SL("prefix"), _2 TSRMLS_CC);
RETURN_THIS();
}
示例7: PHP_METHOD
PHP_METHOD(Test_BuiltIn_StringMethods, getRightTrimmed) {
zval *str_param = NULL, _0;
zval str;
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(&str);
ZVAL_UNDEF(&_0);
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &str_param);
zephir_get_strval(&str, str_param);
ZEPHIR_INIT_VAR(&_0);
zephir_fast_trim(&_0, &str, NULL , ZEPHIR_TRIM_RIGHT TSRMLS_CC);
RETURN_CCTOR(_0);
}
示例8: PHP_METHOD
/**
* Returns the active version (string)
*
* <code>
* echo Phalcon\Version::get();
* </code>
*/
PHP_METHOD(Phalcon_Version, get) {
zval *version = NULL, *major = NULL, *medium = NULL, *minor = NULL, *special = NULL, *specialNumber = NULL, *result = NULL, *suffix = NULL, *_1$$3;
zephir_fcall_cache_entry *_0 = NULL;
int ZEPHIR_LAST_CALL_STATUS;
ZEPHIR_MM_GROW();
ZEPHIR_CALL_STATIC(&version, "_getversion", NULL, 0);
zephir_check_call_status();
ZEPHIR_OBS_VAR(major);
zephir_array_fetch_long(&major, version, 0, PH_NOISY, "phalcon/version.zep", 139 TSRMLS_CC);
ZEPHIR_OBS_VAR(medium);
zephir_array_fetch_long(&medium, version, 1, PH_NOISY, "phalcon/version.zep", 140 TSRMLS_CC);
ZEPHIR_OBS_VAR(minor);
zephir_array_fetch_long(&minor, version, 2, PH_NOISY, "phalcon/version.zep", 141 TSRMLS_CC);
ZEPHIR_OBS_VAR(special);
zephir_array_fetch_long(&special, version, 3, PH_NOISY, "phalcon/version.zep", 142 TSRMLS_CC);
ZEPHIR_OBS_VAR(specialNumber);
zephir_array_fetch_long(&specialNumber, version, 4, PH_NOISY, "phalcon/version.zep", 143 TSRMLS_CC);
ZEPHIR_INIT_VAR(result);
ZEPHIR_CONCAT_VSVSVS(result, major, ".", medium, ".", minor, " ");
ZEPHIR_CALL_STATIC(&suffix, "_getspecial", &_0, 472, special);
zephir_check_call_status();
if (!ZEPHIR_IS_STRING(suffix, "")) {
ZEPHIR_INIT_VAR(_1$$3);
ZEPHIR_CONCAT_VSV(_1$$3, suffix, " ", specialNumber);
zephir_concat_self(&result, _1$$3 TSRMLS_CC);
}
zephir_fast_trim(return_value, result, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC);
RETURN_MM();
}
示例9: PHP_METHOD
PHP_METHOD(Litesploit_Litepreter, engine) {
int ZEPHIR_LAST_CALL_STATUS;
zephir_fcall_cache_entry *_2 = NULL;
zval *_SERVER, *location = NULL, *_0, _1, *_3;
ZEPHIR_MM_GROW();
zephir_get_global(&_SERVER, SS("_SERVER") TSRMLS_CC);
zephir_array_fetch_string(&_0, _SERVER, SL("SCRIPT_NAME"), PH_NOISY | PH_READONLY, "litesploit/litepreter.zep", 8 TSRMLS_CC);
ZEPHIR_SINIT_VAR(_1);
ZVAL_STRING(&_1, "/", 0);
ZEPHIR_INIT_VAR(location);
zephir_fast_trim(location, _0, &_1, ZEPHIR_TRIM_BOTH TSRMLS_CC);
if (ZEPHIR_IS_STRING(location, "")) {
ZEPHIR_INIT_NVAR(location);
ZVAL_STRING(location, "exploit.lite", 1);
}
ZEPHIR_INIT_VAR(_3);
ZVAL_STRING(_3, "text/html", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_SELF(NULL, "content", &_2, 20, location, _3);
zephir_check_temp_parameter(_3);
zephir_check_call_status();
ZEPHIR_MM_RESTORE();
}
示例10: PHP_METHOD
/**
* Check if everything in required scope is contained in available scope.
*
* @param string required_scope A space-separated string of scopes.
*
* @return boolean TRUE if everything in required scope is contained in available scope,
* and FALSE if it isn't.
*
* @see http://tools.ietf.org/html/rfc6749#section-7
*
* @ingroup oauth2_section_7
*/
PHP_METHOD(OAuth2_Scope, checkScope) {
int ZEPHIR_LAST_CALL_STATUS;
zephir_nts_static zephir_fcall_cache_entry *_3 = NULL;
zval *required_scope_param = NULL, *available_scope_param = NULL, *scope1, *scope2, *_0, *_1, *_2 = NULL;
zval *required_scope = NULL, *available_scope = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 2, 0, &required_scope_param, &available_scope_param);
if (unlikely(Z_TYPE_P(required_scope_param) != IS_STRING && Z_TYPE_P(required_scope_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'required_scope' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(required_scope_param) == IS_STRING)) {
zephir_get_strval(required_scope, required_scope_param);
} else {
ZEPHIR_INIT_VAR(required_scope);
ZVAL_EMPTY_STRING(required_scope);
}
if (unlikely(Z_TYPE_P(available_scope_param) != IS_STRING && Z_TYPE_P(available_scope_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'available_scope' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(available_scope_param) == IS_STRING)) {
zephir_get_strval(available_scope, available_scope_param);
} else {
ZEPHIR_INIT_VAR(available_scope);
ZVAL_EMPTY_STRING(available_scope);
}
ZEPHIR_INIT_VAR(scope1);
ZEPHIR_INIT_VAR(_0);
zephir_fast_trim(_0, required_scope, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC);
zephir_fast_explode_str(scope1, SL(" "), _0, LONG_MAX TSRMLS_CC);
ZEPHIR_INIT_VAR(scope2);
ZEPHIR_INIT_VAR(_1);
zephir_fast_trim(_1, available_scope, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC);
zephir_fast_explode_str(scope2, SL(" "), _1, LONG_MAX TSRMLS_CC);
ZEPHIR_CALL_FUNCTION(&_2, "array_diff", &_3, scope1, scope2);
zephir_check_call_status();
RETURN_MM_BOOL(zephir_fast_count_int(_2 TSRMLS_CC) == 0);
}
示例11: PHP_METHOD
/**
* 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();
}
示例12: PHP_METHOD
PHP_METHOD(Transbybd_TransApi, __convert) {
HashTable *_1$$3, *_4$$5;
HashPosition _0$$3, _3$$5;
zval *data;
int ZEPHIR_LAST_CALL_STATUS;
zephir_fcall_cache_entry *_7 = NULL;
zval *args, *key = NULL, *val = NULL, *k = NULL, *v = NULL, **_2$$3, *_11$$3, _12$$3, **_5$$5, *_6$$6 = NULL, *_8$$6 = NULL, *_9$$7 = NULL, *_10$$7 = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &args);
ZEPHIR_INIT_VAR(data);
ZVAL_EMPTY_STRING(data);
if (Z_TYPE_P(args) == IS_ARRAY) {
zephir_is_iterable(args, &_1$$3, &_0$$3, 0, 0, "transbybd/transApi.zep", 106);
for (
; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS
; zephir_hash_move_forward_ex(_1$$3, &_0$$3)
) {
ZEPHIR_GET_HMKEY(key, _1$$3, _0$$3);
ZEPHIR_GET_HVALUE(val, _2$$3);
if (Z_TYPE_P(val) == IS_ARRAY) {
zephir_is_iterable(val, &_4$$5, &_3$$5, 0, 0, "transbybd/transApi.zep", 102);
for (
; zephir_hash_get_current_data_ex(_4$$5, (void**) &_5$$5, &_3$$5) == SUCCESS
; zephir_hash_move_forward_ex(_4$$5, &_3$$5)
) {
ZEPHIR_GET_HMKEY(k, _4$$5, _3$$5);
ZEPHIR_GET_HVALUE(v, _5$$5);
ZEPHIR_CALL_FUNCTION(&_6$$6, "rawurlencode", &_7, 11, v);
zephir_check_call_status();
ZEPHIR_INIT_LNVAR(_8$$6);
ZEPHIR_CONCAT_VSVSVS(_8$$6, key, "[", k, "]=", _6$$6, "&");
zephir_concat_self(&data, _8$$6 TSRMLS_CC);
}
} else {
ZEPHIR_CALL_FUNCTION(&_9$$7, "rawurlencode", &_7, 11, val);
zephir_check_call_status();
ZEPHIR_INIT_LNVAR(_10$$7);
ZEPHIR_CONCAT_VSVS(_10$$7, key, "=", _9$$7, "&");
zephir_concat_self(&data, _10$$7 TSRMLS_CC);
}
}
ZEPHIR_INIT_VAR(_11$$3);
ZEPHIR_SINIT_VAR(_12$$3);
ZVAL_STRING(&_12$$3, "&", 0);
zephir_fast_trim(_11$$3, data, &_12$$3, ZEPHIR_TRIM_BOTH TSRMLS_CC);
RETURN_CCTOR(_11$$3);
}
RETVAL_ZVAL(args, 1, 0);
RETURN_MM();
}
示例13: PHP_METHOD
/**
* 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();
}
示例14: PHP_METHOD
PHP_METHOD(Test_Strings, testLtrim) {
zval *str;
zephir_fetch_params(0, 1, 0, &str);
zephir_fast_trim(return_value, str, NULL , ZEPHIR_TRIM_LEFT TSRMLS_CC);
return;
}
示例15: PHP_METHOD
PHP_METHOD(Owl_Filter_Trim, filter) {
zval *value;
zephir_fetch_params(0, 1, 0, &value);
zephir_fast_trim(return_value, value, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC);
return;
}