本文整理汇总了C++中phalcon_call_method_p1函数的典型用法代码示例。如果您正苦于以下问题:C++ phalcon_call_method_p1函数的具体用法?C++ phalcon_call_method_p1怎么用?C++ phalcon_call_method_p1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phalcon_call_method_p1函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* Returns the value of the CSRF token in session
*
* @return string
*/
PHP_METHOD(Phalcon_Security, getSessionToken){
zval *dependency_injector, *service, *session;
zval *key, *session_token;
PHALCON_MM_GROW();
PHALCON_OBS_VAR(dependency_injector);
phalcon_read_property_this(&dependency_injector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC);
if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_flash_exception_ce, "A dependency injection container is required to access the 'session' service");
return;
}
PHALCON_INIT_VAR(service);
ZVAL_STRING(service, "session", 1);
PHALCON_INIT_VAR(session);
phalcon_call_method_p1(session, dependency_injector, "getshared", service);
PHALCON_VERIFY_INTERFACE(session, phalcon_session_adapterinterface_ce);
PHALCON_INIT_VAR(key);
ZVAL_STRING(key, "$PHALCON/CSRF$", 1);
PHALCON_INIT_VAR(session_token);
phalcon_call_method_p1(session_token, session, "get", key);
RETURN_CCTOR(session_token);
}
开发者ID:CreativeOutbreak,项目名称:cphalcon,代码行数:34,代码来源:security.c
示例2: PHP_METHOD
/**
* Returns the messages stored in session
*
* @param boolean $remove
* @return array
*/
PHP_METHOD(Phalcon_Flash_Session, _getSessionMessages){
zval *remove, *dependency_injector, *service;
zval *session, *index_name, *messages;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &remove);
PHALCON_OBS_VAR(dependency_injector);
phalcon_read_property_this(&dependency_injector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC);
if (unlikely(Z_TYPE_P(dependency_injector) != IS_OBJECT)) {
PHALCON_THROW_EXCEPTION_STR(phalcon_flash_exception_ce, "A dependency injection container is required to access the 'session' service");
return;
}
PHALCON_INIT_VAR(service);
ZVAL_STRING(service, "session", 1);
PHALCON_INIT_VAR(session);
phalcon_call_method_p1(session, dependency_injector, "getshared", service);
PHALCON_VERIFY_INTERFACE(session, phalcon_session_adapterinterface_ce);
PHALCON_INIT_VAR(index_name);
ZVAL_STRING(index_name, "_flashMessages", 1);
PHALCON_INIT_VAR(messages);
phalcon_call_method_p1(messages, session, "get", index_name);
if (PHALCON_IS_TRUE(remove)) {
phalcon_call_method_p1_noret(session, "remove", index_name);
}
RETURN_CCTOR(messages);
}
开发者ID:CreativeOutbreak,项目名称:cphalcon,代码行数:40,代码来源:session.c
示例3: PHP_METHOD
/**
* Check if a model has certain attribute
*
*<code>
* var_dump($metaData->hasAttribute(new Robots(), 'name'));
*</code>
*
* @param Phalcon\Mvc\ModelInterface $model
* @param string $attribute
* @return boolean
*/
PHP_METHOD(Phalcon_Mvc_Model_MetaData, hasAttribute) {
zval *model, *attribute, *column_map, *meta_data;
zval *data_types;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 2, 0, &model, &attribute);
if (Z_TYPE_P(attribute) != IS_STRING) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "Attribute must be a string");
return;
}
PHALCON_INIT_VAR(column_map);
phalcon_call_method_p1(column_map, this_ptr, "getreversecolumnmap", model);
if (Z_TYPE_P(column_map) == IS_ARRAY) {
if (phalcon_array_isset(column_map, attribute)) {
RETURN_MM_TRUE;
}
} else {
PHALCON_INIT_VAR(meta_data);
phalcon_call_method_p1(meta_data, this_ptr, "readmetadata", model);
PHALCON_OBS_VAR(data_types);
phalcon_array_fetch_long(&data_types, meta_data, 4, PH_NOISY);
if (phalcon_array_isset(data_types, attribute)) {
RETURN_MM_TRUE;
}
}
RETURN_MM_FALSE;
}
开发者ID:rakeshbitling,项目名称:cphalcon,代码行数:44,代码来源:metadata.c
示例4: PHP_METHOD
/**
* Executes the validation
*
* @param Phalcon\Validation $validator
* @param string $attribute
* @return boolean
*/
PHP_METHOD(Phalcon_Validation_Validator_ExclusionIn, validate){
zval *validator, *attribute, *value, *option = NULL, *domain;
zval *message_str = NULL, *joined_domain, *type, *message;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 2, 0, &validator, &attribute);
PHALCON_INIT_VAR(value);
phalcon_call_method_p1(value, validator, "getvalue", attribute);
/**
* A domain is an array with a list of valid values
*/
PHALCON_INIT_VAR(option);
ZVAL_STRING(option, "domain", 1);
PHALCON_INIT_VAR(domain);
phalcon_call_method_p1(domain, this_ptr, "getoption", option);
if (Z_TYPE_P(domain) != IS_ARRAY) {
PHALCON_THROW_EXCEPTION_STR(phalcon_validation_exception_ce, "Option 'domain' must be an array");
return;
}
/**
* Check if the value is contained by the array
*/
if (phalcon_fast_in_array(value, domain TSRMLS_CC)) {
PHALCON_INIT_NVAR(option);
ZVAL_STRING(option, "message", 1);
PHALCON_INIT_VAR(message_str);
phalcon_call_method_p1(message_str, this_ptr, "getoption", option);
if (!zend_is_true(message_str)) {
PHALCON_INIT_VAR(joined_domain);
phalcon_fast_join_str(joined_domain, SL(", "), domain TSRMLS_CC);
PHALCON_INIT_NVAR(message_str);
PHALCON_CONCAT_SVSV(message_str, "Value of field '", attribute, "' must not be part of list: ", joined_domain);
}
PHALCON_INIT_VAR(type);
ZVAL_STRING(type, "ExclusionIn", 1);
PHALCON_INIT_VAR(message);
object_init_ex(message, phalcon_validation_message_ce);
phalcon_call_method_p3_noret(message, "__construct", message_str, attribute, type);
phalcon_call_method_p1_noret(validator, "appendmessage", message);
RETURN_MM_FALSE;
}
RETURN_MM_TRUE;
}
开发者ID:11mariom,项目名称:cphalcon,代码行数:63,代码来源:exclusionin.c
示例5: PHP_METHOD
/**
* Redirect by HTTP to another action or URL
*
*<code>
* //Using a string redirect (internal/external)
* $response->redirect("posts/index");
* $response->redirect("http://en.wikipedia.org", true);
* $response->redirect("http://www.example.com/new-location", true, 301);
*
* //Making a redirection based on a named route
* $response->redirect(array(
* "for" => "index-lang",
* "lang" => "jp",
* "controller" => "index"
* ));
*</code>
*
* @param string $location
* @param boolean $externalRedirect
* @param int $statusCode
* @return Phalcon\Http\ResponseInterface
*/
PHP_METHOD(Phalcon_Http_Response, redirect){
zval *location = NULL, *external_redirect = NULL, *status_code = NULL;
zval *header = NULL, *dependency_injector, *service;
zval *url, *status_text, *header_name;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 0, 3, &location, &external_redirect, &status_code);
if (!location) {
PHALCON_INIT_VAR(location);
}
if (!external_redirect) {
PHALCON_INIT_VAR(external_redirect);
ZVAL_BOOL(external_redirect, 0);
}
if (!status_code) {
PHALCON_INIT_VAR(status_code);
ZVAL_LONG(status_code, 302);
}
if (zend_is_true(external_redirect)) {
PHALCON_CPY_WRT(header, location);
} else {
PHALCON_INIT_VAR(dependency_injector);
phalcon_call_method(dependency_injector, this_ptr, "getdi");
PHALCON_INIT_VAR(service);
ZVAL_STRING(service, "url", 1);
PHALCON_INIT_VAR(url);
phalcon_call_method_p1(url, dependency_injector, "getshared", service);
PHALCON_INIT_NVAR(header);
phalcon_call_method_p1(header, url, "get", location);
}
/**
* The HTTP status is 302 by default, a temporary redirection
*/
PHALCON_INIT_VAR(status_text);
ZVAL_STRING(status_text, "Redirect", 1);
phalcon_call_method_p2_noret(this_ptr, "setstatuscode", status_code, status_text);
/**
* Change the current location using 'Location'
*/
PHALCON_INIT_VAR(header_name);
ZVAL_STRING(header_name, "Location", 1);
phalcon_call_method_p2_noret(this_ptr, "setheader", header_name, header);
RETURN_THIS();
}
开发者ID:Diego-Brocanelli,项目名称:cphalcon,代码行数:78,代码来源:response.c
示例6: PHP_METHOD
/**
* Executes the validation
*
* @param Phalcon\Validation $validator
* @param string $attribute
* @return boolean
*/
PHP_METHOD(Phalcon_Validation_Validator_Between, validate){
zval *validator, *attribute, *value, *option = NULL, *minimum;
zval *maximum, *valid = NULL, *type, *message_str = NULL, *message;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 2, 0, &validator, &attribute);
PHALCON_INIT_VAR(value);
phalcon_call_method_p1(value, validator, "getvalue", attribute);
PHALCON_INIT_VAR(option);
ZVAL_STRING(option, "minimum", 1);
PHALCON_INIT_VAR(minimum);
phalcon_call_method_p1(minimum, this_ptr, "getoption", option);
PHALCON_INIT_NVAR(option);
ZVAL_STRING(option, "maximum", 1);
PHALCON_INIT_VAR(maximum);
phalcon_call_method_p1(maximum, this_ptr, "getoption", option);
PHALCON_INIT_VAR(valid);
is_smaller_or_equal_function(valid, minimum, value TSRMLS_CC);
if (zend_is_true(valid)) {
is_smaller_or_equal_function(valid, value, maximum TSRMLS_CC);
}
if (PHALCON_IS_FALSE(valid)) {
PHALCON_INIT_VAR(type);
ZVAL_STRING(type, "Between", 1);
PHALCON_INIT_NVAR(option);
ZVAL_STRING(option, "message", 1);
PHALCON_INIT_VAR(message_str);
phalcon_call_method_p1(message_str, this_ptr, "getoption", option);
if (!zend_is_true(message_str)) {
PHALCON_INIT_NVAR(message_str);
PHALCON_CONCAT_VS(message_str, attribute, " is not between a valid range");
}
PHALCON_INIT_VAR(message);
object_init_ex(message, phalcon_validation_message_ce);
phalcon_call_method_p3_noret(message, "__construct", message_str, attribute, type);
phalcon_call_method_p1_noret(validator, "appendmessage", message);
RETURN_MM_FALSE;
}
RETURN_MM_TRUE;
}
开发者ID:11mariom,项目名称:cphalcon,代码行数:62,代码来源:between.c
示例7: PHP_METHOD
/**
* Executes the validator
*
* @param Phalcon\Mvc\ModelInterface $record
* @return boolean
*/
PHP_METHOD(Phalcon_Mvc_Model_Validator_Url, validate){
zval *record, *option = NULL, *field, *value, *flag, *is_valid;
zval *message = NULL, *type;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &record);
PHALCON_INIT_VAR(option);
ZVAL_STRING(option, "field", 1);
PHALCON_INIT_VAR(field);
phalcon_call_method_p1(field, this_ptr, "getoption", option);
if (Z_TYPE_P(field) != IS_STRING) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "Field name must be a string");
return;
}
PHALCON_INIT_VAR(value);
phalcon_call_method_p1(value, record, "readattribute", field);
PHALCON_INIT_VAR(flag);
ZVAL_LONG(flag, 273);
/**
* Filters the format using FILTER_VALIDATE_URL
*/
PHALCON_INIT_VAR(is_valid);
phalcon_call_func_p2(is_valid, "filter_var", value, flag);
if (!zend_is_true(is_valid)) {
/**
* Check if the developer has defined a custom message
*/
PHALCON_INIT_NVAR(option);
ZVAL_STRING(option, "message", 1);
PHALCON_INIT_VAR(message);
phalcon_call_method_p1(message, this_ptr, "getoption", option);
if (!zend_is_true(message)) {
PHALCON_INIT_NVAR(message);
PHALCON_CONCAT_SVS(message, "'", field, "' does not have a valid url format");
}
PHALCON_INIT_VAR(type);
ZVAL_STRING(type, "Url", 1);
phalcon_call_method_p3_noret(this_ptr, "appendmessage", message, field, type);
RETURN_MM_FALSE;
}
RETURN_MM_TRUE;
}
开发者ID:11mariom,项目名称:cphalcon,代码行数:59,代码来源:url.c
示例8: PHP_METHOD
/**
* Initializes the session bag. This method must not be called directly, the class calls it when its internal data is accesed
*/
PHP_METHOD(Phalcon_Session_Bag, initialize){
zval *session = NULL, *dependency_injector = NULL, *service;
zval *name, *data = NULL;
PHALCON_MM_GROW();
PHALCON_OBS_VAR(session);
phalcon_read_property_this(&session, this_ptr, SL("_session"), PH_NOISY_CC);
if (Z_TYPE_P(session) != IS_OBJECT) {
PHALCON_OBS_VAR(dependency_injector);
phalcon_read_property_this(&dependency_injector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC);
if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_INIT_NVAR(dependency_injector);
PHALCON_CALL_STATIC(dependency_injector, "phalcon\\di", "getdefault");
if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_session_exception_ce, "A dependency injection object is required to access the 'session' service");
return;
}
}
PHALCON_INIT_VAR(service);
ZVAL_STRING(service, "session", 1);
PHALCON_INIT_NVAR(session);
phalcon_call_method_p1(session, dependency_injector, "getshared", service);
PHALCON_VERIFY_INTERFACE(session, phalcon_session_adapterinterface_ce);
phalcon_update_property_this(this_ptr, SL("_session"), session TSRMLS_CC);
}
PHALCON_OBS_VAR(name);
phalcon_read_property_this(&name, this_ptr, SL("_name"), PH_NOISY_CC);
PHALCON_INIT_VAR(data);
phalcon_call_method_p1(data, session, "get", name);
if (Z_TYPE_P(data) != IS_ARRAY) {
PHALCON_INIT_NVAR(data);
array_init(data);
}
phalcon_update_property_this(this_ptr, SL("_data"), data TSRMLS_CC);
phalcon_update_property_bool(this_ptr, SL("_initalized"), 1 TSRMLS_CC);
PHALCON_MM_RESTORE();
}
开发者ID:11mariom,项目名称:cphalcon,代码行数:51,代码来源:bag.c
示例9: PHP_METHOD
/**
* Returns cached content
*
* @param string $keyName
* @param long $lifetime
* @return mixed
*/
PHP_METHOD(Phalcon_Cache_Backend_Xcache, get){
zval *key_name, *lifetime = NULL, *frontend, *prefix, *prefixed_key;
zval *cached_content, *processed;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 1, &key_name, &lifetime);
if (!lifetime) {
PHALCON_INIT_VAR(lifetime);
}
PHALCON_OBS_VAR(frontend);
phalcon_read_property_this(&frontend, this_ptr, SL("_frontend"), PH_NOISY_CC);
PHALCON_OBS_VAR(prefix);
phalcon_read_property_this(&prefix, this_ptr, SL("_prefix"), PH_NOISY_CC);
PHALCON_INIT_VAR(prefixed_key);
PHALCON_CONCAT_SVV(prefixed_key, "_PHCX", prefix, key_name);
phalcon_update_property_this(this_ptr, SL("_lastKey"), prefixed_key TSRMLS_CC);
PHALCON_INIT_VAR(cached_content);
phalcon_call_func_p1(cached_content, "xcache_get", prefixed_key);
if (Z_TYPE_P(cached_content) == IS_NULL) {
RETURN_MM_NULL();
}
PHALCON_INIT_VAR(processed);
phalcon_call_method_p1(processed, frontend, "afterretrieve", cached_content);
RETURN_CCTOR(processed);
}
开发者ID:RSivakov,项目名称:cphalcon,代码行数:41,代码来源:xcache.c
示例10: PHP_METHOD
/**
* Checks for annotations in the controller docblock
*
* @param string $handler
* @param Phalcon\Annotations\AdapterInterface
*/
PHP_METHOD(Phalcon_Mvc_Router_Annotations, processControllerAnnotation){
zval *handler, *annotation, *name, *position, *value;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 2, 0, &handler, &annotation);
PHALCON_INIT_VAR(name);
phalcon_call_method(name, annotation, "getname");
/**
* @RoutePrefix add a prefix for all the routes defined in the model
*/
if (PHALCON_IS_STRING(name, "RoutePrefix")) {
PHALCON_INIT_VAR(position);
ZVAL_LONG(position, 0);
PHALCON_INIT_VAR(value);
phalcon_call_method_p1(value, annotation, "getargument", position);
phalcon_update_property_this(this_ptr, SL("_routePrefix"), value TSRMLS_CC);
}
PHALCON_MM_RESTORE();
}
开发者ID:CreativeOutbreak,项目名称:cphalcon,代码行数:31,代码来源:annotations.c
示例11: PHP_METHOD
/**
* Sets the DependencyInjector container
*
* @param Phalcon\DiInterface $dependencyInjector
*/
PHP_METHOD(Phalcon_Mvc_Micro, setDI){
zval *dependency_injector, *service, *exists;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &dependency_injector);
if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_application_exception_ce, "The dependency injector must be an object");
return;
}
/**
* We automatically set ourselves as application service
*/
PHALCON_INIT_VAR(service);
ZVAL_STRING(service, "application", 1);
PHALCON_INIT_VAR(exists);
phalcon_call_method_p1(exists, dependency_injector, "has", service);
if (!zend_is_true(exists)) {
phalcon_call_method_p2_noret(dependency_injector, "set", service, this_ptr);
}
phalcon_update_property_this(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);
PHALCON_MM_RESTORE();
}
开发者ID:RSivakov,项目名称:cphalcon,代码行数:34,代码来源:micro.c
示例12: PHP_METHOD
/**
* Applies a format to a message before sent it to the internal log
*
* @param string $message
* @param int $type
* @param int $timestamp
* @return string
*/
PHP_METHOD(Phalcon_Logger_Formatter_Line, format) {
zval *message, *type, *timestamp, *format = NULL, *date_format;
zval *date, *date_wildcard, *new_format = NULL, *type_string;
zval *type_wildcard, *message_wildcard, *eol;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 3, 0, &message, &type, ×tamp);
PHALCON_OBS_VAR(format);
phalcon_read_property_this(&format, this_ptr, SL("_format"), PH_NOISY_CC);
/**
* Check if the format has the %date% placeholder
*/
if (phalcon_memnstr_str(format, SL("%date%"))) {
PHALCON_OBS_VAR(date_format);
phalcon_read_property_this(&date_format, this_ptr, SL("_dateFormat"), PH_NOISY_CC);
PHALCON_INIT_VAR(date);
phalcon_call_func_p2(date, "date", date_format, timestamp);
PHALCON_INIT_VAR(date_wildcard);
ZVAL_STRING(date_wildcard, "%date%", 1);
PHALCON_INIT_VAR(new_format);
phalcon_fast_str_replace(new_format, date_wildcard, date, format);
} else {
PHALCON_CPY_WRT(new_format, format);
}
/**
* Check if the format has the %type% placeholder
*/
if (phalcon_memnstr_str(format, SL("%type%"))) {
PHALCON_INIT_VAR(type_string);
phalcon_call_method_p1(type_string, this_ptr, "gettypestring", type);
PHALCON_INIT_VAR(type_wildcard);
ZVAL_STRING(type_wildcard, "%type%", 1);
PHALCON_INIT_NVAR(format);
phalcon_fast_str_replace(format, type_wildcard, type_string, new_format);
} else {
PHALCON_CPY_WRT(format, new_format);
}
PHALCON_INIT_VAR(message_wildcard);
ZVAL_STRING(message_wildcard, "%message%", 1);
PHALCON_INIT_NVAR(new_format);
phalcon_fast_str_replace(new_format, message_wildcard, message, format);
PHALCON_INIT_VAR(eol);
ZVAL_STRING(eol, PHP_EOL, 1);
PHALCON_CONCAT_VV(return_value, new_format, eol);
RETURN_MM();
}
开发者ID:golovanov,项目名称:cphalcon,代码行数:68,代码来源:line.c
示例13: PHP_METHOD
/**
* Gets HTTP schema (http/https)
*
* @return string
*/
PHP_METHOD(Phalcon_Http_Request, getScheme){
zval *https_header, *https, *scheme = NULL;
PHALCON_MM_GROW();
PHALCON_INIT_VAR(https_header);
ZVAL_STRING(https_header, "HTTPS", 1);
PHALCON_INIT_VAR(https);
phalcon_call_method_p1(https, this_ptr, "getserver", https_header);
if (zend_is_true(https)) {
if (PHALCON_IS_STRING(https, "off")) {
PHALCON_INIT_VAR(scheme);
ZVAL_STRING(scheme, "http", 1);
} else {
PHALCON_INIT_NVAR(scheme);
ZVAL_STRING(scheme, "https", 1);
}
} else {
PHALCON_INIT_NVAR(scheme);
ZVAL_STRING(scheme, "http", 1);
}
RETURN_CTOR(scheme);
}
开发者ID:CreativeOutbreak,项目名称:cphalcon,代码行数:31,代码来源:request.c
示例14: PHP_METHOD
/**
* Executes the validator
*
* @param Phalcon\Mvc\ModelInterface $record
* @return boolean
*/
PHP_METHOD(Phalcon_Mvc_Model_Validator_Numericality, validate){
zval *record, *option = NULL, *field, *value, *message = NULL, *type;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &record);
PHALCON_INIT_VAR(option);
ZVAL_STRING(option, "field", 1);
PHALCON_INIT_VAR(field);
phalcon_call_method_p1(field, this_ptr, "getoption", option);
if (Z_TYPE_P(field) != IS_STRING) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "Field name must be a string");
return;
}
PHALCON_INIT_VAR(value);
phalcon_call_method_p1(value, record, "readattribute", field);
/**
* Check if the value is numeric using is_numeric in the PHP userland
*/
if (!phalcon_is_numeric(value)) {
/**
* Check if the developer has defined a custom message
*/
PHALCON_INIT_NVAR(option);
ZVAL_STRING(option, "message", 1);
PHALCON_INIT_VAR(message);
phalcon_call_method_p1(message, this_ptr, "getoption", option);
if (!zend_is_true(message)) {
PHALCON_INIT_NVAR(message);
PHALCON_CONCAT_SVS(message, "Value of field '", field, "' must be numeric");
}
PHALCON_INIT_VAR(type);
ZVAL_STRING(type, "Numericality", 1);
phalcon_call_method_p3_noret(this_ptr, "appendmessage", message, field, type);
RETURN_MM_FALSE;
}
RETURN_MM_TRUE;
}
开发者ID:CreativeOutbreak,项目名称:cphalcon,代码行数:53,代码来源:numericality.c
示例15: PHP_METHOD
/**
* Sets a Expires header to use HTTP cache
*
*<code>
* $this->response->setExpires(new DateTime());
*</code>
*
* @param DateTime $datetime
* @return Phalcon\Http\ResponseInterface
*/
PHP_METHOD(Phalcon_Http_Response, setExpires){
zval *datetime, *headers, *date, *utc_zone, *timezone;
zval *format, *utc_format, *utc_date, *expires_header;
zend_class_entry *ce0;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &datetime);
if (Z_TYPE_P(datetime) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_http_response_exception_ce, "datetime parameter must be an instance of DateTime");
return;
}
PHALCON_INIT_VAR(headers);
phalcon_call_method(headers, this_ptr, "getheaders");
PHALCON_INIT_VAR(date);
if (phalcon_clone(date, datetime TSRMLS_CC) == FAILURE) {
return;
}
/**
* All the expiration times are sent in UTC
*/
PHALCON_INIT_VAR(utc_zone);
ZVAL_STRING(utc_zone, "UTC", 1);
ce0 = zend_fetch_class(SL("DateTimeZone"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
PHALCON_INIT_VAR(timezone);
object_init_ex(timezone, ce0);
if (phalcon_has_constructor(timezone TSRMLS_CC)) {
phalcon_call_method_p1_noret(timezone, "__construct", utc_zone);
}
/**
* Change the timezone to utc
*/
phalcon_call_method_p1_noret(date, "settimezone", timezone);
PHALCON_INIT_VAR(format);
ZVAL_STRING(format, "D, d M Y H:i:s", 1);
PHALCON_INIT_VAR(utc_format);
phalcon_call_method_p1(utc_format, date, "format", format);
PHALCON_INIT_VAR(utc_date);
PHALCON_CONCAT_VS(utc_date, utc_format, " GMT");
/**
* The 'Expires' header set this info
*/
PHALCON_INIT_VAR(expires_header);
ZVAL_STRING(expires_header, "Expires", 1);
phalcon_call_method_p2_noret(this_ptr, "setheader", expires_header, utc_date);
RETURN_THIS();
}
开发者ID:11mariom,项目名称:cphalcon,代码行数:69,代码来源:response.c
示例16: PHP_METHOD
/**
* Returns a cached content
*
* @param int|string $keyName
* @param long $lifetime
* @return mixed
*/
PHP_METHOD(Phalcon_Cache_Backend_Memcache, get){
zval *key_name, *lifetime = NULL, *memcache = NULL, *frontend;
zval *prefix, *prefixed_key, *cached_content;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 1, &key_name, &lifetime);
if (!lifetime) {
PHALCON_INIT_VAR(lifetime);
}
PHALCON_OBS_VAR(memcache);
phalcon_read_property_this(&memcache, this_ptr, SL("_memcache"), PH_NOISY_CC);
if (Z_TYPE_P(memcache) != IS_OBJECT) {
phalcon_call_method_noret(this_ptr, "_connect");
PHALCON_OBS_NVAR(memcache);
phalcon_read_property_this(&memcache, this_ptr, SL("_memcache"), PH_NOISY_CC);
}
PHALCON_OBS_VAR(frontend);
phalcon_read_property_this(&frontend, this_ptr, SL("_frontend"), PH_NOISY_CC);
PHALCON_OBS_VAR(prefix);
phalcon_read_property_this(&prefix, this_ptr, SL("_prefix"), PH_NOISY_CC);
PHALCON_INIT_VAR(prefixed_key);
PHALCON_CONCAT_VV(prefixed_key, prefix, key_name);
phalcon_update_property_this(this_ptr, SL("_lastKey"), prefixed_key TSRMLS_CC);
PHALCON_INIT_VAR(cached_content);
phalcon_call_method_p1(cached_content, memcache, "get", prefixed_key);
if (PHALCON_IS_FALSE(cached_content)) {
RETURN_MM_NULL();
}
phalcon_call_method_p1(return_value, frontend, "afterretrieve", cached_content);
RETURN_MM();
}
开发者ID:CreativeOutbreak,项目名称:cphalcon,代码行数:48,代码来源:memcache.c
示例17: PHP_METHOD
/**
* Magic getter to obtain values from the session bag
*
*<code>
* echo $user->name;
*</code>
*
* @param string $property
* @return string
*/
PHP_METHOD(Phalcon_Session_Bag, __get){
zval *property, *value;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &property);
PHALCON_INIT_VAR(value);
phalcon_call_method_p1(value, this_ptr, "get", property);
RETURN_CCTOR(value);
}
开发者ID:RSivakov,项目名称:cphalcon,代码行数:22,代码来源:bag.c
示例18: PHP_METHOD
/**
* Returns a PDO prepared statement to be executed with 'executePrepared'
*
*<code>
* $statement = $db->prepare('SELECT * FROM robots WHERE name = :name');
* $result = $connection->executePrepared($statement, array('name' => 'Voltron'));
*</code>
*
* @param string $sqlStatement
* @return \PDOStatement
*/
PHP_METHOD(Phalcon_Db_Adapter_Pdo, prepare){
zval *sql_statement, *pdo;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &sql_statement);
PHALCON_OBS_VAR(pdo);
phalcon_read_property_this(&pdo, this_ptr, SL("_pdo"), PH_NOISY_CC);
phalcon_call_method_p1(return_value, pdo, "prepare", sql_statement);
RETURN_MM();
}
开发者ID:CreativeOutbreak,项目名称:cphalcon,代码行数:24,代码来源:pdo.c
示例19: PHP_METHOD
/**
* Renders the element widget returning html
*
* @param array $attributes
* @return string
*/
PHP_METHOD(Phalcon_Forms_Element_Date, render){
zval *attributes = NULL, *widget_attributes;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 0, 1, &attributes);
if (!attributes) {
PHALCON_INIT_VAR(attributes);
}
PHALCON_INIT_VAR(widget_attributes);
phalcon_call_method_p1(widget_attributes, this_ptr, "prepareattributes", attributes);
PHALCON_CALL_STATIC_PARAMS_1(return_value, "phalcon\\tag", "datefield", widget_attributes);
RETURN_MM();
}
开发者ID:11mariom,项目名称:cphalcon,代码行数:23,代码来源:date.c
示例20: PHP_METHOD
/**
* Renders the element widget returning html
*
* @param array $attributes
* @return string
*/
PHP_METHOD(Phalcon_Forms_Element_Hidden, render){
zval *attributes = NULL, *widget_attributes, *code;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 0, 1, &attributes);
if (!attributes) {
PHALCON_INIT_VAR(attributes);
}
PHALCON_INIT_VAR(widget_attributes);
phalcon_call_method_p1(widget_attributes, this_ptr, "prepareattributes", attributes);
PHALCON_INIT_VAR(code);
PHALCON_CALL_STATIC_PARAMS_1(code, "phalcon\\tag", "hiddenfield", widget_attributes);
RETURN_CCTOR(code);
}
开发者ID:RSivakov,项目名称:cphalcon,代码行数:25,代码来源:hidden.c
注:本文中的phalcon_call_method_p1函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论