Skip to content

Commit

Permalink
Paginator and Tag updated to 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
phalcon committed Aug 17, 2012
1 parent 305e4c7 commit e8c19a7
Show file tree
Hide file tree
Showing 34 changed files with 705 additions and 338 deletions.
2 changes: 1 addition & 1 deletion dev/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ PHP_ARG_ENABLE(phalcon, whether to enable phalcon framework, [ --enable-phalcon

if test "$PHP_PHALCON" = "yes"; then
AC_DEFINE(HAVE_PHALCON, 1, [Whether you have Phalcon Framework])
PHP_NEW_EXTENSION(phalcon, phalcon.c kernel/main.c kernel/fcall.c kernel/require.c kernel/debug.c kernel/assert.c kernel/object.c kernel/array.c kernel/operators.c kernel/concat.c kernel/exception.c kernel/memory.c session/namespace.c loader.c di.c text.c mvc/router.c mvc/dispatcher/exception.c mvc/view.c mvc/view/engine.c mvc/view/exception.c mvc/view/engine/php.c mvc/url.c mvc/controller.c mvc/application/exception.c mvc/dispatcher.c mvc/model.c mvc/model/validator/uniqueness.c mvc/model/validator/exclusionin.c mvc/model/validator/regex.c mvc/model/validator/inclusionin.c mvc/model/validator/numericality.c mvc/model/validator/email.c mvc/model/query.c mvc/model/query/lang.c mvc/model/exception.c mvc/model/validator.c mvc/model/row.c mvc/model/transaction/exception.c mvc/model/transaction/failed.c mvc/model/transaction/manager.c mvc/model/metadata.c mvc/model/message.c mvc/model/manager.c mvc/model/metadata/memory.c mvc/model/metadata/apc.c mvc/model/metadata/session.c mvc/model/resultset.c mvc/model/transaction.c mvc/application.c test.c config/exception.c config/adapter/ini.c exception.c db.c logger.c cache/exception.c cache/frontend/output.c cache/frontend/none.c cache/frontend/data.c cache/backend.c cache/backend/memcache.c cache/backend/apc.c cache/backend/file.c acl/exception.c acl/adapter/memory.c acl/role.c acl/resource.c registry.c paginator/exception.c paginator/adapter/array.c paginator/adapter/model.c tag/exception.c tag/select.c internal/test.c internal/testparent.c internal/testtemp.c internal/testdummy.c paginator.c translate.c db/profiler.c db/exception.c db/reference.c db/dialect.c db/adapter/pdo/mysql.c db/adapter/pdo/postgresql.c db/adapter/pdo.c db/profiler/item.c db/rawvalue.c db/column.c db/index.c db/result/pdo.c db/dialect/mysql.c db/dialect/postgresql.c tag.c http/request/exception.c http/request/file.c http/response/exception.c http/response/headers.c http/response.c http/request.c session.c flash.c config.c filter.c di/exception.c events/event.c events/exception.c events/manager.c acl.c translate/exception.c translate/adapter/nativearray.c logger/exception.c logger/adapter/file.c logger/item.c loader/exception.c mvc/model/query/parser.c mvc/model/query/scanner.c, $ext_shared)
PHP_NEW_EXTENSION(phalcon, phalcon.c kernel/main.c kernel/fcall.c kernel/require.c kernel/debug.c kernel/assert.c kernel/object.c kernel/array.c kernel/operators.c kernel/concat.c kernel/exception.c kernel/memory.c session/namespace.c loader.c di.c text.c mvc/router.c mvc/dispatcher/exception.c mvc/view.c mvc/view/engine.c mvc/view/exception.c mvc/view/engine/php.c mvc/url.c mvc/controller.c mvc/application/exception.c mvc/dispatcher.c mvc/model.c mvc/model/validator/uniqueness.c mvc/model/validator/exclusionin.c mvc/model/validator/regex.c mvc/model/validator/inclusionin.c mvc/model/validator/numericality.c mvc/model/validator/email.c mvc/model/query.c mvc/model/query/lang.c mvc/model/exception.c mvc/model/validator.c mvc/model/row.c mvc/model/transaction/exception.c mvc/model/transaction/failed.c mvc/model/transaction/manager.c mvc/model/metadata.c mvc/model/message.c mvc/model/manager.c mvc/model/metadata/memory.c mvc/model/metadata/apc.c mvc/model/metadata/session.c mvc/model/resultset.c mvc/model/transaction.c mvc/application.c test.c config/exception.c config/adapter/ini.c exception.c db.c logger.c cache/exception.c cache/frontend/output.c cache/frontend/none.c cache/frontend/data.c cache/backend.c cache/backend/memcache.c cache/backend/apc.c cache/backend/file.c acl/exception.c acl/adapter/memory.c acl/role.c acl/resource.c registry.c paginator/exception.c paginator/adapter/model.c paginator/adapter/nativearray.c tag/exception.c tag/select.c internal/test.c internal/testparent.c internal/testtemp.c internal/testdummy.c translate.c db/profiler.c db/exception.c db/reference.c db/dialect.c db/adapter/pdo/mysql.c db/adapter/pdo/postgresql.c db/adapter/pdo.c db/profiler/item.c db/rawvalue.c db/column.c db/index.c db/result/pdo.c db/dialect/mysql.c db/dialect/postgresql.c tag.c http/request/exception.c http/request/file.c http/response/exception.c http/response/headers.c http/response.c http/request.c session.c flash.c config.c filter.c di/exception.c events/event.c events/exception.c events/manager.c acl.c translate/exception.c translate/adapter/nativearray.c logger/exception.c logger/adapter/file.c logger/item.c loader/exception.c mvc/model/query/parser.c mvc/model/query/scanner.c, $ext_shared)
fi
4 changes: 2 additions & 2 deletions dev/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if (PHP_PHALCON != "no") {
EXTENSION("phalcon", "phalcon.c");
ADD_SOURCES("ext/phalcon/kernel", "main.c fcall.c require.c debug.c assert.c object.c array.c memory.c operators.c concat.c exception.c", "phalcon")
ADD_SOURCES("ext/phalcon/session", "namespace.c", "phalcon")
ADD_SOURCES("ext/phalcon/.", "loader.c di.c text.c test.c exception.c db.c logger.c registry.c paginator.c translate.c tag.c session.c flash.c config.c filter.c acl.c", "phalcon")
ADD_SOURCES("ext/phalcon/.", "loader.c di.c text.c test.c exception.c db.c logger.c registry.c translate.c tag.c session.c flash.c config.c filter.c acl.c", "phalcon")
ADD_SOURCES("ext/phalcon/mvc", "router.c view.c url.c controller.c dispatcher.c model.c application.c", "phalcon")
ADD_SOURCES("ext/phalcon/mvc/dispatcher", "exception.c", "phalcon")
ADD_SOURCES("ext/phalcon/mvc/view", "engine.c exception.c", "phalcon")
Expand All @@ -23,7 +23,7 @@ if (PHP_PHALCON != "no") {
ADD_SOURCES("ext/phalcon/acl", "exception.c role.c resource.c", "phalcon")
ADD_SOURCES("ext/phalcon/acl/adapter", "memory.c", "phalcon")
ADD_SOURCES("ext/phalcon/paginator", "exception.c", "phalcon")
ADD_SOURCES("ext/phalcon/paginator/adapter", "array.c model.c", "phalcon")
ADD_SOURCES("ext/phalcon/paginator/adapter", "model.c nativearray.c", "phalcon")
ADD_SOURCES("ext/phalcon/tag", "exception.c select.c", "phalcon")
ADD_SOURCES("ext/phalcon/internal", "test.c testparent.c testtemp.c testdummy.c", "phalcon")
ADD_SOURCES("ext/phalcon/db", "profiler.c exception.c reference.c dialect.c rawvalue.c column.c index.c", "phalcon")
Expand Down
56 changes: 38 additions & 18 deletions dev/di.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ PHP_METHOD(Phalcon_DI, set){
phalcon_array_update_zval(&t0, alias, &config, PH_COPY TSRMLS_CC);
phalcon_update_property_zval(this_ptr, SL("_services"), t0 TSRMLS_CC);

PHALCON_MM_RESTORE();
RETURN_CCTOR(this_ptr);
}

PHP_METHOD(Phalcon_DI, remove){
Expand Down Expand Up @@ -121,7 +121,8 @@ PHP_METHOD(Phalcon_DI, attempt){
phalcon_update_property_zval(this_ptr, SL("_services"), services TSRMLS_CC);
}

PHALCON_MM_RESTORE();

RETURN_CCTOR(this_ptr);
}

PHP_METHOD(Phalcon_DI, _factory){
Expand Down Expand Up @@ -351,8 +352,9 @@ PHP_METHOD(Phalcon_DI, wasFreshInstance){

PHP_METHOD(Phalcon_DI, __call){

zval *method = NULL, *arguments = NULL, *services = NULL, *possible_service = NULL;
zval *c0 = NULL, *c1 = NULL, *c2 = NULL;
zval *method = NULL, *arguments = NULL, *action = NULL, *services = NULL, *possible_service = NULL;
zval *handler = NULL;
zval *c0 = NULL, *c1 = NULL, *c2 = NULL, *c3 = NULL;
zval *r0 = NULL, *r1 = NULL, *r2 = NULL, *r3 = NULL, *r4 = NULL, *r5 = NULL;
zval *i0 = NULL;
int eval_int;
Expand All @@ -373,36 +375,54 @@ PHP_METHOD(Phalcon_DI, __call){
ZVAL_LONG(c0, 0);
PHALCON_INIT_VAR(c1);
ZVAL_LONG(c1, 3);
PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_CALL_FUNC_PARAMS_3(r0, "substr", method, c0, c1);
if (PHALCON_COMPARE_STRING(r0, "get")) {
PHALCON_INIT_VAR(action);
PHALCON_CALL_FUNC_PARAMS_3(action, "substr", method, c0, c1);
if (PHALCON_COMPARE_STRING(action, "get")) {
PHALCON_INIT_VAR(services);
phalcon_read_property(&services, this_ptr, SL("_services"), PH_NOISY_CC);

PHALCON_INIT_VAR(c2);
ZVAL_LONG(c2, 3);

PHALCON_ALLOC_ZVAL_MM(r1);
PHALCON_CALL_FUNC_PARAMS_2(r1, "substr", method, c2);
PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_CALL_FUNC_PARAMS_2(r0, "substr", method, c2);

PHALCON_INIT_VAR(possible_service);
PHALCON_CALL_FUNC_PARAMS_1(possible_service, "strtolower", r1);
PHALCON_CALL_FUNC_PARAMS_1(possible_service, "strtolower", r0);
eval_int = phalcon_array_isset(services, possible_service);
if (eval_int) {
PHALCON_ALLOC_ZVAL_MM(r2);
phalcon_fast_count(r2, arguments TSRMLS_CC);
if (zend_is_true(r2)) {
PHALCON_ALLOC_ZVAL_MM(r1);
phalcon_fast_count(r1, arguments TSRMLS_CC);
if (zend_is_true(r1)) {
PHALCON_ALLOC_ZVAL_MM(r2);
PHALCON_CALL_METHOD_PARAMS_2(r2, this_ptr, "get", possible_service, arguments, PH_NO_CHECK);
RETURN_CTOR(r2);
} else {
PHALCON_ALLOC_ZVAL_MM(r3);
PHALCON_CALL_METHOD_PARAMS_2(r3, this_ptr, "get", possible_service, arguments, PH_NO_CHECK);
PHALCON_CALL_METHOD_PARAMS_1(r3, this_ptr, "get", possible_service, PH_NO_CHECK);
RETURN_CTOR(r3);
} else {
PHALCON_ALLOC_ZVAL_MM(r4);
PHALCON_CALL_METHOD_PARAMS_1(r4, this_ptr, "get", possible_service, PH_NO_CHECK);
RETURN_CTOR(r4);
}
}
}

if (PHALCON_COMPARE_STRING(action, "set")) {
eval_int = phalcon_array_isset_long(arguments, 0);
if (eval_int) {
PHALCON_INIT_VAR(c3);
ZVAL_LONG(c3, 3);
PHALCON_ALLOC_ZVAL_MM(r4);
PHALCON_CALL_FUNC_PARAMS_2(r4, "substr", method, c3);
PHALCON_INIT_VAR(possible_service);
PHALCON_CALL_FUNC_PARAMS_1(possible_service, "strtolower", r4);

PHALCON_INIT_VAR(handler);
phalcon_array_fetch_long(&handler, arguments, 0, PH_NOISY_CC);
PHALCON_CALL_METHOD_PARAMS_2_NORETURN(this_ptr, "set", possible_service, handler, PH_NO_CHECK);
PHALCON_MM_RESTORE();
RETURN_NULL();
}
}

PHALCON_ALLOC_ZVAL_MM(i0);
object_init_ex(i0, phalcon_di_exception_ce);

Expand Down
28 changes: 25 additions & 3 deletions dev/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ PHP_METHOD(Phalcon_Loader, setEventsManager){
PHALCON_MM_RESTORE();
}

/**
* Sets an array of extensions that the Loader must check together with the path
*
* @param array $extensions
*/
PHP_METHOD(Phalcon_Loader, setExtensions){

zval *extensions = NULL;
Expand Down Expand Up @@ -157,7 +162,7 @@ PHP_METHOD(Phalcon_Loader, registerDirs){
}
phalcon_update_property_zval(this_ptr, SL("_directories"), directories TSRMLS_CC);

PHALCON_MM_RESTORE();
RETURN_CCTOR(this_ptr);
}

/**
Expand Down Expand Up @@ -202,6 +207,23 @@ PHP_METHOD(Phalcon_Loader, register){
RETURN_CCTOR(this_ptr);
}

/**
* Unregister the autoload method
*/
PHP_METHOD(Phalcon_Loader, unregister){

zval *a0 = NULL;

PHALCON_MM_GROW();
PHALCON_ALLOC_ZVAL_MM(a0);
array_init(a0);
phalcon_array_append(&a0, this_ptr, PH_SEPARATE TSRMLS_CC);
add_next_index_stringl(a0, SL("autoLoad"), 1);
PHALCON_CALL_FUNC_PARAMS_1_NORETURN("spl_autoload_unregister", a0);

RETURN_CCTOR(this_ptr);
}

/**
* Makes the work of autoload registered classes
*
Expand Down Expand Up @@ -430,8 +452,8 @@ PHP_METHOD(Phalcon_Loader, autoLoad){
PHALCON_CALL_METHOD_PARAMS_2_NORETURN(events_manager, "fire", c8, this_ptr, PH_NO_CHECK);
}


RETURN_CCTOR(this_ptr);
PHALCON_MM_RESTORE();
RETURN_FALSE;
}

PHP_METHOD(Phalcon_Loader, getFoundPath){
Expand Down
9 changes: 4 additions & 5 deletions dev/mvc/model.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
#include "kernel/main.h"
#include "kernel/memory.h"

#include "kernel/object.h"
#include "kernel/fcall.h"
#include "kernel/exception.h"
#include "kernel/object.h"
#include "kernel/array.h"
#include "kernel/operators.h"
#include "kernel/concat.h"
Expand Down Expand Up @@ -95,18 +95,17 @@ PHP_METHOD(Phalcon_Mvc_Model, __construct){
ZVAL_NULL(db_service);
}

if (zend_is_true(dependency_injector)) {
phalcon_update_property_zval(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);
} else {
if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_INIT_VAR(dependency_injector);
PHALCON_CALL_STATIC(dependency_injector, "phalcon\\di", "getdefault");
phalcon_update_property_zval(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);
}
if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "A dependency injector container is required to obtain the services related to the ORM");
return;
}

phalcon_update_property_zval(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);

PHALCON_INIT_VAR(c0);
ZVAL_STRING(c0, "modelsManager", 1);

Expand Down
63 changes: 58 additions & 5 deletions dev/mvc/url.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include "kernel/memory.h"

#include "kernel/object.h"
#include "kernel/array.h"
#include "kernel/fcall.h"
#include "kernel/concat.h"

/**
Expand All @@ -59,13 +61,64 @@ PHP_METHOD(Phalcon_Mvc_Url, setBaseUri){

PHP_METHOD(Phalcon_Mvc_Url, getBaseUri){

zval *t0 = NULL;
zval *base_uri = NULL, *slash = NULL, *dirname = NULL, *slice = NULL, *uri = NULL;
zval *g0 = NULL;
zval *r0 = NULL, *r1 = NULL, *r2 = NULL;
zval *c0 = NULL;
zval *t0 = NULL, *t1 = NULL;
int eval_int;

PHALCON_MM_GROW();
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, this_ptr, SL("_baseUri"), PH_NOISY_CC);
PHALCON_INIT_VAR(base_uri);
phalcon_read_property(&base_uri, this_ptr, SL("_baseUri"), PH_NOISY_CC);
if (!zend_is_true(base_uri)) {
PHALCON_INIT_VAR(slash);
ZVAL_STRING(slash, "/", 1);
phalcon_get_global(&g0, SL("_SERVER")+1 TSRMLS_CC);
eval_int = phalcon_array_isset_string(g0, SL("PHP_SELF")+1);
if (eval_int) {
PHALCON_ALLOC_ZVAL_MM(r0);
phalcon_array_fetch_string(&r0, g0, SL("PHP_SELF"), PH_NOISY_CC);
PHALCON_INIT_VAR(dirname);
PHALCON_CALL_FUNC_PARAMS_1(dirname, "dirname", r0);

PHALCON_ALLOC_ZVAL_MM(r1);
phalcon_fast_explode(r1, slash, dirname TSRMLS_CC);

PHALCON_INIT_VAR(c0);
ZVAL_LONG(c0, 1);

PHALCON_INIT_VAR(t1);
ZVAL_LONG(t1, 1);

PHALCON_INIT_VAR(t0);
ZVAL_LONG(t0, -1);

PHALCON_ALLOC_ZVAL_MM(r2);
mul_function(r2, t0, t1 TSRMLS_CC);

PHALCON_INIT_VAR(slice);
PHALCON_CALL_FUNC_PARAMS_3(slice, "array_slice", r1, c0, r2);

PHALCON_INIT_VAR(uri);
phalcon_fast_join(uri, slash, slice TSRMLS_CC);
} else {
PHALCON_INIT_VAR(uri);
ZVAL_STRING(uri, "", 1);
}

if (!zend_is_true(uri)) {
PHALCON_CPY_WRT(base_uri, slash);
} else {
PHALCON_INIT_VAR(base_uri);
PHALCON_CONCAT_VVV(base_uri, slash, uri, slash);
}

phalcon_update_property_zval(this_ptr, SL("_baseUri"), base_uri TSRMLS_CC);
}

RETURN_CCTOR(t0);

RETURN_CCTOR(base_uri);
}

PHP_METHOD(Phalcon_Mvc_Url, setBasePath){
Expand Down Expand Up @@ -119,7 +172,7 @@ PHP_METHOD(Phalcon_Mvc_Url, get){
}

PHALCON_INIT_VAR(base_uri);
phalcon_read_property(&base_uri, this_ptr, SL("_baseUri"), PH_NOISY_CC);
PHALCON_CALL_METHOD(base_uri, this_ptr, "getbaseuri", PH_NO_CHECK);

PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_CONCAT_VV(r0, base_uri, uri);
Expand Down
98 changes: 0 additions & 98 deletions dev/paginator.c

This file was deleted.

Empty file modified dev/paginator/adapter/array.c
100644 → 100755
Empty file.
Loading

0 comments on commit e8c19a7

Please sign in to comment.