November 9, 2012

List connected files as array when we call a file with php?

Question by AnzaVR

What I am trying to achieve, when I open a website, it starts a network activity by loading images, swf files, css file etc. Is there any way in php to get a list of those resources as array?

Answer by Starx

You can use regular expression to parse the links once you have all HTML markups.

Here is an example to get the CSS request:

$regexp = "<links[^>]*href=("??)([^" >]*?)\1[^>]*/>"; 
preg_match_all("/$regexp/siU", $input, $matches);
var_dump($matches);

In the same way get scripts resources, image request, and iframe request.

April 10, 2012

What resources mean in ACL in zend framework

Question by PalAla

I want to know what is resouces in ACL, is it module, controller in a module or action in controller in module.

In the documentation, resoiurces (newsletter, news,latest) and others are not clear what they are.

Also in this example the resources are not clear!!!

[mainMenu]
login          = Everyone
applications   = Everyone
preferences    = User
administration = Implementor

[userPreferences]
details = User
params  = User
themes  = User

Answer by Jani Hartikainen

Resource is simply something you want to limit access to. It could be a page, a record in your DB or whatever your application needs.

I wrote a three-part series on Zend_Acl, in which I talk about what resources are amongst other things: http://codeutopia.net/blog/2009/02/06/zend_acl-part-1-misconceptions-and-simple-acls/

Answer by Starx

For example

new Zend_Acl_Resource('someResource')

Denotes that someResource points to an PHP module/section, which is suppose to be accessible but, it has be controlled so that only authorized roles can access it.

...

Please fill the form - I will response as fast as I can!