kartik-v / yii2-krajee-base

Foundation classes and components used by Krajee Yii2 extensions
http://demos.krajee.com
Other
68 stars 61 forks source link

Json::htmlEncode #38

Closed nkovacs closed 9 years ago

nkovacs commented 9 years ago

You should use Json::htmlEncode instead of Json::encode when the result is inserted into html.

For example, here: https://github.com/kartik-v/yii2-krajee-base/blob/master/WidgetTrait.php#L71

More info: http://www.yiiframework.com/news/86/yii-2-0-4-is-released/

kartik-v commented 9 years ago

Will need to check on this... and update.

nkovacs commented 9 years ago

Select2's tags option may contain user input. I can't Html encode them, because select2 expects them to not be encoded, so they have to be Json::htmlEncode-ed to be correctly passed to select2.

kartik-v commented 9 years ago

Resolved via latest commit.

cappato commented 9 years ago

hi, i finish to implement upgrade 2.0.2 to 2.0.5 last version, so then i paste the new vendor version in my project and install again the kartik nav navx and now i have this error in one page

PHP Fatal Error – yii\base\ErrorException

Call to undefined method yii\helpers\Json::htmlEncode()

  1. in /var/www/html/advanced/vendor/kartik-v/yii2-krajee-base/WidgetTrait.php

help please.

cappato commented 9 years ago

finally i installed the new version in a new project, all widgets again, create the modules migrate the models, controllers, views and assets. This fix mi problem. thx

kartik-v commented 9 years ago

Yes you must install via composer... and not manually copy paste files... else you will get errors because of package dependencies.

cappato commented 9 years ago

you say upgrade yii 2.0.2 to 2.0.5 via composer? is posible this? I not found any code to do this

kartik-v commented 9 years ago

I was talking about updating this extension.

But yes you can also update yii via composer using composer update. Refer composer docs to configure your composer.json if you are unclear.

cappato commented 9 years ago

Ok. Thank you again Kartik