/** * Phalcon\Http\Uri constructor * * @param mixed $uri */ PHP_METHOD(Phalcon_Http_Uri, __construct) { zval *uri = NULL, parts = {}, query = {}, params = {}; phalcon_fetch_params(0, 0, 1, &uri); if (!uri || PHALCON_IS_EMPTY(uri)) { phalcon_update_property_empty_array(getThis(), SL("_parts")); } else if (Z_TYPE_P(uri) == IS_STRING) { PHALCON_CALL_FUNCTIONW(&parts, "parse_url", uri); if (phalcon_array_isset_fetch_str(&query, &parts, SL("query"))) { ZVAL_MAKE_REF(¶ms); PHALCON_CALL_FUNCTIONW(NULL, "parse_str", &query, ¶ms); ZVAL_UNREF(¶ms); phalcon_array_update_str(&parts, SL("query"), ¶ms, PH_COPY); } phalcon_update_property_zval(getThis(), SL("_parts"), &parts); } else if (Z_TYPE_P(uri) == IS_ARRAY) { phalcon_update_property_zval(getThis(), SL("_parts"), uri); } else if (Z_TYPE_P(uri) == IS_OBJECT && Z_OBJCE_P(uri) == phalcon_http_uri_ce) { phalcon_return_property(&parts, uri, SL("_parts")); phalcon_update_property_zval(getThis(), SL("_parts"), &parts); } else { phalcon_update_property_empty_array(getThis(), SL("_parts")); } }
/** * Phalcon\Acl\Adapter\Memory constructor */ PHP_METHOD(Phalcon_Acl_Adapter_Memory, __construct){ zval *a0 = NULL, *a1 = NULL, *a2 = NULL; PHALCON_MM_GROW(); phalcon_update_property_empty_array(phalcon_acl_adapter_memory_ce, this_ptr, SL("_rolesNames") TSRMLS_CC); phalcon_update_property_empty_array(phalcon_acl_adapter_memory_ce, this_ptr, SL("_roles") TSRMLS_CC); phalcon_update_property_empty_array(phalcon_acl_adapter_memory_ce, this_ptr, SL("_resources") TSRMLS_CC); phalcon_update_property_empty_array(phalcon_acl_adapter_memory_ce, this_ptr, SL("_access") TSRMLS_CC); phalcon_update_property_empty_array(phalcon_acl_adapter_memory_ce, this_ptr, SL("_roleInherits") TSRMLS_CC); PHALCON_INIT_VAR(a0); array_init_size(a0, 1); add_assoc_bool_ex(a0, SS("*"), 1); zend_update_property(phalcon_acl_adapter_memory_ce, this_ptr, SL("_resourcesNames"), a0 TSRMLS_CC); PHALCON_INIT_VAR(a1); array_init_size(a1, 1); PHALCON_INIT_VAR(a2); array_init_size(a2, 1); add_assoc_bool_ex(a2, SS("*"), 1); phalcon_array_update_string(&a1, SL("*"), &a2, PH_COPY | PH_SEPARATE TSRMLS_CC); zend_update_property(phalcon_acl_adapter_memory_ce, this_ptr, SL("_accessList"), a1 TSRMLS_CC); PHALCON_MM_RESTORE(); }
/** * Phalcon\Http\Uri constructor * * @param mixed $uri */ PHP_METHOD(Phalcon_Http_Uri, __construct){ zval *uri = NULL, *parts = NULL, *query, *params; PHALCON_MM_GROW(); phalcon_fetch_params(1, 0, 1, &uri); if (!uri || PHALCON_IS_EMPTY(uri)) { phalcon_update_property_empty_array(getThis(), SL("_parts")); } else if (Z_TYPE_P(uri) == IS_STRING) { PHALCON_CALL_FUNCTION(&parts, "parse_url", uri); if (phalcon_array_isset_str_fetch(&query, parts, SL("query"))) { PHALCON_INIT_VAR(params); ZVAL_MAKE_REF(params); PHALCON_CALL_FUNCTION(NULL, "parse_str", query, params); ZVAL_UNREF(params); phalcon_array_update_str(parts, SL("query"), params, PH_COPY); } phalcon_update_property_this(getThis(), SL("_parts"), parts); } else if (Z_TYPE_P(uri) == IS_ARRAY) { phalcon_update_property_this(getThis(), SL("_parts"), uri); } else if (Z_TYPE_P(uri) == IS_OBJECT && Z_OBJCE_P(uri) == phalcon_http_uri_ce) { parts = phalcon_read_property(uri, SL("_parts"), PH_NOISY); phalcon_update_property_this(getThis(), SL("_parts"), parts); } else { phalcon_update_property_empty_array(getThis(), SL("_parts")); } PHALCON_MM_RESTORE(); }
/** * Phalcon\CLI\Router constructor */ PHP_METHOD(Phalcon_CLI_Router, __construct){ phalcon_update_property_empty_array(phalcon_cli_router_ce, this_ptr, SL("_params") TSRMLS_CC); phalcon_update_property_empty_array(phalcon_cli_router_ce, this_ptr, SL("_defaultParams") TSRMLS_CC); }
/** * Phalcon\Paginator\Adapter\Sql * * @param array $config */ PHP_METHOD(Phalcon_Paginator_Adapter_Sql, __construct){ zval *config, db = {}, sql = {}, total_sql = {}, bind = {}, limit = {}, page = {}; long int i_limit; phalcon_fetch_params(0, 1, 0, &config); if (!phalcon_array_isset_fetch_str(&db, config, SL("db"))) { PHALCON_THROW_EXCEPTION_STRW(phalcon_paginator_exception_ce, "Parameter 'db' is required"); return; } if (!phalcon_array_isset_fetch_str(&sql, config, SL("sql"))) { PHALCON_THROW_EXCEPTION_STRW(phalcon_paginator_exception_ce, "Parameter 'sql' is required"); return; } if (!phalcon_array_isset_fetch_str(&total_sql, config, SL("total_sql"))) { PHALCON_THROW_EXCEPTION_STRW(phalcon_paginator_exception_ce, "Parameter 'sql' is required"); return; } if (phalcon_array_isset_fetch_str(&bind, config, SL("bind"))) { if (Z_TYPE_P(&bind) != IS_ARRAY) { phalcon_update_property_empty_array(getThis(), SL("_bind")); } else { phalcon_update_property_this(getThis(), SL("_bind"), &bind); } } else { phalcon_update_property_empty_array(getThis(), SL("_bind")); } PHALCON_VERIFY_INTERFACE_EX(&db, phalcon_db_adapterinterface_ce, phalcon_paginator_exception_ce, 0); phalcon_update_property_this(getThis(), SL("_db"), &db); phalcon_update_property_this(getThis(), SL("_sql"), &sql); phalcon_update_property_this(getThis(), SL("_total_sql"), &total_sql); if (!phalcon_array_isset_fetch_str(&limit, config, SL("limit"))) { PHALCON_THROW_EXCEPTION_STRW(phalcon_paginator_exception_ce, "Parameter 'limit' is required"); return; } i_limit = phalcon_get_intval(&limit); if (i_limit < 1) { PHALCON_THROW_EXCEPTION_STRW(phalcon_paginator_exception_ce, "'limit' should be positive"); return; } phalcon_update_property_this(getThis(), SL("_limitRows"), &limit); if (phalcon_array_isset_fetch_str(&page, config, SL("page"))) { phalcon_update_property_this(getThis(), SL("_page"), &page); } }
/** * Phalcon\Mvc\Model\Validator constructor * * @param array $options */ PHP_METHOD(Phalcon_Mvc_Model_Validator, __construct){ zval *options; phalcon_update_property_empty_array(phalcon_mvc_model_validator_ce, this_ptr, SL("_options") TSRMLS_CC); phalcon_update_property_empty_array(phalcon_mvc_model_validator_ce, this_ptr, SL("_messages") TSRMLS_CC); phalcon_fetch_params(0, 1, 0, &options); if (Z_TYPE_P(options) != IS_ARRAY) { PHALCON_THROW_EXCEPTION_STRW(phalcon_mvc_model_exception_ce, "$options argument must be an Array"); return; } phalcon_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC); }
/** * Phalcon\Mvc\Model\MetaData\Session constructor * * @param array $options */ PHP_METHOD(Phalcon_Mvc_Model_MetaData_Session, __construct){ zval *options = NULL, *prefix; phalcon_fetch_params(0, 0, 1, &options); if (options && Z_TYPE_P(options) == IS_ARRAY) { if (phalcon_array_isset_str_fetch(&prefix, options, SL("prefix"))) { phalcon_update_property_this(getThis(), SL("_prefix"), prefix); } } phalcon_update_property_empty_array(getThis(), SL("_metaData")); }
/** * Phalcon\Mvc\Model\MetaData\Apc constructor * * @param array $options */ PHP_METHOD(Phalcon_Mvc_Model_MetaData_Apc, __construct){ zval *options = NULL, prefix = {}, lifetime = {}; phalcon_fetch_params(0, 0, 1, &options); if (options && Z_TYPE_P(options) == IS_ARRAY) { if (phalcon_array_isset_fetch_str(&prefix, options, SL("prefix"))) { phalcon_update_property_zval(getThis(), SL("_prefix"), &prefix); } if (phalcon_array_isset_fetch_str(&lifetime, options, SL("lifetime"))) { phalcon_update_property_zval(getThis(), SL("_ttl"), &lifetime); } } phalcon_update_property_empty_array(getThis(), SL("_metaData")); }
/** * Phalcon\Debug\Dump constructor * * @param array styles set styles for vars type * @param boolean detailed debug object's private and protected properties */ PHP_METHOD(Phalcon_Debug_Dump, __construct){ zval *styles = NULL, *detailed = NULL, *default_styles; PHALCON_MM_GROW(); phalcon_fetch_params(1, 0, 2, &styles, &detailed); PHALCON_INIT_VAR(default_styles); array_init(default_styles); phalcon_array_update_string_string(&default_styles, SL("pre"), SL("background-color:#f3f3f3; font-size:11px; padding:10px; border:1px solid #ccc; text-align:left; color:#333"), PH_COPY); phalcon_array_update_string_string(&default_styles, SL("arr"), SL("color:red"), PH_COPY); phalcon_array_update_string_string(&default_styles, SL("bool"), SL("color:green"), PH_COPY); phalcon_array_update_string_string(&default_styles, SL("float"), SL("color:fuchsia"), PH_COPY); phalcon_array_update_string_string(&default_styles, SL("int"), SL("color:blue"), PH_COPY); phalcon_array_update_string_string(&default_styles, SL("null"), SL("color:black"), PH_COPY); phalcon_array_update_string_string(&default_styles, SL("num"), SL("color:navy"), PH_COPY); phalcon_array_update_string_string(&default_styles, SL("obj"), SL("color:purple"), PH_COPY); phalcon_array_update_string_string(&default_styles, SL("other"), SL("color:maroon"), PH_COPY); phalcon_array_update_string_string(&default_styles, SL("res"), SL("color:lime"), PH_COPY); phalcon_array_update_string_string(&default_styles, SL("str"), SL("color:teal"), PH_COPY); phalcon_update_property_this(this_ptr, SL("_styles"), default_styles TSRMLS_CC); if (styles && Z_TYPE_P(styles) != IS_NULL) { PHALCON_CALL_SELF(NULL, "setstyles", styles); } if (detailed && zend_is_true(detailed)) { phalcon_update_property_bool(this_ptr, SL("_detailed"), 1 TSRMLS_CC); } phalcon_update_property_empty_array(this_ptr, SL("_objects") TSRMLS_CC); PHALCON_MM_RESTORE(); }
/** * Phalcon\Dispatcher constructor */ PHP_METHOD(Phalcon_Dispatcher, __construct){ phalcon_update_property_empty_array(this_ptr, SL("_params") TSRMLS_CC); }
/** * Phalcon\Db\Profiler constructor */ PHP_METHOD(Phalcon_Db_Profiler, __construct){ phalcon_update_property_empty_array(phalcon_db_profiler_ce, this_ptr, SL("_allProfiles") TSRMLS_CC); }
/** * Phalcon\Mvc\Micro constructor */ PHP_METHOD(Phalcon_Mvc_Micro, __construct){ phalcon_update_property_empty_array(phalcon_mvc_micro_ce, this_ptr, SL("_handlers") TSRMLS_CC); }
/** * Resets the profiler, cleaning up all the profiles * * @return Phalcon\Db\Profiler */ PHP_METHOD(Phalcon_Db_Profiler, reset){ phalcon_update_property_empty_array(getThis(), SL("_allProfiles")); RETURN_THISW(); }
/** * Phalcon\CLI\Router constructor */ PHP_METHOD(Phalcon_CLI_Router, __construct){ phalcon_update_property_empty_array(getThis(), SL("_params")); phalcon_update_property_empty_array(getThis(), SL("_defaultParams")); }
/** * Phalcon\Filter constructor */ PHP_METHOD(Phalcon_Filter, __construct){ phalcon_update_property_empty_array(phalcon_filter_ce, this_ptr, SL("_filters") TSRMLS_CC); }
/** * Phalcon\Mvc\Model\MetaData\Libmemcached constructor * * @param array $options */ PHP_METHOD(Phalcon_Mvc_Model_MetaData_Libmemcached, __construct){ zval *options = NULL; zval *servers, *client, *lifetime, *prefix; zval *frontend_data, *libmemcached, *option; PHALCON_MM_GROW(); phalcon_fetch_params(1, 1, 0, &options); if (Z_TYPE_P(options) != IS_ARRAY) { PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "The options must be an array"); return; } if (!phalcon_array_isset_str_fetch(&servers, options, SL("servers"))) { PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "No servers given in options"); return; } if (!phalcon_array_isset_str_fetch(&client, options, SL("client"))) { client = NULL; } if (!phalcon_array_isset_str_fetch(&lifetime, options, SL("lifetime"))) { PHALCON_INIT_VAR(lifetime); ZVAL_LONG(lifetime, 8600); } phalcon_update_property_this(getThis(), SL("_lifetime"), lifetime); if (!phalcon_array_isset_str_fetch(&prefix, options, SL("prefix"))) { PHALCON_INIT_VAR(prefix); ZVAL_EMPTY_STRING(prefix); } /* create libmemcached instance */ PHALCON_INIT_VAR(option); array_init_size(option, 1); phalcon_array_update_str(option, SL("lifetime"), lifetime, PH_COPY); PHALCON_INIT_VAR(frontend_data); object_init_ex(frontend_data, phalcon_cache_frontend_data_ce); PHALCON_CALL_METHOD(NULL, frontend_data, "__construct", option); PHALCON_INIT_NVAR(option); array_init(option); phalcon_array_update_str_str(option, SL("statsKey"), SL("$PMM$"), PH_COPY); phalcon_array_update_str(option, SL("servers"), servers, PH_COPY); if (client) { phalcon_array_update_str(option, SL("client"), client, PH_COPY); } phalcon_array_update_str(option, SL("prefix"), prefix, PH_COPY); PHALCON_INIT_VAR(libmemcached); object_init_ex(libmemcached, phalcon_cache_backend_libmemcached_ce); PHALCON_CALL_METHOD(NULL, libmemcached, "__construct", frontend_data, option); phalcon_update_property_this(getThis(), SL("_libmemcached"), libmemcached); phalcon_update_property_empty_array(getThis(), SL("_metaData")); PHALCON_MM_RESTORE(); }
/** * Phalcon\Http\Response\Headers constructor */ PHP_METHOD(Phalcon_Http_Response_Headers, __construct){ phalcon_update_property_empty_array(phalcon_http_response_headers_ce, this_ptr, SL("_headers") TSRMLS_CC); }
/** * Phalcon\Http\Client\Header constructor */ PHP_METHOD(Phalcon_Http_Client_Header, __construct){ zval *messages; PHALCON_MM_GROW(); PHALCON_INIT_VAR(messages); array_init(messages); phalcon_array_update_long_string(&messages, 100, SL("Continue"), PH_COPY); phalcon_array_update_long_string(&messages, 101, SL("Switching Protocols"), PH_COPY); phalcon_array_update_long_string(&messages, 200, SL("OK"), PH_COPY); phalcon_array_update_long_string(&messages, 201, SL("Created"), PH_COPY); phalcon_array_update_long_string(&messages, 202, SL("Accepted"), PH_COPY); phalcon_array_update_long_string(&messages, 203, SL("Non-Authoritative Information"), PH_COPY); phalcon_array_update_long_string(&messages, 204, SL("No Content"), PH_COPY); phalcon_array_update_long_string(&messages, 205, SL("Reset Content"), PH_COPY); phalcon_array_update_long_string(&messages, 206, SL("Partial Content"), PH_COPY); phalcon_array_update_long_string(&messages, 300, SL("Multiple Choices"), PH_COPY); phalcon_array_update_long_string(&messages, 301, SL("Moved Permanently"), PH_COPY); phalcon_array_update_long_string(&messages, 302, SL("Found"), PH_COPY); phalcon_array_update_long_string(&messages, 303, SL("See Other"), PH_COPY); phalcon_array_update_long_string(&messages, 304, SL("Not Modified"), PH_COPY); phalcon_array_update_long_string(&messages, 305, SL("Use Proxy"), PH_COPY); phalcon_array_update_long_string(&messages, 306, SL("(Unused)"), PH_COPY); phalcon_array_update_long_string(&messages, 307, SL("Temporary Redirect"), PH_COPY); phalcon_array_update_long_string(&messages, 400, SL("Bad Request"), PH_COPY); phalcon_array_update_long_string(&messages, 401, SL("Unauthorized"), PH_COPY); phalcon_array_update_long_string(&messages, 402, SL("Payment Required"), PH_COPY); phalcon_array_update_long_string(&messages, 403, SL("Forbidden"), PH_COPY); phalcon_array_update_long_string(&messages, 404, SL("Not Found"), PH_COPY); phalcon_array_update_long_string(&messages, 405, SL("Method Not Allowed"), PH_COPY); phalcon_array_update_long_string(&messages, 406, SL("Not Acceptable"), PH_COPY); phalcon_array_update_long_string(&messages, 407, SL("Proxy Authentication Required"), PH_COPY); phalcon_array_update_long_string(&messages, 408, SL("Request Timeout"), PH_COPY); phalcon_array_update_long_string(&messages, 409, SL("Conflict"), PH_COPY); phalcon_array_update_long_string(&messages, 410, SL("Gone"), PH_COPY); phalcon_array_update_long_string(&messages, 411, SL("Length Required"), PH_COPY); phalcon_array_update_long_string(&messages, 412, SL("Precondition Failed"), PH_COPY); phalcon_array_update_long_string(&messages, 413, SL("Request Entity Too Large"), PH_COPY); phalcon_array_update_long_string(&messages, 414, SL("Request-URI Too Long"), PH_COPY); phalcon_array_update_long_string(&messages, 415, SL("Unsupported Media Type"), PH_COPY); phalcon_array_update_long_string(&messages, 416, SL("Requested Range Not Satisfiable"), PH_COPY); phalcon_array_update_long_string(&messages, 417, SL("Expectation Failed"), PH_COPY); phalcon_array_update_long_string(&messages, 500, SL("Internal Server Error"), PH_COPY); phalcon_array_update_long_string(&messages, 501, SL("Not Implemented"), PH_COPY); phalcon_array_update_long_string(&messages, 502, SL("Bad Gateway"), PH_COPY); phalcon_array_update_long_string(&messages, 503, SL("Service Unavailable"), PH_COPY); phalcon_array_update_long_string(&messages, 504, SL("Gateway Timeout"), PH_COPY); phalcon_array_update_long_string(&messages, 505, SL("HTTP Version Not Supported"), PH_COPY); phalcon_array_update_long_string(&messages, 506, SL("Bandwidth Limit Exceeded"), PH_COPY); phalcon_update_static_property_ce(phalcon_http_client_header_ce, SL("_messages"), messages TSRMLS_CC); phalcon_update_property_empty_array(this_ptr, SL("_fields") TSRMLS_CC); PHALCON_MM_RESTORE(); }
/** * Phalcon\Mvc\Model\MetaData\Redis constructor * * @param array $options */ PHP_METHOD(Phalcon_Mvc_Model_MetaData_Redis, __construct){ zval *options = NULL; zval *host, *port, *auth, *persistent, *lifetime, *prefix; zval *frontend_data, *redis, *option; PHALCON_MM_GROW(); phalcon_fetch_params(1, 1, 0, &options); if (Z_TYPE_P(options) != IS_ARRAY) { PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "The options must be an array"); return; } if (!phalcon_array_isset_string_fetch(&host, options, SS("host"))) { host = NULL; } if (!phalcon_array_isset_string_fetch(&port, options, SS("port"))) { port = NULL; } if (!phalcon_array_isset_string_fetch(&auth, options, SS("auth"))) { auth = NULL; } if (!phalcon_array_isset_string_fetch(&persistent, options, SS("persistent"))) { persistent = NULL; } if (!phalcon_array_isset_string_fetch(&lifetime, options, SS("lifetime"))) { PHALCON_INIT_VAR(lifetime); ZVAL_LONG(lifetime, 8600); } phalcon_update_property_this(this_ptr, SL("_lifetime"), lifetime TSRMLS_CC); if (!phalcon_array_isset_string_fetch(&prefix, options, SS("prefix"))) { PHALCON_INIT_VAR(prefix); ZVAL_EMPTY_STRING(prefix); } /* create redis instance */ PHALCON_INIT_VAR(option); array_init_size(option, 1); phalcon_array_update_string(&option, SL("lifetime"), lifetime, PH_COPY); PHALCON_INIT_VAR(frontend_data); object_init_ex(frontend_data, phalcon_cache_frontend_data_ce); PHALCON_CALL_METHOD(NULL, frontend_data, "__construct", option); PHALCON_INIT_NVAR(option); array_init(option); phalcon_array_update_string_string(&option, SL("statsKey"), SL("$PMM$"), PH_COPY); if (host) { phalcon_array_update_string(&option, SL("host"), host, PH_COPY); } if (port) { phalcon_array_update_string(&option, SL("port"), port, PH_COPY); } if (auth) { phalcon_array_update_string(&option, SL("auth"), auth, PH_COPY); } if (persistent) { phalcon_array_update_string(&option, SL("persistent"), persistent, PH_COPY); } phalcon_array_update_string(&option, SL("prefix"), prefix, PH_COPY); PHALCON_INIT_VAR(redis); object_init_ex(redis, phalcon_cache_backend_redis_ce); PHALCON_CALL_METHOD(NULL, redis, "__construct", frontend_data, option); phalcon_update_property_this(this_ptr, SL("_redis"), redis TSRMLS_CC); phalcon_update_property_empty_array(this_ptr, SL("_metaData") TSRMLS_CC); PHALCON_MM_RESTORE(); }
/** * Phalcon\DI constructor * */ PHP_METHOD(Phalcon_Registry, __construct){ phalcon_update_property_empty_array(getThis(), SL("_data")); }