Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug #951 #957

Merged
merged 8 commits into from
Jul 31, 2013
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix bug #951
  • Loading branch information
dreamsxin committed Jul 31, 2013
commit dbf610ac55aed7ad7594ff29a8b4b63925806313
39 changes: 29 additions & 10 deletions ext/assets/manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ PHP_METHOD(Phalcon_Assets_Manager, collection){
*/
PHP_METHOD(Phalcon_Assets_Manager, output){

zval *collection, *callback, *output, *use_implicit_output;
zval *collection, *callback, *type, *output, *use_implicit_output;
zval *resources, *filters, *prefix, *source_base_path = NULL;
zval *target_base_path = NULL, *options, *collection_source_path;
zval *complete_source_path = NULL, *collection_target_path;
Expand All @@ -471,10 +471,11 @@ PHP_METHOD(Phalcon_Assets_Manager, output){
HashTable *ah0, *ah1;
HashPosition hp0, hp1;
zval **hd;
zval *type_css;

PHALCON_MM_GROW();

phalcon_fetch_params(1, 2, 0, &collection, &callback);
phalcon_fetch_params(1, 3, 0, &collection, &callback, &type);

PHALCON_INIT_VAR(output);

Expand All @@ -498,6 +499,9 @@ PHP_METHOD(Phalcon_Assets_Manager, output){
*/
PHALCON_INIT_VAR(prefix);
phalcon_call_method(prefix, collection, "getprefix");

PHALCON_INIT_VAR(type_css);
ZVAL_STRING(type_css, "css", 1);

/**
* Prepare options if the collection must be filtered
Expand Down Expand Up @@ -799,11 +803,20 @@ PHP_METHOD(Phalcon_Assets_Manager, output){
* Update the joined filtered content
*/
if (zend_is_true(join)) {
if (Z_TYPE_P(filtered_joined_content) == IS_NULL) {
PHALCON_INIT_NVAR(filtered_joined_content);
PHALCON_CONCAT_VS(filtered_joined_content, filtered_content, ";");
if (PHALCON_IS_EQUAL(type, type_css)) {
if (Z_TYPE_P(filtered_joined_content) == IS_NULL) {
PHALCON_INIT_NVAR(filtered_joined_content);
PHALCON_CONCAT_VS(filtered_joined_content, filtered_content, "");
} else {
PHALCON_SCONCAT_VS(filtered_joined_content, filtered_content, "");
}
} else {
PHALCON_SCONCAT_VS(filtered_joined_content, filtered_content, ";");
if (Z_TYPE_P(filtered_joined_content) == IS_NULL) {
PHALCON_INIT_NVAR(filtered_joined_content);
PHALCON_CONCAT_VS(filtered_joined_content, filtered_content, ";");
} else {
PHALCON_SCONCAT_VS(filtered_joined_content, filtered_content, ";");
}
}
}

Expand Down Expand Up @@ -973,7 +986,7 @@ PHP_METHOD(Phalcon_Assets_Manager, output){
*/
PHP_METHOD(Phalcon_Assets_Manager, outputCss){

zval *collection_name = NULL, *collection = NULL, *callback;
zval *collection_name = NULL, *collection = NULL, *callback, *type = NULL;
zval *output;

PHALCON_MM_GROW();
Expand All @@ -996,9 +1009,12 @@ PHP_METHOD(Phalcon_Assets_Manager, outputCss){
array_init_size(callback, 2);
add_next_index_stringl(callback, SL("Phalcon\\Tag"), 1);
add_next_index_stringl(callback, SL("stylesheetLink"), 1);

PHALCON_INIT_VAR(type);
ZVAL_STRING(type, "css", 1);

PHALCON_INIT_VAR(output);
phalcon_call_method_p2(output, this_ptr, "output", collection, callback);
phalcon_call_method_p2(output, this_ptr, "output", collection, callback, type);

RETURN_CCTOR(output);
}
Expand All @@ -1010,7 +1026,7 @@ PHP_METHOD(Phalcon_Assets_Manager, outputCss){
*/
PHP_METHOD(Phalcon_Assets_Manager, outputJs){

zval *collection_name = NULL, *collection = NULL, *callback;
zval *collection_name = NULL, *collection = NULL, *callback, *type = NULL;
zval *output;

PHALCON_MM_GROW();
Expand All @@ -1034,8 +1050,11 @@ PHP_METHOD(Phalcon_Assets_Manager, outputJs){
add_next_index_stringl(callback, SL("Phalcon\\Tag"), 1);
add_next_index_stringl(callback, SL("javascriptInclude"), 1);

PHALCON_INIT_VAR(type);
ZVAL_STRING(type, "js", 1);

PHALCON_INIT_VAR(output);
phalcon_call_method_p2(output, this_ptr, "output", collection, callback);
phalcon_call_method_p2(output, this_ptr, "output", collection, callback, type);

RETURN_CCTOR(output);
}
Expand Down