本文整理汇总了C++中PHALCON_GLOBAL函数的典型用法代码示例。如果您正苦于以下问题:C++ PHALCON_GLOBAL函数的具体用法?C++ PHALCON_GLOBAL怎么用?C++ PHALCON_GLOBAL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PHALCON_GLOBAL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* 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 = {}, decrypt_value = {};
phalcon_fetch_params(0, 1, 2, &text, &key, &safe);
PHALCON_ENSURE_IS_STRING(text);
if (!key) {
key = &PHALCON_GLOBAL(z_null);
}
if (!safe) {
safe = &PHALCON_GLOBAL(z_false);
}
if (zend_is_true(safe)) {
ZVAL_NEW_STR(&decrypt_text, zend_string_dup(Z_STR_P(text), 0));
php_strtr(Z_STRVAL(decrypt_text), Z_STRLEN(decrypt_text), "-_", "+/", 2);
} else {
PHALCON_CPY_WRT_CTOR(&decrypt_text, text);
}
phalcon_base64_decode(&decrypt_value, &decrypt_text);
PHALCON_RETURN_CALL_METHODW(getThis(), "decrypt", &decrypt_value, key);
}
示例2: PHP_METHOD
/**
* Adds a javascript resource to the 'js' collection
*
*<code>
* $assets->addJs('scripts/jquery.js');
* $assets->addJs('http://jquery.my-cdn.com/jquery.js', true);
*</code>
*
* @param string $path
* @param boolean $local
* @param boolean $filter
* @param array $attributes
* @return Phalcon\Assets\Manager
*/
PHP_METHOD(Phalcon_Assets_Manager, addJs){
zval *path, *local = NULL, *filter = NULL, *attributes = NULL, *type, *resource;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 3, &path, &local, &filter, &attributes);
if (!local) {
local = PHALCON_GLOBAL(z_true);
}
if (!filter) {
filter = PHALCON_GLOBAL(z_true);
}
if (!attributes) {
attributes = PHALCON_GLOBAL(z_null);
}
PHALCON_INIT_VAR(type);
ZVAL_STRING(type, "js", 1);
PHALCON_INIT_VAR(resource);
object_init_ex(resource, phalcon_assets_resource_js_ce);
PHALCON_CALL_METHOD(NULL, resource, "__construct", path, local, filter, attributes);
PHALCON_CALL_METHOD(NULL, this_ptr, "addresourcebytype", type, resource);
RETURN_THIS();
}
示例3: PHP_METHOD
/**
* 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);
}
示例4: PHP_METHOD
/**
* Gets variable from $_GET superglobal applying filters if needed
* If no parameters are given the $_GET superglobal is returned
*
*<code>
* //Returns value from $_GET["id"] without sanitizing
* $id = $request->getQuery("id");
*
* //Returns value from $_GET["id"] with sanitizing
* $id = $request->getQuery("id", "int");
*
* //Returns value from $_GET["id"] with a default value
* $id = $request->getQuery("id", null, 150);
*</code>
*
* @param string $name
* @param string|array $filters
* @param mixed $defaultValue
* @param boolean $notAllowEmpty
* @param boolean $noRecursive
* @return mixed
*/
PHP_METHOD(Phalcon_Http_Request, getQuery){
zval *name = NULL, *filters = NULL, *default_value = NULL, *not_allow_empty = NULL, *norecursive = NULL, *get;
phalcon_fetch_params(0, 0, 5, &name, &filters, &default_value, ¬_allow_empty, &norecursive);
if (!name) {
name = &PHALCON_GLOBAL(z_null);
}
if (!filters) {
filters = &PHALCON_GLOBAL(z_null);
}
if (!default_value) {
default_value = &PHALCON_GLOBAL(z_null);
}
if (!not_allow_empty) {
not_allow_empty = &PHALCON_GLOBAL(z_false);
}
if (!norecursive) {
norecursive = &PHALCON_GLOBAL(z_false);
}
get = phalcon_get_global_str(SL("_GET"));
PHALCON_RETURN_CALL_SELFW("_get", get, name, filters, default_value, not_allow_empty, norecursive);
}
示例5: PHP_METHOD
/**
* Escapes a column/table/schema name
*
* @param string $identifier
* @return string
*/
PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, escapeIdentifier){
zval *identifier, *domain, *name;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &identifier);
if (Z_TYPE_P(identifier) == IS_ARRAY) {
PHALCON_OBS_VAR(domain);
phalcon_array_fetch_long(&domain, identifier, 0, PH_NOISY);
PHALCON_OBS_VAR(name);
phalcon_array_fetch_long(&name, identifier, 1, PH_NOISY);
if (PHALCON_GLOBAL(db).escape_identifiers) {
PHALCON_CONCAT_SVSVS(return_value, "`", domain, "`.`", name, "`");
RETURN_MM();
}
PHALCON_CONCAT_VSV(return_value, domain, ".", name);
RETURN_MM();
}
if (PHALCON_GLOBAL(db).escape_identifiers) {
PHALCON_CONCAT_SVS(return_value, "`", identifier, "`");
RETURN_MM();
}
RETURN_CCTOR(identifier);
}
示例6: PHP_METHOD
/**
* Adds a resource to the annotations handler
* A resource is a class that contains routing annotations
* The class is located in a module
*
* @param string $module
* @param string $handler
* @param string $prefix
* @return Phalcon\Mvc\Router\Annotations
*/
PHP_METHOD(Phalcon_Mvc_Router_Annotations, addModuleResource){
zval *module, *handler, *prefix = NULL, *scope;
phalcon_fetch_params(0, 2, 1, &module, &handler, &prefix);
if (!prefix) {
prefix = PHALCON_GLOBAL(z_null);
}
if (Z_TYPE_P(module) != IS_STRING) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_mvc_router_exception_ce, "The module is not a valid string");
return;
}
if (Z_TYPE_P(handler) != IS_STRING) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_mvc_router_exception_ce, "The handler must be a class name");
return;
}
MAKE_STD_ZVAL(scope);
array_init_size(scope, 3);
phalcon_array_append(&scope, prefix, 0);
phalcon_array_append(&scope, handler, 0);
phalcon_array_append(&scope, module, 0);
phalcon_update_property_array_append(this_ptr, SL("_handlers"), scope TSRMLS_CC);
zval_ptr_dtor(&scope);
phalcon_update_property_this(this_ptr, SL("_processed"), PHALCON_GLOBAL(z_false) TSRMLS_CC);
RETURN_THISW();
}
示例7: PHP_METHOD
/**
* 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();
}
示例8: PHP_METHOD
/**
* Creates a form registering it in the forms manager
*
* @param string $name
* @param object $entity
* @return Phalcon\Forms\Form
*/
PHP_METHOD(Phalcon_Forms_Manager, create){
zval *name = NULL, *entity = NULL, form = {};
phalcon_fetch_params(0, 0, 2, &name, &entity);
if (!name) {
name = &PHALCON_GLOBAL(z_null);
}
if (!entity) {
entity = &PHALCON_GLOBAL(z_null);
}
if (Z_TYPE_P(name) != IS_STRING) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_forms_exception_ce, "The form name must be string");
return;
}
object_init_ex(&form, phalcon_forms_form_ce);
PHALCON_CALL_METHODW(NULL, &form, "__construct", entity);
phalcon_update_property_array(getThis(), SL("_forms"), name, &form);
RETURN_CTORW(&form);
}
示例9: PHP_METHOD
/**
* Phalcon\Assets\Resource constructor
*
* @param string $type
* @param string $path
* @param boolean $local
* @param boolean $filter
* @param array $attributes
*/
PHP_METHOD(Phalcon_Assets_Resource, __construct){
zval *type, *path, *local = NULL, *filter = NULL, *attributes = NULL;
phalcon_fetch_params(0, 2, 3, &type, &path, &local, &filter, &attributes);
if (!local) {
local = PHALCON_GLOBAL(z_true);
}
if (!filter) {
filter = PHALCON_GLOBAL(z_true);
}
if (!attributes) {
attributes = PHALCON_GLOBAL(z_null);
}
phalcon_update_property_this(this_ptr, SL("_type"), type TSRMLS_CC);
phalcon_update_property_this(this_ptr, SL("_path"), path TSRMLS_CC);
phalcon_update_property_this(this_ptr, SL("_local"), local TSRMLS_CC);
phalcon_update_property_this(this_ptr, SL("_filter"), filter TSRMLS_CC);
if (Z_TYPE_P(attributes) == IS_ARRAY) {
phalcon_update_property_this(this_ptr, SL("_attributes"), attributes TSRMLS_CC);
}
}
示例10: PHP_METHOD
/**
* Create a new Query Builder for Delete
*
*
* @return Phalcon\Mvc\Model\Query\Builder\Delete
*/
PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, createDeleteBuilder){
zval *params = NULL, *_di = NULL, di = {}, service_name = {};
phalcon_fetch_params(0, 0, 2, ¶ms, &_di);
if (!params) {
params = &PHALCON_GLOBAL(z_null);
}
if (!_di) {
_di = &PHALCON_GLOBAL(z_null);
}
if (Z_TYPE_P(_di) == IS_OBJECT) {
PHALCON_VERIFY_INTERFACEW(_di, phalcon_diinterface_ce);
PHALCON_CPY_WRT(&di, _di);
} else {
PHALCON_CALL_CE_STATICW(&di, phalcon_di_ce, "getdefault", _di);
}
PHALCON_STR(&service_name, ISV(modelsQueryBuilderForDelete));
PHALCON_CALL_METHODW(return_value, &di, "get", &service_name, &PHALCON_GLOBAL(z_null), &PHALCON_GLOBAL(z_true));
if (Z_TYPE_P(return_value) != IS_OBJECT) {
object_init_ex(return_value, phalcon_mvc_model_query_builder_delete_ce);
PHALCON_CALL_METHODW(NULL, return_value, "__construct", params);
}
PHALCON_VERIFY_INTERFACEW(return_value, phalcon_mvc_model_query_builderinterface_ce);
}
示例11: PHP_METHOD
/**
* Resolves a service, the resolved service is stored in the DI, subsequent requests for this service will return the same instance
*
* @param string $name
* @param array $parameters
* @return mixed
*/
PHP_METHOD(Phalcon_DI, getShared){
zval *name, *parameters = NULL, *noerror = NULL, instance = {};
phalcon_fetch_params(0, 1, 2, &name, ¶meters, &noerror);
PHALCON_ENSURE_IS_STRING(name);
if (!parameters) {
parameters = &PHALCON_GLOBAL(z_null);
}
if (!noerror) {
noerror = &PHALCON_GLOBAL(z_null);
}
if (phalcon_isset_property_array(getThis(), SL("_sharedInstances"), name)) {
phalcon_return_property_array(&instance, getThis(), SL("_sharedInstances"), name);
phalcon_update_property_bool(getThis(), SL("_freshInstance"), 0);
} else {
PHALCON_CALL_SELFW(&instance, "get", name, parameters, noerror);
if (zend_is_true(&instance)) {
phalcon_update_property_bool(getThis(), SL("_freshInstance"), 1);
phalcon_update_property_array(getThis(), SL("_sharedInstances"), name, &instance);
}
}
RETURN_CTORW(&instance);
}
示例12: PHP_METHOD
/**
* Reads the ordered/reversed column map for certain model
*
*<code>
* print_r($metaData->readColumnMap(new Robots()));
*</code>
*
* @param Phalcon\Mvc\ModelInterface $model
* @return array
*/
PHP_METHOD(Phalcon_Mvc_Model_MetaData, readColumnMap){
zval *model, *key_name, *column_map = NULL, *null_value;
zval *data;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &model);
PHALCON_VERIFY_INTERFACE_EX(model, phalcon_mvc_modelinterface_ce, phalcon_mvc_model_exception_ce, 1);
if (!PHALCON_GLOBAL(orm).column_renaming) {
RETURN_MM();
}
PHALCON_INIT_VAR(key_name);
phalcon_get_class(key_name, model, 1 TSRMLS_CC);
PHALCON_OBS_VAR(column_map);
phalcon_read_property_this(&column_map, this_ptr, SL("_columnMap"), PH_NOISY TSRMLS_CC);
if (!phalcon_array_isset(column_map, key_name)) {
null_value = PHALCON_GLOBAL(z_null);
PHALCON_CALL_METHOD(NULL, this_ptr, "_initialize", model, null_value, null_value, null_value);
PHALCON_OBS_NVAR(column_map);
phalcon_read_property_this(&column_map, this_ptr, SL("_columnMap"), PH_NOISY TSRMLS_CC);
}
PHALCON_OBS_VAR(data);
phalcon_array_fetch(&data, column_map, key_name, PH_NOISY);
RETURN_CTOR(data);
}
示例13: PHP_METHOD
/**
* Phalcon\Mvc\Collection\Message constructor
*
* @param string $message
* @param string $field
* @param string $type
* @param Phalcon\Mvc\CollectionInterface $collection
*/
PHP_METHOD(Phalcon_Mvc_Collection_Message, __construct){
zval *message, *field = NULL, *type = NULL, *collection = NULL, *code = NULL;
phalcon_fetch_params(0, 1, 4, &message, &field, &type, &code, &collection);
if (!field) {
field = PHALCON_GLOBAL(z_null);
}
if (!type) {
type = PHALCON_GLOBAL(z_null);
}
if (!collection) {
collection = PHALCON_GLOBAL(z_null);
}
if (!code) {
code = PHALCON_GLOBAL(z_zero);
}
phalcon_update_property_this(this_ptr, SL("_message"), message TSRMLS_CC);
phalcon_update_property_this(this_ptr, SL("_field"), field TSRMLS_CC);
phalcon_update_property_this(this_ptr, SL("_type"), type TSRMLS_CC);
if (Z_TYPE_P(collection) == IS_OBJECT) {
phalcon_update_property_this(this_ptr, SL("_collection"), collection TSRMLS_CC);
}
phalcon_update_property_this(this_ptr, SL("_code"), code TSRMLS_CC);
}
示例14: PHP_METHOD
/**
* Creates a form registering it in the forms manager
*
* @param string $name
* @param object $entity
* @return Phalcon\Forms\Form
*/
PHP_METHOD(Phalcon_Forms_Manager, create){
zval *name = NULL, *entity = NULL, *form;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 0, 2, &name, &entity);
if (!name) {
name = PHALCON_GLOBAL(z_null);
}
if (!entity) {
entity = PHALCON_GLOBAL(z_null);
}
if (Z_TYPE_P(name) != IS_STRING) {
PHALCON_THROW_EXCEPTION_STR(phalcon_forms_exception_ce, "The form name must be string");
return;
}
PHALCON_INIT_VAR(form);
object_init_ex(form, phalcon_forms_form_ce);
PHALCON_CALL_METHOD(NULL, form, "__construct", entity);
phalcon_update_property_array(this_ptr, SL("_forms"), name, form TSRMLS_CC);
RETURN_CTOR(form);
}
示例15: PHP_METHOD
/**
* Adds a resource to the ACL list
*
* Access names can be a particular action, by example
* search, update, delete, etc or a list of them
*
* Example:
* <code>
* //Add a resource to the the list allowing access to an action
* $acl->addResource(new Phalcon\Acl\Resource('customers'), 'search');
* $acl->addResource('customers', 'search');
*
* //Add a resource with an access list
* $acl->addResource(new Phalcon\Acl\Resource('customers'), array('create', 'search'));
* $acl->addResource('customers', array('create', 'search'));
* </code>
*
* @param Phalcon\Acl\Resource|string $resource
* @param array $accessList
* @return boolean
*/
PHP_METHOD(Phalcon_Acl_Adapter_Memory, addResource){
zval *resource, *access_list = NULL, *resource_name = NULL;
zval *object = NULL, *resources_names;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 1, &resource, &access_list);
if (!access_list) {
access_list = PHALCON_GLOBAL(z_null);
}
if (Z_TYPE_P(resource) == IS_OBJECT) {
PHALCON_CALL_METHOD(&resource_name, resource, "getname");
PHALCON_CPY_WRT(object, resource);
} else {
PHALCON_CPY_WRT(resource_name, resource);
PHALCON_INIT_NVAR(object);
object_init_ex(object, phalcon_acl_resource_ce);
PHALCON_CALL_METHOD(NULL, object, "__construct", resource_name);
}
PHALCON_OBS_VAR(resources_names);
phalcon_read_property_this(&resources_names, this_ptr, SL("_resourcesNames"), PH_NOISY TSRMLS_CC);
if (!phalcon_array_isset(resources_names, resource_name)) {
phalcon_update_property_array_append(this_ptr, SL("_resources"), object TSRMLS_CC);
phalcon_update_property_array(this_ptr, SL("_resourcesNames"), resource_name, PHALCON_GLOBAL(z_true) TSRMLS_CC);
}
PHALCON_RETURN_CALL_METHOD(this_ptr, "addresourceaccess", resource_name, access_list);
RETURN_MM();
}