/** * Returns validation record messages which stop the transaction * * @return Phalcon\Mvc\Model\MessageInterface[] */ PHP_METHOD(Phalcon_Mvc_Model_Transaction_Failed, getRecordMessages) { zval *record = phalcon_fetch_nproperty_this(this_ptr, SL("_record"), PH_NOISY TSRMLS_CC); if (Z_TYPE_P(record) != IS_NULL) { PHALCON_RETURN_CALL_METHODW(record, "getmessages"); } PHALCON_RETURN_CALL_METHODW(this_ptr, "getmessage"); }
/** * Returns the translation related to the given key * * @param string $translateKey * @return string */ PHP_METHOD(Phalcon_Translate_Adapter, offsetGet){ zval *translate_key; phalcon_fetch_params(0, 1, 0, &translate_key); PHALCON_RETURN_CALL_METHODW(getThis(), "query", translate_key); }
/** * Return the error info, if any * * @return array */ PHP_METHOD(Phalcon_Db_Adapter_Pdo, getErrorInfo){ zval *pdo; pdo = phalcon_fetch_nproperty_this(this_ptr, SL("_pdo"), PH_NOISY TSRMLS_CC); PHALCON_RETURN_CALL_METHODW(pdo, "errorinfo"); }
/** * 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); }
/** * Checks whether internal connection is under an active transaction * * @return boolean */ PHP_METHOD(Phalcon_Mvc_Model_Transaction, isValid){ zval connection = {}; phalcon_read_property(&connection, getThis(), SL("_connection"), PH_NOISY); PHALCON_RETURN_CALL_METHODW(&connection, "isundertransaction"); }
/** * Outputs a message * * @param string $type * @param string $message * @return string */ PHP_METHOD(Phalcon_Flash_Direct, message) { zval *type, *message; phalcon_fetch_params(0, 2, 0, &type, &message); PHALCON_RETURN_CALL_METHODW(this_ptr, "outputmessage", type, message); }
static void phalcon_flash_message_helper(INTERNAL_FUNCTION_PARAMETERS, const char *stype) { zval *msg, type; phalcon_fetch_params(0, 1, 0, &msg); ZVAL_STRING(&type, stype); PHALCON_RETURN_CALL_METHODW(getThis(), "message", &type, msg); }
/** * Returns the messages produced by a failed operation * * @return Phalcon\Mvc\Model\MessageInterface[] */ PHP_METHOD(Phalcon_Mvc_Model_Query_Status, getMessages){ zval *model; model = phalcon_read_property(getThis(), SL("_model"), PH_NOISY); if (Z_TYPE_P(model) == IS_OBJECT) { PHALCON_RETURN_CALL_METHODW(model, "getmessages"); return; } array_init(return_value); }
/** * Returns the translation string of the given key * * @param string $translateKey * @param array $placeholders * @return string */ PHP_METHOD(Phalcon_Translate_Adapter, t){ zval *translate_key, *placeholders = NULL; phalcon_fetch_params(0, 1, 1, &translate_key, &placeholders); if (!placeholders) { placeholders = &PHALCON_GLOBAL(z_null); } PHALCON_RETURN_CALL_METHODW(getThis(), "query", translate_key, placeholders); }
/** * Commits the transaction * * @return boolean */ PHP_METHOD(Phalcon_Mvc_Model_Transaction, commit){ zval manager = {}, connection = {}; phalcon_read_property(&manager, getThis(), SL("_manager"), PH_NOISY); if (Z_TYPE(manager) == IS_OBJECT) { PHALCON_CALL_METHODW(NULL, &manager, "notifycommit", getThis()); } phalcon_read_property(&connection, getThis(), SL("_connection"), PH_NOISY); PHALCON_RETURN_CALL_METHODW(&connection, "commit"); }
static void phalcon_mvc_router_group_add_helper(INTERNAL_FUNCTION_PARAMETERS, zend_string *method) { zval *pattern, *paths = NULL, http_method = {}; phalcon_fetch_params(0, 1, 1, &pattern, &paths); if (!paths) { paths = &PHALCON_GLOBAL(z_null); } ZVAL_STR(&http_method, method); PHALCON_RETURN_CALL_METHODW(getThis(), "_addroute", pattern, paths, &http_method); }
/** * Renders a partial inside another view * * @param string $partialPath * @param array $params * @return string */ PHP_METHOD(Phalcon_Mvc_View_Engine, partial){ zval *partial_path, *params = NULL, *view; phalcon_fetch_params(0, 1, 1, &partial_path, ¶ms); if (!params) { params = &PHALCON_GLOBAL(z_null); } view = phalcon_read_property(getThis(), SL("_view"), PH_NOISY); PHALCON_RETURN_CALL_METHODW(view, "partial", partial_path, params); }
/** * Returns a service definition without resolving * * @param string $name * @return mixed */ PHP_METHOD(Phalcon_DI, getRaw){ zval *name, *service; phalcon_fetch_params(0, 1, 0, &name); PHALCON_ENSURE_IS_STRING(name); if (phalcon_isset_property_array(getThis(), SL("_services"), name)) { service = phalcon_read_property_array(getThis(), SL("_services"), name); PHALCON_RETURN_CALL_METHODW(service, "getdefinition"); return; } zend_throw_exception_ex(phalcon_di_exception_ce, 0, "Service '%s' was not found in the dependency injection container", Z_STRVAL_P(name)); }
/** * * @param string $sessionId * @return mixed */ PHP_METHOD(Phalcon_Session_Adapter_Memcache, read){ zval *sid, *lifetime, *memcache; phalcon_fetch_params(0, 1, 0, &sid); lifetime = phalcon_read_property(getThis(), SL("_lifetime"), PH_NOISY); memcache = phalcon_read_property(getThis(), SL("_memcache"), PH_NOISY); if (Z_TYPE_P(memcache) == IS_OBJECT) { PHALCON_RETURN_CALL_METHODW(memcache, "get", sid, lifetime); return; } else { RETURN_FALSE; } }
/** * Adds a route to the router on any HTTP method * *<code> * $router->add('/about', 'About::index'); *</code> * * @param string $pattern * @param string/array $paths * @param string $httpMethods * @return Phalcon\Mvc\Router\Route */ PHP_METHOD(Phalcon_Mvc_Router_Group, add){ zval *pattern, *paths = NULL, *http_methods = NULL; phalcon_fetch_params(0, 1, 2, &pattern, &paths, &http_methods); if (!paths) { paths = &PHALCON_GLOBAL(z_null); } if (!http_methods) { http_methods = &PHALCON_GLOBAL(z_null); } PHALCON_RETURN_CALL_METHODW(getThis(), "_addroute", pattern, paths, http_methods); }
/** * Send PUT request * * @param string $uri * @param string $data * @return Phalcon\Http\Client\Response */ PHP_METHOD(Phalcon_Http_Client_Adapter, put){ zval *uri = NULL, *data = NULL; phalcon_fetch_params(0, 0, 2, &uri, &data); if (uri) { PHALCON_CALL_METHODW(NULL, getThis(), "seturi", uri); } if (data) { PHALCON_CALL_METHODW(NULL, getThis(), "setdata", data); } phalcon_update_property_str(getThis(), SL("_method"), SL("PUT")); PHALCON_RETURN_CALL_METHODW(getThis(), "send"); }
/** * * @param string $session_id optional, session id * * @return boolean */ PHP_METHOD(Phalcon_Session_Adapter_Memcache, destroy){ zval *_sid = NULL, sid = {}, *memcache; phalcon_fetch_params(0, 0, 1, &_sid); if (!_sid) { PHALCON_CALL_SELFW(&sid, "getid"); } else { PHALCON_CPY_WRT(&sid, _sid); } memcache = phalcon_read_property(getThis(), SL("_memcache"), PH_NOISY); if (Z_TYPE_P(memcache) == IS_OBJECT) { PHALCON_RETURN_CALL_METHODW(memcache, "delete", &sid); return; } else { RETURN_FALSE; } }
/** * 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 = {}, cached_content = {}; phalcon_fetch_params(0, 1, 1, &key_name, &lifetime); phalcon_return_property(&frontend, getThis(), SL("_frontend")); phalcon_return_property(&prefix, getThis(), SL("_prefix")); PHALCON_CONCAT_SVV(&prefixed_key, "_PHCX", &prefix, key_name); phalcon_update_property_zval(getThis(), SL("_lastKey"), &prefixed_key); PHALCON_CALL_FUNCTIONW(&cached_content, "xcache_get", &prefixed_key); if (Z_TYPE(cached_content) == IS_NULL) { RETURN_NULL(); } if (phalcon_is_numeric(&cached_content)) { RETURN_CTORW(&cached_content); } else { PHALCON_RETURN_CALL_METHODW(&frontend, "afterretrieve", &cached_content); } }
/** * Returns a cached content * * @param string $keyName * @param long $lifetime * @return mixed */ PHP_METHOD(Phalcon_Cache_Backend_Apc, get) { zval *key_name, *lifetime = NULL, prefixed_key = {}, prefix = {}, frontend = {}, cached_content = {}; phalcon_fetch_params(0, 1, 1, &key_name, &lifetime); phalcon_read_property(&prefix, getThis(), SL("_prefix"), PH_NOISY); PHALCON_CONCAT_SVV(&prefixed_key, "_PHCA", &prefix, key_name); phalcon_update_property_zval(getThis(), SL("_lastKey"), &prefixed_key); PHALCON_CALL_FUNCTIONW(&cached_content, "apc_fetch", &prefixed_key); if (PHALCON_IS_FALSE(&cached_content)) { RETURN_NULL(); } if (phalcon_is_numeric(&cached_content)) { RETURN_CTORW(&cached_content); } else { phalcon_read_property(&frontend, getThis(), SL("_frontend"), PH_NOISY); PHALCON_RETURN_CALL_METHODW(&frontend, "afterretrieve", &cached_content); } }
/** * Returns cached ouput on another view stage * * @return array */ PHP_METHOD(Phalcon_Mvc_View_Engine, getContent) { zval *view = phalcon_read_property(getThis(), SL("_view"), PH_NOISY); PHALCON_RETURN_CALL_METHODW(view, "getcontent"); }
/** * Checks whether the platform supports releasing savepoints. * * @return boolean */ PHP_METHOD(Phalcon_Db_Dialect, supportsReleaseSavepoints) { PHALCON_RETURN_CALL_METHODW(this_ptr, "supportssavepoints"); }