/** * Phalcon\Forms\Element\Email constructor * * @param string $name * @param array $attributes * @param array $options * @param array $optionsValues */ PHP_METHOD(Phalcon_Forms_Element_Email, __construct){ zval *name, *attributes = NULL, *options = NULL, *options_values = NULL, *_type = NULL, type = {}; phalcon_fetch_params(0, 1, 4, &name, &attributes, &options, &options_values, &_type); if (!attributes) { attributes = &PHALCON_GLOBAL(z_null); } if (!options) { options = &PHALCON_GLOBAL(z_null); } if (!options_values) { options_values = &PHALCON_GLOBAL(z_null); } if (!_type || PHALCON_IS_EMPTY(_type)) { PHALCON_STR(&type, "email"); } else { PHALCON_CPY_WRT(&type, _type); } PHALCON_CALL_PARENTW(NULL, phalcon_forms_element_email_ce, getThis(), "__construct", name, attributes, options, options_values, &type); }
/** * Phalcon\Cache\Backend\Memcache constructor * * @param Phalcon\Cache\FrontendInterface $frontend * @param array $options */ PHP_METHOD(Phalcon_Cache_Backend_Memcache, __construct){ zval *frontend, *opts = NULL, options = {}; phalcon_fetch_params(0, 1, 1, &frontend, &opts); if (opts) { PHALCON_CPY_WRT(&options, opts); } if (Z_TYPE(options) != IS_ARRAY) { array_init_size(&options, 4); } if (!phalcon_array_isset_str(&options, SL("host"))) { phalcon_array_update_str_str(&options, SL("host"), SL("127.0.0.1"), PH_COPY); } if (!phalcon_array_isset_str(&options, SL("port"))) { phalcon_array_update_str_long(&options, SL("port"), 11211, 0); } if (!phalcon_array_isset_str(&options, SL("persistent"))) { phalcon_array_update_str_bool(&options, SL("persistent"), 0, 0); } if (!phalcon_array_isset_str(&options, SL("statsKey"))) { phalcon_array_update_str_str(&options, SL("statsKey"), SL("_PHCM"), PH_COPY); } PHALCON_CALL_PARENTW(NULL, phalcon_cache_backend_memcache_ce, getThis(), "__construct", frontend, &options); }
PHP_METHOD(Phalcon_Mvc_Model_MetaData_Session, reset) { zval prefix_key, *_SESSION; zval *prefix = phalcon_read_property(getThis(), SL("_prefix"), PH_NOISY); phalcon_concat_sv(&prefix_key, SL("$PMM$"), prefix, 0); _SESSION = phalcon_get_global(SL("_SESSION")); phalcon_array_unset(_SESSION, &prefix_key, 0); zval_dtor(&prefix_key); PHALCON_CALL_PARENTW(NULL, phalcon_mvc_model_metadata_session_ce, getThis(), "reset"); }
PHP_METHOD(Phalcon_Mvc_Model_MetaData_Session, reset) { zval prefix_key = zval_used_for_init, *pprefix = &prefix_key, *_SESSION; zval *prefix = phalcon_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY TSRMLS_CC); phalcon_concat_sv(&pprefix, SL("$PMM$"), prefix, 0 TSRMLS_CC); _SESSION = phalcon_get_global(SS("_SESSION") TSRMLS_CC); phalcon_array_unset(&_SESSION, &prefix_key, 0); zval_dtor(&prefix_key); PHALCON_CALL_PARENTW(NULL, phalcon_mvc_model_metadata_session_ce, getThis(), "reset"); }
/** * Phalcon\Assets\Resource\Js * * @param string $path * @param boolean $local * @param boolean $filter * @param array $attributes */ PHP_METHOD(Phalcon_Assets_Resource_Js, __construct){ zval *path, *local = NULL, *filter = NULL, *attributes = NULL, type = {}; phalcon_fetch_params(0, 1, 3, &path, &local, &filter, &attributes); ZVAL_STRING(&type, "js"); PHALCON_CALL_PARENTW(NULL, phalcon_assets_resource_js_ce, getThis(), "__construct", &type, path, (local ? local : &PHALCON_GLOBAL(z_true)), (filter ? filter : &PHALCON_GLOBAL(z_true)), (attributes ? attributes : &PHALCON_GLOBAL(z_null)) ); }
/** * Phalcon\DI\FactoryDefault\CLI constructor */ PHP_METHOD(Phalcon_DI_FactoryDefault_CLI, __construct){ zval *shared, name = {}, definition = {}; PHALCON_CALL_PARENTW(NULL, phalcon_di_factorydefault_cli_ce, getThis(), "__construct"); shared = &PHALCON_GLOBAL(z_true); ZVAL_STRING(&name, ISV(router)); ZVAL_STRING(&definition, "Phalcon\\CLI\\Router"); PHALCON_CALL_SELFW(NULL, "set", &name, &definition, shared); ZVAL_STRING(&name, ISV(dispatcher)); ZVAL_STRING(&definition, "Phalcon\\CLI\\Dispatcher"); PHALCON_CALL_SELFW(NULL, "set", &name, &definition, shared); }
/** * Phalcon\Cache\Backend\Xcache constructor * * @param Phalcon\Cache\FrontendInterface $frontend * @param array $options */ PHP_METHOD(Phalcon_Cache_Backend_Xcache, __construct){ zval *frontend, *_options = NULL, options = {}; phalcon_fetch_params(0, 1, 1, &frontend, &_options); if (!_options) { array_init(&options); } else { if (Z_TYPE_P(_options) != IS_ARRAY) { array_init(&options); } else { PHALCON_CPY_WRT(&options, _options); } } if (!phalcon_array_isset_str(&options, SL("statsKey"))) { phalcon_array_update_str_str(&options, SL("statsKey"), SL("_PHCX"), PH_COPY); } PHALCON_CALL_PARENTW(NULL, phalcon_cache_backend_xcache_ce, getThis(), "__construct", frontend, &options); }
/** * Constructor for Phalcon\Session\Adapter\Memcache * * @param array $options */ PHP_METHOD(Phalcon_Session_Adapter_Memcache, __construct){ zval *options, host = {}, port = {}, lifetime = {}, persistent = {}, prefix = {}; zval frontend_option = {}, backend_option = {}, frontend_data = {}, memcache = {}; zval callable_open = {}, callable_close = {}, callable_read = {}, callable_write = {}, callable_destroy = {}, callable_gc = {}; phalcon_fetch_params(0, 1, 0, &options); if (Z_TYPE_P(options) != IS_ARRAY) { PHALCON_THROW_EXCEPTION_STRW(phalcon_session_exception_ce, "The options must be an array"); return; } if (!phalcon_array_isset_fetch_str(&host, options, SL("host"))) { PHALCON_THROW_EXCEPTION_STRW(phalcon_session_exception_ce, "No session host given in options"); return; } if (!phalcon_array_isset_fetch_str(&port, options, SL("port"))) { ZVAL_LONG(&port, 11211); } if (!phalcon_array_isset_fetch_str(&lifetime, options, SL("lifetime"))) { ZVAL_LONG(&lifetime, 8600); } else { phalcon_update_property_this(getThis(), SL("_lifetime"), &lifetime); } if (!phalcon_array_isset_fetch_str(&persistent, options, SL("persistent"))) { ZVAL_FALSE(&persistent); } if (!phalcon_array_isset_fetch_str(&prefix, options, SL("prefix"))) { ZVAL_EMPTY_STRING(&prefix); } /* create memcache instance */ array_init_size(&frontend_option, 1); phalcon_array_update_str(&frontend_option, SL("lifetime"), &lifetime, PH_COPY); object_init_ex(&frontend_data, phalcon_cache_frontend_data_ce); PHALCON_CALL_METHODW(NULL, &frontend_data, "__construct", &frontend_option); array_init_size(&backend_option, 3); phalcon_array_update_str(&backend_option, SL("host"), &host, PH_COPY); phalcon_array_update_str(&backend_option, SL("port"), &port, PH_COPY); phalcon_array_update_str(&backend_option, SL("persistent"), &persistent, PH_COPY); phalcon_array_update_str(&backend_option, SL("prefix"), &prefix, PH_COPY); object_init_ex(&memcache, phalcon_cache_backend_memcache_ce); PHALCON_CALL_METHODW(NULL, &memcache, "__construct", &frontend_data, &backend_option); phalcon_update_property_this(getThis(), SL("_memcache"), &memcache); /* open callback */ array_init_size(&callable_open, 2); phalcon_array_append(&callable_open, getThis(), 0); phalcon_array_append_string(&callable_open, SL("open"), 0); /* close callback */ array_init_size(&callable_close, 2); phalcon_array_append(&callable_close, getThis(), 0); phalcon_array_append_string(&callable_close, SL("close"), 0); /* read callback */ array_init_size(&callable_read, 2); phalcon_array_append(&callable_read, getThis(), 0); phalcon_array_append_string(&callable_read, SL("read"), 0); /* write callback */ array_init_size(&callable_write, 2); phalcon_array_append(&callable_write, getThis(), 0); phalcon_array_append_string(&callable_write, SL("write"), 0); /* destroy callback */ array_init_size(&callable_destroy, 2); phalcon_array_append(&callable_destroy, getThis(), 0); phalcon_array_append_string(&callable_destroy, SL("destroy"), 0); /* gc callback */ array_init_size(&callable_gc, 2); phalcon_array_append(&callable_gc, getThis(), 0); phalcon_array_append_string(&callable_gc, SL("gc"), 0); PHALCON_CALL_FUNCTIONW(NULL, "session_set_save_handler", &callable_open, &callable_close, &callable_read, &callable_write, &callable_destroy, &callable_gc); PHALCON_CALL_PARENTW(NULL, phalcon_session_adapter_memcache_ce, getThis(), "__construct", options); }