/** * Rotate the image by a given amount. * * @param int $degrees degrees to rotate: -360-360 * @return Phalcon\Image\Adapter */ PHP_METHOD(Phalcon_Image_Adapter, rotate) { zval **degrees, *d; long tmp_degrees; phalcon_fetch_params_ex(1, 0, °rees); PHALCON_ENSURE_IS_LONG(degrees); PHALCON_MM_GROW(); tmp_degrees = Z_LVAL_PP(degrees); if (tmp_degrees > 180) { tmp_degrees %= 360; if (tmp_degrees > 180) { tmp_degrees -= 360; }; } else if (tmp_degrees < -180) { do { tmp_degrees += 360; } while (tmp_degrees < -180); } PHALCON_ALLOC_GHOST_ZVAL(d); ZVAL_LONG(d, tmp_degrees); PHALCON_CALL_METHOD(NULL, this_ptr, "_rotate", d); RETURN_THIS(); }
/** * This method scales the images using liquid rescaling method. Only support Imagick * * @param int $width new width * @param int $height new height * @param int $delta_x How much the seam can traverse on x-axis. Passing 0 causes the seams to be straight. * @param int $rigidity Introduces a bias for non-straight seams. This parameter is typically 0. * @return Phalcon\Image\Adapter */ PHP_METHOD(Phalcon_Image_Adapter, liquidRescale) { zval **width, **height, **delta_x = NULL, **rigidity = NULL; phalcon_fetch_params_ex(2, 2, &width, &height, &delta_x, &rigidity); PHALCON_ENSURE_IS_LONG(width); PHALCON_ENSURE_IS_LONG(height); PHALCON_MM_GROW(); if (!delta_x) { delta_x = &PHALCON_GLOBAL(z_zero); } else { PHALCON_ENSURE_IS_LONG(delta_x); } if (!rigidity) { rigidity = &PHALCON_GLOBAL(z_zero); } else { PHALCON_ENSURE_IS_LONG(rigidity); } PHALCON_CALL_METHOD(NULL, this_ptr, "_liquidrescale", *width, *height, *delta_x, *rigidity); RETURN_THIS(); }
/** * Reads meta-data from files * * @param string $key * @return array */ PHP_METHOD(Phalcon_Mvc_Model_MetaData_Files, read){ zval **key, *meta_data_dir, *virtual_key; zval *path, *data = NULL; phalcon_fetch_params_ex(1, 0, &key); PHALCON_ENSURE_IS_STRING(key); PHALCON_MM_GROW(); meta_data_dir = phalcon_fetch_nproperty_this(this_ptr, SL("_metaDataDir"), PH_NOISY TSRMLS_CC); PHALCON_INIT_VAR(virtual_key); phalcon_prepare_virtual_path_ex(virtual_key, Z_STRVAL_PP(key), Z_STRLEN_PP(key), '_' TSRMLS_CC); PHALCON_INIT_VAR(path); PHALCON_CONCAT_VVS(path, meta_data_dir, virtual_key, ".php"); if (phalcon_file_exists(path TSRMLS_CC) == SUCCESS) { RETURN_MM_ON_FAILURE(phalcon_require_ret(&data, Z_STRVAL_P(path) TSRMLS_CC)); RETVAL_ZVAL(data, 1, 1); } PHALCON_MM_RESTORE(); }
PHP_METHOD(Phalcon_Debug, getFileLink) { zval **file, **line, **format; phalcon_fetch_params_ex(3, 0, &file, &line, &format); PHALCON_ENSURE_IS_STRING(file); PHALCON_ENSURE_IS_STRING(line); if (Z_TYPE_PP(format) == IS_STRING) { char *tmp, *link; int tmp_len, link_len; zval z_link = zval_used_for_init; tmp = php_str_to_str_ex(Z_STRVAL_PP(format), Z_STRLEN_PP(format), SL("%f"), Z_STRVAL_PP(file), Z_STRLEN_PP(file), &tmp_len, 1, NULL); link = php_str_to_str_ex(tmp, tmp_len, SL("%l"), Z_STRVAL_PP(line), Z_STRLEN_PP(line), &link_len, 1, NULL); ZVAL_STRINGL(&z_link, link, link_len, 0); efree(tmp); PHALCON_CONCAT_SVSVS(return_value, "<a href=\"", &z_link, "\">", *file, "</a>"); efree(link); } else { RETVAL_ZVAL(*file, 1, 0); } }
/** * Decrypt a text that is coded as a base64 string * * @param string $text * @param string $key * @return string */ PHP_METHOD(Phalcon_Crypt, decryptBase64){ zval **text, **key = NULL, **safe = NULL, *decrypt_text; char *decoded; int decoded_len; phalcon_fetch_params_ex(1, 2, &text, &key, &safe); PHALCON_ENSURE_IS_STRING(text); if (!key) { key = &PHALCON_GLOBAL(z_null); } if (safe && zend_is_true(*safe)) { char *tmp = estrndup(Z_STRVAL_PP(text), Z_STRLEN_PP(text)); php_strtr(tmp, Z_STRLEN_PP(text), "-_", "+/", 2); decoded = (char*)php_base64_decode((unsigned char*)tmp, Z_STRLEN_PP(text), &decoded_len); efree(tmp); } else { decoded = (char*)php_base64_decode((unsigned char*)(Z_STRVAL_PP(text)), Z_STRLEN_PP(text), &decoded_len); } if (!decoded) { RETURN_FALSE; } PHALCON_MM_GROW(); PHALCON_ALLOC_GHOST_ZVAL(decrypt_text); ZVAL_STRINGL(decrypt_text, decoded, decoded_len, 0); PHALCON_RETURN_CALL_METHOD(this_ptr, "decrypt", decrypt_text, *key); RETURN_MM(); }
/** * Writes the meta-data to files * * @param string $key * @param array $data */ PHP_METHOD(Phalcon_Mvc_Model_MetaData_Files, write){ zval **key, **data, *meta_data_dir, *virtual_key; zval *path, *php_export, *status; smart_str exp = { NULL, 0, 0 }; phalcon_fetch_params_ex(2, 0, &key, &data); PHALCON_MM_GROW(); meta_data_dir = phalcon_fetch_nproperty_this(this_ptr, SL("_metaDataDir"), PH_NOISY TSRMLS_CC); PHALCON_INIT_VAR(virtual_key); phalcon_prepare_virtual_path_ex(virtual_key, Z_STRVAL_PP(key), Z_STRLEN_PP(key), '_' TSRMLS_CC); PHALCON_INIT_VAR(path); PHALCON_CONCAT_VVS(path, meta_data_dir, virtual_key, ".php"); smart_str_appends(&exp, "<?php return "); php_var_export_ex(data, 0, &exp TSRMLS_CC); smart_str_appendc(&exp, ';'); smart_str_0(&exp); PHALCON_INIT_VAR(php_export); ZVAL_STRINGL(php_export, exp.c, exp.len, 0); PHALCON_INIT_VAR(status); phalcon_file_put_contents(status, path, php_export TSRMLS_CC); if (PHALCON_IS_FALSE(status)) { PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "Meta-Data directory cannot be written"); return; } PHALCON_MM_RESTORE(); }
/** * Sets the encoding to be used by the escaper * *<code> * $escaper->setEncoding('utf-8'); *</code> * * @param string $encoding */ PHP_METHOD(Phalcon_Escaper, setEncoding){ zval **encoding; phalcon_fetch_params_ex(1, 0, &encoding); PHALCON_ENSURE_IS_STRING(encoding); phalcon_update_property_this(this_ptr, SL("_encoding"), *encoding TSRMLS_CC); }
/** * Sets the HTML quoting type for htmlspecialchars * *<code> * $escaper->setHtmlQuoteType(ENT_XHTML); *</code> * * @param int $quoteType */ PHP_METHOD(Phalcon_Escaper, setHtmlQuoteType){ zval **quote_type; phalcon_fetch_params_ex(1, 0, "e_type); PHALCON_ENSURE_IS_LONG(quote_type); phalcon_update_property_this(this_ptr, SL("_htmlQuoteType"), *quote_type TSRMLS_CC); }
/** * Phalcon\Session\Bag constructor * * @param string $name */ PHP_METHOD(Phalcon_Session_Bag, __construct){ zval **name; phalcon_fetch_params_ex(1, 0, &name); PHALCON_ENSURE_IS_STRING(name); phalcon_update_property_this(this_ptr, SL("_name"), *name TSRMLS_CC); }
/** * Sets the dependency injector * * @param Phalcon\DiInterface $dependencyInjector * @throw Phalcon\Di\Exception */ PHP_METHOD(Phalcon_DI_Injectable, setDI){ zval **dependency_injector; phalcon_fetch_params_ex(1, 0, &dependency_injector); PHALCON_VERIFY_INTERFACE_OR_NULL_EX(*dependency_injector, phalcon_diinterface_ce, phalcon_di_exception_ce, 0); phalcon_update_property_this(this_ptr, SL("_dependencyInjector"), *dependency_injector TSRMLS_CC); }
/** * Sets the default working factor for bcrypts password's salts * * @param int $workFactor */ PHP_METHOD(Phalcon_Security, setWorkFactor){ zval **work_factor; phalcon_fetch_params_ex(1, 0, &work_factor); PHALCON_ENSURE_IS_LONG(work_factor); phalcon_update_property_this(this_ptr, SL("_workFactor"), *work_factor TSRMLS_CC); }
PHP_METHOD(Phalcon_Logger_Formatter_Firephp, enableLabels) { zval **enable; phalcon_fetch_params_ex(1, 0, &enable); PHALCON_ENSURE_IS_BOOL(enable); phalcon_update_property_this(getThis(), SL("_enableLabels"), *enable TSRMLS_CC); }
PHP_METHOD(Phalcon_Logger_Formatter_Firephp, setShowBacktrace) { zval **show; phalcon_fetch_params_ex(1, 0, &show); PHALCON_ENSURE_IS_BOOL(show); phalcon_update_property_this(getThis(), SL("_showBacktrace"), *show TSRMLS_CC); }
/** * Sets the number of lines deplayed after the error line * * @brief \Phalcon\Debug \Phalcon\Debug::setLinesAfterContext(int $lines) * @param int $lines * @return \Phalcon\Debug */ PHP_METHOD(Phalcon_Debug, setLinesAfterContext) { zval **lines; phalcon_fetch_params_ex(1, 0, &lines); PHALCON_ENSURE_IS_LONG(lines); phalcon_update_property_this(getThis(), SL("_afterContext"), *lines TSRMLS_CC); RETURN_THISW(); }
/** * Sets the encryption key * * @param string $key * @return Phalcon\Encrypt */ PHP_METHOD(Phalcon_Crypt, setKey){ zval **key; phalcon_fetch_params_ex(1, 0, &key); PHALCON_ENSURE_IS_STRING(key); phalcon_update_property_this(this_ptr, SL("_key"), *key TSRMLS_CC); RETURN_THISW(); }
/** * Sets the encrypt/decrypt mode * * @param string $cipher * @return Phalcon\Encrypt */ PHP_METHOD(Phalcon_Crypt, setMode){ zval **mode; phalcon_fetch_params_ex(1, 0, &mode); PHALCON_ENSURE_IS_STRING(mode); phalcon_update_property_this(this_ptr, SL("_mode"), *mode TSRMLS_CC); RETURN_THISW(); }
/** * @brief Phalcon\CryptInterface Phalcon\Crypt::setPadding(int $scheme) * * @param int scheme Padding scheme * @return Phalcon\CryptInterface */ PHP_METHOD(Phalcon_Crypt, setPadding) { zval **scheme; phalcon_fetch_params_ex(1, 0, &scheme); PHALCON_ENSURE_IS_LONG(scheme); phalcon_update_property_this(this_ptr, SL("_padding"), *scheme TSRMLS_CC); RETURN_THISW(); }
/** * Sets the character set used to display the HTML * * @brief \Phalcon\Debug \Phalcon\Debug::setCharset(string $charset) * @param string $charset * @return \Phalcon\Debug */ PHP_METHOD(Phalcon_Debug, setCharset) { zval **charset; phalcon_fetch_params_ex(1, 0, &charset); PHALCON_ENSURE_IS_STRING(charset); phalcon_update_static_property_ce(phalcon_debug_ce, SL("_charset"), *charset TSRMLS_CC); RETURN_THISW(); }
/** * Registers a form in the Forms Manager * * @param string $name * @param Phalcon\Forms\Form $form * @return Phalcon\Forms\Manager */ PHP_METHOD(Phalcon_Forms_Manager, set){ zval **name, **form; phalcon_fetch_params_ex(2, 0, &name, &form); PHALCON_ENSURE_IS_STRING(name); PHALCON_VERIFY_CLASS_EX(*form, phalcon_forms_form_ce, phalcon_forms_exception_ce, 0); phalcon_update_property_array(this_ptr, SL("_forms"), *name, *form TSRMLS_CC); RETURN_THISW(); }
/** * 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_fetch_params_ex(3, 0, &doc_block, &file, &line); PHALCON_ENSURE_IS_STRING(doc_block); PHALCON_ENSURE_IS_STRING(file); PHALCON_ENSURE_IS_LONG(line); RETURN_ON_FAILURE(phannot_parse_annotations(return_value, Z_STRVAL_PP(doc_block), Z_STRLEN_PP(doc_block), Z_STRVAL_PP(file), Z_LVAL_PP(line) TSRMLS_CC)); }
/** * Phalcon\Queue\Beanstalk\Job * * @param Phalcon\Queue\Beanstalk $queue * @param string $id * @param mixed $body */ PHP_METHOD(Phalcon_Queue_Beanstalk_Job, __construct){ zval **queue, **id, **body; phalcon_fetch_params_ex(3, 0, &queue, &id, &body); PHALCON_VERIFY_CLASS_EX(*queue, phalcon_queue_beanstalk_ce, phalcon_exception_ce, 0); PHALCON_ENSURE_IS_STRING(id); phalcon_update_property_this(this_ptr, SL("_queue"), *queue TSRMLS_CC); phalcon_update_property_this(this_ptr, SL("_id"), *id TSRMLS_CC); phalcon_update_property_this(this_ptr, SL("_body"), *body TSRMLS_CC); }
/** * Checks a plain text password and its hash version to check if the password matches * * @param string $password * @param string $passwordHash * @param int $maxPasswordLength * @return boolean */ PHP_METHOD(Phalcon_Security, checkHash){ zval **password, **password_hash, **max_pass_length = NULL, *hash; zval* params[2]; int check = 0; phalcon_fetch_params_ex(2, 1, &password, &password_hash, &max_pass_length); PHALCON_ENSURE_IS_STRING(password); if (max_pass_length) { PHALCON_ENSURE_IS_LONG(max_pass_length); if (Z_LVAL_PP(max_pass_length) > 0 && Z_STRLEN_PP(password) > Z_LVAL_PP(max_pass_length)) { RETURN_FALSE; } } params[0] = *password; params[1] = *password_hash; ALLOC_INIT_ZVAL(hash); phalcon_call_func_params_w(hash, SL("crypt"), 2, params TSRMLS_CC); if (UNEXPECTED(EG(exception) != NULL)) { zval_ptr_dtor(&hash); RETURN_NULL(); } if (UNEXPECTED(Z_TYPE_P(hash) != IS_STRING)) { convert_to_string(hash); } if (Z_STRLEN_P(hash) == Z_STRLEN_PP(password_hash)) { int n = Z_STRLEN_P(hash); char *h1 = Z_STRVAL_P(hash); char *h2 = Z_STRVAL_PP(password_hash); while (n) { check |= ((unsigned int)*h1) ^ ((unsigned int)*h2); ++h1; ++h2; --n; } zval_ptr_dtor(&hash); RETURN_BOOL(check == 0); } zval_ptr_dtor(&hash); RETURN_FALSE; }
/** * Interpolates context values into the message placeholders * * @see http://www.php-fig.org/psr/psr-3/ Section 1.2 Message * @param string $message * @param array $context */ PHP_METHOD(Phalcon_Logger_Formatter, interpolate) { zval **message, **context; phalcon_fetch_params_ex(2, 0, &message, &context); if (Z_TYPE_PP(context) == IS_ARRAY && zend_hash_num_elements(Z_ARRVAL_PP(context)) > 0) { HashTable *ht = Z_ARRVAL_PP(context); HashPosition hp; zval *replace, **val; PHALCON_ALLOC_GHOST_ZVAL(replace); array_init_size(replace, zend_hash_num_elements(ht)); for ( zend_hash_internal_pointer_reset_ex(ht, &hp); zend_hash_get_current_data_ex(ht, (void**)&val, &hp) == SUCCESS; zend_hash_move_forward_ex(ht, &hp) ) { char *str_index, *idx; uint str_length; ulong num_index; int type = zend_hash_get_current_key_ex(ht, &str_index, &str_length, &num_index, 0, &hp); if (HASH_KEY_IS_STRING == type) { str_length += 2; idx = emalloc(str_length); idx[0] = '{'; idx[str_length-2] = '}'; idx[str_length-1] = '\0'; memcpy(idx + 1, str_index, str_length - 3); } else if (HASH_KEY_IS_LONG == type) { str_length = spprintf(&idx, 0, "{%ld}", num_index); } else { /* Better safe than sorry */ continue; } Z_ADDREF_PP(val); zend_hash_add(Z_ARRVAL_P(replace), idx, str_length, (void*)val, sizeof(zval*), NULL); efree(idx); } PHALCON_RETURN_CALL_FUNCTIONW("strtr", *message, replace); return; } RETURN_ZVAL(*message, 1, 0); }
/** * Returns a form by its name * * @param string $name * @return Phalcon\Forms\Form */ PHP_METHOD(Phalcon_Forms_Manager, get){ zval **name, *forms, *form; phalcon_fetch_params_ex(1, 0, &name); PHALCON_ENSURE_IS_STRING(name); forms = phalcon_fetch_nproperty_this(this_ptr, SL("_forms"), PH_NOISY TSRMLS_CC); if (!phalcon_array_isset_fetch(&form, forms, *name)) { zend_throw_exception_ex(phalcon_forms_exception_ce, 0 TSRMLS_CC, "There is no form with name='%s'", Z_STRVAL_PP(name)); return; } RETURN_ZVAL(form, 1, 0); }
/** * Sets a number of bytes to be generated by the openssl pseudo random generator * * @param string $randomBytes */ PHP_METHOD(Phalcon_Security, setRandomBytes){ zval **random_bytes; phalcon_fetch_params_ex(1, 0, &random_bytes); PHALCON_ENSURE_IS_LONG(random_bytes); if (PHALCON_LT_LONG(*random_bytes, 16)) { PHALCON_THROW_EXCEPTION_STRW(phalcon_security_exception_ce, "At least 16 bytes are needed to produce a correct salt"); return; } phalcon_update_property_this(this_ptr, SL("_numberBytes"), *random_bytes TSRMLS_CC); }
/** * Flip the image along the horizontal or vertical axis. * * @param $int $direction direction: Image::HORIZONTAL, Image::VERTICAL * @return Phalcon\Image\Adapter */ PHP_METHOD(Phalcon_Image_Adapter, flip) { zval **direction, *dir; phalcon_fetch_params_ex(1, 0, &direction); PHALCON_ENSURE_IS_LONG(direction); PHALCON_MM_GROW(); PHALCON_ALLOC_GHOST_ZVAL(dir); ZVAL_LONG(dir, (Z_LVAL_PP(direction) != 11) ? 12 : 11); PHALCON_CALL_METHOD(NULL, this_ptr, "_flip", dir); RETURN_THIS(); }
/** * Add a reflection to an image. The most opaque part of the reflection * will be equal to the opacity setting and fade out to full transparent. * Alpha transparency is preserved. * * @param int $height reflection height * @param int $opacity reflection opacity: 0-100 * @param boolean $fade_in TRUE to fade in, FALSE to fade out * @return Phalcon\Image\Adapter */ PHP_METHOD(Phalcon_Image_Adapter, reflection) { zval **h = NULL, **op = NULL, **fade_in = NULL; zval *image_height, *height = NULL, *opacity = NULL; long tmp_image_height; phalcon_fetch_params_ex(0, 3, &h, &op, &fade_in); PHALCON_MM_GROW(); image_height = phalcon_fetch_nproperty_this(this_ptr, SL("_height"), PH_NOISY TSRMLS_CC); tmp_image_height = phalcon_get_intval(image_height); if (!h || Z_TYPE_PP(h) != IS_LONG || Z_LVAL_PP(h) > tmp_image_height) { PHALCON_INIT_VAR(height); ZVAL_LONG(height, tmp_image_height); } else { PHALCON_CPY_WRT_CTOR(height, *h); } if (!op) { PHALCON_INIT_VAR(opacity); ZVAL_LONG(opacity, 100); } else { PHALCON_ENSURE_IS_LONG(op); if (Z_LVAL_PP(op) > 100) { PHALCON_INIT_VAR(opacity); ZVAL_LONG(opacity, 100); } else if (Z_LVAL_PP(op) < 0) { PHALCON_INIT_VAR(opacity); ZVAL_LONG(opacity, 0); } else { PHALCON_CPY_WRT_CTOR(opacity, *op); } } if (!fade_in) { fade_in = &PHALCON_GLOBAL(z_false); } PHALCON_CALL_METHOD(NULL, this_ptr, "_reflection", height, opacity, *fade_in); RETURN_THIS(); }
/** * Phalcon\Http\Cookie constructor * * @param string $name * @param mixed $value * @param int $expire * @param string $path * @param boolean $secure * @param string $domain * @param boolean $httpOnly */ PHP_METHOD(Phalcon_Http_Cookie, __construct){ zval **name, **value = NULL, **expire = NULL, **path = NULL, **secure = NULL, **domain = NULL; zval **http_only = NULL; phalcon_fetch_params_ex(1, 6, &name, &value, &expire, &path, &secure, &domain, &http_only); PHALCON_ENSURE_IS_STRING(name); if (!expire) { expire = &PHALCON_GLOBAL(z_zero); } phalcon_update_property_this(this_ptr, SL("_name"), *name TSRMLS_CC); if (value && Z_TYPE_PP(value) != IS_NULL) { phalcon_update_property_this(this_ptr, SL("_value"), *value TSRMLS_CC); phalcon_update_property_bool(this_ptr, SL("_readed"), 1 TSRMLS_CC); } phalcon_update_property_this(this_ptr, SL("_expire"), *expire TSRMLS_CC); if (path && Z_TYPE_PP(path) != IS_NULL) { phalcon_update_property_this(this_ptr, SL("_path"), *path TSRMLS_CC); } else { zval *path; PHALCON_ALLOC_GHOST_ZVAL(path); ZVAL_STRINGL(path, "/", 1, 1); phalcon_update_property_this(this_ptr, SL("_path"), path TSRMLS_CC); } if (secure && Z_TYPE_PP(secure) != IS_NULL) { phalcon_update_property_this(this_ptr, SL("_secure"), *secure TSRMLS_CC); } if (domain && Z_TYPE_PP(domain) != IS_NULL) { phalcon_update_property_this(this_ptr, SL("_domain"), *domain TSRMLS_CC); } if (http_only && Z_TYPE_PP(http_only) != IS_NULL) { phalcon_update_property_this(this_ptr, SL("_httpOnly"), *http_only TSRMLS_CC); } }
/** * Reads meta-data for certain model using a MODEL_* constant * *<code> * print_r($metaData->writeColumnMapIndex(new Robots(), MetaData::MODELS_REVERSE_COLUMN_MAP, array('leName' => 'name'))); *</code> * * @param Phalcon\Mvc\ModelInterface $model * @param int $index * @return array */ PHP_METHOD(Phalcon_Mvc_Model_MetaData, readMetaDataIndex){ zval **model, **index, *table = NULL, *schema = NULL, *class_name; zval *key, *meta_data = NULL, *meta_data_index, *attributes; phalcon_fetch_params_ex(2, 0, &model, &index); PHALCON_VERIFY_INTERFACE_EX(*model, phalcon_mvc_modelinterface_ce, phalcon_mvc_model_exception_ce, 0); PHALCON_ENSURE_IS_LONG(index); PHALCON_MM_GROW(); PHALCON_CALL_METHOD(&table, *model, "getsource"); PHALCON_CALL_METHOD(&schema, *model, "getschema"); PHALCON_INIT_VAR(class_name); phalcon_get_class(class_name, *model, 1 TSRMLS_CC); /** * Unique key for meta-data is created using class-name-schema-table */ PHALCON_INIT_VAR(key); PHALCON_CONCAT_VSVV(key, class_name, "-", schema, table); PHALCON_OBS_VAR(meta_data); phalcon_read_property_this(&meta_data, this_ptr, SL("_metaData"), PH_NOISY TSRMLS_CC); if (!phalcon_array_isset(meta_data, key)) { PHALCON_CALL_METHOD(NULL, this_ptr, "_initialize", *model, key, table, schema); PHALCON_OBS_NVAR(meta_data); phalcon_read_property_this(&meta_data, this_ptr, SL("_metaData"), PH_NOISY TSRMLS_CC); } PHALCON_OBS_VAR(meta_data_index); phalcon_array_fetch(&meta_data_index, meta_data, key, PH_NOISY); PHALCON_OBS_VAR(attributes); phalcon_array_fetch(&attributes, meta_data_index, *index, PH_NOISY); RETURN_CTOR(attributes); }
/** * Returns the string meaning of a logger constant * * @param integer $type * @return string */ PHP_METHOD(Phalcon_Logger_Formatter_Firephp, getTypeString) { static const char* lut[10] = { "ERROR", "ERROR", "WARN", "ERROR", "WARN", "INFO", "INFO", "LOG", "INFO", "LOG" }; zval **type; int itype; phalcon_fetch_params_ex(1, 0, &type); PHALCON_ENSURE_IS_LONG(type); itype = Z_LVAL_PP(type); if (itype > 0 && itype < 10) { RETURN_STRING(lut[itype], 1); } RETURN_STRING("CUSTOM", 1); }