本文整理汇总了C++中zephir_hash_get_current_data_ex函数的典型用法代码示例。如果您正苦于以下问题:C++ zephir_hash_get_current_data_ex函数的具体用法?C++ zephir_hash_get_current_data_ex怎么用?C++ zephir_hash_get_current_data_ex使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zephir_hash_get_current_data_ex函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* Sets the path for a domain
*/
PHP_METHOD(Phalcon_Translate_Adapter_Gettext, setDirectory) {
int ZEPHIR_LAST_CALL_STATUS;
zephir_fcall_cache_entry *_3 = NULL;
HashTable *_1;
HashPosition _0;
zval *directory, *key = NULL, *value = NULL, **_2, *_4 = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &directory);
zephir_update_property_this(this_ptr, SL("_directory"), directory TSRMLS_CC);
if (Z_TYPE_P(directory) == IS_ARRAY) {
if (zephir_fast_count_int(directory TSRMLS_CC)) {
zephir_is_iterable(directory, &_1, &_0, 0, 0, "phalcon/translate/adapter/gettext.zep", 180);
for (
; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
; zephir_hash_move_forward_ex(_1, &_0)
) {
ZEPHIR_GET_HMKEY(key, _1, _0);
ZEPHIR_GET_HVALUE(value, _2);
ZEPHIR_CALL_FUNCTION(NULL, "bindtextdomain", &_3, 423, key, value);
zephir_check_call_status();
}
}
} else {
ZEPHIR_CALL_METHOD(&_4, this_ptr, "getdefaultdomain", NULL, 0);
zephir_check_call_status();
ZEPHIR_CALL_FUNCTION(NULL, "bindtextdomain", &_3, 423, _4, directory);
zephir_check_call_status();
}
ZEPHIR_MM_RESTORE();
}
示例2: PHP_METHOD
PHP_METHOD(Test_Flow, testFor2) {
HashTable *_2;
HashPosition _1;
double c;
zval *v = NULL, *k = NULL, *b, *_0 = NULL, **_3;
ZEPHIR_MM_GROW();
c = (double) (0);
ZEPHIR_INIT_VAR(b);
zephir_create_array(b, 4, 0 TSRMLS_CC);
ZEPHIR_INIT_VAR(_0);
ZVAL_LONG(_0, 1);
zephir_array_fast_append(b, _0);
ZEPHIR_INIT_NVAR(_0);
ZVAL_LONG(_0, 2);
zephir_array_fast_append(b, _0);
ZEPHIR_INIT_NVAR(_0);
ZVAL_LONG(_0, 3);
zephir_array_fast_append(b, _0);
ZEPHIR_INIT_NVAR(_0);
ZVAL_LONG(_0, 4);
zephir_array_fast_append(b, _0);
zephir_is_iterable(b, &_2, &_1, 0, 0, "test/flow.zep", 453);
for (
; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS
; zephir_hash_move_forward_ex(_2, &_1)
) {
ZEPHIR_GET_HMKEY(k, _2, _1);
ZEPHIR_GET_HVALUE(v, _3);
c += zephir_get_numberval(k);
}
RETURN_MM_DOUBLE(c);
}
示例3: PHP_METHOD
/**
* Applies a format to a message before sending it to the log
*
* @param string $message
* @param int $type
* @param int $timestamp
* @param array $context
*
* @return string
*/
PHP_METHOD(Phalcon_Logger_Formatter_Firephp, format) {
zval *_18;
HashTable *_7;
HashPosition _6;
zend_bool param, _11, _14;
int type, timestamp, ZEPHIR_LAST_CALL_STATUS;
zval *message_param = NULL, *type_param = NULL, *timestamp_param = NULL, *context = NULL, *meta, *body = NULL, *backtrace = NULL, *encoded, *len, *lastTrace = NULL, *_0 = NULL, *_1 = NULL, *_2, *backtraceItem = NULL, *key = NULL, _3, _4, *_5, **_8, *_9, *_10, *_12, *_13, *_15, *_16, *_17;
zval *message = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 3, 1, &message_param, &type_param, ×tamp_param, &context);
zephir_get_strval(message, message_param);
type = zephir_get_intval(type_param);
timestamp = zephir_get_intval(timestamp_param);
if (!context) {
context = ZEPHIR_GLOBAL(global_null);
}
if (Z_TYPE_P(context) == IS_ARRAY) {
ZEPHIR_CALL_METHOD(&_0, this_ptr, "interpolate", NULL, 0, message, context);
zephir_check_call_status();
zephir_get_strval(message, _0);
}
ZEPHIR_INIT_VAR(meta);
zephir_create_array(meta, 1, 0 TSRMLS_CC);
ZEPHIR_INIT_VAR(_1);
ZVAL_LONG(_1, type);
ZEPHIR_CALL_METHOD(&_0, this_ptr, "gettypestring", NULL, 0, _1);
zephir_check_call_status();
zephir_array_update_string(&meta, SL("Type"), &_0, PH_COPY | PH_SEPARATE);
_2 = zephir_fetch_nproperty_this(this_ptr, SL("_showBacktrace"), PH_NOISY_CC);
if (zephir_is_true(_2)) {
param = 0;
ZEPHIR_INIT_NVAR(_1);
ZEPHIR_GET_CONSTANT(_1, "PHP_VERSION");
ZEPHIR_SINIT_VAR(_3);
ZVAL_STRING(&_3, "5.3.6", 0);
ZEPHIR_SINIT_VAR(_4);
ZVAL_STRING(&_4, "<", 0);
ZEPHIR_CALL_FUNCTION(&_0, "version_compare", NULL, 248, _1, &_3, &_4);
zephir_check_call_status();
if (!(zephir_is_true(_0))) {
param = (2) ? 1 : 0;
}
ZEPHIR_CALL_FUNCTION(&backtrace, "debug_backtrace", NULL, 150, (param ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false)));
zephir_check_call_status();
Z_SET_ISREF_P(backtrace);
ZEPHIR_CALL_FUNCTION(&lastTrace, "end", NULL, 170, backtrace);
Z_UNSET_ISREF_P(backtrace);
zephir_check_call_status();
if (zephir_array_isset_string(lastTrace, SS("file"))) {
zephir_array_fetch_string(&_5, lastTrace, SL("file"), PH_NOISY | PH_READONLY, "phalcon/logger/formatter/firephp.zep", 133 TSRMLS_CC);
zephir_array_update_string(&meta, SL("File"), &_5, PH_COPY | PH_SEPARATE);
}
if (zephir_array_isset_string(lastTrace, SS("line"))) {
zephir_array_fetch_string(&_5, lastTrace, SL("line"), PH_NOISY | PH_READONLY, "phalcon/logger/formatter/firephp.zep", 137 TSRMLS_CC);
zephir_array_update_string(&meta, SL("Line"), &_5, PH_COPY | PH_SEPARATE);
}
zephir_is_iterable(backtrace, &_7, &_6, 1, 0, "phalcon/logger/formatter/firephp.zep", 146);
for (
; zephir_hash_get_current_data_ex(_7, (void**) &_8, &_6) == SUCCESS
; zephir_hash_move_forward_ex(_7, &_6)
) {
ZEPHIR_GET_HMKEY(key, _7, _6);
ZEPHIR_GET_HVALUE(backtraceItem, _8);
zephir_array_unset_string(&backtraceItem, SS("object"), PH_SEPARATE);
zephir_array_unset_string(&backtraceItem, SS("args"), PH_SEPARATE);
zephir_array_update_zval(&backtrace, key, &backtraceItem, PH_COPY | PH_SEPARATE);
}
}
_9 = zephir_fetch_nproperty_this(this_ptr, SL("_enableLabels"), PH_NOISY_CC);
if (zephir_is_true(_9)) {
zephir_array_update_string(&meta, SL("Label"), &message, PH_COPY | PH_SEPARATE);
}
_10 = zephir_fetch_nproperty_this(this_ptr, SL("_enableLabels"), PH_NOISY_CC);
_11 = !zephir_is_true(_10);
if (_11) {
_12 = zephir_fetch_nproperty_this(this_ptr, SL("_showBacktrace"), PH_NOISY_CC);
_11 = !zephir_is_true(_12);
}
_13 = zephir_fetch_nproperty_this(this_ptr, SL("_enableLabels"), PH_NOISY_CC);
_14 = zephir_is_true(_13);
if (_14) {
_15 = zephir_fetch_nproperty_this(this_ptr, SL("_showBacktrace"), PH_NOISY_CC);
_14 = !zephir_is_true(_15);
}
if (_11) {
//.........这里部分代码省略.........
示例4: PHP_METHOD
/**
* Unregisters one or all listeners for an event.
*
* @param string|\Xpl\Event\Event event Event ID or object.
* @param callable callback [Optional] Callback to remove. If no callback is given,
* then all of the event's listeners are removed.
* @return \Xpl\Event\Manager
*
* @throws \InvalidArgumentException if event is not a string or Event instance.
*/
PHP_METHOD(Xpl_Event_Manager, off) {
HashTable *_6$$8;
HashPosition _5$$8;
int ZEPHIR_LAST_CALL_STATUS;
zval *event, *callback = NULL, *id = NULL, *listeners = NULL, *_4, *_0$$4, *_1$$5, *_2$$5, *_3$$5, *i$$8 = NULL, *listener$$8 = NULL, **_7$$8, *_8$$9 = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &event, &callback);
if (!callback) {
callback = ZEPHIR_GLOBAL(global_null);
}
if (Z_TYPE_P(event) == IS_STRING) {
ZEPHIR_CPY_WRT(id, event);
} else if (zephir_instance_of_ev(event, xpl_event_event_ce TSRMLS_CC)) {
ZEPHIR_OBS_VAR(_0$$4);
zephir_read_property(&_0$$4, event, SL("id"), PH_NOISY_CC);
ZEPHIR_CPY_WRT(id, _0$$4);
} else {
ZEPHIR_INIT_VAR(_1$$5);
object_init_ex(_1$$5, spl_ce_InvalidArgumentException);
ZEPHIR_INIT_VAR(_2$$5);
zephir_gettype(_2$$5, event TSRMLS_CC);
ZEPHIR_INIT_VAR(_3$$5);
ZEPHIR_CONCAT_SV(_3$$5, "Event must be string or instance of Event, given: ", _2$$5);
ZEPHIR_CALL_METHOD(NULL, _1$$5, "__construct", NULL, 5, _3$$5);
zephir_check_call_status();
zephir_throw_exception_debug(_1$$5, "xpl/event/manager.zep", 118 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
ZEPHIR_OBS_VAR(listeners);
_4 = zephir_fetch_nproperty_this(this_ptr, SL("listeners"), PH_NOISY_CC);
if (zephir_array_isset_fetch(&listeners, _4, id, 0 TSRMLS_CC)) {
if (Z_TYPE_P(callback) == IS_NULL) {
zephir_array_unset(&listeners, id, PH_SEPARATE);
} else {
zephir_is_iterable(listeners, &_6$$8, &_5$$8, 1, 0, "xpl/event/manager.zep", 137);
for (
; zephir_hash_get_current_data_ex(_6$$8, (void**) &_7$$8, &_5$$8) == SUCCESS
; zephir_hash_move_forward_ex(_6$$8, &_5$$8)
) {
ZEPHIR_GET_HMKEY(i$$8, _6$$8, _5$$8);
ZEPHIR_GET_HVALUE(listener$$8, _7$$8);
ZEPHIR_OBS_NVAR(_8$$9);
zephir_read_property(&_8$$9, listener$$8, SL("callback"), PH_NOISY_CC);
if (ZEPHIR_IS_EQUAL(callback, _8$$9)) {
zephir_array_unset(&listeners, i$$8, PH_SEPARATE);
}
}
zend_hash_destroy(_6$$8);
FREE_HASHTABLE(_6$$8);
}
zephir_update_property_array(this_ptr, SL("listeners"), id, listeners TSRMLS_CC);
}
RETURN_THIS();
}
示例5: PHP_METHOD
/**
* Returns an array of Phalcon\Db\Column objects describing a table
*
* <code>
* print_r($connection->describeColumns("posts"));
* </code>
*
* @param string table
* @param string schema
* @return Phalcon\Db\Column[]
*/
PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeColumns) {
zephir_fcall_cache_entry *_17 = NULL;
zephir_nts_static zephir_fcall_cache_entry *_10 = NULL;
HashTable *_5;
HashPosition _4;
int ZEPHIR_LAST_CALL_STATUS;
zval *table_param = NULL, *schema_param = NULL, *columns, *columnType = NULL, *field = NULL, *definition = NULL, *oldColumn = NULL, *sizePattern, *matches = NULL, *matchOne = NULL, *matchTwo = NULL, *columnName, *_0 = NULL, *_1, *_2 = NULL, *_3 = NULL, **_6, *_7 = NULL, *_8 = NULL, *_9 = NULL, *_11 = NULL, *_12, *_13, *_14, *_15 = NULL, *_16;
zval *table = NULL, *schema = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &table_param, &schema_param);
zephir_get_strval(table, table_param);
if (!schema_param) {
ZEPHIR_INIT_VAR(schema);
ZVAL_EMPTY_STRING(schema);
} else {
zephir_get_strval(schema, schema_param);
}
ZEPHIR_INIT_VAR(oldColumn);
ZVAL_NULL(oldColumn);
ZEPHIR_INIT_VAR(sizePattern);
ZVAL_STRING(sizePattern, "#\\(([0-9]+)(?:,\\s*([0-9]+))*\\)#", 1);
ZEPHIR_INIT_VAR(columns);
array_init(columns);
_1 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC);
ZEPHIR_CALL_METHOD(&_2, _1, "describecolumns", NULL, table, schema);
zephir_check_call_status();
ZEPHIR_INIT_VAR(_3);
ZVAL_LONG(_3, 3);
ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, _2, _3);
zephir_check_call_status();
zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/mysql.zep", 271);
for (
; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS
; zephir_hash_move_forward_ex(_5, &_4)
) {
ZEPHIR_GET_HVALUE(field, _6);
ZEPHIR_INIT_NVAR(definition);
zephir_create_array(definition, 1, 0 TSRMLS_CC);
add_assoc_long_ex(definition, SS("bindType"), 2);
ZEPHIR_OBS_NVAR(columnType);
zephir_array_fetch_long(&columnType, field, 1, PH_NOISY, "phalcon/db/adapter/pdo/mysql.zep", 115 TSRMLS_CC);
while (1) {
if (zephir_memnstr_str(columnType, SL("enum"), "phalcon/db/adapter/pdo/mysql.zep", 122)) {
ZEPHIR_INIT_NVAR(_3);
ZVAL_LONG(_3, 5);
zephir_array_update_string(&definition, SL("type"), &_3, PH_COPY | PH_SEPARATE);
break;
}
if (zephir_memnstr_str(columnType, SL("int"), "phalcon/db/adapter/pdo/mysql.zep", 130)) {
ZEPHIR_INIT_NVAR(_7);
ZVAL_LONG(_7, 0);
zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE);
zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE);
ZEPHIR_INIT_NVAR(_8);
ZVAL_LONG(_8, 1);
zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE);
break;
}
if (zephir_memnstr_str(columnType, SL("varchar"), "phalcon/db/adapter/pdo/mysql.zep", 140)) {
ZEPHIR_INIT_NVAR(_7);
ZVAL_LONG(_7, 2);
zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE);
break;
}
if (zephir_memnstr_str(columnType, SL("datetime"), "phalcon/db/adapter/pdo/mysql.zep", 148)) {
ZEPHIR_INIT_NVAR(_7);
ZVAL_LONG(_7, 4);
zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE);
break;
}
if (zephir_memnstr_str(columnType, SL("decimal"), "phalcon/db/adapter/pdo/mysql.zep", 156)) {
ZEPHIR_INIT_NVAR(_7);
ZVAL_LONG(_7, 3);
zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE);
zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE);
ZEPHIR_INIT_NVAR(_8);
ZVAL_LONG(_8, 32);
zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE);
break;
}
if (zephir_memnstr_str(columnType, SL("char"), "phalcon/db/adapter/pdo/mysql.zep", 166)) {
ZEPHIR_INIT_NVAR(_7);
ZVAL_LONG(_7, 5);
zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE);
//.........这里部分代码省略.........
示例6: PHP_METHOD
PHP_METHOD(Yb_Std, groupIndexedValues) {
HashTable *_1;
HashPosition _0;
zephir_fcall_cache_entry *_5 = NULL;
int ZEPHIR_LAST_CALL_STATUS;
zval *groupKey = NULL, *indexKey = NULL, *valueKey = NULL;
zval *data_param = NULL, *groupKey_param = NULL, *indexKey_param = NULL, *valueKey_param = NULL, *k = NULL, *v = NULL, *arr = NULL, *groupValue = NULL, *indexValue = NULL, *valueValue = NULL, **_2, *_3$$4 = NULL, *_4$$4 = NULL, *_6$$5 = NULL, *_7$$5 = NULL, *_8$$6 = NULL, *_9$$6 = NULL, *_10$$7 = NULL, *_11$$7 = NULL;
zval *data = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 4, 0, &data_param, &groupKey_param, &indexKey_param, &valueKey_param);
zephir_get_arrval(data, data_param);
zephir_get_strval(groupKey, groupKey_param);
zephir_get_strval(indexKey, indexKey_param);
zephir_get_strval(valueKey, valueKey_param);
ZEPHIR_INIT_VAR(arr);
array_init(arr);
zephir_is_iterable(data, &_1, &_0, 0, 0, "yb/std.zep", 359);
for (
; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
; zephir_hash_move_forward_ex(_1, &_0)
) {
ZEPHIR_GET_HMKEY(k, _1, _0);
ZEPHIR_GET_HVALUE(v, _2);
if (unlikely(Z_TYPE_P(v) != IS_ARRAY)) {
ZEPHIR_INIT_NVAR(_3$$4);
object_init_ex(_3$$4, yb_exception_ce);
ZEPHIR_INIT_LNVAR(_4$$4);
ZEPHIR_CONCAT_SV(_4$$4, "Invalid item type, array required at: ", k);
ZEPHIR_CALL_METHOD(NULL, _3$$4, "__construct", &_5, 2, _4$$4);
zephir_check_call_status();
zephir_throw_exception_debug(_3$$4, "yb/std.zep", 344 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
ZEPHIR_OBS_NVAR(groupValue);
if (unlikely(!(zephir_array_isset_fetch(&groupValue, v, groupKey, 0 TSRMLS_CC)))) {
ZEPHIR_INIT_NVAR(_6$$5);
object_init_ex(_6$$5, yb_exception_ce);
ZEPHIR_INIT_LNVAR(_7$$5);
ZEPHIR_CONCAT_SV(_7$$5, "Cannot find value of group at: ", k);
ZEPHIR_CALL_METHOD(NULL, _6$$5, "__construct", &_5, 2, _7$$5);
zephir_check_call_status();
zephir_throw_exception_debug(_6$$5, "yb/std.zep", 347 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
ZEPHIR_OBS_NVAR(indexValue);
if (unlikely(!(zephir_array_isset_fetch(&indexValue, v, indexKey, 0 TSRMLS_CC)))) {
ZEPHIR_INIT_NVAR(_8$$6);
object_init_ex(_8$$6, yb_exception_ce);
ZEPHIR_INIT_LNVAR(_9$$6);
ZEPHIR_CONCAT_SV(_9$$6, "Cannot find value of index at: ", k);
ZEPHIR_CALL_METHOD(NULL, _8$$6, "__construct", &_5, 2, _9$$6);
zephir_check_call_status();
zephir_throw_exception_debug(_8$$6, "yb/std.zep", 350 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
ZEPHIR_OBS_NVAR(valueValue);
if (unlikely(!(zephir_array_isset_fetch(&valueValue, v, valueKey, 0 TSRMLS_CC)))) {
ZEPHIR_INIT_NVAR(_10$$7);
object_init_ex(_10$$7, yb_exception_ce);
ZEPHIR_INIT_LNVAR(_11$$7);
ZEPHIR_CONCAT_SV(_11$$7, "Cannot find value of value at: ", k);
ZEPHIR_CALL_METHOD(NULL, _10$$7, "__construct", &_5, 2, _11$$7);
zephir_check_call_status();
zephir_throw_exception_debug(_10$$7, "yb/std.zep", 353 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
zephir_array_update_multi(&arr, &valueValue TSRMLS_CC, SL("zz"), 2, groupValue, indexValue);
}
RETURN_CCTOR(arr);
}
示例7: PHP_METHOD
/**
* Handles routing information received from the rewrite engine
*
*<code>
* //Read the info from the rewrite engine
* $router->handle();
*
* //Manually passing an URL
* $router->handle('/posts/edit/1');
*</code>
*
* @param string uri
*/
PHP_METHOD(Test_Router, handle) {
zephir_nts_static zephir_fcall_cache_entry *_12 = NULL;
HashTable *_2, *_9;
HashPosition _1, _8;
int ZEPHIR_LAST_CALL_STATUS;
zval *uri = NULL, *realUri = NULL, *request = NULL, *currentHostName = NULL, *routeFound = NULL, *parts = NULL, *params, *matches, *notFoundPaths, *vnamespace, *module, *controller, *action, *paramsStr, *strParams = NULL, *paramsMerge = NULL, *route = NULL, *methods = NULL, *dependencyInjector = NULL, *hostname = NULL, *regexHostName = NULL, *matched = NULL, *pattern = NULL, *handledUri = NULL, *beforeMatch = NULL, *paths = NULL, *converters = NULL, *part = NULL, *position = NULL, *matchPosition = NULL, *_0, **_3, *_4, *_5 = NULL, *_6 = NULL, *_7 = NULL, **_10, _11, *_13, *_14, *_15, *_16;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 0, 1, &uri);
if (!uri) {
uri = ZEPHIR_GLOBAL(global_null);
}
if (!(zephir_is_true(uri))) {
ZEPHIR_CALL_METHOD(&realUri, this_ptr, "getrewriteuri", NULL);
zephir_check_call_status();
} else {
ZEPHIR_CPY_WRT(realUri, uri);
}
_0 = zephir_fetch_nproperty_this(this_ptr, SL("_removeExtraSlashes"), PH_NOISY_CC);
if (zephir_is_true(_0)) {
ZEPHIR_CALL_METHOD(&handledUri, this_ptr, "doremoveextraslashes", NULL, realUri);
zephir_check_call_status();
} else {
ZEPHIR_CPY_WRT(handledUri, realUri);
}
ZEPHIR_INIT_VAR(request);
ZVAL_NULL(request);
ZEPHIR_INIT_VAR(currentHostName);
ZVAL_NULL(currentHostName);
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);
_0 = zephir_fetch_nproperty_this(this_ptr, SL("_routes"), PH_NOISY_CC);
zephir_is_iterable(_0, &_2, &_1, 0, 1);
for (
; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS
; zephir_hash_move_backwards_ex(_2, &_1)
) {
ZEPHIR_GET_HVALUE(route, _3);
ZEPHIR_CALL_METHOD(&methods, route, "gethttpmethods", NULL);
zephir_check_call_status();
if (Z_TYPE_P(methods) != IS_NULL) {
if (Z_TYPE_P(request) == IS_NULL) {
_4 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC);
ZEPHIR_CPY_WRT(dependencyInjector, _4);
if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) {
ZEPHIR_THROW_EXCEPTION_STR(test_router_exception_ce, "A dependency injection container is required to access the 'request' service");
return;
}
ZEPHIR_INIT_NVAR(_5);
ZVAL_STRING(_5, "request", 0);
ZEPHIR_CALL_METHOD(&request, dependencyInjector, "getshared", NULL, _5);
zephir_check_temp_parameter(_5);
zephir_check_call_status();
}
ZEPHIR_CALL_METHOD(&_6, request, "ismethod", NULL, methods);
zephir_check_call_status();
if (ZEPHIR_IS_FALSE(_6)) {
continue;
}
}
ZEPHIR_CALL_METHOD(&hostname, route, "gethostname", NULL);
zephir_check_call_status();
if (Z_TYPE_P(hostname) != IS_NULL) {
if (Z_TYPE_P(request) == IS_NULL) {
ZEPHIR_OBS_NVAR(dependencyInjector);
zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC);
if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) {
ZEPHIR_THROW_EXCEPTION_STR(test_router_exception_ce, "A dependency injection container is required to access the 'request' service");
return;
}
ZEPHIR_INIT_NVAR(_5);
ZVAL_STRING(_5, "request", 0);
ZEPHIR_CALL_METHOD(&request, dependencyInjector, "getshared", NULL, _5);
zephir_check_temp_parameter(_5);
zephir_check_call_status();
//.........这里部分代码省略.........
示例8: PHP_METHOD
/**
* Returns current row in the resultset
*/
PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, current) {
zephir_fcall_cache_entry *_8 = NULL, *_11 = NULL;
HashTable *_2, *_5;
HashPosition _1, _4;
int dirtyState, ZEPHIR_LAST_CALL_STATUS;
zval *row, *hydrateMode, *alias = NULL, *activeRow = NULL, *type = NULL, *columnTypes, *column = NULL, *columnValue = NULL, *value = NULL, *attribute = NULL, *source = NULL, *attributes = NULL, *columnMap = NULL, *rowModel = NULL, *keepSnapshots = NULL, *sqlAlias = NULL, *_0, **_3, **_6, *_7 = NULL, *_9, *_10 = NULL, _12 = zval_used_for_init, _13 = zval_used_for_init;
ZEPHIR_MM_GROW();
ZEPHIR_OBS_VAR(activeRow);
zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC);
if (Z_TYPE_P(activeRow) != IS_NULL) {
RETURN_CCTOR(activeRow);
}
ZEPHIR_OBS_VAR(row);
zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC);
_0 = zephir_fetch_nproperty_this(this_ptr, SL("_disableHydration"), PH_NOISY_CC);
if (zephir_is_true(_0)) {
zephir_update_property_this(this_ptr, SL("_activeRow"), row TSRMLS_CC);
RETURN_CCTOR(row);
}
if (Z_TYPE_P(row) != IS_ARRAY) {
zephir_update_property_this(this_ptr, SL("_activeRow"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC);
RETURN_MM_BOOL(0);
}
ZEPHIR_OBS_VAR(hydrateMode);
zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC);
do {
if (ZEPHIR_IS_LONG(hydrateMode, 0)) {
ZEPHIR_INIT_NVAR(activeRow);
object_init_ex(activeRow, phalcon_mvc_model_row_ce);
if (zephir_has_constructor(activeRow TSRMLS_CC)) {
ZEPHIR_CALL_METHOD(NULL, activeRow, "__construct", NULL, 0);
zephir_check_call_status();
}
break;
}
if (ZEPHIR_IS_LONG(hydrateMode, 1)) {
ZEPHIR_INIT_NVAR(activeRow);
array_init(activeRow);
break;
}
ZEPHIR_INIT_NVAR(activeRow);
object_init(activeRow);
break;
} while(0);
ZEPHIR_OBS_VAR(columnTypes);
zephir_read_property_this(&columnTypes, this_ptr, SL("_columnTypes"), PH_NOISY_CC);
dirtyState = 0;
zephir_is_iterable(columnTypes, &_2, &_1, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 235);
for (
; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS
; zephir_hash_move_forward_ex(_2, &_1)
) {
ZEPHIR_GET_HMKEY(alias, _2, _1);
ZEPHIR_GET_HVALUE(column, _3);
if (Z_TYPE_P(column) != IS_ARRAY) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Column type is corrupt", "phalcon/mvc/model/resultset/complex.zep", 136);
return;
}
ZEPHIR_OBS_NVAR(type);
zephir_array_fetch_string(&type, column, SL("type"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 139 TSRMLS_CC);
if (ZEPHIR_IS_STRING(type, "object")) {
ZEPHIR_OBS_NVAR(source);
zephir_array_fetch_string(&source, column, SL("column"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 145 TSRMLS_CC);
ZEPHIR_OBS_NVAR(attributes);
zephir_array_fetch_string(&attributes, column, SL("attributes"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 146 TSRMLS_CC);
ZEPHIR_OBS_NVAR(columnMap);
zephir_array_fetch_string(&columnMap, column, SL("columnMap"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 147 TSRMLS_CC);
ZEPHIR_INIT_NVAR(rowModel);
array_init(rowModel);
zephir_is_iterable(attributes, &_5, &_4, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 165);
for (
; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS
; zephir_hash_move_forward_ex(_5, &_4)
) {
ZEPHIR_GET_HVALUE(attribute, _6);
ZEPHIR_OBS_NVAR(columnValue);
ZEPHIR_INIT_LNVAR(_7);
ZEPHIR_CONCAT_SVSV(_7, "_", source, "_", attribute);
zephir_array_fetch(&columnValue, row, _7, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 158 TSRMLS_CC);
zephir_array_update_zval(&rowModel, attribute, &columnValue, PH_COPY | PH_SEPARATE);
}
do {
if (ZEPHIR_IS_LONG(hydrateMode, 0)) {
ZEPHIR_OBS_NVAR(keepSnapshots);
if (!(zephir_array_isset_string_fetch(&keepSnapshots, column, SS("keepSnapshots"), 0 TSRMLS_CC))) {
ZEPHIR_INIT_NVAR(keepSnapshots);
ZVAL_BOOL(keepSnapshots, 0);
}
zephir_array_fetch_string(&_9, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 180 TSRMLS_CC);
ZEPHIR_INIT_NVAR(_10);
ZVAL_LONG(_10, dirtyState);
ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmap", &_8, 0, _9, rowModel, columnMap, _10, keepSnapshots);
zephir_check_call_status();
//.........这里部分代码省略.........
示例9: PHP_METHOD
//.........这里部分代码省略.........
ZEPHIR_INIT_BNVAR(_1);
ZVAL_LONG(_1, 3);
zephir_array_fast_append(_0, _1);
ZEPHIR_INIT_BNVAR(_1);
ZVAL_LONG(_1, 23);
zephir_array_fast_append(_0, _1);
zephir_array_fast_append(box, _0);
ZEPHIR_INIT_BNVAR(_0);
array_init_size(_0, 5);
ZEPHIR_INIT_BNVAR(_1);
ZVAL_LONG(_1, 23);
zephir_array_fast_append(_0, _1);
ZEPHIR_INIT_BNVAR(_1);
ZVAL_LONG(_1, 7);
zephir_array_fast_append(_0, _1);
ZEPHIR_INIT_BNVAR(_1);
ZVAL_LONG(_1, 12);
zephir_array_fast_append(_0, _1);
zephir_array_fast_append(box, _0);
ZEPHIR_INIT_BNVAR(_0);
array_init_size(_0, 5);
ZEPHIR_INIT_BNVAR(_1);
ZVAL_LONG(_1, 12);
zephir_array_fast_append(_0, _1);
ZEPHIR_INIT_BNVAR(_1);
ZVAL_LONG(_1, 25);
zephir_array_fast_append(_0, _1);
ZEPHIR_INIT_BNVAR(_1);
ZVAL_LONG(_1, 5);
zephir_array_fast_append(_0, _1);
zephir_array_fast_append(box, _0);
ZEPHIR_INIT_BNVAR(_0);
array_init_size(_0, 5);
ZEPHIR_INIT_BNVAR(_1);
ZVAL_LONG(_1, 24);
zephir_array_fast_append(_0, _1);
ZEPHIR_INIT_BNVAR(_1);
ZVAL_LONG(_1, 7);
zephir_array_fast_append(_0, _1);
ZEPHIR_INIT_BNVAR(_1);
ZVAL_LONG(_1, 11);
zephir_array_fast_append(_0, _1);
zephir_array_fast_append(box, _0);
ZEPHIR_INIT_BNVAR(_0);
array_init_size(_0, 5);
ZEPHIR_INIT_BNVAR(_1);
ZVAL_LONG(_1, 11);
zephir_array_fast_append(_0, _1);
ZEPHIR_INIT_BNVAR(_1);
ZVAL_LONG(_1, 27);
zephir_array_fast_append(_0, _1);
ZEPHIR_INIT_BNVAR(_1);
ZVAL_LONG(_1, 4);
zephir_array_fast_append(_0, _1);
zephir_array_fast_append(box, _0);
ZEPHIR_INIT_BNVAR(_0);
array_init_size(_0, 5);
ZEPHIR_INIT_BNVAR(_1);
ZVAL_LONG(_1, 11);
zephir_array_fast_append(_0, _1);
ZEPHIR_INIT_BNVAR(_1);
ZVAL_LONG(_1, 27);
zephir_array_fast_append(_0, _1);
ZEPHIR_INIT_BNVAR(_1);
ZVAL_LONG(_1, 4);
zephir_array_fast_append(_0, _1);
zephir_array_fast_append(box, _0);
zephir_is_iterable(box, &_3, &_2, 0, 0);
for (
; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS
; zephir_hash_move_forward_ex(_3, &_2)
) {
ZEPHIR_GET_HVALUE(side, _4);
j = 0;
_7 = 2;
_6 = 0;
_5 = 0;
if ((_6 <= _7)) {
while (1) {
if (_5) {
_6++;
if (!((_6 <= _7))) {
break;
}
} else {
_5 = 1;
}
i = _6;
zephir_array_fetch_long(&_8, side, i, PH_NOISY | PH_READONLY TSRMLS_CC);
j += zephir_get_numberval(_8);
}
}
if ((j != 42)) {
ZEPHIR_THROW_EXCEPTION_STR(test_exception_ce, "not true");
return;
}
}
ZEPHIR_MM_RESTORE();
}
示例10: PHP_METHOD
/**
* Tries to render the view with every engine registered in the component
*
* @param string path
* @param array params
*/
PHP_METHOD(Phalcon_Mvc_View_Simple, _internalRender) {
zephir_fcall_cache_entry *_11 = NULL, *_12 = NULL;
HashTable *_4;
HashPosition _3;
int ZEPHIR_LAST_CALL_STATUS;
zend_bool notExists, mustClean, _7, _9;
zval *path_param = NULL, *params, *eventsManager, *engines = NULL, *extension = NULL, *engine = NULL, *viewEnginePath = NULL, *viewsDirPath, *_0 = NULL, *_1 = NULL, *_2, **_5, *_6 = NULL, _8 = zval_used_for_init, *_10 = NULL;
zval *path = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 2, 0, &path_param, ¶ms);
if (unlikely(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 (likely(Z_TYPE_P(path_param) == IS_STRING)) {
zephir_get_strval(path, path_param);
} else {
ZEPHIR_INIT_VAR(path);
ZVAL_EMPTY_STRING(path);
}
ZEPHIR_OBS_VAR(eventsManager);
zephir_read_property_this(&eventsManager, this_ptr, SL("_eventsManager"), PH_NOISY_CC);
if (Z_TYPE_P(eventsManager) == IS_OBJECT) {
zephir_update_property_this(this_ptr, SL("_activeRenderPath"), path TSRMLS_CC);
}
if (Z_TYPE_P(eventsManager) == IS_OBJECT) {
ZEPHIR_INIT_VAR(_1);
ZVAL_STRING(_1, "view:beforeRender", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&_0, eventsManager, "fire", NULL, 0, _1, this_ptr);
zephir_check_temp_parameter(_1);
zephir_check_call_status();
if (ZEPHIR_IS_FALSE_IDENTICAL(_0)) {
RETURN_MM_NULL();
}
}
notExists = 1;
mustClean = 1;
_2 = zephir_fetch_nproperty_this(this_ptr, SL("_viewsDir"), PH_NOISY_CC);
ZEPHIR_INIT_VAR(viewsDirPath);
ZEPHIR_CONCAT_VV(viewsDirPath, _2, path);
ZEPHIR_CALL_METHOD(&engines, this_ptr, "_loadtemplateengines", NULL, 0);
zephir_check_call_status();
zephir_is_iterable(engines, &_4, &_3, 0, 0, "phalcon/mvc/view/simple.zep", 261);
for (
; zephir_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS
; zephir_hash_move_forward_ex(_4, &_3)
) {
ZEPHIR_GET_HMKEY(extension, _4, _3);
ZEPHIR_GET_HVALUE(engine, _5);
ZEPHIR_INIT_LNVAR(_6);
ZEPHIR_CONCAT_VV(_6, viewsDirPath, extension);
if ((zephir_file_exists(_6 TSRMLS_CC) == SUCCESS)) {
ZEPHIR_INIT_NVAR(viewEnginePath);
ZEPHIR_CONCAT_VV(viewEnginePath, viewsDirPath, extension);
} else {
_7 = zephir_is_true(extension);
if (_7) {
ZEPHIR_SINIT_NVAR(_8);
ZVAL_LONG(&_8, -zephir_fast_strlen_ev(extension));
ZEPHIR_INIT_NVAR(_1);
zephir_substr(_1, viewsDirPath, zephir_get_intval(&_8), 0, ZEPHIR_SUBSTR_NO_LENGTH);
_7 = ZEPHIR_IS_EQUAL(_1, extension);
}
_9 = _7;
if (_9) {
_9 = (zephir_file_exists(viewsDirPath TSRMLS_CC) == SUCCESS);
}
if (_9) {
ZEPHIR_CPY_WRT(viewEnginePath, viewsDirPath);
} else {
ZEPHIR_INIT_NVAR(viewEnginePath);
ZVAL_STRING(viewEnginePath, "", 1);
}
}
if (zephir_is_true(viewEnginePath)) {
if (Z_TYPE_P(eventsManager) == IS_OBJECT) {
ZEPHIR_INIT_NVAR(_10);
ZVAL_STRING(_10, "view:beforeRenderView", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&_0, eventsManager, "fire", &_11, 0, _10, this_ptr, viewEnginePath);
zephir_check_temp_parameter(_10);
zephir_check_call_status();
if (ZEPHIR_IS_FALSE_IDENTICAL(_0)) {
continue;
}
}
ZEPHIR_CALL_METHOD(NULL, engine, "render", NULL, 0, viewEnginePath, params, (mustClean ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false)));
zephir_check_call_status();
notExists = 0;
//.........这里部分代码省略.........
示例11: PHP_METHOD
/**
* Returns an array of Phalcon\Db\Column objects describing a table
*
* <code>
* print_r($connection->describeColumns("posts"));
* </code>
*/
PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns) {
zephir_fcall_cache_entry *_16 = NULL, *_20 = NULL, *_21 = NULL;
zend_bool _9;
HashTable *_5;
HashPosition _4;
int ZEPHIR_LAST_CALL_STATUS;
zval *table_param = NULL, *schema_param = NULL, *columns, *columnType = NULL, *field = NULL, *definition = NULL, *oldColumn = NULL, *sizePattern, *matches = NULL, *matchOne = NULL, *matchTwo = NULL, *columnName, *_0 = NULL, *_1, *_2 = NULL, *_3 = NULL, **_6, *_7 = NULL, *_8 = NULL, *_10, *_11 = NULL, *_12, *_13, _14 = zval_used_for_init, *_15 = NULL, *_17, *_18, *_19 = NULL;
zval *table = NULL, *schema = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &table_param, &schema_param);
zephir_get_strval(table, table_param);
if (!schema_param) {
ZEPHIR_INIT_VAR(schema);
ZVAL_EMPTY_STRING(schema);
} else {
zephir_get_strval(schema, schema_param);
}
ZEPHIR_INIT_VAR(oldColumn);
ZVAL_NULL(oldColumn);
ZEPHIR_INIT_VAR(sizePattern);
ZVAL_STRING(sizePattern, "#\\(([0-9]+)(?:,\\s*([0-9]+))*\\)#", 1);
ZEPHIR_INIT_VAR(columns);
array_init(columns);
_1 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC);
ZEPHIR_CALL_METHOD(&_2, _1, "describecolumns", NULL, 0, table, schema);
zephir_check_call_status();
ZEPHIR_INIT_VAR(_3);
ZVAL_LONG(_3, 3);
ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, _2, _3);
zephir_check_call_status();
zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 291);
for (
; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS
; zephir_hash_move_forward_ex(_5, &_4)
) {
ZEPHIR_GET_HVALUE(field, _6);
ZEPHIR_INIT_NVAR(definition);
zephir_create_array(definition, 1, 0 TSRMLS_CC);
add_assoc_long_ex(definition, SS("bindType"), 2);
ZEPHIR_OBS_NVAR(columnType);
zephir_array_fetch_long(&columnType, field, 2, PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 108 TSRMLS_CC);
while (1) {
if (zephir_memnstr_str(columnType, SL("tinyint(1)"), "phalcon/db/adapter/pdo/sqlite.zep", 115)) {
ZEPHIR_INIT_NVAR(_3);
ZVAL_LONG(_3, 8);
zephir_array_update_string(&definition, SL("type"), &_3, PH_COPY | PH_SEPARATE);
ZEPHIR_INIT_NVAR(_7);
ZVAL_LONG(_7, 5);
zephir_array_update_string(&definition, SL("bindType"), &_7, PH_COPY | PH_SEPARATE);
ZEPHIR_INIT_NVAR(columnType);
ZVAL_STRING(columnType, "boolean", 1);
break;
}
if (zephir_memnstr_str(columnType, SL("bigint"), "phalcon/db/adapter/pdo/sqlite.zep", 125)) {
ZEPHIR_INIT_NVAR(_7);
ZVAL_LONG(_7, 14);
zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE);
zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE);
ZEPHIR_INIT_NVAR(_8);
ZVAL_LONG(_8, 1);
zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE);
break;
}
_9 = zephir_memnstr_str(columnType, SL("int"), "phalcon/db/adapter/pdo/sqlite.zep", 135);
if (!(_9)) {
_9 = zephir_memnstr_str(columnType, SL("INT"), "phalcon/db/adapter/pdo/sqlite.zep", 135);
}
if (_9) {
ZEPHIR_INIT_NVAR(_7);
ZVAL_LONG(_7, 0);
zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE);
zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE);
ZEPHIR_INIT_NVAR(_8);
ZVAL_LONG(_8, 1);
zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE);
zephir_array_fetch_long(&_10, field, 5, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 141 TSRMLS_CC);
if (zephir_is_true(_10)) {
zephir_array_update_string(&definition, SL("autoIncrement"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE);
}
break;
}
if (zephir_memnstr_str(columnType, SL("varchar"), "phalcon/db/adapter/pdo/sqlite.zep", 150)) {
ZEPHIR_INIT_NVAR(_7);
ZVAL_LONG(_7, 2);
zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE);
break;
}
if (zephir_memnstr_str(columnType, SL("date"), "phalcon/db/adapter/pdo/sqlite.zep", 158)) {
//.........这里部分代码省略.........
示例12: PHP_METHOD
/**
* Sanitizes a value with a specified single or set of filters
*/
PHP_METHOD(Phalcon_Filter, sanitize) {
zephir_fcall_cache_entry *_8 = NULL;
int ZEPHIR_LAST_CALL_STATUS;
HashTable *_1, *_5, *_10;
HashPosition _0, _4, _9;
zend_bool noRecursive, _3;
zval *value = NULL, *filters, *noRecursive_param = NULL, *filter = NULL, *arrayValue = NULL, *itemKey = NULL, *itemValue = NULL, *sanitizedValue, **_2, **_6, *_7 = NULL, **_11;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 2, 1, &value, &filters, &noRecursive_param);
ZEPHIR_SEPARATE_PARAM(value);
if (!noRecursive_param) {
noRecursive = 0;
} else {
noRecursive = zephir_get_boolval(noRecursive_param);
}
if (Z_TYPE_P(filters) == IS_ARRAY) {
if (Z_TYPE_P(value) != IS_NULL) {
zephir_is_iterable(filters, &_1, &_0, 0, 0, "phalcon/filter.zep", 107);
for (
; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
; zephir_hash_move_forward_ex(_1, &_0)
) {
ZEPHIR_GET_HVALUE(filter, _2);
_3 = Z_TYPE_P(value) == IS_ARRAY;
if (_3) {
_3 = !noRecursive;
}
if (_3) {
ZEPHIR_INIT_NVAR(arrayValue);
array_init(arrayValue);
zephir_is_iterable(value, &_5, &_4, 0, 0, "phalcon/filter.zep", 102);
for (
; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS
; zephir_hash_move_forward_ex(_5, &_4)
) {
ZEPHIR_GET_HMKEY(itemKey, _5, _4);
ZEPHIR_GET_HVALUE(itemValue, _6);
ZEPHIR_CALL_METHOD(&_7, this_ptr, "_sanitize", &_8, itemValue, filter);
zephir_check_call_status();
zephir_array_update_zval(&arrayValue, itemKey, &_7, PH_COPY | PH_SEPARATE);
}
ZEPHIR_CPY_WRT(value, arrayValue);
} else {
ZEPHIR_CALL_METHOD(&_7, this_ptr, "_sanitize", &_8, value, filter);
zephir_check_call_status();
ZEPHIR_CPY_WRT(value, _7);
}
}
}
RETVAL_ZVAL(value, 1, 0);
RETURN_MM();
}
_3 = Z_TYPE_P(value) == IS_ARRAY;
if (_3) {
_3 = !noRecursive;
}
if (_3) {
ZEPHIR_INIT_VAR(sanitizedValue);
array_init(sanitizedValue);
zephir_is_iterable(value, &_10, &_9, 0, 0, "phalcon/filter.zep", 119);
for (
; zephir_hash_get_current_data_ex(_10, (void**) &_11, &_9) == SUCCESS
; zephir_hash_move_forward_ex(_10, &_9)
) {
ZEPHIR_GET_HMKEY(itemKey, _10, _9);
ZEPHIR_GET_HVALUE(itemValue, _11);
ZEPHIR_CALL_METHOD(&_7, this_ptr, "_sanitize", &_8, itemValue, filters);
zephir_check_call_status();
zephir_array_update_zval(&sanitizedValue, itemKey, &_7, PH_COPY | PH_SEPARATE);
}
RETURN_CCTOR(sanitizedValue);
}
ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_sanitize", &_8, value, filters);
zephir_check_call_status();
RETURN_MM();
}
示例13: PHP_METHOD
/**
* Phalcon\Config\Adapter\Ini constructor
*/
PHP_METHOD(Phalcon_Config_Adapter_Ini, __construct) {
HashTable *_5, *_8$$5;
HashPosition _4, _7$$5;
zephir_fcall_cache_entry *_12 = NULL, *_16 = NULL, *_17 = NULL;
int ZEPHIR_LAST_CALL_STATUS;
zval *filePath_param = NULL, *iniConfig = NULL, _0, *config = NULL, *section = NULL, *sections = NULL, *directives = NULL, *path = NULL, *lastValue = NULL, **_6, *_1$$3, *_2$$3, *_3$$3, **_9$$5, *_10$$6 = NULL, *_13$$7 = NULL, _14$$7 = zval_used_for_init, *_15$$8 = NULL;
zval *filePath = NULL, *_11$$6 = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &filePath_param);
if (unlikely(Z_TYPE_P(filePath_param) != IS_STRING && Z_TYPE_P(filePath_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'filePath' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(filePath_param) == IS_STRING)) {
zephir_get_strval(filePath, filePath_param);
} else {
ZEPHIR_INIT_VAR(filePath);
ZVAL_EMPTY_STRING(filePath);
}
ZEPHIR_SINIT_VAR(_0);
ZVAL_LONG(&_0, 1);
ZEPHIR_CALL_FUNCTION(&iniConfig, "parse_ini_file", NULL, 134, filePath, ZEPHIR_GLOBAL(global_true), &_0);
zephir_check_call_status();
if (ZEPHIR_IS_FALSE_IDENTICAL(iniConfig)) {
ZEPHIR_INIT_VAR(_1$$3);
object_init_ex(_1$$3, phalcon_config_exception_ce);
ZEPHIR_INIT_VAR(_2$$3);
zephir_basename(_2$$3, filePath TSRMLS_CC);
ZEPHIR_INIT_VAR(_3$$3);
ZEPHIR_CONCAT_SVS(_3$$3, "Configuration file ", _2$$3, " can't be loaded");
ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 9, _3$$3);
zephir_check_call_status();
zephir_throw_exception_debug(_1$$3, "phalcon/config/adapter/ini.zep", 67 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
ZEPHIR_INIT_VAR(config);
array_init(config);
zephir_is_iterable(iniConfig, &_5, &_4, 0, 0, "phalcon/config/adapter/ini.zep", 88);
for (
; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS
; zephir_hash_move_forward_ex(_5, &_4)
) {
ZEPHIR_GET_HMKEY(section, _5, _4);
ZEPHIR_GET_HVALUE(directives, _6);
if (Z_TYPE_P(directives) == IS_ARRAY) {
ZEPHIR_INIT_NVAR(sections);
array_init(sections);
zephir_is_iterable(directives, &_8$$5, &_7$$5, 0, 0, "phalcon/config/adapter/ini.zep", 80);
for (
; zephir_hash_get_current_data_ex(_8$$5, (void**) &_9$$5, &_7$$5) == SUCCESS
; zephir_hash_move_forward_ex(_8$$5, &_7$$5)
) {
ZEPHIR_GET_HMKEY(path, _8$$5, _7$$5);
ZEPHIR_GET_HVALUE(lastValue, _9$$5);
zephir_get_strval(_11$$6, path);
ZEPHIR_CALL_METHOD(&_10$$6, this_ptr, "_parseinistring", &_12, 0, _11$$6, lastValue);
zephir_check_call_status();
zephir_array_append(§ions, _10$$6, PH_SEPARATE, "phalcon/config/adapter/ini.zep", 78);
}
if (zephir_fast_count_int(sections TSRMLS_CC)) {
ZEPHIR_INIT_NVAR(_13$$7);
ZEPHIR_SINIT_NVAR(_14$$7);
ZVAL_STRING(&_14$$7, "array_merge_recursive", 0);
ZEPHIR_CALL_USER_FUNC_ARRAY(_13$$7, &_14$$7, sections);
zephir_check_call_status();
zephir_array_update_zval(&config, section, &_13$$7, PH_COPY | PH_SEPARATE);
}
} else {
ZEPHIR_CALL_METHOD(&_15$$8, this_ptr, "_cast", &_16, 135, directives);
zephir_check_call_status();
zephir_array_update_zval(&config, section, &_15$$8, PH_COPY | PH_SEPARATE);
}
}
ZEPHIR_CALL_PARENT(NULL, phalcon_config_adapter_ini_ce, this_ptr, "__construct", &_17, 19, config);
zephir_check_call_status();
ZEPHIR_MM_RESTORE();
}
示例14: PHP_METHOD
/**
* Outputs a message formatting it with HTML
*
*<code>
* $flash->outputMessage('error', message);
*</code>
*
* @param string|array message
* @return string|void
*/
PHP_METHOD(Phalcon_Flash, outputMessage) {
HashTable *_3$$8;
HashPosition _2$$8;
zend_bool automaticHtml = 0, implicitFlush = 0;
zval *type_param = NULL, *message, *content = NULL, *cssClasses = NULL, *classes = NULL, *typeClasses = NULL, *eol = NULL, *msg = NULL, *htmlMessage = NULL, *_0 = NULL, *_1$$5, **_4$$8;
zval *type = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 2, 0, &type_param, &message);
zephir_get_strval(type, type_param);
ZEPHIR_OBS_VAR(_0);
zephir_read_property_this(&_0, this_ptr, SL("_automaticHtml"), PH_NOISY_CC);
automaticHtml = zephir_get_boolval(_0);
if (automaticHtml == 1) {
ZEPHIR_OBS_VAR(classes);
zephir_read_property_this(&classes, this_ptr, SL("_cssClasses"), PH_NOISY_CC);
ZEPHIR_OBS_VAR(typeClasses);
if (zephir_array_isset_fetch(&typeClasses, classes, type, 0 TSRMLS_CC)) {
ZEPHIR_INIT_VAR(cssClasses);
if (Z_TYPE_P(typeClasses) == IS_ARRAY) {
ZEPHIR_INIT_VAR(_1$$5);
zephir_fast_join_str(_1$$5, SL(" "), typeClasses TSRMLS_CC);
ZEPHIR_CONCAT_SVS(cssClasses, " class=\"", _1$$5, "\"");
} else {
ZEPHIR_CONCAT_SVS(cssClasses, " class=\"", typeClasses, "\"");
}
} else {
ZEPHIR_INIT_NVAR(cssClasses);
ZVAL_STRING(cssClasses, "", 1);
}
ZEPHIR_INIT_VAR(eol);
ZEPHIR_GET_CONSTANT(eol, "PHP_EOL");
}
ZEPHIR_OBS_NVAR(_0);
zephir_read_property_this(&_0, this_ptr, SL("_implicitFlush"), PH_NOISY_CC);
implicitFlush = zephir_get_boolval(_0);
if (Z_TYPE_P(message) == IS_ARRAY) {
if (implicitFlush == 0) {
ZEPHIR_INIT_VAR(content);
ZVAL_STRING(content, "", 1);
}
zephir_is_iterable(message, &_3$$8, &_2$$8, 0, 0, "phalcon/flash.zep", 204);
for (
; zephir_hash_get_current_data_ex(_3$$8, (void**) &_4$$8, &_2$$8) == SUCCESS
; zephir_hash_move_forward_ex(_3$$8, &_2$$8)
) {
ZEPHIR_GET_HVALUE(msg, _4$$8);
if (automaticHtml == 1) {
ZEPHIR_INIT_NVAR(htmlMessage);
ZEPHIR_CONCAT_SVSVSV(htmlMessage, "<div", cssClasses, ">", msg, "</div>", eol);
} else {
ZEPHIR_CPY_WRT(htmlMessage, msg);
}
if (implicitFlush == 1) {
zend_print_zval(htmlMessage, 0);
} else {
zephir_concat_self(&content, htmlMessage TSRMLS_CC);
zephir_update_property_array_append(this_ptr, SL("_messages"), htmlMessage TSRMLS_CC);
}
}
if (implicitFlush == 0) {
RETURN_CCTOR(content);
}
} else {
if (automaticHtml == 1) {
ZEPHIR_INIT_NVAR(htmlMessage);
ZEPHIR_CONCAT_SVSVSV(htmlMessage, "<div", cssClasses, ">", message, "</div>", eol);
} else {
ZEPHIR_CPY_WRT(htmlMessage, message);
}
if (implicitFlush == 1) {
zend_print_zval(htmlMessage, 0);
} else {
zephir_update_property_array_append(this_ptr, SL("_messages"), htmlMessage TSRMLS_CC);
RETURN_CCTOR(htmlMessage);
}
}
ZEPHIR_MM_RESTORE();
}
示例15: PHP_METHOD
//.........这里部分代码省略.........
if (ZEPHIR_IS_EMPTY(columnSql)) {
zephir_concat_self_str(&columnSql, SL("VARCHAR") TSRMLS_CC);
}
ZEPHIR_CALL_METHOD(&_0, column, "getsize", NULL);
zephir_check_call_status();
ZEPHIR_INIT_VAR(_1);
ZEPHIR_CONCAT_SVS(_1, "(", _0, ")");
zephir_concat_self(&columnSql, _1 TSRMLS_CC);
break;
}
if (ZEPHIR_IS_LONG(type, 3)) {
if (ZEPHIR_IS_EMPTY(columnSql)) {
zephir_concat_self_str(&columnSql, SL("NUMERIC") TSRMLS_CC);
}
ZEPHIR_CALL_METHOD(&_0, column, "getsize", NULL);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&_2, column, "getscale", NULL);
zephir_check_call_status();
ZEPHIR_INIT_LNVAR(_1);
ZEPHIR_CONCAT_SVSVS(_1, "(", _0, ",", _2, ")");
zephir_concat_self(&columnSql, _1 TSRMLS_CC);
break;
}
if (ZEPHIR_IS_LONG(type, 4)) {
if (ZEPHIR_IS_EMPTY(columnSql)) {
zephir_concat_self_str(&columnSql, SL("TIMESTAMP") TSRMLS_CC);
}
break;
}
if (ZEPHIR_IS_LONG(type, 5)) {
if (ZEPHIR_IS_EMPTY(columnSql)) {
zephir_concat_self_str(&columnSql, SL("CHARACTER") TSRMLS_CC);
}
ZEPHIR_CALL_METHOD(&_0, column, "getsize", NULL);
zephir_check_call_status();
ZEPHIR_INIT_LNVAR(_1);
ZEPHIR_CONCAT_SVS(_1, "(", _0, ")");
zephir_concat_self(&columnSql, _1 TSRMLS_CC);
break;
}
if (ZEPHIR_IS_LONG(type, 6)) {
if (ZEPHIR_IS_EMPTY(columnSql)) {
zephir_concat_self_str(&columnSql, SL("TEXT") TSRMLS_CC);
}
break;
}
if (ZEPHIR_IS_LONG(type, 7)) {
if (ZEPHIR_IS_EMPTY(columnSql)) {
zephir_concat_self_str(&columnSql, SL("FLOAT") TSRMLS_CC);
}
break;
}
if (ZEPHIR_IS_EMPTY(columnSql)) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Unrecognized SQLite data type", "phalcon/db/dialect/sqlite.zep", 112);
return;
}
ZEPHIR_CALL_METHOD(&typeValues, column, "gettypevalues", NULL);
zephir_check_call_status();
if (!(ZEPHIR_IS_EMPTY(typeValues))) {
if (Z_TYPE_P(typeValues) == IS_ARRAY) {
ZEPHIR_INIT_VAR(valueSql);
ZVAL_STRING(valueSql, "", 1);
zephir_is_iterable(typeValues, &_4, &_3, 0, 0, "phalcon/db/dialect/sqlite.zep", 123);
for (
; zephir_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS
; zephir_hash_move_forward_ex(_4, &_3)
) {
ZEPHIR_GET_HVALUE(value, _5);
ZEPHIR_SINIT_NVAR(_6);
ZVAL_STRING(&_6, "\"", 0);
ZEPHIR_CALL_FUNCTION(&_0, "addcslashes", &_7, value, &_6);
zephir_check_call_status();
ZEPHIR_INIT_LNVAR(_1);
ZEPHIR_CONCAT_SVS(_1, "\"", _0, "\", ");
zephir_concat_self(&valueSql, _1 TSRMLS_CC);
}
ZEPHIR_SINIT_NVAR(_6);
ZVAL_LONG(&_6, 0);
ZEPHIR_SINIT_VAR(_8);
ZVAL_LONG(&_8, -2);
ZEPHIR_INIT_VAR(_9);
zephir_substr(_9, valueSql, 0 , -2 , 0);
ZEPHIR_INIT_VAR(_10);
ZEPHIR_CONCAT_SVS(_10, "(", _9, ")");
zephir_concat_self(&columnSql, _10 TSRMLS_CC);
} else {
ZEPHIR_SINIT_NVAR(_8);
ZVAL_STRING(&_8, "\"", 0);
ZEPHIR_CALL_FUNCTION(&_2, "addcslashes", &_7, typeValues, &_8);
zephir_check_call_status();
ZEPHIR_INIT_LNVAR(_10);
ZEPHIR_CONCAT_SVS(_10, "(\"", _2, "\")");
zephir_concat_self(&columnSql, _10 TSRMLS_CC);
}
}
} while(0);
RETURN_CCTOR(columnSql);
}