1. <?php
  2. /**
  3. * Plugin array structure
  4. *
  5. * Goals:
  6. * To define routes so we can facilitate 'Clean URLS' and future development
  7. * To define permissions
  8. * To allow plugins to override/add to other core, provider (3rd Pary) and custom plugins, without touching their core code
  9. * Note: Template overrides are separate from Plugin overrides and will be applied in
  10. * the Template system using the directory structure
  11. */
  12. /**
  13. * Plugin page array structure
  14. *
  15. * Defines:
  16. * plugin page name -
  17. * Example Values:
  18. * array('Blog Posts' => array($route, $permissions)) // page to list blog posts
  19. * array('View Blog Post' => array($route, $permissions)) // page to display on full blog post
  20. *
  21. * plugin page route -
  22. * Example Value:
  23. * array('/blog/2013/06/19' => 'page_view_post')
  24. *
  25. * The resulting URL would be:
  26. * http://your_site.com/index.php?a=/blog/2013/06/19 - without clean URLS
  27. * http://your_site.com/blog/2013/06/19 - with clean URLS
  28. *
  29. * The function that is called would be:
  30. * function page_view_post() {}
  31. *
  32. * plugin page permissions -
  33. * Example Value:
  34. * array('Edit Post' => true) // means this permission is active and will display on the Permissions admin page
  35. */
  36. $plugins[$plugin_name] = array();
  37. $plugins[$plugin_name][$pages] = array();
  38. $plugins[$plugin_name][$pages][$page_name] = array();
  39. $plugins[$plugin_name][$pages][$page_name][$route] = array();
  40. $plugins[$plugin_name][$pages][$page_name][$route][$route_path] = 'callbackFunction';
  41. $plugins[$plugin_name][$pages][$page_name][$permissions] = array();
  42. $plugins[$plugin_name][$pages][$page_name][$permissions][$perm_name] = true;
  43. /**
  44. * Plugin blocks array structure
  45. *
  46. * Defines:
  47. * plugin block name -
  48. * Examples:
  49. * array('Blog Categories' => array($route, $permissions)) // block to list recent blog posts
  50. *
  51. * plugin block route -
  52. * Example Value:
  53. * 'block_blog_categories'
  54. *
  55. * The function that is called would be:
  56. * function block_blog_categories() {}
  57. *
  58. * plugin block permissions -
  59. * Example:
  60. * array('View Block' => true) - means this permission is active and will display on the Permissions admin page
  61. */
  62. $plugins[$plugin_name][$blocks] = array();
  63. $plugins[$plugin_name][$blocks][$block_name] = array();
  64. $plugins[$plugin_name][$blocks][$block_name][$route] = 'callbackFunction';
  65. $plugins[$plugin_name][$blocks][$block_name][$permissions] = array();
  66. $plugins[$plugin_name][$blocks][$block_name][$permissions][$perm_name] = true;
  67. /**
  68. * Plugin overrides array structure
  69. *
  70. * First the plugin data structures will be parsed and compiled, then overrides will be applied. Any conflicts between
  71. * overrides (inside the current plugin and with other plugins) will be caught and an error/exception will be thrown.
  72. */
  73. $plugins[$plugin_name][$overrides] = array();
  74. $plugins[$plugin_name][$overrides][$plugin_name] = array();
  75. $plugins[$plugin_name][$overrides][$plugin_name][$pages] = array();
  76. $plugins[$plugin_name][$overrides][$plugin_name][$pages][$page_name] = array();
  77. $plugins[$plugin_name][$overrides][$plugin_name][$pages][$page_name][$route] = array();
  78. $plugins[$plugin_name][$overrides][$plugin_name][$pages][$page_name][$route][$route_path] = 'callbackFunction';
  79. $plugins[$plugin_name][$overrides][$plugin_name][$pages][$page_name][$permissions] = array();
  80. $plugins[$plugin_name][$overrides][$plugin_name][$pages][$page_name][$permissions][$perm_name] = true;
  81. $plugins[$plugin_name][$overrides][$plugin_name][$blocks] = array();
  82. $plugins[$plugin_name][$overrides][$plugin_name][$blocks][$block_name] = array();
  83. $plugins[$plugin_name][$overrides][$plugin_name][$blocks][$block_name][$route] = 'callbackFunction';
  84. $plugins[$plugin_name][$overrides][$plugin_name][$blocks][$block_name][$permissions] = array();
  85. $plugins[$plugin_name][$overrides][$plugin_name][$blocks][$block_name][$permissions][$perm_name] = true;

Initial array overview