1.6版本的zf终于将SOAP放进来了,同时也增加了DOJO的支持。不过我没有想通。为什么那么多的JS框架,最终会选择了DOJO。
这些不是我能够想得通的。还是看看到底更新了什么再说吧。
An overview of new features:
- Dojo Integration
- JSON-RPC
- Dojo Data packing
- Dojo View Helper
- Dijit integration with Zend_Form & Zend_View
- Dojo Library Distribution
- SOAP
- SOAP Server
- SOAP Client
- Autodiscovery
- WSDL access
- WSDL Generation
- Preview of Tooling Project in Laboratory (see /laboratory folder)
- Command Line Interface
- Project Asset Management
- Unit Testing Harness for Controllers
- Lucene 2.3 Index File Format Support
- Zend_Session save handler for Database Tables
- Paginator Component
- Text/Figlet Support
- ReCaptcha Service
- Zend_Config_Xml Attribute Support
- Character Set Option for DB Adapters
- Zend File Transfer Component
- New Media View Helpers (Flash, Quicktime, Object, and Page)
- Support in Zend_Translate for INI File Format
This obviously marks a very important step towards a high-quality, highly tested 1.6 GA release. Thanks to everyone who has contributed to this release in any way: with patches/check ins, documentation/translations, and bug reports.
But our work is not yet over! Let's do our best to bring this release to the breaking point to find areas we can improve the release for General Availability. Based on your feedback we will determine in the next few weeks whether we require additional release candidates, so please provide feedback on our issue tracker (http://framework.zend.com/issues) as soon as you can and ask any questions/post your experiences on the appropriate mailing list.
Again, the Zend Framework community does NOT recommend this release for production use. We do, however, recommend evaluating new features in this release with existing and new applications.
Enjoy 1.6RC1, and see you on the issue tracker, wiki, and mailing lists!
————END————
不知道:Zend File Transfer Component,这个会给我们带来什么样的惊喜?大文件传输还是其他的?下载源码研究一下,哈哈
原文地址:http://devzone.zend.com/article/3509-Zend_Acl-and-MVC-Integration-Part-I-Basic-Use
原文内容:
By Aldemar Bernal
So, what is wrong with Zend_Acl and the current MVC implementation in the Zend Framework? there is nothing wrong, it is just that it gets not too obvious for developers how to achieve an optimal integration between these two important parts of the framework.
First at all, this article is based on the following Zend Framework Proporsal (link), by this moment this proposal is in Pending Recommendation state.
Well, how it works? There are two key components in this proposal:
- A Front Controller Plugin: This component resolves if the current user has access to the page which is being opened.
- An Action Helper: This component allows you to check whether the current user has access inside a controller.
Based on these two components, let's try them with an example. Let's talk about a website like DevZone, we would need a controller that work with the user management and another one which will deal with article management, as well we need 3 types of users (roles), one for guests, one for writers and another one which will approve the articles; resuming, we have:
Resources:
- user controller.
- article controller.
Roles:
- Guest.
- Writer.
- Admin.
Setting up the Zend_Acl component
After defined what we want to do, the next step will create a Zend_Acl instance which will reflect our model.
/** Creating the ACL object */
require_once 'Zend/Acl.php';
$myAcl = new Zend_Acl();
Creating the roles
Now we create the roles in our Zend_Acl instance.
/** Creating Roles */
require_once 'Zend/Acl/Role.php';
$myAcl->addRole(new Zend_Acl_Role('guest'))
->addRole(new Zend_Acl_Role('writer'), 'guest')
->addRole(new Zend_Acl_Role('admin'), 'writer');
Creating the resources
And then we create the resources needed (one per controller) and their relationship with the roles we created.
/** Creating resources */
require_once 'Zend/Acl/Resource.php';
$myAcl->add(new Zend_Acl_Resource('user'))
->add(new Zend_Acl_Resource('article'));
Creating the permissions
Now that we added the roles and resources to our Zend_Acl instance, it's time to explain what actions must be available to which roles.
- Guest won't have access to edit, add or approve an article.
- Writer won't have access to approve an article.
- Admin will have complete access.
/** Creating permissions */
$myAcl->allow('guest', 'user')
->deny('guest', 'article')
->allow('guest', 'article', 'view')
->allow('writer', 'article', array('add', 'edit'))
->allow('admin', 'article', 'approve');
Creating the access denied view file
We will need to create a view and an action which will address all those denied users, in order to do it, first we create a new action in our error controller:
class ErrorController extends Zend_Controller_Action
{
....
public function deniedAction()
{
}
....
}
And then we create our view file (/application/views/scripts/error/denied.phtml) with some warning message:
<h1>Error</h1>
<h2>Access denied</h2>
<p>You are trying to access an area which you have not allowed.</p>
Finishing the configuration
Okay, we have setup our Zend_Acl configuration, so far, it doesn't look like something new, but the next step is register the controller plugin, this important part takes the Zend_Acl instance we created and then validates it against the current page being accessed by an user.
/** Setting up the front controller */
require_once 'Zend/Controller/Front.php';
$front = Zend_Controller_Front::getInstance();
$front->setControllerDirectory('path/to/controllers');
/** Registering the Plugin object */
require_once 'Zend/Controller/Plugin/Acl.php';
$aclPlugin = new Zend_Controller_Plugin_Acl($myAcl);
$aclPlugin->setRoleName($currentUserRole);
$front->registerPlugin(new Zend_Controller_Plugin_Acl($acl, 'guest'));
/** Dispatching the front controller */
$front->dispatch();
After this configuration is done, once an user enters in our application, depending the role he/she has the page will be displayed or an access denied page will be displayed.
For more information about this you can go to:
Zend_Acl & MVC Integration
and here is a small implementation source code of this:
Source Code
————END————
由于本文并没有什么特别的地方,而且单词也没有什么,故不作翻译。
Copy from framework.zend.com , it's submitted of
and someone were comments for this news,
XML/HTML代码
- This is really great news! I am currently using JSON as the interface format between my Zend Framework and Flex app. This week I've been considering switching to amfphp (Lee Brimelow prepared a screencast http://www.gotoandlearn.com/player.php?id=78), but I didn't want to refactor/change all of my code. Zend_Amf is great news. I can't wait to begin using it. Cheers Adobe!
这样看来,以后ADOBE或许也会主动参与了吧?
TP的COOKIE类是被封装好的,里面包含了一些常见的操作,set,get,clear等等,其实TP的cookie类与其他的COOKIE有着明显的不同,那就是TP的COOKIE ID是唯一的(不好意思,在我写完这段的时候,为了防止写错,我又重新打开了cookie.class.php,却突然发现,现在的cookie功能与以前的不一样了。)
以前的set函数是类似于这样:
PHP代码
- $_COOKIE[C('COOKIE_ID')][C('COOKIE_PREFIX').$name] = $value ;
如今的又恢复成:
PHP代码
- $_COOKIE[C('COOKIE_PREFIX').$name] = $value;
既然如此,我还是按最新的稍作讲解吧。。。
Cookie类,固名思意,就是把对COOKIE的操作进行了封装,通过定义一个COOKIE名的前缀,以防与其他COOKIE产生冲突,然后加上COOKIE变量的名称,就可以进行赋值、取值等。
Cookie类所有的操作都采用了静态方法,即在实际应用中,只要加载了Cookie类,就可以随时使用了:
PHP代码
- <?
-
- Cookie::get('test');
-
-
- Cookie::set('test','123456');
-
-
对于这些封装,可以方便使用,同样需要注意的是,在Cookie操作时,请不要输出header,否则可能会出现header already send的warning,同时无法写cookie,这点请需要注意。
另外一个需要注意的是,cookie在不同的浏览器下面有着不同的限制,最常见的就是cookie的长度,请尽量不要超过4K的字节。
参考资料:
FF浏览器
- * 一个 Cookie 档案最多只能包含 300 个 Cookies。(这只适用于 Netscape,因为它把所有的 Cookie 都放在一个档案。)
- * 每一个 Cookie 的大小不得超过 4KB。
- * 每一个 URL 路径,最多只能设定 20 个 Cookie。
如果你在使用ThinkPHP框架的时候不想采用TP自带的模版系统,而使用第三方的模版系统,你有很多其他的选择,在这里我仅介绍Smarty这种比较官方,而且比较强大的模版系统。
由于Smarty兼容PHP4,因此,它的效率会相对低一点点,这个低只是相对的,估计等Smarty啥时候正式放弃PHP4的时候,效率可能会上很大一个台阶。
………………………………………………
最多请看全文。
» 阅读全文