本文整理汇总了C++中zephir_array_isset_string_fetch函数的典型用法代码示例。如果您正苦于以下问题:C++ zephir_array_isset_string_fetch函数的具体用法?C++ zephir_array_isset_string_fetch怎么用?C++ zephir_array_isset_string_fetch使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zephir_array_isset_string_fetch函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* Restore the internal state of a service
*/
PHP_METHOD(Phalcon_Di_Service, __set_state) {
zend_long ZEPHIR_LAST_CALL_STATUS;
zval *attributes_param = NULL, definition, shared;
zval attributes;
zval *this_ptr = getThis();
ZVAL_UNDEF(&attributes);
ZVAL_UNDEF(&definition);
ZVAL_UNDEF(&shared);
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &attributes_param);
ZEPHIR_OBS_COPY_OR_DUP(&attributes, attributes_param);
ZEPHIR_OBS_VAR(&definition);
if (!(zephir_array_isset_string_fetch(&definition, &attributes, SL("_definition"), 0))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_di_exception_ce, "The attribute '_definition' is required", "phalcon/di/service.zep", 277);
return;
}
ZEPHIR_OBS_VAR(&shared);
if (!(zephir_array_isset_string_fetch(&shared, &attributes, SL("_shared"), 0))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_di_exception_ce, "The attribute '_shared' is required", "phalcon/di/service.zep", 281);
return;
}
object_init_ex(return_value, phalcon_di_service_ce);
ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 52, &definition, &shared);
zephir_check_call_status();
RETURN_MM();
}
示例2: PHP_METHOD
/**
* Phalcon\Mvc\Model\MetaData\Xcache constructor
*
* @param array options
*/
PHP_METHOD(Phalcon_Mvc_Model_MetaData_Xcache, __construct) {
zval *options = NULL, *prefix = NULL, *ttl = NULL, *_0;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 0, 1, &options);
if (!options) {
options = ZEPHIR_GLOBAL(global_null);
}
if (Z_TYPE_P(options) == IS_ARRAY) {
if (zephir_array_isset_string_fetch(&prefix, options, SS("prefix"), 1 TSRMLS_CC)) {
zephir_update_property_this(this_ptr, SL("_prefix"), prefix TSRMLS_CC);
}
if (zephir_array_isset_string_fetch(&ttl, options, SS("lifetime"), 1 TSRMLS_CC)) {
zephir_update_property_this(this_ptr, SL("_ttl"), ttl TSRMLS_CC);
}
}
ZEPHIR_INIT_VAR(_0);
array_init(_0);
zephir_update_property_this(this_ptr, SL("_metaData"), _0 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
}
示例3: PHP_METHOD
/**
* Phalcon\Paginator\Adapter\QueryBuilder
*/
PHP_METHOD(Phalcon_Paginator_Adapter_QueryBuilder, __construct) {
int ZEPHIR_LAST_CALL_STATUS;
zval *config_param = NULL, *builder, *limit, *page;
zval *config = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &config_param);
zephir_get_arrval(config, config_param);
zephir_update_property_this(this_ptr, SL("_config"), config TSRMLS_CC);
ZEPHIR_OBS_VAR(builder);
if (!(zephir_array_isset_string_fetch(&builder, config, SS("builder"), 0 TSRMLS_CC))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_paginator_exception_ce, "Parameter 'builder' is required", "phalcon/paginator/adapter/querybuilder.zep", 67);
return;
}
ZEPHIR_OBS_VAR(limit);
if (!(zephir_array_isset_string_fetch(&limit, config, SS("limit"), 0 TSRMLS_CC))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_paginator_exception_ce, "Parameter 'limit' is required", "phalcon/paginator/adapter/querybuilder.zep", 71);
return;
}
ZEPHIR_CALL_METHOD(NULL, this_ptr, "setquerybuilder", NULL, builder);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(NULL, this_ptr, "setlimit", NULL, limit);
zephir_check_call_status();
ZEPHIR_OBS_VAR(page);
if (zephir_array_isset_string_fetch(&page, config, SS("page"), 0 TSRMLS_CC)) {
ZEPHIR_CALL_METHOD(NULL, this_ptr, "setcurrentpage", NULL, page);
zephir_check_call_status();
}
ZEPHIR_MM_RESTORE();
}
示例4: PHP_METHOD
/**
* @param \Phal\Entity
* @param array data
* @return void
*/
PHP_METHOD(Phal_Format_Reader_Hal_JsonReader, transformMetadata) {
int ZEPHIR_LAST_CALL_STATUS;
zval *resource, *data, *key = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 2, 0, &resource, &data);
if (!(zephir_instance_of_ev(resource, phal_entity_ce TSRMLS_CC))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Parameter 'resource' must be an instance of 'Phal\\Entity'", "", 0);
return;
}
if (Z_TYPE_P(data) != IS_ARRAY) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "data must be array", "phal/format/reader/hal/jsonreader.zep", 43);
return;
}
ZEPHIR_OBS_VAR(key);
if (zephir_array_isset_string_fetch(&key, data, SS("_links"), 0 TSRMLS_CC)) {
ZEPHIR_CALL_METHOD(NULL, this_ptr, "transformlinks", NULL, resource, key);
zephir_check_call_status();
}
ZEPHIR_OBS_NVAR(key);
if (zephir_array_isset_string_fetch(&key, data, SS("_embedded"), 0 TSRMLS_CC)) {
ZEPHIR_CALL_METHOD(NULL, this_ptr, "transformembeddeds", NULL, resource, key);
zephir_check_call_status();
}
ZEPHIR_MM_RESTORE();
}
示例5: PHP_METHOD
/**
* Restore a Phalcon\Db\Index object from export
*/
PHP_METHOD(Phalcon_Db_Index, __set_state) {
int ZEPHIR_LAST_CALL_STATUS;
zval *data_param = NULL, *indexName, *columns, *type = NULL;
zval *data = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &data_param);
data = data_param;
ZEPHIR_OBS_VAR(indexName);
if (!(zephir_array_isset_string_fetch(&indexName, data, SS("_name"), 0 TSRMLS_CC))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "_name parameter is required", "phalcon/db/index.zep", 71);
return;
}
ZEPHIR_OBS_VAR(columns);
if (!(zephir_array_isset_string_fetch(&columns, data, SS("_columns"), 0 TSRMLS_CC))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "_columns parameter is required", "phalcon/db/index.zep", 75);
return;
}
ZEPHIR_OBS_VAR(type);
if (!(zephir_array_isset_string_fetch(&type, data, SS("_type"), 0 TSRMLS_CC))) {
ZEPHIR_INIT_NVAR(type);
ZVAL_STRING(type, "", 1);
}
object_init_ex(return_value, phalcon_db_index_ce);
ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 10, indexName, columns, type);
zephir_check_call_status();
RETURN_MM();
}
示例6: PHP_METHOD
/**
* Inserts jobs into the queue
*/
PHP_METHOD(Phalcon_Queue_Beanstalk, put) {
zend_bool _2;
zephir_fcall_cache_entry *_1 = NULL;
int ZEPHIR_LAST_CALL_STATUS;
zval *options = NULL;
zval *data, *options_param = NULL, *priority = NULL, *delay = NULL, *ttr = NULL, *serialized = NULL, *response = NULL, *status = NULL, *length = NULL, *_0, *_3;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &data, &options_param);
if (!options_param) {
ZEPHIR_INIT_VAR(options);
array_init(options);
} else {
zephir_get_arrval(options, options_param);
}
ZEPHIR_OBS_VAR(priority);
if (!(zephir_array_isset_string_fetch(&priority, options, SS("priority"), 0 TSRMLS_CC))) {
ZEPHIR_INIT_NVAR(priority);
ZVAL_LONG(priority, 100);
}
ZEPHIR_OBS_VAR(delay);
if (!(zephir_array_isset_string_fetch(&delay, options, SS("delay"), 0 TSRMLS_CC))) {
ZEPHIR_INIT_NVAR(delay);
ZVAL_LONG(delay, 0);
}
ZEPHIR_OBS_VAR(ttr);
if (!(zephir_array_isset_string_fetch(&ttr, options, SS("ttr"), 0 TSRMLS_CC))) {
ZEPHIR_INIT_NVAR(ttr);
ZVAL_LONG(ttr, 86400);
}
ZEPHIR_CALL_FUNCTION(&serialized, "serialize", NULL, 75, data);
zephir_check_call_status();
ZEPHIR_INIT_VAR(length);
ZVAL_LONG(length, zephir_fast_strlen_ev(serialized));
ZEPHIR_INIT_VAR(_0);
ZEPHIR_CONCAT_SVSVSVSV(_0, "put ", priority, " ", delay, " ", ttr, " ", length);
ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", &_1, 0, _0);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", &_1, 0, serialized);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", NULL, 382);
zephir_check_call_status();
zephir_array_fetch_long(&status, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 150 TSRMLS_CC);
_2 = !ZEPHIR_IS_STRING(status, "INSERTED");
if (_2) {
_2 = !ZEPHIR_IS_STRING(status, "BURIED");
}
if (_2) {
RETURN_MM_BOOL(0);
}
zephir_array_fetch_long(&_3, response, 1, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 156 TSRMLS_CC);
RETURN_CTOR(_3);
}
示例7: PHP_METHOD
/**
* Sets the conditions parameter in the criteria
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, where) {
zval *conditions_param = NULL, *bindParams = NULL, *bindTypes = NULL, *currentBindParams = NULL, *mergedParams = NULL, *mergedParamsTypes = NULL, *currentBindTypes = NULL, *_0, *_1$$3, *_2$$3, *_3$$6, *_4$$6;
zval *conditions = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 2, &conditions_param, &bindParams, &bindTypes);
if (unlikely(Z_TYPE_P(conditions_param) != IS_STRING && Z_TYPE_P(conditions_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'conditions' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(conditions_param) == IS_STRING)) {
zephir_get_strval(conditions, conditions_param);
} else {
ZEPHIR_INIT_VAR(conditions);
ZVAL_EMPTY_STRING(conditions);
}
if (!bindParams) {
bindParams = ZEPHIR_GLOBAL(global_null);
}
if (!bindTypes) {
bindTypes = ZEPHIR_GLOBAL(global_null);
}
ZEPHIR_INIT_VAR(_0);
ZVAL_STRING(_0, "conditions", 1);
zephir_update_property_array(this_ptr, SL("_params"), _0, conditions TSRMLS_CC);
if (Z_TYPE_P(bindParams) == IS_ARRAY) {
ZEPHIR_OBS_VAR(currentBindParams);
_1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_params"), PH_NOISY_CC);
if (zephir_array_isset_string_fetch(¤tBindParams, _1$$3, SS("bind"), 0 TSRMLS_CC)) {
ZEPHIR_INIT_VAR(mergedParams);
zephir_fast_array_merge(mergedParams, &(currentBindParams), &(bindParams) TSRMLS_CC);
} else {
ZEPHIR_CPY_WRT(mergedParams, bindParams);
}
ZEPHIR_INIT_VAR(_2$$3);
ZVAL_STRING(_2$$3, "bind", 1);
zephir_update_property_array(this_ptr, SL("_params"), _2$$3, mergedParams TSRMLS_CC);
}
if (Z_TYPE_P(bindTypes) == IS_ARRAY) {
ZEPHIR_OBS_VAR(currentBindTypes);
_3$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_params"), PH_NOISY_CC);
if (zephir_array_isset_string_fetch(¤tBindTypes, _3$$6, SS("bindTypes"), 0 TSRMLS_CC)) {
ZEPHIR_INIT_VAR(mergedParamsTypes);
zephir_fast_array_merge(mergedParamsTypes, &(currentBindTypes), &(bindTypes) TSRMLS_CC);
} else {
ZEPHIR_CPY_WRT(mergedParamsTypes, bindTypes);
}
ZEPHIR_INIT_VAR(_4$$6);
ZVAL_STRING(_4$$6, "bindTypes", 1);
zephir_update_property_array(this_ptr, SL("_params"), _4$$6, mergedParamsTypes TSRMLS_CC);
}
RETURN_THIS();
}
示例8: PHP_METHOD
/**
* Create internal connection to memcached
*/
PHP_METHOD(Phalcon_Cache_Backend_Libmemcached, _connect) {
zval *options = NULL, *memcache = NULL, *client = NULL, *servers = NULL, *persistentId = NULL, *_0 = NULL, *_1$$4 = NULL, *_2$$4 = NULL;
int ZEPHIR_LAST_CALL_STATUS;
ZEPHIR_MM_GROW();
ZEPHIR_OBS_VAR(options);
zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC);
ZEPHIR_OBS_VAR(persistentId);
if (!(zephir_array_isset_string_fetch(&persistentId, options, SS("persistent_id"), 0 TSRMLS_CC))) {
ZEPHIR_INIT_NVAR(persistentId);
ZVAL_STRING(persistentId, "phalcon_cache", 1);
}
ZEPHIR_INIT_VAR(memcache);
object_init_ex(memcache, zephir_get_internal_ce(SS("memcached") TSRMLS_CC));
ZEPHIR_CALL_METHOD(NULL, memcache, "__construct", NULL, 0, persistentId);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&_0, memcache, "getserverlist", NULL, 0);
zephir_check_call_status();
if (ZEPHIR_IS_EMPTY(_0)) {
ZEPHIR_OBS_VAR(servers);
if (!(zephir_array_isset_string_fetch(&servers, options, SS("servers"), 0 TSRMLS_CC))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Servers must be an array", "phalcon/cache/backend/libmemcached.zep", 113);
return;
}
if (Z_TYPE_P(servers) != IS_ARRAY) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Servers must be an array", "phalcon/cache/backend/libmemcached.zep", 117);
return;
}
ZEPHIR_OBS_VAR(client);
if (!(zephir_array_isset_string_fetch(&client, options, SS("client"), 0 TSRMLS_CC))) {
ZEPHIR_INIT_NVAR(client);
array_init(client);
}
if (Z_TYPE_P(client) != IS_ARRAY) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Client options must be instance of array", "phalcon/cache/backend/libmemcached.zep", 125);
return;
}
ZEPHIR_CALL_METHOD(&_1$$4, memcache, "setoptions", NULL, 0, client);
zephir_check_call_status();
if (!(zephir_is_true(_1$$4))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Cannot set to Memcached options", "phalcon/cache/backend/libmemcached.zep", 129);
return;
}
ZEPHIR_CALL_METHOD(&_2$$4, memcache, "addservers", NULL, 0, servers);
zephir_check_call_status();
if (!(zephir_is_true(_2$$4))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Cannot connect to Memcached server", "phalcon/cache/backend/libmemcached.zep", 133);
return;
}
}
zephir_update_property_this(this_ptr, SL("_memcache"), memcache TSRMLS_CC);
ZEPHIR_MM_RESTORE();
}
示例9: PHP_METHOD
/**
* Inserts jobs into the queue
*
* @param string data
* @param array options
*/
PHP_METHOD(Phalcon_Queue_Beanstalk, put) {
zend_bool _4;
zephir_fcall_cache_entry *_2 = NULL;
int ZEPHIR_LAST_CALL_STATUS;
zephir_nts_static zephir_fcall_cache_entry *_0 = NULL, *_3 = NULL;
zval *data, *options = NULL, *priority = NULL, *delay = NULL, *ttr = NULL, *serialized = NULL, *response = NULL, *status, *length, *_1, *_5;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &data, &options);
if (!options) {
options = ZEPHIR_GLOBAL(global_null);
}
ZEPHIR_OBS_VAR(priority);
if (!(zephir_array_isset_string_fetch(&priority, options, SS("priority"), 0 TSRMLS_CC))) {
ZEPHIR_INIT_NVAR(priority);
ZVAL_LONG(priority, 100);
}
ZEPHIR_OBS_VAR(delay);
if (!(zephir_array_isset_string_fetch(&delay, options, SS("delay"), 0 TSRMLS_CC))) {
ZEPHIR_INIT_NVAR(delay);
ZVAL_LONG(delay, 0);
}
ZEPHIR_OBS_VAR(ttr);
if (!(zephir_array_isset_string_fetch(&ttr, options, SS("ttr"), 0 TSRMLS_CC))) {
ZEPHIR_INIT_NVAR(ttr);
ZVAL_LONG(ttr, 86400);
}
ZEPHIR_CALL_FUNCTION(&serialized, "serialize", &_0, data);
zephir_check_call_status();
ZEPHIR_INIT_VAR(length);
ZVAL_LONG(length, zephir_fast_strlen_ev(serialized));
ZEPHIR_INIT_VAR(_1);
ZEPHIR_CONCAT_SVSVSVSV(_1, "put ", priority, " ", delay, " ", ttr, " ", length);
ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", &_2, _1);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", &_2, serialized);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&response, this_ptr, "readstatus", &_3);
zephir_check_call_status();
zephir_array_fetch_long(&status, response, 0, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 128 TSRMLS_CC);
_4 = !ZEPHIR_IS_STRING(status, "INSERTED");
if (_4) {
_4 = !ZEPHIR_IS_STRING(status, "BURIED");
}
if (_4) {
RETURN_MM_BOOL(0);
}
zephir_array_fetch_long(&_5, response, 1, PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 134 TSRMLS_CC);
RETURN_CTOR(_5);
}
示例10: PHP_METHOD
/**
* Forwards the execution flow to another controller/action
* Dispatchers are unique per module. Forwarding between modules is not allowed
*
*<code>
* $this->dispatcher->forward(array("controller" => "posts", "action" => "index"));
*</code>
*
* @param array forward
*/
PHP_METHOD(Phalcon_Dispatcher, forward) {
int ZEPHIR_LAST_CALL_STATUS;
zval *forward, *namespaceName = NULL, *controllerName = NULL, *params = NULL, *actionName = NULL, *taskName = NULL, *_0$$3, *_1$$4, *_2$$5, *_3$$7, *_4$$8;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &forward);
if (Z_TYPE_P(forward) != IS_ARRAY) {
ZEPHIR_INIT_VAR(_0$$3);
ZVAL_STRING(_0$$3, "Forward parameter must be an Array", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(NULL, this_ptr, "_throwdispatchexception", NULL, 0, _0$$3);
zephir_check_temp_parameter(_0$$3);
zephir_check_call_status();
RETURN_MM_NULL();
}
if (zephir_array_isset_string_fetch(&namespaceName, forward, SS("namespace"), 1 TSRMLS_CC)) {
_1$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_namespaceName"), PH_NOISY_CC);
zephir_update_property_this(this_ptr, SL("_previousNamespaceName"), _1$$4 TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("_namespaceName"), namespaceName TSRMLS_CC);
}
if (zephir_array_isset_string_fetch(&controllerName, forward, SS("controller"), 1 TSRMLS_CC)) {
_2$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_handlerName"), PH_NOISY_CC);
zephir_update_property_this(this_ptr, SL("_previousHandlerName"), _2$$5 TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("_handlerName"), controllerName TSRMLS_CC);
} else {
if (zephir_array_isset_string_fetch(&taskName, forward, SS("task"), 1 TSRMLS_CC)) {
_3$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_handlerName"), PH_NOISY_CC);
zephir_update_property_this(this_ptr, SL("_previousHandlerName"), _3$$7 TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("_handlerName"), taskName TSRMLS_CC);
}
}
if (zephir_array_isset_string_fetch(&actionName, forward, SS("action"), 1 TSRMLS_CC)) {
_4$$8 = zephir_fetch_nproperty_this(this_ptr, SL("_actionName"), PH_NOISY_CC);
zephir_update_property_this(this_ptr, SL("_previousActionName"), _4$$8 TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("_actionName"), actionName TSRMLS_CC);
}
if (zephir_array_isset_string_fetch(¶ms, forward, SS("params"), 1 TSRMLS_CC)) {
zephir_update_property_this(this_ptr, SL("_params"), params TSRMLS_CC);
}
if (0) {
zephir_update_property_this(this_ptr, SL("_finished"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC);
} else {
zephir_update_property_this(this_ptr, SL("_finished"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC);
}
if (1) {
zephir_update_property_this(this_ptr, SL("_forwarded"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC);
} else {
zephir_update_property_this(this_ptr, SL("_forwarded"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC);
}
ZEPHIR_MM_RESTORE();
}
示例11: PHP_METHOD
/**
* Create internal connection to redis
*/
PHP_METHOD(Phalcon_Cache_Backend_Redis, _connect) {
zend_bool _0, _1;
int ZEPHIR_LAST_CALL_STATUS;
zval *options, *redis, *persistent, *success = NULL, *host, *port, *auth;
ZEPHIR_MM_GROW();
ZEPHIR_OBS_VAR(options);
zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC);
ZEPHIR_INIT_VAR(redis);
object_init_ex(redis, zephir_get_internal_ce(SS("redis") TSRMLS_CC));
if (zephir_has_constructor(redis TSRMLS_CC)) {
ZEPHIR_CALL_METHOD(NULL, redis, "__construct", NULL);
zephir_check_call_status();
}
ZEPHIR_OBS_VAR(host);
_0 = !(zephir_array_isset_string_fetch(&host, options, SS("host"), 0 TSRMLS_CC));
if (!(_0)) {
ZEPHIR_OBS_VAR(port);
_0 = !(zephir_array_isset_string_fetch(&port, options, SS("port"), 0 TSRMLS_CC));
}
_1 = _0;
if (!(_1)) {
ZEPHIR_OBS_VAR(persistent);
_1 = !(zephir_array_isset_string_fetch(&persistent, options, SS("persistent"), 0 TSRMLS_CC));
}
if (_1) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Unexpected inconsistency in options", "phalcon/cache/backend/redis.zep", 104);
return;
}
if (zephir_is_true(persistent)) {
ZEPHIR_CALL_METHOD(&success, redis, "pconnect", NULL, host, port);
zephir_check_call_status();
} else {
ZEPHIR_CALL_METHOD(&success, redis, "connect", NULL, host, port);
zephir_check_call_status();
}
if (!(zephir_is_true(success))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Cannot connect to Redisd server", "phalcon/cache/backend/redis.zep", 114);
return;
}
ZEPHIR_OBS_VAR(auth);
if (zephir_array_isset_string_fetch(&auth, options, SS("auth"), 0 TSRMLS_CC)) {
ZEPHIR_CALL_METHOD(&success, redis, "auth", NULL, auth);
zephir_check_call_status();
if (!(zephir_is_true(success))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Redisd server is authentication failed", "phalcon/cache/backend/redis.zep", 121);
return;
}
}
zephir_update_property_this(this_ptr, SL("_redis"), redis TSRMLS_CC);
ZEPHIR_MM_RESTORE();
}
示例12: PHP_METHOD
/**
* Reads the cookie-related info from the SESSION to restore the cookie as it was set
* This method is automatically called internally so normally you don't need to call it
*/
PHP_METHOD(Phalcon_Http_Cookie, restore) {
zval *dependencyInjector = NULL, *expire = NULL, *domain = NULL, *path = NULL, *secure = NULL, *httpOnly = NULL, *session = NULL, *definition = NULL, *_0, *_1$$4, *_2$$4 = NULL, *_3$$5, *_4$$5;
int ZEPHIR_LAST_CALL_STATUS;
ZEPHIR_MM_GROW();
_0 = zephir_fetch_nproperty_this(this_ptr, SL("_restored"), PH_NOISY_CC);
if (!(zephir_is_true(_0))) {
ZEPHIR_OBS_VAR(dependencyInjector);
zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC);
if (Z_TYPE_P(dependencyInjector) == IS_OBJECT) {
ZEPHIR_INIT_VAR(_1$$4);
ZVAL_STRING(_1$$4, "session", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&session, dependencyInjector, "getshared", NULL, 0, _1$$4);
zephir_check_temp_parameter(_1$$4);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&_2$$4, session, "isstarted", NULL, 0);
zephir_check_call_status();
if (zephir_is_true(_2$$4)) {
_3$$5 = zephir_fetch_nproperty_this(this_ptr, SL("_name"), PH_NOISY_CC);
ZEPHIR_INIT_VAR(_4$$5);
ZEPHIR_CONCAT_SV(_4$$5, "_PHCOOKIE_", _3$$5);
ZEPHIR_CALL_METHOD(&definition, session, "get", NULL, 0, _4$$5);
zephir_check_call_status();
if (Z_TYPE_P(definition) == IS_ARRAY) {
if (zephir_array_isset_string_fetch(&expire, definition, SS("expire"), 1 TSRMLS_CC)) {
zephir_update_property_this(this_ptr, SL("_expire"), expire TSRMLS_CC);
}
if (zephir_array_isset_string_fetch(&domain, definition, SS("domain"), 1 TSRMLS_CC)) {
zephir_update_property_this(this_ptr, SL("_domain"), domain TSRMLS_CC);
}
if (zephir_array_isset_string_fetch(&path, definition, SS("path"), 1 TSRMLS_CC)) {
zephir_update_property_this(this_ptr, SL("_path"), path TSRMLS_CC);
}
if (zephir_array_isset_string_fetch(&secure, definition, SS("secure"), 1 TSRMLS_CC)) {
zephir_update_property_this(this_ptr, SL("_secure"), secure TSRMLS_CC);
}
if (zephir_array_isset_string_fetch(&httpOnly, definition, SS("httpOnly"), 1 TSRMLS_CC)) {
zephir_update_property_this(this_ptr, SL("_httpOnly"), httpOnly TSRMLS_CC);
}
}
}
}
if (1) {
zephir_update_property_this(this_ptr, SL("_restored"), ZEPHIR_GLOBAL(global_true) TSRMLS_CC);
} else {
zephir_update_property_this(this_ptr, SL("_restored"), ZEPHIR_GLOBAL(global_false) TSRMLS_CC);
}
}
RETURN_THIS();
}
示例13: PHP_METHOD
/**
* Phalcon\Http\Request\File constructor
*/
PHP_METHOD(Phalcon_Http_Request_File, __construct) {
int ZEPHIR_LAST_CALL_STATUS;
zval *file_param = NULL, *key = NULL, *name, *tempName, *size, *type, *error, _0 = zval_used_for_init, *_1 = NULL, *_2 = NULL;
zval *file = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &file_param, &key);
file = file_param;
if (!key) {
key = ZEPHIR_GLOBAL(global_null);
}
ZEPHIR_OBS_VAR(name);
if (zephir_array_isset_string_fetch(&name, file, SS("name"), 0 TSRMLS_CC)) {
zephir_update_property_this(this_ptr, SL("_name"), name TSRMLS_CC);
ZEPHIR_SINIT_VAR(_0);
ZVAL_STRING(&_0, "PATHINFO_EXTENSION", 0);
ZEPHIR_CALL_FUNCTION(&_1, "defined", NULL, 204, &_0);
zephir_check_call_status();
if (zephir_is_true(_1)) {
ZEPHIR_SINIT_NVAR(_0);
ZVAL_LONG(&_0, 4);
ZEPHIR_CALL_FUNCTION(&_2, "pathinfo", NULL, 205, name, &_0);
zephir_check_call_status();
zephir_update_property_this(this_ptr, SL("_extension"), _2 TSRMLS_CC);
}
}
if (zephir_array_isset_string_fetch(&tempName, file, SS("tmp_name"), 1 TSRMLS_CC)) {
zephir_update_property_this(this_ptr, SL("_tmp"), tempName TSRMLS_CC);
}
if (zephir_array_isset_string_fetch(&size, file, SS("size"), 1 TSRMLS_CC)) {
zephir_update_property_this(this_ptr, SL("_size"), size TSRMLS_CC);
}
if (zephir_array_isset_string_fetch(&type, file, SS("type"), 1 TSRMLS_CC)) {
zephir_update_property_this(this_ptr, SL("_type"), type TSRMLS_CC);
}
if (zephir_array_isset_string_fetch(&error, file, SS("error"), 1 TSRMLS_CC)) {
zephir_update_property_this(this_ptr, SL("_error"), error TSRMLS_CC);
}
if (zephir_is_true(key)) {
zephir_update_property_this(this_ptr, SL("_key"), key TSRMLS_CC);
}
ZEPHIR_MM_RESTORE();
}
示例14: PHP_METHOD
/**
* Phalcon\Cache\Backend\File constructor
*
* @param Phalcon\Cache\FrontendInterface frontend
* @param array options
*/
PHP_METHOD(Phalcon_Cache_Backend_File, __construct) {
int ZEPHIR_LAST_CALL_STATUS;
zephir_nts_static zephir_fcall_cache_entry *_4 = NULL, *_5 = NULL;
zend_bool _1;
zval *frontend, *options = NULL, *prefix, *safekey, *_0, *_2, *_3 = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &frontend, &options);
if (!options) {
options = ZEPHIR_GLOBAL(global_null);
}
if (!(zephir_array_isset_string(options, SS("cacheDir")))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Cache directory must be specified with the option cacheDir", "phalcon/cache/backend/file.zep", 78);
return;
}
ZEPHIR_OBS_VAR(safekey);
if (zephir_array_isset_string_fetch(&safekey, options, SS("safekey"), 0 TSRMLS_CC)) {
if (Z_TYPE_P(safekey) != IS_BOOL) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "safekey option should be a boolean.", "phalcon/cache/backend/file.zep", 83);
return;
}
zephir_update_property_this(this_ptr, SL("_useSafeKey"), safekey TSRMLS_CC);
}
ZEPHIR_OBS_VAR(prefix);
if (zephir_array_isset_string_fetch(&prefix, options, SS("prefix"), 0 TSRMLS_CC)) {
_0 = zephir_fetch_nproperty_this(this_ptr, SL("_useSafeKey"), PH_NOISY_CC);
_1 = zephir_is_true(_0);
if (_1) {
ZEPHIR_INIT_VAR(_2);
ZVAL_STRING(_2, "/[^a-zA-Z0-9_.-]+/", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_FUNCTION(&_3, "preg_match", &_4, _2, prefix);
zephir_check_temp_parameter(_2);
zephir_check_call_status();
_1 = zephir_is_true(_3);
}
if (_1) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "FileCache prefix should only use alphanumeric characters.", "phalcon/cache/backend/file.zep", 92);
return;
}
}
ZEPHIR_CALL_PARENT(NULL, phalcon_cache_backend_file_ce, this_ptr, "__construct", &_5, frontend, options);
zephir_check_call_status();
ZEPHIR_MM_RESTORE();
}
示例15: PHP_METHOD
/**
* Phalcon\Cache\Backend\File constructor
*/
PHP_METHOD(Phalcon_Cache_Backend_File, __construct) {
zend_bool _1$$6;
int ZEPHIR_LAST_CALL_STATUS;
zephir_fcall_cache_entry *_5 = NULL;
zval *options = NULL;
zval *frontend, *options_param = NULL, *prefix = NULL, *safekey = NULL, *_0$$6, *_2$$6, *_3$$6, _4$$6;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 2, 0, &frontend, &options_param);
zephir_get_arrval(options, options_param);
if (!(zephir_array_isset_string(options, SS("cacheDir")))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Cache directory must be specified with the option cacheDir", "phalcon/cache/backend/file.zep", 79);
return;
}
ZEPHIR_OBS_VAR(safekey);
if (zephir_array_isset_string_fetch(&safekey, options, SS("safekey"), 0 TSRMLS_CC)) {
if (Z_TYPE_P(safekey) != IS_BOOL) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "safekey option should be a boolean.", "phalcon/cache/backend/file.zep", 84);
return;
}
zephir_update_property_this(this_ptr, SL("_useSafeKey"), safekey TSRMLS_CC);
}
ZEPHIR_OBS_VAR(prefix);
if (zephir_array_isset_string_fetch(&prefix, options, SS("prefix"), 0 TSRMLS_CC)) {
_0$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_useSafeKey"), PH_NOISY_CC);
_1$$6 = zephir_is_true(_0$$6);
if (_1$$6) {
ZEPHIR_INIT_VAR(_2$$6);
ZEPHIR_INIT_VAR(_3$$6);
ZEPHIR_SINIT_VAR(_4$$6);
ZVAL_STRING(&_4$$6, "/[^a-zA-Z0-9_.-]+/", 0);
zephir_preg_match(_3$$6, &_4$$6, prefix, _2$$6, 0, 0 , 0 TSRMLS_CC);
_1$$6 = zephir_is_true(_3$$6);
}
if (_1$$6) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "FileCache prefix should only use alphanumeric characters.", "phalcon/cache/backend/file.zep", 93);
return;
}
}
ZEPHIR_CALL_PARENT(NULL, phalcon_cache_backend_file_ce, this_ptr, "__construct", &_5, 113, frontend, options);
zephir_check_call_status();
ZEPHIR_MM_RESTORE();
}