本文整理汇总了C++中PHALCON_SEPARATE_PARAM函数的典型用法代码示例。如果您正苦于以下问题:C++ PHALCON_SEPARATE_PARAM函数的具体用法?C++ PHALCON_SEPARATE_PARAM怎么用?C++ PHALCON_SEPARATE_PARAM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PHALCON_SEPARATE_PARAM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* Blur image
*
* @param int $radius Blur radius
* @return Phalcon\Image\Adapter
*/
PHP_METHOD(Phalcon_Image_Adapter, blur) {
zval *radius = NULL;
long r;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 0, 1, &radius);
if (!radius) {
PHALCON_INIT_VAR(radius);
ZVAL_LONG(radius, 1);
} else if (Z_TYPE_P(radius) != IS_LONG) {
PHALCON_SEPARATE_PARAM(radius);
PHALCON_INIT_NVAR(radius);
ZVAL_LONG(radius, 1);
} else {
r = phalcon_get_intval(radius);
if (r < 1) {
PHALCON_SEPARATE_PARAM(radius);
PHALCON_INIT_NVAR(radius);
ZVAL_LONG(radius, 1);
} else if (r > 100) {
PHALCON_SEPARATE_PARAM(radius);
PHALCON_INIT_NVAR(radius);
ZVAL_LONG(radius, 100);
}
}
PHALCON_CALL_METHOD(NULL, this_ptr, "_blur", radius);
RETURN_THIS();
}
示例2: PHP_METHOD
/**
* Phalcon_Model_MetaData_Session constructor
*
* @param Phalcon_Config|stdClass $options
*/
PHP_METHOD(Phalcon_Model_MetaData_Session, __construct){
zval *options = NULL, *adapter_options = NULL;
zval *t0 = NULL;
int eval_int;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &options) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_SEPARATE_PARAM(options);
if (Z_TYPE_P(options) == IS_ARRAY) {
PHALCON_SEPARATE_PARAM(options);
convert_to_array(options);
PHALCON_CPY_WRT(adapter_options, options);
} else {
PHALCON_CPY_WRT(adapter_options, options);
}
eval_int = phalcon_isset_property(adapter_options, "suffix", strlen("suffix") TSRMLS_CC);
if (eval_int) {
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, adapter_options, "suffix", sizeof("suffix")-1, PHALCON_NOISY TSRMLS_CC);
phalcon_update_property_zval(this_ptr, "_suffix", strlen("_suffix"), t0 TSRMLS_CC);
}
PHALCON_MM_RESTORE();
}
示例3: PHP_METHOD
/**
* Changes the fetching mode affecting Phalcon\Db\Result\Pdo::fetch()
*
*<code>
* //Return array with integer indexes
* $result->setFetchMode(Phalcon\Db::FETCH_NUM);
*
* //Return associative array without integer indexes
* $result->setFetchMode(Phalcon\Db::FETCH_ASSOC);
*
* //Return associative array together with integer indexes
* $result->setFetchMode(Phalcon\Db::FETCH_BOTH);
*
* //Return an object
* $result->setFetchMode(Phalcon\Db::FETCH_OBJ);
*</code>
*
* @param int $fetchMode
*/
PHP_METHOD(Phalcon_Db_Result_Pdo, setFetchMode){
zval *fetch_mode, *fetch_arg1 = NULL, *fetch_arg2 = NULL;
zval *pdo_statement;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 2, &fetch_mode, &fetch_arg1, &fetch_arg2);
PHALCON_SEPARATE_PARAM(fetch_mode);
if (Z_TYPE_P(fetch_mode) != IS_LONG) {
convert_to_long(fetch_mode);
}
pdo_statement = phalcon_read_property(getThis(), SL("_pdoStatement"), PH_NOISY);
if (Z_LVAL_P(fetch_mode) != 0) {
if (fetch_arg1 && fetch_arg2) {
PHALCON_CALL_METHOD(NULL, pdo_statement, "setfetchmode", fetch_mode, fetch_arg1, fetch_arg2);
} else if (fetch_arg1) {
PHALCON_CALL_METHOD(NULL, pdo_statement, "setfetchmode", fetch_mode, fetch_arg1);
} else if (fetch_arg2) {
PHALCON_CALL_METHOD(NULL, pdo_statement, "setfetchmode", fetch_mode, fetch_arg2);
} else {
PHALCON_CALL_METHOD(NULL, pdo_statement, "setfetchmode", fetch_mode);
}
phalcon_update_property_long(getThis(), SL("_fetchMode"), Z_LVAL_P(fetch_mode));
}
RETURN_MM_NULL();
}
示例4: PHP_METHOD
/**
* This method is automatically called in Phalcon\Db\Adapter\Pdo constructor.
* Call it when you need to restore a database connection.
*
* @param array $descriptor
* @return boolean
*/
PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, connect){
zval *descriptor = NULL, *dbname;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &descriptor) == FAILURE) {
RETURN_MM_NULL();
}
if (!descriptor) {
PHALCON_INIT_VAR(descriptor);
} else {
PHALCON_SEPARATE_PARAM(descriptor);
}
if (!zend_is_true(descriptor)) {
PHALCON_OBS_NVAR(descriptor);
phalcon_read_property(&descriptor, this_ptr, SL("_descriptor"), PH_NOISY_CC);
}
if (!phalcon_array_isset_string(descriptor, SS("dbname"))) {
PHALCON_THROW_EXCEPTION_STR(phalcon_db_exception_ce, "dbname must be specified");
return;
} else {
PHALCON_OBS_VAR(dbname);
phalcon_array_fetch_string(&dbname, descriptor, SL("dbname"), PH_NOISY_CC);
phalcon_array_update_string(&descriptor, SL("dsn"), &dbname, PH_COPY | PH_SEPARATE TSRMLS_CC);
}
PHALCON_CALL_PARENT_PARAMS_1_NORETURN(this_ptr, "Phalcon\\Db\\Adapter\\Pdo\\Sqlite", "connect", descriptor);
PHALCON_MM_RESTORE();
}
示例5: PHP_METHOD
/**
* Creates a password hash using bcrypt with a pseudo random salt
*
* @param string $password
* @param int $workFactor
* @return string
*/
PHP_METHOD(Phalcon_Security, hash){
zval *password, *work_factor = NULL, *format, *factor;
zval *salt_bytes, *salt;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 1, &password, &work_factor);
if (!work_factor) {
PHALCON_INIT_VAR(work_factor);
} else {
PHALCON_SEPARATE_PARAM(work_factor);
}
if (Z_TYPE_P(work_factor) == IS_NULL) {
PHALCON_OBS_NVAR(work_factor);
phalcon_read_property_this(&work_factor, this_ptr, SL("_workFactor"), PH_NOISY_CC);
}
PHALCON_INIT_VAR(format);
ZVAL_STRING(format, "%02s", 1);
PHALCON_INIT_VAR(factor);
phalcon_call_func_p2(factor, "sprintf", format, work_factor);
PHALCON_INIT_VAR(salt_bytes);
phalcon_call_method(salt_bytes, this_ptr, "getsaltbytes");
PHALCON_INIT_VAR(salt);
PHALCON_CONCAT_SVSV(salt, "$2a$", factor, "$", salt_bytes);
phalcon_call_func_p2(return_value, "crypt", password, salt);
RETURN_MM();
}
示例6: PHP_METHOD
/**
* Phalcon\Cache\Backend\Xcache constructor
*
* @param Phalcon\Cache\FrontendInterface $frontend
* @param array $options
*/
PHP_METHOD(Phalcon_Cache_Backend_Xcache, __construct){
zval *frontend, *options = NULL;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 1, &frontend, &options);
if (!options) {
PHALCON_INIT_VAR(options);
} else {
PHALCON_SEPARATE_PARAM(options);
}
if (Z_TYPE_P(options) != IS_ARRAY) {
PHALCON_INIT_NVAR(options);
array_init(options);
}
if (!phalcon_array_isset_str(options, SL("statsKey"))) {
phalcon_array_update_str_str(options, SL("statsKey"), SL("_PHCX"), PH_COPY);
}
PHALCON_CALL_PARENT(NULL, phalcon_cache_backend_xcache_ce, getThis(), "__construct", frontend, options);
PHALCON_MM_RESTORE();
}
示例7: PHP_METHOD
/**
* Phalcon\Cache\Backend\Xcache constructor
*
* @param Phalcon\Cache\FrontendInterface $frontend
* @param array $options
*/
PHP_METHOD(Phalcon_Cache_Backend_Xcache, __construct){
zval *frontend, *options = NULL;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 1, &frontend, &options);
if (!options) {
PHALCON_INIT_VAR(options);
} else {
PHALCON_SEPARATE_PARAM(options);
}
if (Z_TYPE_P(options) != IS_ARRAY) {
PHALCON_INIT_NVAR(options);
array_init(options);
}
if (!phalcon_array_isset_string(options, SS("statsKey"))) {
phalcon_array_update_string_string(&options, SL("statsKey"), SL("_PHCX"), PH_SEPARATE TSRMLS_CC);
}
PHALCON_CALL_PARENT_PARAMS_2_NORETURN(this_ptr, "Phalcon\\Cache\\Backend\\Xcache", "__construct", frontend, options);
PHALCON_MM_RESTORE();
}
示例8: PHP_METHOD
/**
* Constructor for Phalcon_Db_Adapter_Mysql. This method does not should to be called directly. Use Phalcon_Db::factory instead
*
* @param stdClass $descriptor
*/
PHP_METHOD(Phalcon_Db_Adapter_Mysql, __construct){
zval *descriptor = NULL;
zval *t0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &descriptor) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (!descriptor) {
PHALCON_INIT_VAR(descriptor);
ZVAL_NULL(descriptor);
} else {
PHALCON_SEPARATE_PARAM(descriptor);
}
if (!zend_is_true(descriptor)) {
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, this_ptr, SL("_descriptor"), PHALCON_NOISY TSRMLS_CC);
PHALCON_CPY_WRT(descriptor, t0);
}
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(this_ptr, "connect", descriptor, PHALCON_NO_CHECK);
PHALCON_MM_RESTORE();
}
示例9: PHP_METHOD
/**
* Phalcon\Flash constructor
*
* @param array $cssClasses
*/
PHP_METHOD(Phalcon_Flash, __construct){
zval *css_classes = NULL;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 0, 1, &css_classes);
if (!css_classes) {
PHALCON_INIT_VAR(css_classes);
} else {
PHALCON_SEPARATE_PARAM(css_classes);
}
if (Z_TYPE_P(css_classes) != IS_ARRAY) {
PHALCON_INIT_NVAR(css_classes);
array_init_size(css_classes, 4);
add_assoc_stringl_ex(css_classes, SS("error"), SL("errorMessage"), 1);
add_assoc_stringl_ex(css_classes, SS("notice"), SL("noticeMessage"), 1);
add_assoc_stringl_ex(css_classes, SS("success"), SL("successMessage"), 1);
add_assoc_stringl_ex(css_classes, SS("warning"), SL("warningMessage"), 1);
}
phalcon_update_property_this(this_ptr, SL("_cssClasses"), css_classes TSRMLS_CC);
PHALCON_MM_RESTORE();
}
示例10: PHP_METHOD
/**
* Phalcon\Flash constructor
*
* @param array $cssClasses
*/
PHP_METHOD(Phalcon_Flash, __construct){
zval *css_classes = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &css_classes) == FAILURE) {
RETURN_MM_NULL();
}
if (!css_classes) {
PHALCON_INIT_VAR(css_classes);
} else {
PHALCON_SEPARATE_PARAM(css_classes);
}
if (Z_TYPE_P(css_classes) != IS_ARRAY) {
PHALCON_INIT_NVAR(css_classes);
array_init_size(css_classes, 4);
add_assoc_stringl_ex(css_classes, SS("error"), SL("errorMessage"), 1);
add_assoc_stringl_ex(css_classes, SS("notice"), SL("noticeMessage"), 1);
add_assoc_stringl_ex(css_classes, SS("success"), SL("successMessage"), 1);
add_assoc_stringl_ex(css_classes, SS("warning"), SL("warningMessage"), 1);
}
phalcon_update_property_zval(this_ptr, SL("_cssClasses"), css_classes TSRMLS_CC);
PHALCON_MM_RESTORE();
}
示例11: PHP_METHOD
/**
* Parses a raw doc block returning the annotations found
*
* @param string $docBlock
* @param string $file
* @param int $line
* @return array
*/
PHP_METHOD(Phalcon_Annotations_Reader, parseDocBlock){
zval *doc_block, *file = NULL, *line = NULL;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 2, &doc_block, &file, &line);
if (!file) {
PHALCON_INIT_VAR(file);
} else {
PHALCON_SEPARATE_PARAM(file);
}
if (!line) {
PHALCON_INIT_VAR(line);
}
if (Z_TYPE_P(file) != IS_STRING) {
PHALCON_INIT_NVAR(file);
ZVAL_STRING(file, "eval code", 1);
}
if (phannot_parse_annotations(return_value, doc_block, file, line TSRMLS_CC) == FAILURE) {
return;
}
RETURN_MM();
}
示例12: PHP_METHOD
/**
* Handles routing information received from command-line arguments
*
* @param array $arguments
*/
PHP_METHOD(Phalcon_CLI_Router, handle){
zval *arguments = NULL, *module_name = NULL, *task_name = NULL, *action_name = NULL;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 0, 1, &arguments);
if (!arguments) {
PHALCON_INIT_VAR(arguments);
array_init(arguments);
} else {
PHALCON_SEPARATE_PARAM(arguments);
}
if (Z_TYPE_P(arguments) != IS_ARRAY) {
PHALCON_THROW_EXCEPTION_STR(phalcon_cli_router_exception_ce, "Arguments must be an Array");
return;
}
PHALCON_INIT_VAR(module_name);
PHALCON_INIT_VAR(task_name);
PHALCON_INIT_VAR(action_name);
/**
* Check for a module
*/
if (phalcon_array_isset_string(arguments, SS("module"))) {
PHALCON_OBS_NVAR(module_name);
phalcon_array_fetch_string(&module_name, arguments, SL("module"), PH_NOISY);
phalcon_array_unset_string(&arguments, SS("module"), PH_SEPARATE);
}
/**
* Check for a task
*/
if (phalcon_array_isset_string(arguments, SS("task"))) {
PHALCON_OBS_NVAR(task_name);
phalcon_array_fetch_string(&task_name, arguments, SL("task"), PH_NOISY);
phalcon_array_unset_string(&arguments, SS("task"), PH_SEPARATE);
}
/**
* Check for an action
*/
if (phalcon_array_isset_string(arguments, SS("action"))) {
PHALCON_OBS_NVAR(action_name);
phalcon_array_fetch_string(&action_name, arguments, SL("action"), PH_NOISY);
phalcon_array_unset_string(&arguments, SS("action"), PH_SEPARATE);
}
phalcon_update_property_this(this_ptr, SL("_module"), module_name TSRMLS_CC);
phalcon_update_property_this(this_ptr, SL("_task"), task_name TSRMLS_CC);
phalcon_update_property_this(this_ptr, SL("_action"), action_name TSRMLS_CC);
phalcon_update_property_this(this_ptr, SL("_params"), arguments TSRMLS_CC);
PHALCON_MM_RESTORE();
}
示例13: PHP_METHOD
/**
* Phalcon\Mvc\Model\Transaction\Manager constructor
*
* @param Phalcon\DiInterface $dependencyInjector
*/
PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, __construct){
zval *dependency_injector = NULL;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 0, 1, &dependency_injector);
if (!dependency_injector) {
PHALCON_INIT_VAR(dependency_injector);
} else {
PHALCON_SEPARATE_PARAM(dependency_injector);
}
if (zend_is_true(dependency_injector)) {
phalcon_update_property_this(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);
} else {
PHALCON_INIT_NVAR(dependency_injector);
PHALCON_CALL_STATIC(dependency_injector, "phalcon\\di", "getdefault");
phalcon_update_property_this(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);
}
if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_transaction_exception_ce, "A dependency injector container is required to obtain the services related to the ORM");
return;
}
PHALCON_MM_RESTORE();
}
示例14: test_phalcon_separate_param
void test_phalcon_separate_param(void)
{
startup_php(__func__);
zend_first_try {
zval* x;
zval* orig;
PHALCON_MM_GROW();
MAKE_STD_ZVAL(x);
ZVAL_LONG(x, 0xB61964F6l);
Z_ADDREF_P(x);
Z_ADDREF_P(x);
Z_ADDREF_P(x);
orig = x;
CU_ASSERT_EQUAL(Z_REFCOUNT_P(x), 4);
CU_ASSERT_EQUAL(Z_ISREF_P(x), 0);
PHALCON_SEPARATE_PARAM(x);
CU_ASSERT_EQUAL(Z_REFCOUNT_P(x), 1);
CU_ASSERT_EQUAL(Z_ISREF_P(x), 0);
CU_ASSERT_PTR_NOT_EQUAL(x, orig);
CU_ASSERT_EQUAL(Z_REFCOUNT_P(orig), 4);
CU_ASSERT_EQUAL(Z_ISREF_P(orig), 0);
CU_ASSERT_EQUAL(Z_TYPE_P(x), IS_LONG);
CU_ASSERT_EQUAL(Z_LVAL_P(x), 0xB61964F6l);
CU_ASSERT_EQUAL(Z_TYPE_P(x), Z_TYPE_P(orig));
CU_ASSERT_EQUAL(Z_LVAL_P(x), Z_LVAL_P(orig));
zval_ptr_dtor(&orig);
CU_ASSERT_EQUAL(_mem_block_check(x, 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC), 1);
CU_ASSERT_EQUAL(_mem_block_check(orig, 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC), 1);
CU_ASSERT_EQUAL(Z_REFCOUNT_P(orig), 3);
zval_ptr_dtor(&orig);
CU_ASSERT_EQUAL(_mem_block_check(x, 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC), 1);
CU_ASSERT_EQUAL(_mem_block_check(orig, 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC), 1);
CU_ASSERT_EQUAL(Z_REFCOUNT_P(orig), 2);
zval_ptr_dtor(&orig);
CU_ASSERT_EQUAL(_mem_block_check(x, 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC), 1);
CU_ASSERT_EQUAL(_mem_block_check(orig, 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC), 1);
CU_ASSERT_EQUAL(Z_REFCOUNT_P(orig), 1);
zval_ptr_dtor(&orig);
CU_ASSERT_EQUAL(_mem_block_check(x, 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC), 1);
PHALCON_MM_RESTORE();
}
zend_catch {
CU_ASSERT(0);
}
zend_end_try();
shutdown_php();
CU_ASSERT_EQUAL(leaks, 0);
}
示例15: PHP_METHOD
/**
* This method is automatically called in Phalcon\Db\Adapter\Pdo constructor.
* Call it when you need to restore a database connection.
*
* Support set search_path after connectted if schema is specified in config.
*
* @param array $descriptor
* @return boolean
*/
PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, connect){
zval *descriptor = NULL, *schema = NULL, *sql, *password;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 0, 1, &descriptor);
if (!descriptor) {
PHALCON_INIT_VAR(descriptor);
} else {
PHALCON_SEPARATE_PARAM(descriptor);
}
if (!zend_is_true(descriptor)) {
PHALCON_OBS_NVAR(descriptor);
phalcon_read_property_this(&descriptor, this_ptr, SL("_descriptor"), PH_NOISY TSRMLS_CC);
}
if (phalcon_array_isset_string(descriptor, SS("schema"))) {
PHALCON_OBS_VAR(schema);
phalcon_array_fetch_string(&schema, descriptor, SL("schema"), PH_NOISY);
phalcon_array_unset_string(&descriptor, SS("schema"), PH_COPY);
phalcon_update_property_this(this_ptr, SL("_schema"), schema TSRMLS_CC);
}
else {
PHALCON_INIT_VAR(schema);
}
if (phalcon_array_isset_string_fetch(&password, descriptor, SS("password"))) {
/* There is a bug in pdo_pgsql driver when the password is empty,
* the driver tries to access invalid memory:
*
* if (dbh->password[0] != '\'' && dbh->password[strlen(dbh->password) - 1] != '\'')
*
* To avoid this we set the password to null
*/
if (Z_TYPE_P(password) == IS_STRING && Z_STRLEN_P(password) == 0) {
phalcon_array_update_string(&descriptor, SL("password"), PHALCON_GLOBAL(z_null), PH_COPY);
}
}
PHALCON_CALL_PARENT(NULL, phalcon_db_adapter_pdo_postgresql_ce, this_ptr, "connect", descriptor);
/**
* Execute the search path in the after connect
*/
if (Z_TYPE_P(schema) == IS_STRING) {
PHALCON_INIT_VAR(sql);
PHALCON_CONCAT_SVS(sql, "SET search_path TO '", schema, "'");
PHALCON_CALL_METHOD(NULL, this_ptr, "execute", sql);
}
PHALCON_MM_RESTORE();
}