From be9b7a58da066f30919c3e64912263955489aae4 Mon Sep 17 00:00:00 2001 From: Tom Elliott Date: Mon, 31 Aug 2026 07:32:45 -0500 Subject: [PATCH] Put every plugin class into its own FOG\Plugins\ namespace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every class/interface/trait-declaring file under a plugin directory (*.class.php, *.hook.php, *.page.php, *.event.php, *.report.php, *.task.php -- 176 files across 15 plugins) now declares `namespace FOG\Plugins\;`, mechanically derived from the plugin's directory name with no exceptions. The subdirectory (class/, pages/, hooks/, events/, reports/, tasks/, capone's odd reg-task/) is not part of it, so every class in a plugin shares one flat namespace. Core references stay exactly as they were -- already leading-backslash FQCNs (fogproject ADR 0013 §2/§13) -- and self::getClass() string literals are untouched, since core's FOGBase::qualify() already resolves a plugin short name to its new FQCN. A per-file bare-builtin and cross-plugin-reference sweep found nothing to fix; the source was already clean. Fixed the stale helloworld docblock claiming the class is found by PHP's default spl_autoload lowercasing the filename -- that fallback was removed from core (ADR 0013 §2b) because it let a plugin shadow a core class. It documents Initiator::autoload() and the new namespace instead. tests/oidc-flow-safety.test.php and tests/oidc-provider-safety.test.php require the OIDC plugin's source directly and call OIDC/OIDCManager/ OIDCGroupManager/OIDCUserGrantManager by bare name -- both now qualify those references, matching the FQCN convention everywhere else. Added tests/plugins-are-namespaced.test.php: for every class file under every plugin directory, asserts exactly one namespace declaration, that it matches FOG\Plugins\ case-insensitively (a third-party plugin may spell it differently from a strict ucfirst()), and that the file declares no class_alias(). Mutation-verified by copying ldap/class/ldapmanager.class.php aside, removing its namespace line (went red: "declares no namespace"), restoring, setting it to a wrong namespace (went red: "declares namespace 'FOG\Plugins\Oidc', expected 'fog\plugins\ldap'"), then restoring the original file byte-for-byte. Co-Authored-By: Claude --- capone/class/capone.class.php | 3 + capone/class/caponemanager.class.php | 3 + capone/hooks/addbootmenuitem.hook.php | 3 + capone/hooks/addcaponeapi.hook.php | 3 + capone/hooks/addcaponejs.hook.php | 3 + capone/hooks/addcaponemenuitem.hook.php | 3 + capone/pages/caponemanagement.page.php | 3 + capone/reg-task/caponetasking.class.php | 3 + helloworld/class/helloworld.class.php | 12 +- helloworld/class/helloworldmanager.class.php | 3 + helloworld/hooks/addhelloworldapi.hook.php | 3 + helloworld/hooks/addhelloworldjs.hook.php | 3 + .../hooks/addhelloworldmenuitem.hook.php | 3 + .../pages/helloworldmanagement.page.php | 3 + helloworld/tasks/helloworldheartbeat.task.php | 3 + ldap/class/ldap.class.php | 3 + ldap/class/ldapgroup.class.php | 3 + ldap/class/ldapgroupmanager.class.php | 3 + ldap/class/ldapgrouproleassociation.class.php | 3 + .../ldapgrouproleassociationmanager.class.php | 3 + .../ldapgroupusergroupassociation.class.php | 3 + ...groupusergroupassociationmanager.class.php | 3 + ldap/class/ldapmanager.class.php | 3 + ldap/class/ldapusergrant.class.php | 3 + ldap/class/ldapusergrantmanager.class.php | 3 + ldap/hooks/addldapapi.hook.php | 3 + ldap/hooks/addldapgrouptabs.hook.php | 3 + ldap/hooks/addldapjs.hook.php | 3 + ldap/hooks/addldapmenuitem.hook.php | 3 + ldap/hooks/addldaptype.hook.php | 3 + ldap/hooks/ldapdeletemassitems.hook.php | 3 + ldap/hooks/ldappluginhook.hook.php | 3 + ldap/pages/ldapgroupmanagement.page.php | 3 + ldap/pages/ldapmanagement.page.php | 3 + ldap/reports/ldap_report.report.php | 3 + location/class/location.class.php | 3 + location/class/locationassociation.class.php | 3 + .../locationassociationmanager.class.php | 3 + location/class/locationmanager.class.php | 3 + location/hooks/addlocationapi.hook.php | 3 + location/hooks/addlocationgroup.hook.php | 3 + location/hooks/addlocationhost.hook.php | 3 + location/hooks/addlocationimport.hook.php | 3 + location/hooks/addlocationjs.hook.php | 3 + location/hooks/addlocationmenuitem.hook.php | 3 + location/hooks/addlocationtype.hook.php | 3 + .../hooks/addserviceconfiguration.hook.php | 3 + location/hooks/locationchangeitems.hook.php | 3 + .../hooks/locationdeletemassitems.hook.php | 3 + location/pages/locationmanagement.page.php | 3 + location/reports/location_report.report.php | 3 + ntfy/class/ntfy.class.php | 3 + ntfy/class/ntfyexception.class.php | 3 + ntfy/class/ntfyextends.class.php | 3 + ntfy/class/ntfyhandler.class.php | 3 + ntfy/class/ntfymanager.class.php | 3 + ntfy/events/imagecomplete_ntfy.event.php | 3 + ntfy/events/imagefail_ntfy.event.php | 3 + ntfy/events/loginfailure_ntfy.event.php | 3 + ntfy/events/snapincomplete_ntfy.event.php | 3 + ntfy/events/snapintaskcomplete_ntfy.event.php | 3 + ntfy/hooks/addntfyapi.hook.php | 3 + ntfy/hooks/addntfyjs.hook.php | 3 + ntfy/hooks/addntfymenuitem.hook.php | 3 + ntfy/pages/ntfymanagement.page.php | 3 + oidc/class/oidc.class.php | 3 + oidc/class/oidcflow.class.php | 3 + oidc/class/oidcgroup.class.php | 3 + oidc/class/oidcgroupmanager.class.php | 3 + oidc/class/oidcgrouproleassociation.class.php | 3 + .../oidcgrouproleassociationmanager.class.php | 3 + .../oidcgroupusergroupassociation.class.php | 3 + ...groupusergroupassociationmanager.class.php | 3 + oidc/class/oidcidentity.class.php | 3 + oidc/class/oidcidentitymanager.class.php | 3 + oidc/class/oidcmanager.class.php | 3 + oidc/class/oidcusergrant.class.php | 3 + oidc/class/oidcusergrantmanager.class.php | 3 + oidc/hooks/addoidcapi.hook.php | 3 + oidc/hooks/addoidcgrouptabs.hook.php | 3 + oidc/hooks/addoidcjs.hook.php | 3 + oidc/hooks/addoidcmenuitem.hook.php | 3 + oidc/hooks/addoidcroutes.hook.php | 3 + oidc/hooks/oidcdeletemassitems.hook.php | 3 + oidc/hooks/oidcloginredirect.hook.php | 3 + oidc/hooks/oidclogout.hook.php | 3 + oidc/pages/oidcgroupmanagement.page.php | 3 + oidc/pages/oidcmanagement.page.php | 3 + ou/class/ou.class.php | 3 + ou/class/ouassociation.class.php | 3 + ou/class/ouassociationmanager.class.php | 3 + ou/class/oumanager.class.php | 3 + ou/hooks/addouapi.hook.php | 3 + ou/hooks/addougroup.hook.php | 3 + ou/hooks/addouhost.hook.php | 3 + ou/hooks/addoujs.hook.php | 3 + ou/hooks/addoumenuitem.hook.php | 3 + ou/hooks/addoutype.hook.php | 3 + ou/hooks/ouchangeitems.hook.php | 3 + ou/hooks/oudeletemassitems.hook.php | 3 + ou/pages/oumanagement.page.php | 3 + ou/reports/ou_report.report.php | 3 + .../class/persistentgroups.class.php | 3 + .../class/persistentgroupsmanager.class.php | 3 + pushbullet/class/pushbullet.class.php | 3 + .../class/pushbulletexception.class.php | 3 + pushbullet/class/pushbulletextends.class.php | 3 + pushbullet/class/pushbullethandler.class.php | 3 + pushbullet/class/pushbulletmanager.class.php | 3 + .../events/imagecomplete_pushbullet.event.php | 3 + .../events/imagefail_pushbullet.event.php | 3 + .../events/loginfailure_pushbullet.event.php | 3 + .../snapincomplete_pushbullet.event.php | 3 + .../snapintaskcomplete_pushbullet.event.php | 3 + pushbullet/hooks/addpushbulletapi.hook.php | 3 + pushbullet/hooks/addpushbulletjs.hook.php | 3 + .../hooks/addpushbulletmenuitem.hook.php | 3 + .../pages/pushbulletmanagement.page.php | 3 + slack/class/slack.class.php | 3 + slack/class/slackexception.class.php | 3 + slack/class/slackhandler.class.php | 3 + slack/class/slackmanager.class.php | 3 + slack/events/imagecomplete_slack.event.php | 3 + slack/events/imagefail_slack.event.php | 3 + slack/events/loginfailure_slack.event.php | 3 + slack/events/snapincomplete_slack.event.php | 3 + .../events/snapintaskcomplete_slack.event.php | 3 + slack/hooks/addslackapi.hook.php | 3 + slack/hooks/addslackjs.hook.php | 3 + slack/hooks/addslackmenuitem.hook.php | 3 + slack/pages/slackmanagement.page.php | 3 + subnetgroup/class/subnetgroup.class.php | 3 + .../class/subnetgroupmanager.class.php | 3 + subnetgroup/hooks/addsubnetgroupapi.hook.php | 3 + subnetgroup/hooks/addsubnetgrouphost.hook.php | 3 + subnetgroup/hooks/addsubnetgroupjs.hook.php | 3 + .../hooks/addsubnetgroupmenuitem.hook.php | 3 + subnetgroup/hooks/addsubnetgrouptype.hook.php | 3 + .../hooks/removesubnetgroupgroup.hook.php | 3 + .../pages/subnetgroupmanagement.page.php | 3 + .../reports/subnetgroup_report.report.php | 3 + taskstateedit/class/taskstateedit.class.php | 3 + .../class/taskstateeditmanager.class.php | 3 + .../hooks/addtaskstateeditjs.hook.php | 3 + .../hooks/addtaskstateeditmenuitem.hook.php | 3 + taskstateedit/hooks/addtaskstatetype.hook.php | 3 + .../pages/taskstateeditmanagement.page.php | 3 + .../reports/taskstateedit_report.report.php | 3 + tasktypeedit/class/tasktypeedit.class.php | 3 + .../class/tasktypeeditmanager.class.php | 3 + tasktypeedit/hooks/addtasktypeeditjs.hook.php | 3 + .../hooks/addtasktypeeditmenuitem.hook.php | 3 + tasktypeedit/hooks/addtasktypetype.hook.php | 3 + .../pages/tasktypeeditmanagement.page.php | 3 + .../reports/tasktypeedit_report.report.php | 3 + tests/oidc-flow-safety.test.php | 8 +- tests/oidc-provider-safety.test.php | 26 +-- tests/plugins-are-namespaced.test.php | 216 ++++++++++++++++++ windowskey/class/windowskey.class.php | 3 + .../class/windowskeyassociation.class.php | 3 + .../windowskeyassociationmanager.class.php | 3 + windowskey/class/windowskeymanager.class.php | 3 + windowskey/hooks/addwindowskeyapi.hook.php | 3 + windowskey/hooks/addwindowskeyimage.hook.php | 3 + windowskey/hooks/addwindowskeyjs.hook.php | 3 + .../hooks/addwindowskeymenuitem.hook.php | 3 + windowskey/hooks/changehostkey.hook.php | 3 + .../hooks/windowskeydeletemassitems.hook.php | 3 + .../pages/windowskeymanagement.page.php | 3 + .../reports/windowskey_report.report.php | 3 + wolbroadcast/class/wolbroadcast.class.php | 3 + .../class/wolbroadcastmanager.class.php | 3 + .../hooks/addbroadcastaddresses.hook.php | 3 + .../hooks/addwolbroadcastapi.hook.php | 3 + wolbroadcast/hooks/addwolbroadcastjs.hook.php | 3 + .../hooks/addwolbroadcastmenuitem.hook.php | 3 + .../hooks/addwolbroadcasttype.hook.php | 3 + .../pages/wolbroadcastmanagement.page.php | 3 + .../reports/wolbroadcast_report.report.php | 3 + 179 files changed, 767 insertions(+), 20 deletions(-) create mode 100644 tests/plugins-are-namespaced.test.php diff --git a/capone/class/capone.class.php b/capone/class/capone.class.php index b8c95563..d036c40b 100644 --- a/capone/class/capone.class.php +++ b/capone/class/capone.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Capone; + /** * Handles the database for Capone plugin * diff --git a/capone/class/caponemanager.class.php b/capone/class/caponemanager.class.php index 836aaead..5de2434f 100644 --- a/capone/class/caponemanager.class.php +++ b/capone/class/caponemanager.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Capone; + /** * Manager class for Capone * diff --git a/capone/hooks/addbootmenuitem.hook.php b/capone/hooks/addbootmenuitem.hook.php index 6210fca8..0f15bb3b 100644 --- a/capone/hooks/addbootmenuitem.hook.php +++ b/capone/hooks/addbootmenuitem.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Capone; + /** * Creates the capone menu item. * diff --git a/capone/hooks/addcaponeapi.hook.php b/capone/hooks/addcaponeapi.hook.php index 02e90453..55b76cc6 100644 --- a/capone/hooks/addcaponeapi.hook.php +++ b/capone/hooks/addcaponeapi.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Capone; + /** * Injects capone stuff into the api system. * diff --git a/capone/hooks/addcaponejs.hook.php b/capone/hooks/addcaponejs.hook.php index ede2efc7..eb9e104b 100644 --- a/capone/hooks/addcaponejs.hook.php +++ b/capone/hooks/addcaponejs.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Capone; + /** * Sets the javascript files up for this plugin. * diff --git a/capone/hooks/addcaponemenuitem.hook.php b/capone/hooks/addcaponemenuitem.hook.php index c9cb7541..ce710959 100644 --- a/capone/hooks/addcaponemenuitem.hook.php +++ b/capone/hooks/addcaponemenuitem.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Capone; + /** * Adds the capone menu item. * diff --git a/capone/pages/caponemanagement.page.php b/capone/pages/caponemanagement.page.php index 6f1c12f2..1a1b3b34 100644 --- a/capone/pages/caponemanagement.page.php +++ b/capone/pages/caponemanagement.page.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Capone; + /** * The capone page. * diff --git a/capone/reg-task/caponetasking.class.php b/capone/reg-task/caponetasking.class.php index dc193851..a58c9527 100644 --- a/capone/reg-task/caponetasking.class.php +++ b/capone/reg-task/caponetasking.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Capone; + /** * This is only used for capone plugin. * diff --git a/helloworld/class/helloworld.class.php b/helloworld/class/helloworld.class.php index 6c35f581..bc98eb35 100644 --- a/helloworld/class/helloworld.class.php +++ b/helloworld/class/helloworld.class.php @@ -7,9 +7,12 @@ * get('name') / set('name', ...) / save() / load() / destroy(), and * instantiate with an id (new HelloWorld(42)) to auto-load. * - * NOTE: the autoloader uses PHP's default spl_autoload, which lowercases the - * class name to find the file. So class HelloWorld must live in the file - * helloworld.class.php. + * NOTE: FOG's own autoloader, Initiator::autoload(), resolves the class -- + * there is no spl_autoload fallback (fogproject ADR 0013 §2b removed it, since + * it let a plugin shadow a core class by filename). The filename still has to + * match the class name (case-insensitively), because that match is how + * Initiator finds the file. So class HelloWorld must live in the file + * helloworld.class.php, and declares namespace FOG\Plugins\Helloworld. * * PHP version 5 * @@ -19,6 +22,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Helloworld; + /** * Hello World example plugin (model). * diff --git a/helloworld/class/helloworldmanager.class.php b/helloworld/class/helloworldmanager.class.php index a41c0bcd..aec9ff1a 100644 --- a/helloworld/class/helloworldmanager.class.php +++ b/helloworld/class/helloworldmanager.class.php @@ -19,6 +19,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Helloworld; + /** * Hello World example plugin (manager). * diff --git a/helloworld/hooks/addhelloworldapi.hook.php b/helloworld/hooks/addhelloworldapi.hook.php index fe099497..913c4c67 100644 --- a/helloworld/hooks/addhelloworldapi.hook.php +++ b/helloworld/hooks/addhelloworldapi.hook.php @@ -14,6 +14,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Helloworld; + /** * Injects Hello World into the API system. * diff --git a/helloworld/hooks/addhelloworldjs.hook.php b/helloworld/hooks/addhelloworldjs.hook.php index 5aa0c95a..315e74d7 100644 --- a/helloworld/hooks/addhelloworldjs.hook.php +++ b/helloworld/hooks/addhelloworldjs.hook.php @@ -14,6 +14,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Helloworld; + /** * Injects the Hello World JS files. * diff --git a/helloworld/hooks/addhelloworldmenuitem.hook.php b/helloworld/hooks/addhelloworldmenuitem.hook.php index e63a65c1..b0b26a80 100644 --- a/helloworld/hooks/addhelloworldmenuitem.hook.php +++ b/helloworld/hooks/addhelloworldmenuitem.hook.php @@ -15,6 +15,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Helloworld; + /** * Adds the Hello World menu item. * diff --git a/helloworld/pages/helloworldmanagement.page.php b/helloworld/pages/helloworldmanagement.page.php index be6c9a94..f27c6cce 100644 --- a/helloworld/pages/helloworldmanagement.page.php +++ b/helloworld/pages/helloworldmanagement.page.php @@ -21,6 +21,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Helloworld; + /** * Hello World example plugin (management page). * diff --git a/helloworld/tasks/helloworldheartbeat.task.php b/helloworld/tasks/helloworldheartbeat.task.php index 6736e0fc..d4d2bbae 100644 --- a/helloworld/tasks/helloworldheartbeat.task.php +++ b/helloworld/tasks/helloworldheartbeat.task.php @@ -34,6 +34,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Helloworld; + /** * Counts this plugin's rows on a schedule and writes the number to the log. * diff --git a/ldap/class/ldap.class.php b/ldap/class/ldap.class.php index 540ed4c8..3d63835d 100644 --- a/ldap/class/ldap.class.php +++ b/ldap/class/ldap.class.php @@ -12,6 +12,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ldap; + /** * LDAP Authentication plugin * diff --git a/ldap/class/ldapgroup.class.php b/ldap/class/ldapgroup.class.php index e65c220e..89d20ffa 100644 --- a/ldap/class/ldapgroup.class.php +++ b/ldap/class/ldapgroup.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ldap; + /** * A directory group this server is willing to recognise. * diff --git a/ldap/class/ldapgroupmanager.class.php b/ldap/class/ldapgroupmanager.class.php index 0d739390..7971b4c1 100644 --- a/ldap/class/ldapgroupmanager.class.php +++ b/ldap/class/ldapgroupmanager.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ldap; + /** * Manager for the LDAPGroups table. * diff --git a/ldap/class/ldapgrouproleassociation.class.php b/ldap/class/ldapgrouproleassociation.class.php index c67d75e1..02c088b4 100644 --- a/ldap/class/ldapgrouproleassociation.class.php +++ b/ldap/class/ldapgrouproleassociation.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ldap; + /** * Association between a directory group and a FOG role. * diff --git a/ldap/class/ldapgrouproleassociationmanager.class.php b/ldap/class/ldapgrouproleassociationmanager.class.php index 86ace0db..f0604bec 100644 --- a/ldap/class/ldapgrouproleassociationmanager.class.php +++ b/ldap/class/ldapgrouproleassociationmanager.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ldap; + /** * Manager for the ldapGroupRoleAssoc table. * diff --git a/ldap/class/ldapgroupusergroupassociation.class.php b/ldap/class/ldapgroupusergroupassociation.class.php index 47398c17..dab49e3d 100644 --- a/ldap/class/ldapgroupusergroupassociation.class.php +++ b/ldap/class/ldapgroupusergroupassociation.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ldap; + /** * Association between a directory group and a FOG user group. * diff --git a/ldap/class/ldapgroupusergroupassociationmanager.class.php b/ldap/class/ldapgroupusergroupassociationmanager.class.php index 2e555e04..503f732a 100644 --- a/ldap/class/ldapgroupusergroupassociationmanager.class.php +++ b/ldap/class/ldapgroupusergroupassociationmanager.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ldap; + /** * Manager for the ldapGroupUserGroupAssoc table. * diff --git a/ldap/class/ldapmanager.class.php b/ldap/class/ldapmanager.class.php index 405f8d37..6601825e 100644 --- a/ldap/class/ldapmanager.class.php +++ b/ldap/class/ldapmanager.class.php @@ -12,6 +12,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ldap; + /** * LDAPManager * diff --git a/ldap/class/ldapusergrant.class.php b/ldap/class/ldapusergrant.class.php index fca783cf..fe838033 100644 --- a/ldap/class/ldapusergrant.class.php +++ b/ldap/class/ldapusergrant.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ldap; + /** * A record of one role or user group this plugin granted to one user. * diff --git a/ldap/class/ldapusergrantmanager.class.php b/ldap/class/ldapusergrantmanager.class.php index fc66fecf..03469723 100644 --- a/ldap/class/ldapusergrantmanager.class.php +++ b/ldap/class/ldapusergrantmanager.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ldap; + /** * Manager for the ldapUserGrant table. * diff --git a/ldap/hooks/addldapapi.hook.php b/ldap/hooks/addldapapi.hook.php index c0deacbb..3d191ac4 100644 --- a/ldap/hooks/addldapapi.hook.php +++ b/ldap/hooks/addldapapi.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ldap; + /** * Injects LDAP stuff into the api system. * diff --git a/ldap/hooks/addldapgrouptabs.hook.php b/ldap/hooks/addldapgrouptabs.hook.php index 2b167c9b..74ea486c 100644 --- a/ldap/hooks/addldapgrouptabs.hook.php +++ b/ldap/hooks/addldapgrouptabs.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ldap; + /** * Associates directory groups from the role and user group pages. * diff --git a/ldap/hooks/addldapjs.hook.php b/ldap/hooks/addldapjs.hook.php index 0c25aecc..f522aaae 100644 --- a/ldap/hooks/addldapjs.hook.php +++ b/ldap/hooks/addldapjs.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ldap; + /** * Sets the javascript files up for this plugin. * diff --git a/ldap/hooks/addldapmenuitem.hook.php b/ldap/hooks/addldapmenuitem.hook.php index 368a80bc..59005b9a 100644 --- a/ldap/hooks/addldapmenuitem.hook.php +++ b/ldap/hooks/addldapmenuitem.hook.php @@ -12,6 +12,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ldap; + /** * Adds the menu item for this plugin * diff --git a/ldap/hooks/addldaptype.hook.php b/ldap/hooks/addldaptype.hook.php index 057cf2d8..2235eb75 100644 --- a/ldap/hooks/addldaptype.hook.php +++ b/ldap/hooks/addldaptype.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ldap; + /** * Adds the ldap type to the reports/exports items * diff --git a/ldap/hooks/ldapdeletemassitems.hook.php b/ldap/hooks/ldapdeletemassitems.hook.php index 8b23925a..1c952bad 100644 --- a/ldap/hooks/ldapdeletemassitems.hook.php +++ b/ldap/hooks/ldapdeletemassitems.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ldap; + /** * Deletes the LDAP plugin elements en-mass. * diff --git a/ldap/hooks/ldappluginhook.hook.php b/ldap/hooks/ldappluginhook.hook.php index b1fd511a..e99dc8b2 100644 --- a/ldap/hooks/ldappluginhook.hook.php +++ b/ldap/hooks/ldappluginhook.hook.php @@ -12,6 +12,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ldap; + /** * LDAPPluginHook enables our checks as required * diff --git a/ldap/pages/ldapgroupmanagement.page.php b/ldap/pages/ldapgroupmanagement.page.php index ade5d165..585b74b3 100644 --- a/ldap/pages/ldapgroupmanagement.page.php +++ b/ldap/pages/ldapgroupmanagement.page.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ldap; + /** * The LDAP group management page * diff --git a/ldap/pages/ldapmanagement.page.php b/ldap/pages/ldapmanagement.page.php index 485b0a5c..d82c53f5 100644 --- a/ldap/pages/ldapmanagement.page.php +++ b/ldap/pages/ldapmanagement.page.php @@ -12,6 +12,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ldap; + /** * The ldap management page * diff --git a/ldap/reports/ldap_report.report.php b/ldap/reports/ldap_report.report.php index 930f5289..66ab33a6 100644 --- a/ldap/reports/ldap_report.report.php +++ b/ldap/reports/ldap_report.report.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ldap; + /** * LDAP report. * diff --git a/location/class/location.class.php b/location/class/location.class.php index 4cc84fdb..fe4577ea 100644 --- a/location/class/location.class.php +++ b/location/class/location.class.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Location; + /** * The location class. * diff --git a/location/class/locationassociation.class.php b/location/class/locationassociation.class.php index aeb26de5..02d706c2 100644 --- a/location/class/locationassociation.class.php +++ b/location/class/locationassociation.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Location; + /** * The association between hosts and locations. * diff --git a/location/class/locationassociationmanager.class.php b/location/class/locationassociationmanager.class.php index 20a77659..a2d16d43 100644 --- a/location/class/locationassociationmanager.class.php +++ b/location/class/locationassociationmanager.class.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Location; + /** * Location association manager class. * diff --git a/location/class/locationmanager.class.php b/location/class/locationmanager.class.php index 5884c389..1e6089e7 100644 --- a/location/class/locationmanager.class.php +++ b/location/class/locationmanager.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Location; + /** * Location manager mass management class * diff --git a/location/hooks/addlocationapi.hook.php b/location/hooks/addlocationapi.hook.php index 9cb66d8c..e89807f6 100644 --- a/location/hooks/addlocationapi.hook.php +++ b/location/hooks/addlocationapi.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Location; + /** * Injects location stuff into the api system. * diff --git a/location/hooks/addlocationgroup.hook.php b/location/hooks/addlocationgroup.hook.php index c82b438f..e9bfca6d 100644 --- a/location/hooks/addlocationgroup.hook.php +++ b/location/hooks/addlocationgroup.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Location; + /** * Adds the location choice to groups. * diff --git a/location/hooks/addlocationhost.hook.php b/location/hooks/addlocationhost.hook.php index de352cf8..78b34c0c 100644 --- a/location/hooks/addlocationhost.hook.php +++ b/location/hooks/addlocationhost.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Location; + /** * Adds the location choice to host. * diff --git a/location/hooks/addlocationimport.hook.php b/location/hooks/addlocationimport.hook.php index 2c9ab6ce..081fdf86 100644 --- a/location/hooks/addlocationimport.hook.php +++ b/location/hooks/addlocationimport.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Location; + /** * Adds location support to the CSV import/export associations column. * diff --git a/location/hooks/addlocationjs.hook.php b/location/hooks/addlocationjs.hook.php index c5d536ea..5f38cd50 100644 --- a/location/hooks/addlocationjs.hook.php +++ b/location/hooks/addlocationjs.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Location; + /** * Sets the javascript files up for this plugin. * diff --git a/location/hooks/addlocationmenuitem.hook.php b/location/hooks/addlocationmenuitem.hook.php index 283cb139..71e808ea 100644 --- a/location/hooks/addlocationmenuitem.hook.php +++ b/location/hooks/addlocationmenuitem.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Location; + /** * Adds the location menu item. * diff --git a/location/hooks/addlocationtype.hook.php b/location/hooks/addlocationtype.hook.php index 3fd1bbeb..248a73b3 100644 --- a/location/hooks/addlocationtype.hook.php +++ b/location/hooks/addlocationtype.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Location; + /** * Adds the location report type. * diff --git a/location/hooks/addserviceconfiguration.hook.php b/location/hooks/addserviceconfiguration.hook.php index 2ba2e5bf..8be067f7 100644 --- a/location/hooks/addserviceconfiguration.hook.php +++ b/location/hooks/addserviceconfiguration.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Location; + /** * Adds service configuration with locations. * diff --git a/location/hooks/locationchangeitems.hook.php b/location/hooks/locationchangeitems.hook.php index bbb537f1..2f33e06a 100644 --- a/location/hooks/locationchangeitems.hook.php +++ b/location/hooks/locationchangeitems.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Location; + /** * Changes the elements we need. * diff --git a/location/hooks/locationdeletemassitems.hook.php b/location/hooks/locationdeletemassitems.hook.php index 322d41b5..0d227cd3 100644 --- a/location/hooks/locationdeletemassitems.hook.php +++ b/location/hooks/locationdeletemassitems.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Location; + /** * Deletes the Location the elements en-mass. * diff --git a/location/pages/locationmanagement.page.php b/location/pages/locationmanagement.page.php index 0a56cf39..df70dce1 100644 --- a/location/pages/locationmanagement.page.php +++ b/location/pages/locationmanagement.page.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Location; + /** * Location management page. * diff --git a/location/reports/location_report.report.php b/location/reports/location_report.report.php index d827a2a8..ad997fde 100644 --- a/location/reports/location_report.report.php +++ b/location/reports/location_report.report.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Location; + /** * Location report. * diff --git a/ntfy/class/ntfy.class.php b/ntfy/class/ntfy.class.php index 41b47868..13b17ff8 100644 --- a/ntfy/class/ntfy.class.php +++ b/ntfy/class/ntfy.class.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ntfy; + /** * The ntfy database and object definer * diff --git a/ntfy/class/ntfyexception.class.php b/ntfy/class/ntfyexception.class.php index af70e18f..4f79f5a4 100644 --- a/ntfy/class/ntfyexception.class.php +++ b/ntfy/class/ntfyexception.class.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ntfy; + /** * Exception class for ntfy * diff --git a/ntfy/class/ntfyextends.class.php b/ntfy/class/ntfyextends.class.php index 602fbcae..6edf64a7 100644 --- a/ntfy/class/ntfyextends.class.php +++ b/ntfy/class/ntfyextends.class.php @@ -13,6 +13,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ntfy; + /** * The base class of ntfy elements * diff --git a/ntfy/class/ntfyhandler.class.php b/ntfy/class/ntfyhandler.class.php index 605466bf..fda6d579 100644 --- a/ntfy/class/ntfyhandler.class.php +++ b/ntfy/class/ntfyhandler.class.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ntfy; + /** * Ntfy handler * diff --git a/ntfy/class/ntfymanager.class.php b/ntfy/class/ntfymanager.class.php index b3b9b038..ac13e03c 100644 --- a/ntfy/class/ntfymanager.class.php +++ b/ntfy/class/ntfymanager.class.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ntfy; + /** * Manager class for ntfy * diff --git a/ntfy/events/imagecomplete_ntfy.event.php b/ntfy/events/imagecomplete_ntfy.event.php index 0797098b..45dabdc6 100644 --- a/ntfy/events/imagecomplete_ntfy.event.php +++ b/ntfy/events/imagecomplete_ntfy.event.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ntfy; + /** * Pushes notification on image completion. * diff --git a/ntfy/events/imagefail_ntfy.event.php b/ntfy/events/imagefail_ntfy.event.php index 049355e5..6091a8cf 100644 --- a/ntfy/events/imagefail_ntfy.event.php +++ b/ntfy/events/imagefail_ntfy.event.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ntfy; + /** * Pushes notification on imaging failure. * diff --git a/ntfy/events/loginfailure_ntfy.event.php b/ntfy/events/loginfailure_ntfy.event.php index ead6cceb..5a79266f 100644 --- a/ntfy/events/loginfailure_ntfy.event.php +++ b/ntfy/events/loginfailure_ntfy.event.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ntfy; + /** * Pushes notification on login failure. * diff --git a/ntfy/events/snapincomplete_ntfy.event.php b/ntfy/events/snapincomplete_ntfy.event.php index 3e0c4dc6..577ae46f 100644 --- a/ntfy/events/snapincomplete_ntfy.event.php +++ b/ntfy/events/snapincomplete_ntfy.event.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ntfy; + /** * Pushes notification on snapin completion. * diff --git a/ntfy/events/snapintaskcomplete_ntfy.event.php b/ntfy/events/snapintaskcomplete_ntfy.event.php index 737791f8..3053772b 100644 --- a/ntfy/events/snapintaskcomplete_ntfy.event.php +++ b/ntfy/events/snapintaskcomplete_ntfy.event.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ntfy; + /** * Pushes notification on snapin task completion. * diff --git a/ntfy/hooks/addntfyapi.hook.php b/ntfy/hooks/addntfyapi.hook.php index f30dd01b..92e96fce 100644 --- a/ntfy/hooks/addntfyapi.hook.php +++ b/ntfy/hooks/addntfyapi.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ntfy; + /** * Injects ntfy stuff into the api system. * diff --git a/ntfy/hooks/addntfyjs.hook.php b/ntfy/hooks/addntfyjs.hook.php index db647d7e..2ad4dbc9 100644 --- a/ntfy/hooks/addntfyjs.hook.php +++ b/ntfy/hooks/addntfyjs.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ntfy; + /** * Sets the javascript files up for this plugin. * diff --git a/ntfy/hooks/addntfymenuitem.hook.php b/ntfy/hooks/addntfymenuitem.hook.php index 0189ff48..2ebada3d 100644 --- a/ntfy/hooks/addntfymenuitem.hook.php +++ b/ntfy/hooks/addntfymenuitem.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ntfy; + /** * Adds the ntfy menu item to the menu. * diff --git a/ntfy/pages/ntfymanagement.page.php b/ntfy/pages/ntfymanagement.page.php index 5f4682e6..742f0a3a 100644 --- a/ntfy/pages/ntfymanagement.page.php +++ b/ntfy/pages/ntfymanagement.page.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ntfy; + /** * Page presenter for ntfy plugin * diff --git a/oidc/class/oidc.class.php b/oidc/class/oidc.class.php index 6c857b8f..ad294cde 100644 --- a/oidc/class/oidc.class.php +++ b/oidc/class/oidc.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * An OpenID Connect identity provider FOG can sign users in with. * diff --git a/oidc/class/oidcflow.class.php b/oidc/class/oidcflow.class.php index 7493d388..95e29c71 100644 --- a/oidc/class/oidcflow.class.php +++ b/oidc/class/oidcflow.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * The OpenID Connect authorization code flow. * diff --git a/oidc/class/oidcgroup.class.php b/oidc/class/oidcgroup.class.php index ae666446..0a971945 100644 --- a/oidc/class/oidcgroup.class.php +++ b/oidc/class/oidcgroup.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * A group name from an identity provider, and what it grants. * diff --git a/oidc/class/oidcgroupmanager.class.php b/oidc/class/oidcgroupmanager.class.php index 1ad1af7a..5fa90c5f 100644 --- a/oidc/class/oidcgroupmanager.class.php +++ b/oidc/class/oidcgroupmanager.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * Identity provider groups (collection manager + schema). * diff --git a/oidc/class/oidcgrouproleassociation.class.php b/oidc/class/oidcgrouproleassociation.class.php index 4317a3fa..9034d690 100644 --- a/oidc/class/oidcgrouproleassociation.class.php +++ b/oidc/class/oidcgrouproleassociation.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * Which roles an identity provider group grants. * diff --git a/oidc/class/oidcgrouproleassociationmanager.class.php b/oidc/class/oidcgrouproleassociationmanager.class.php index fe4f31bf..035b63fb 100644 --- a/oidc/class/oidcgrouproleassociationmanager.class.php +++ b/oidc/class/oidcgrouproleassociationmanager.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * Provider group to role associations (collection manager + schema). * diff --git a/oidc/class/oidcgroupusergroupassociation.class.php b/oidc/class/oidcgroupusergroupassociation.class.php index f70d42ad..ad8dfb2b 100644 --- a/oidc/class/oidcgroupusergroupassociation.class.php +++ b/oidc/class/oidcgroupusergroupassociation.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * Which user groups an identity provider group grants. * diff --git a/oidc/class/oidcgroupusergroupassociationmanager.class.php b/oidc/class/oidcgroupusergroupassociationmanager.class.php index e5943687..26ba3e2d 100644 --- a/oidc/class/oidcgroupusergroupassociationmanager.class.php +++ b/oidc/class/oidcgroupusergroupassociationmanager.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * Provider group to user group associations (collection manager + schema). * diff --git a/oidc/class/oidcidentity.class.php b/oidc/class/oidcidentity.class.php index 30e13673..a1da0e5a 100644 --- a/oidc/class/oidcidentity.class.php +++ b/oidc/class/oidcidentity.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * The link between a provider's subject identifier and a FOG user. * diff --git a/oidc/class/oidcidentitymanager.class.php b/oidc/class/oidcidentitymanager.class.php index 1f9de582..2a9c910a 100644 --- a/oidc/class/oidcidentitymanager.class.php +++ b/oidc/class/oidcidentitymanager.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * Provider-subject to FOG-user links (collection manager + schema). * diff --git a/oidc/class/oidcmanager.class.php b/oidc/class/oidcmanager.class.php index c1002977..c70ab71e 100644 --- a/oidc/class/oidcmanager.class.php +++ b/oidc/class/oidcmanager.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * OpenID Connect providers (collection manager + schema). * diff --git a/oidc/class/oidcusergrant.class.php b/oidc/class/oidcusergrant.class.php index 5d994677..db0da8d3 100644 --- a/oidc/class/oidcusergrant.class.php +++ b/oidc/class/oidcusergrant.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * What this plugin granted a user, so it can take it back. * diff --git a/oidc/class/oidcusergrantmanager.class.php b/oidc/class/oidcusergrantmanager.class.php index 221c4711..ffb2fb4c 100644 --- a/oidc/class/oidcusergrantmanager.class.php +++ b/oidc/class/oidcusergrantmanager.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * Recorded grants (collection manager + schema). * diff --git a/oidc/hooks/addoidcapi.hook.php b/oidc/hooks/addoidcapi.hook.php index f2fcfcfd..a837e1f1 100644 --- a/oidc/hooks/addoidcapi.hook.php +++ b/oidc/hooks/addoidcapi.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * Adds this plugin's class to the API and declares its secret. * diff --git a/oidc/hooks/addoidcgrouptabs.hook.php b/oidc/hooks/addoidcgrouptabs.hook.php index f8d66ea1..c9fe6f25 100644 --- a/oidc/hooks/addoidcgrouptabs.hook.php +++ b/oidc/hooks/addoidcgrouptabs.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * Associates provider groups from the role and user group pages. * diff --git a/oidc/hooks/addoidcjs.hook.php b/oidc/hooks/addoidcjs.hook.php index 016ff925..3cd56d33 100644 --- a/oidc/hooks/addoidcjs.hook.php +++ b/oidc/hooks/addoidcjs.hook.php @@ -14,6 +14,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * Injects the OpenID Connect JS files. * diff --git a/oidc/hooks/addoidcmenuitem.hook.php b/oidc/hooks/addoidcmenuitem.hook.php index 9c2f8e36..4dc883d8 100644 --- a/oidc/hooks/addoidcmenuitem.hook.php +++ b/oidc/hooks/addoidcmenuitem.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * Adds the menu item and permission node for this plugin. * diff --git a/oidc/hooks/addoidcroutes.hook.php b/oidc/hooks/addoidcroutes.hook.php index 5a7ce2d4..b6ebc6cb 100644 --- a/oidc/hooks/addoidcroutes.hook.php +++ b/oidc/hooks/addoidcroutes.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * Registers this plugin's routes and its login-page button. * diff --git a/oidc/hooks/oidcdeletemassitems.hook.php b/oidc/hooks/oidcdeletemassitems.hook.php index eb1dbc92..ad544c67 100644 --- a/oidc/hooks/oidcdeletemassitems.hook.php +++ b/oidc/hooks/oidcdeletemassitems.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * Clears identity links when what they point at is deleted. * diff --git a/oidc/hooks/oidcloginredirect.hook.php b/oidc/hooks/oidcloginredirect.hook.php index 9ce843f2..bc179784 100644 --- a/oidc/hooks/oidcloginredirect.hook.php +++ b/oidc/hooks/oidcloginredirect.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * Sends the login page straight to the identity provider. * diff --git a/oidc/hooks/oidclogout.hook.php b/oidc/hooks/oidclogout.hook.php index 97b77c1c..d7c01a0d 100644 --- a/oidc/hooks/oidclogout.hook.php +++ b/oidc/hooks/oidclogout.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * Ends the identity provider's session when FOG's ends. * diff --git a/oidc/pages/oidcgroupmanagement.page.php b/oidc/pages/oidcgroupmanagement.page.php index f5fc1c58..0a8d0843 100644 --- a/oidc/pages/oidcgroupmanagement.page.php +++ b/oidc/pages/oidcgroupmanagement.page.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * The identity provider group management page. * diff --git a/oidc/pages/oidcmanagement.page.php b/oidc/pages/oidcmanagement.page.php index e64cebf7..f47f2435 100644 --- a/oidc/pages/oidcmanagement.page.php +++ b/oidc/pages/oidcmanagement.page.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Oidc; + /** * OpenID Connect provider management page. * diff --git a/ou/class/ou.class.php b/ou/class/ou.class.php index f432f34b..9e9b469d 100644 --- a/ou/class/ou.class.php +++ b/ou/class/ou.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ou; + /** * The OU class. * diff --git a/ou/class/ouassociation.class.php b/ou/class/ouassociation.class.php index 56d656dc..8c480747 100644 --- a/ou/class/ouassociation.class.php +++ b/ou/class/ouassociation.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ou; + /** * The association between hosts and ous. * diff --git a/ou/class/ouassociationmanager.class.php b/ou/class/ouassociationmanager.class.php index 4cd0877c..a08dd59f 100644 --- a/ou/class/ouassociationmanager.class.php +++ b/ou/class/ouassociationmanager.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ou; + /** * OU association manager class. * diff --git a/ou/class/oumanager.class.php b/ou/class/oumanager.class.php index c06deb73..e2210910 100644 --- a/ou/class/oumanager.class.php +++ b/ou/class/oumanager.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ou; + /** * OU manager mass management class * diff --git a/ou/hooks/addouapi.hook.php b/ou/hooks/addouapi.hook.php index 58faa732..d82670cb 100644 --- a/ou/hooks/addouapi.hook.php +++ b/ou/hooks/addouapi.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ou; + /** * Injects ou stuff into the api system. * diff --git a/ou/hooks/addougroup.hook.php b/ou/hooks/addougroup.hook.php index 804acd42..8f38beb0 100644 --- a/ou/hooks/addougroup.hook.php +++ b/ou/hooks/addougroup.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ou; + /** * Adds the OU choice to groups. * diff --git a/ou/hooks/addouhost.hook.php b/ou/hooks/addouhost.hook.php index e6f81c51..b6c2bc3f 100644 --- a/ou/hooks/addouhost.hook.php +++ b/ou/hooks/addouhost.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ou; + /** * Adds the ou choice to host. * diff --git a/ou/hooks/addoujs.hook.php b/ou/hooks/addoujs.hook.php index ea4ad688..fb926650 100644 --- a/ou/hooks/addoujs.hook.php +++ b/ou/hooks/addoujs.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ou; + /** * Sets the javascript files up for this plugin. * diff --git a/ou/hooks/addoumenuitem.hook.php b/ou/hooks/addoumenuitem.hook.php index d07f08a1..f564ef28 100644 --- a/ou/hooks/addoumenuitem.hook.php +++ b/ou/hooks/addoumenuitem.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ou; + /** * Adds the ou menu item. * diff --git a/ou/hooks/addoutype.hook.php b/ou/hooks/addoutype.hook.php index 55ee90a1..a62d732d 100644 --- a/ou/hooks/addoutype.hook.php +++ b/ou/hooks/addoutype.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ou; + /** * Adds the ou report type. * diff --git a/ou/hooks/ouchangeitems.hook.php b/ou/hooks/ouchangeitems.hook.php index 038f5280..dff076fd 100644 --- a/ou/hooks/ouchangeitems.hook.php +++ b/ou/hooks/ouchangeitems.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ou; + /** * Changes the elements we need. * diff --git a/ou/hooks/oudeletemassitems.hook.php b/ou/hooks/oudeletemassitems.hook.php index dd208a52..5db42c90 100644 --- a/ou/hooks/oudeletemassitems.hook.php +++ b/ou/hooks/oudeletemassitems.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ou; + /** * Deletes the OU the elements en-mass. * diff --git a/ou/pages/oumanagement.page.php b/ou/pages/oumanagement.page.php index 896f6bfa..5391be86 100644 --- a/ou/pages/oumanagement.page.php +++ b/ou/pages/oumanagement.page.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ou; + /** * OU management page. * diff --git a/ou/reports/ou_report.report.php b/ou/reports/ou_report.report.php index 7e676d8a..522b28a7 100644 --- a/ou/reports/ou_report.report.php +++ b/ou/reports/ou_report.report.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Ou; + /** * OU report. * diff --git a/persistentgroups/class/persistentgroups.class.php b/persistentgroups/class/persistentgroups.class.php index 42447686..f696ae5d 100644 --- a/persistentgroups/class/persistentgroups.class.php +++ b/persistentgroups/class/persistentgroups.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Persistentgroups; + /** * Persistent group class. * diff --git a/persistentgroups/class/persistentgroupsmanager.class.php b/persistentgroups/class/persistentgroupsmanager.class.php index 33e3169e..6b73bfef 100644 --- a/persistentgroups/class/persistentgroupsmanager.class.php +++ b/persistentgroups/class/persistentgroupsmanager.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Persistentgroups; + /** * The example mass manager class. * diff --git a/pushbullet/class/pushbullet.class.php b/pushbullet/class/pushbullet.class.php index 6164823b..7a17117b 100644 --- a/pushbullet/class/pushbullet.class.php +++ b/pushbullet/class/pushbullet.class.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Pushbullet; + /** * The pushbullet database and object definer * diff --git a/pushbullet/class/pushbulletexception.class.php b/pushbullet/class/pushbulletexception.class.php index 6d6b3050..731934b8 100644 --- a/pushbullet/class/pushbulletexception.class.php +++ b/pushbullet/class/pushbulletexception.class.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Pushbullet; + /** * Exception class for pushbullet * diff --git a/pushbullet/class/pushbulletextends.class.php b/pushbullet/class/pushbulletextends.class.php index 4a3394f4..b60f3258 100644 --- a/pushbullet/class/pushbulletextends.class.php +++ b/pushbullet/class/pushbulletextends.class.php @@ -13,6 +13,9 @@ * @license http://opensource.org/license/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Pushbullet; + /** * The base class of pushbullet elements * diff --git a/pushbullet/class/pushbullethandler.class.php b/pushbullet/class/pushbullethandler.class.php index b5792bfc..4ce15552 100644 --- a/pushbullet/class/pushbullethandler.class.php +++ b/pushbullet/class/pushbullethandler.class.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Pushbullet; + /** * Pushbullet handler * diff --git a/pushbullet/class/pushbulletmanager.class.php b/pushbullet/class/pushbulletmanager.class.php index feca52d0..08e136af 100644 --- a/pushbullet/class/pushbulletmanager.class.php +++ b/pushbullet/class/pushbulletmanager.class.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Pushbullet; + /** * Manager class for pushbullet * diff --git a/pushbullet/events/imagecomplete_pushbullet.event.php b/pushbullet/events/imagecomplete_pushbullet.event.php index f7de97f5..a578a643 100644 --- a/pushbullet/events/imagecomplete_pushbullet.event.php +++ b/pushbullet/events/imagecomplete_pushbullet.event.php @@ -10,6 +10,9 @@ * @license http://opensource.org/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Pushbullet; + /** * Pushes notification on image completion. * diff --git a/pushbullet/events/imagefail_pushbullet.event.php b/pushbullet/events/imagefail_pushbullet.event.php index 67e17a3d..552a5c3b 100644 --- a/pushbullet/events/imagefail_pushbullet.event.php +++ b/pushbullet/events/imagefail_pushbullet.event.php @@ -10,6 +10,9 @@ * @license http://opensource.org/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Pushbullet; + /** * Pushes notification on imaging failure. * diff --git a/pushbullet/events/loginfailure_pushbullet.event.php b/pushbullet/events/loginfailure_pushbullet.event.php index ceff8365..aaf5bf8b 100644 --- a/pushbullet/events/loginfailure_pushbullet.event.php +++ b/pushbullet/events/loginfailure_pushbullet.event.php @@ -10,6 +10,9 @@ * @license http://opensource.org/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Pushbullet; + /** * Pushes notification on login failure. * diff --git a/pushbullet/events/snapincomplete_pushbullet.event.php b/pushbullet/events/snapincomplete_pushbullet.event.php index e982fb3a..6d61def8 100644 --- a/pushbullet/events/snapincomplete_pushbullet.event.php +++ b/pushbullet/events/snapincomplete_pushbullet.event.php @@ -10,6 +10,9 @@ * @license http://opensource.org/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Pushbullet; + /** * Pushes notification on snapin completion. * diff --git a/pushbullet/events/snapintaskcomplete_pushbullet.event.php b/pushbullet/events/snapintaskcomplete_pushbullet.event.php index 17a5619b..f62cf31c 100644 --- a/pushbullet/events/snapintaskcomplete_pushbullet.event.php +++ b/pushbullet/events/snapintaskcomplete_pushbullet.event.php @@ -10,6 +10,9 @@ * @license http://opensource.org/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Pushbullet; + /** * Pushes notification on image completion. * diff --git a/pushbullet/hooks/addpushbulletapi.hook.php b/pushbullet/hooks/addpushbulletapi.hook.php index 17a664a1..e3238f03 100644 --- a/pushbullet/hooks/addpushbulletapi.hook.php +++ b/pushbullet/hooks/addpushbulletapi.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Pushbullet; + /** * Injects pushbullet stuff into the api system. * diff --git a/pushbullet/hooks/addpushbulletjs.hook.php b/pushbullet/hooks/addpushbulletjs.hook.php index c47d1938..7e6a757a 100644 --- a/pushbullet/hooks/addpushbulletjs.hook.php +++ b/pushbullet/hooks/addpushbulletjs.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Pushbullet; + /** * Sets the javascript files up for this plugin. * diff --git a/pushbullet/hooks/addpushbulletmenuitem.hook.php b/pushbullet/hooks/addpushbulletmenuitem.hook.php index 1d1891ae..27c2b291 100644 --- a/pushbullet/hooks/addpushbulletmenuitem.hook.php +++ b/pushbullet/hooks/addpushbulletmenuitem.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Pushbullet; + /** * Adds the pushbullet menu item to the menu. * diff --git a/pushbullet/pages/pushbulletmanagement.page.php b/pushbullet/pages/pushbulletmanagement.page.php index 1a74f68d..09be96ad 100644 --- a/pushbullet/pages/pushbulletmanagement.page.php +++ b/pushbullet/pages/pushbulletmanagement.page.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Pushbullet; + /** * Page presenter for pushbullet plugin * diff --git a/slack/class/slack.class.php b/slack/class/slack.class.php index 610e987f..e1482b69 100644 --- a/slack/class/slack.class.php +++ b/slack/class/slack.class.php @@ -10,6 +10,9 @@ * @license https://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Slack; + /** * Slack class. * diff --git a/slack/class/slackexception.class.php b/slack/class/slackexception.class.php index 66c7c5b7..d1418130 100644 --- a/slack/class/slackexception.class.php +++ b/slack/class/slackexception.class.php @@ -10,6 +10,9 @@ * @license https://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Slack; + /** * Slack exception, simple extends exception. * diff --git a/slack/class/slackhandler.class.php b/slack/class/slackhandler.class.php index ef125070..84793fe3 100644 --- a/slack/class/slackhandler.class.php +++ b/slack/class/slackhandler.class.php @@ -10,6 +10,9 @@ * @license https://opensource.org/license/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Slack; + /** * Handles the api calling of Slack messages. * diff --git a/slack/class/slackmanager.class.php b/slack/class/slackmanager.class.php index a0206277..ef35cc5b 100644 --- a/slack/class/slackmanager.class.php +++ b/slack/class/slackmanager.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Slack; + /** * Slack manager mass management class * diff --git a/slack/events/imagecomplete_slack.event.php b/slack/events/imagecomplete_slack.event.php index 560887d8..a85368b6 100644 --- a/slack/events/imagecomplete_slack.event.php +++ b/slack/events/imagecomplete_slack.event.php @@ -8,6 +8,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Slack; + class ImageComplete_Slack extends \FOG\Base\Event { /** diff --git a/slack/events/imagefail_slack.event.php b/slack/events/imagefail_slack.event.php index 814305e9..3f13b692 100644 --- a/slack/events/imagefail_slack.event.php +++ b/slack/events/imagefail_slack.event.php @@ -8,6 +8,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Slack; + class ImageFail_Slack extends \FOG\Base\Event { /** diff --git a/slack/events/loginfailure_slack.event.php b/slack/events/loginfailure_slack.event.php index bb5f1978..c5fcad88 100644 --- a/slack/events/loginfailure_slack.event.php +++ b/slack/events/loginfailure_slack.event.php @@ -9,6 +9,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Slack; + class LoginFailure_Slack extends \FOG\Base\Event { /** diff --git a/slack/events/snapincomplete_slack.event.php b/slack/events/snapincomplete_slack.event.php index 63dea8a7..751d45d6 100644 --- a/slack/events/snapincomplete_slack.event.php +++ b/slack/events/snapincomplete_slack.event.php @@ -8,6 +8,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Slack; + class SnapinComplete_Slack extends \FOG\Base\Event { /** diff --git a/slack/events/snapintaskcomplete_slack.event.php b/slack/events/snapintaskcomplete_slack.event.php index 21176861..0a550fd8 100644 --- a/slack/events/snapintaskcomplete_slack.event.php +++ b/slack/events/snapintaskcomplete_slack.event.php @@ -8,6 +8,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Slack; + class SnapinTaskComplete_Slack extends \FOG\Base\Event { /** diff --git a/slack/hooks/addslackapi.hook.php b/slack/hooks/addslackapi.hook.php index c0da89dd..b0399a1c 100644 --- a/slack/hooks/addslackapi.hook.php +++ b/slack/hooks/addslackapi.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Slack; + /** * Injects slack stuff into the api system. * diff --git a/slack/hooks/addslackjs.hook.php b/slack/hooks/addslackjs.hook.php index 6b2986b0..aa43912e 100644 --- a/slack/hooks/addslackjs.hook.php +++ b/slack/hooks/addslackjs.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Slack; + /** * Sets the javascript files up for this plugin. * diff --git a/slack/hooks/addslackmenuitem.hook.php b/slack/hooks/addslackmenuitem.hook.php index d81a2869..7330911a 100644 --- a/slack/hooks/addslackmenuitem.hook.php +++ b/slack/hooks/addslackmenuitem.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Slack; + /** * Add slack menu item. * diff --git a/slack/pages/slackmanagement.page.php b/slack/pages/slackmanagement.page.php index 7455f5b6..f989b494 100644 --- a/slack/pages/slackmanagement.page.php +++ b/slack/pages/slackmanagement.page.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Slack; + /** * Slack page edit/add. * diff --git a/subnetgroup/class/subnetgroup.class.php b/subnetgroup/class/subnetgroup.class.php index 02a08146..b03fbbc4 100644 --- a/subnetgroup/class/subnetgroup.class.php +++ b/subnetgroup/class/subnetgroup.class.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Subnetgroup; + /** * Subnet Group plugin * diff --git a/subnetgroup/class/subnetgroupmanager.class.php b/subnetgroup/class/subnetgroupmanager.class.php index ef2c50af..358e6054 100644 --- a/subnetgroup/class/subnetgroupmanager.class.php +++ b/subnetgroup/class/subnetgroupmanager.class.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Subnetgroup; + /** * Site plugin * diff --git a/subnetgroup/hooks/addsubnetgroupapi.hook.php b/subnetgroup/hooks/addsubnetgroupapi.hook.php index a8511819..64a308b4 100644 --- a/subnetgroup/hooks/addsubnetgroupapi.hook.php +++ b/subnetgroup/hooks/addsubnetgroupapi.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Subnetgroup; + /** * Injects subnetgroup into api system. * diff --git a/subnetgroup/hooks/addsubnetgrouphost.hook.php b/subnetgroup/hooks/addsubnetgrouphost.hook.php index 9070b272..a586a407 100644 --- a/subnetgroup/hooks/addsubnetgrouphost.hook.php +++ b/subnetgroup/hooks/addsubnetgrouphost.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Subnetgroup; + /** * Adds the subnet group to host. * diff --git a/subnetgroup/hooks/addsubnetgroupjs.hook.php b/subnetgroup/hooks/addsubnetgroupjs.hook.php index fe4f9e3a..fc130274 100644 --- a/subnetgroup/hooks/addsubnetgroupjs.hook.php +++ b/subnetgroup/hooks/addsubnetgroupjs.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Subnetgroup; + /** * Sets the javascript files up for this plugin. * diff --git a/subnetgroup/hooks/addsubnetgroupmenuitem.hook.php b/subnetgroup/hooks/addsubnetgroupmenuitem.hook.php index e12d3d8c..e8e3f4d9 100644 --- a/subnetgroup/hooks/addsubnetgroupmenuitem.hook.php +++ b/subnetgroup/hooks/addsubnetgroupmenuitem.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Subnetgroup; + /** * Adds the subnet group menu item. * diff --git a/subnetgroup/hooks/addsubnetgrouptype.hook.php b/subnetgroup/hooks/addsubnetgrouptype.hook.php index 6ec82c59..f095a99b 100644 --- a/subnetgroup/hooks/addsubnetgrouptype.hook.php +++ b/subnetgroup/hooks/addsubnetgrouptype.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Subnetgroup; + /** * Adds the subnet group report type. * diff --git a/subnetgroup/hooks/removesubnetgroupgroup.hook.php b/subnetgroup/hooks/removesubnetgroupgroup.hook.php index e80fa9f2..d744054c 100644 --- a/subnetgroup/hooks/removesubnetgroupgroup.hook.php +++ b/subnetgroup/hooks/removesubnetgroupgroup.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Subnetgroup; + /** * Remove the subnet group from the group. * diff --git a/subnetgroup/pages/subnetgroupmanagement.page.php b/subnetgroup/pages/subnetgroupmanagement.page.php index 89462232..5355d7ee 100644 --- a/subnetgroup/pages/subnetgroupmanagement.page.php +++ b/subnetgroup/pages/subnetgroupmanagement.page.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Subnetgroup; + /** * Subnet group management page. * diff --git a/subnetgroup/reports/subnetgroup_report.report.php b/subnetgroup/reports/subnetgroup_report.report.php index 7386a938..94d47ab9 100644 --- a/subnetgroup/reports/subnetgroup_report.report.php +++ b/subnetgroup/reports/subnetgroup_report.report.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Subnetgroup; + /** * Subnet Group report. * diff --git a/taskstateedit/class/taskstateedit.class.php b/taskstateedit/class/taskstateedit.class.php index 7015ed92..01607047 100644 --- a/taskstateedit/class/taskstateedit.class.php +++ b/taskstateedit/class/taskstateedit.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Taskstateedit; + /** * Taskstateedit Class Handler. * diff --git a/taskstateedit/class/taskstateeditmanager.class.php b/taskstateedit/class/taskstateeditmanager.class.php index 3e465ac3..868d7c50 100644 --- a/taskstateedit/class/taskstateeditmanager.class.php +++ b/taskstateedit/class/taskstateeditmanager.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Taskstateedit; + /** * TaskstateeditManager * diff --git a/taskstateedit/hooks/addtaskstateeditjs.hook.php b/taskstateedit/hooks/addtaskstateeditjs.hook.php index 54bc75db..14b5ecec 100644 --- a/taskstateedit/hooks/addtaskstateeditjs.hook.php +++ b/taskstateedit/hooks/addtaskstateeditjs.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Taskstateedit; + /** * Sets the javascript files up for this plugin. * diff --git a/taskstateedit/hooks/addtaskstateeditmenuitem.hook.php b/taskstateedit/hooks/addtaskstateeditmenuitem.hook.php index d2413fc1..bfeed9e2 100644 --- a/taskstateedit/hooks/addtaskstateeditmenuitem.hook.php +++ b/taskstateedit/hooks/addtaskstateeditmenuitem.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Taskstateedit; + /** * Adds task state edit menu item. * diff --git a/taskstateedit/hooks/addtaskstatetype.hook.php b/taskstateedit/hooks/addtaskstatetype.hook.php index b4e67b9f..0fd6f88f 100644 --- a/taskstateedit/hooks/addtaskstatetype.hook.php +++ b/taskstateedit/hooks/addtaskstatetype.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Taskstateedit; + /** * Adds task state type report. * diff --git a/taskstateedit/pages/taskstateeditmanagement.page.php b/taskstateedit/pages/taskstateeditmanagement.page.php index 1233d7e8..1ee922f8 100644 --- a/taskstateedit/pages/taskstateeditmanagement.page.php +++ b/taskstateedit/pages/taskstateeditmanagement.page.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Taskstateedit; + /** * Task state edit page. * diff --git a/taskstateedit/reports/taskstateedit_report.report.php b/taskstateedit/reports/taskstateedit_report.report.php index d565ca7a..64d03f2d 100644 --- a/taskstateedit/reports/taskstateedit_report.report.php +++ b/taskstateedit/reports/taskstateedit_report.report.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Taskstateedit; + /** * Task State report. * diff --git a/tasktypeedit/class/tasktypeedit.class.php b/tasktypeedit/class/tasktypeedit.class.php index fa7d7117..24fb4af9 100644 --- a/tasktypeedit/class/tasktypeedit.class.php +++ b/tasktypeedit/class/tasktypeedit.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Tasktypeedit; + /** * Tasktypeedit Class Handler. * diff --git a/tasktypeedit/class/tasktypeeditmanager.class.php b/tasktypeedit/class/tasktypeeditmanager.class.php index 9cb518d7..981adc29 100644 --- a/tasktypeedit/class/tasktypeeditmanager.class.php +++ b/tasktypeedit/class/tasktypeeditmanager.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Tasktypeedit; + /** * TasktypeeditManager * diff --git a/tasktypeedit/hooks/addtasktypeeditjs.hook.php b/tasktypeedit/hooks/addtasktypeeditjs.hook.php index d8cd1edc..c16450a3 100644 --- a/tasktypeedit/hooks/addtasktypeeditjs.hook.php +++ b/tasktypeedit/hooks/addtasktypeeditjs.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Tasktypeedit; + /** * Sets the javascript files up for this plugin. * diff --git a/tasktypeedit/hooks/addtasktypeeditmenuitem.hook.php b/tasktypeedit/hooks/addtasktypeeditmenuitem.hook.php index feccde67..d64d81df 100644 --- a/tasktypeedit/hooks/addtasktypeeditmenuitem.hook.php +++ b/tasktypeedit/hooks/addtasktypeeditmenuitem.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Tasktypeedit; + /** * Adds task type edit menu item. * diff --git a/tasktypeedit/hooks/addtasktypetype.hook.php b/tasktypeedit/hooks/addtasktypetype.hook.php index 8fdd42be..57f4f681 100644 --- a/tasktypeedit/hooks/addtasktypetype.hook.php +++ b/tasktypeedit/hooks/addtasktypetype.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Tasktypeedit; + /** * Add task type type reporter. * diff --git a/tasktypeedit/pages/tasktypeeditmanagement.page.php b/tasktypeedit/pages/tasktypeeditmanagement.page.php index b25dc1d3..4830fc02 100644 --- a/tasktypeedit/pages/tasktypeeditmanagement.page.php +++ b/tasktypeedit/pages/tasktypeeditmanagement.page.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Tasktypeedit; + /** * Task type edit page. * diff --git a/tasktypeedit/reports/tasktypeedit_report.report.php b/tasktypeedit/reports/tasktypeedit_report.report.php index 4e499a5d..30878500 100644 --- a/tasktypeedit/reports/tasktypeedit_report.report.php +++ b/tasktypeedit/reports/tasktypeedit_report.report.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Tasktypeedit; + /** * Task Type report. * diff --git a/tests/oidc-flow-safety.test.php b/tests/oidc-flow-safety.test.php index ffff40e2..eecb3709 100644 --- a/tests/oidc-flow-safety.test.php +++ b/tests/oidc-flow-safety.test.php @@ -441,8 +441,8 @@ function methodBody($src, $method) ]; foreach ($cases as $setting => $want) { \FOG\Base\FOGController::$settings['FOG_WEB_ROOT'] = $setting; - $gotBase = OIDC::webrootBase(); - $gotUri = OIDC::redirectUri(); + $gotBase = \FOG\Plugins\Oidc\OIDC::webrootBase(); + $gotUri = \FOG\Plugins\Oidc\OIDC::redirectUri(); if ($gotBase !== $want[0] || $gotUri !== $want[1]) { fail( sprintf( @@ -596,7 +596,7 @@ function methodBody($src, $method) $indexCases = [ // class => [table, expected unique index, why] - 'OIDCGroupManager' => [ + 'FOG\Plugins\Oidc\OIDCGroupManager' => [ 'OIDCGroups', [['ogProviderID', 'ogName']], 'one mapping per (provider, group value). The key covers every' @@ -605,7 +605,7 @@ function methodBody($src, $method) . ' index is safe here and is deliberately absent from' . ' OIDCProviders' ], - 'OIDCUserGrantManager' => [ + 'FOG\Plugins\Oidc\OIDCUserGrantManager' => [ 'oidcUserGrant', [['ougUserID', 'ougTargetType', 'ougTargetID']], 'the sync rewrites a user\'s grants with plain INSERT IGNORE after' diff --git a/tests/oidc-provider-safety.test.php b/tests/oidc-provider-safety.test.php index cc35b296..abf322fa 100644 --- a/tests/oidc-provider-safety.test.php +++ b/tests/oidc-provider-safety.test.php @@ -107,7 +107,7 @@ function accepts(callable $fn, $what) // 1. The issuer. accepts( function () { - OIDC::assertValidIssuer('https://login.example.com/realms/fog'); + \FOG\Plugins\Oidc\OIDC::assertValidIssuer('https://login.example.com/realms/fog'); }, 'a plain https issuer' ); @@ -124,14 +124,14 @@ function () { foreach ($badIssuers as $issuer => $what) { refuses( function () use ($issuer) { - OIDC::assertValidIssuer($issuer); + \FOG\Plugins\Oidc\OIDC::assertValidIssuer($issuer); }, $what ); } refuses( function () { - OIDC::assertValidIssuer('https://' . str_repeat('a', 250) . '.com'); + \FOG\Plugins\Oidc\OIDC::assertValidIssuer('https://' . str_repeat('a', 250) . '.com'); }, 'an issuer too long for its column' ); @@ -146,7 +146,7 @@ function () { 'openid openid profile' => 'openid profile', ]; foreach ($scopeCases as $in => $want) { - $got = OIDC::normalizeScopes($in); + $got = \FOG\Plugins\Oidc\OIDC::normalizeScopes($in); if ($got !== $want) { fail( sprintf( @@ -163,14 +163,14 @@ function () { // matches nothing, so every login would be denied with no explanation. accepts( function () { - OIDC::assertValidClaim('preferred_username', 'user claim'); + \FOG\Plugins\Oidc\OIDC::assertValidClaim('preferred_username', 'user claim'); }, 'preferred_username' ); foreach (['', ' ', '-leading', str_repeat('a', 65)] as $claim) { refuses( function () use ($claim) { - OIDC::assertValidClaim($claim, 'user claim'); + \FOG\Plugins\Oidc\OIDC::assertValidClaim($claim, 'user claim'); }, 'claim name ' . var_export($claim, true) ); @@ -180,7 +180,7 @@ function () use ($claim) { // rules as the form. Checked by calling it, not by reading it. refuses( function () { - $o = new OIDC(); + $o = new \FOG\Plugins\Oidc\OIDC(); $o->set('issuer', 'http://idp.example.com') ->set('clientId', 'fog') ->set('userClaim', 'preferred_username') @@ -190,7 +190,7 @@ function () { ); refuses( function () { - $o = new OIDC(); + $o = new \FOG\Plugins\Oidc\OIDC(); $o->set('issuer', 'https://idp.example.com') ->set('clientId', '') ->set('userClaim', 'preferred_username') @@ -198,7 +198,7 @@ function () { }, 'save() with no client ID' ); -$saved = new OIDC(); +$saved = new \FOG\Plugins\Oidc\OIDC(); $saved->set('issuer', 'https://idp.example.com/realms/fog/') ->set('clientId', ' fog ') ->set('scopes', 'profile') @@ -220,7 +220,7 @@ function () { // 5. The column defaults, read out of what the manager asks Schema for. // Positional, because that is how Schema::createTable() is called. -(new OIDCManager())->createSql(); +(new \FOG\Plugins\Oidc\OIDCManager())->createSql(); $call = \FOG\Items\Schema::$lastCall; if (count($call) < 7) { fail('OIDCManager::createSql() did not reach Schema::createTable()'); @@ -308,10 +308,10 @@ function () { * than left to be rediscovered. Needs fogproject#1153. */ $declared = []; -if (property_exists('OIDC', 'databaseFieldsNotInt')) { - $notInt = new \ReflectionProperty('OIDC', 'databaseFieldsNotInt'); +if (property_exists('FOG\Plugins\Oidc\OIDC', 'databaseFieldsNotInt')) { + $notInt = new \ReflectionProperty('FOG\Plugins\Oidc\OIDC', 'databaseFieldsNotInt'); $notInt->setAccessible(true); - $declared = array_map('strtolower', (array)$notInt->getValue(new OIDC())); + $declared = array_map('strtolower', (array)$notInt->getValue(new \FOG\Plugins\Oidc\OIDC())); } if (!in_array('clientid', $declared, true)) { fail( diff --git a/tests/plugins-are-namespaced.test.php b/tests/plugins-are-namespaced.test.php new file mode 100644 index 00000000..6ced7375 --- /dev/null +++ b/tests/plugins-are-namespaced.test.php @@ -0,0 +1,216 @@ +//..php` declares + * `namespace FOG\Plugins\;` -- ucfirst() of + * the plugin's directory name, nothing else. The subdirectory (class/, + * pages/, hooks/, events/, reports/, tasks/, or an odd one like capone's + * reg-task/) is not part of it; every class in a plugin shares one flat + * namespace. + * + * This mirrors core's own rule (fogproject's PSR-4 buckets) closely enough + * that a plugin author can lean on the same instinct, but plugins are NOT + * PSR-4 mapped -- there is no composer.json or autoloader config here to + * enforce it structurally, so a gate is the only thing that catches a new + * plugin file landing bare or a copy-pasted file carrying its donor's + * namespace. + * + * WHAT COUNTS AS A CLASS FILE: the same six extensions the fetch/deploy + * tooling already treats as plugin source -- *.class.php, *.hook.php, + * *.page.php, *.event.php, *.report.php, *.task.php -- found anywhere under + * a plugin directory, subdirectory name irrelevant. config/plugin.config.php + * (a $fog_plugin array, no class) is deliberately excluded by extension + * alone, not by name, so a plugin that ever adds a second config-shaped file + * is not silently exempted. + * + * WHAT COUNTS AS A "PLUGIN DIRECTORY": deliberately NOT a hardcoded list, + * for the same reason core-references-are-qualified.test.php gives for not + * hardcoding core's class list -- this repository is fetched on its own + * (bin/fetch-plugins.sh) and a list here would drift as plugins are added or + * removed. Every top-level directory except the tooling ones (tests/, bin/, + * .github/, .git/) is treated as a plugin directory, matching how the repo + * is actually laid out (see README.md / bin/fetch-plugins.sh). + * + * The namespace comparison is case-INSENSITIVE, deliberately -- PHP + * namespaces are themselves case-insensitive, and a third-party plugin + * author may reasonably spell a namespace segment differently from a strict + * ucfirst() of their directory name (e.g. `MyPlugin` for directory + * `myplugin`). Getting the case slightly "wrong" is not the bug this gate + * exists to catch; declaring no namespace, the WRONG plugin's namespace, or + * more than one namespace is. + * + * Also asserted, same rule as core: no plugin file may declare + * class_alias() -- the compatibility mechanism ADR 0013 §2 is retiring from + * core is not something a plugin gets to reintroduce on its own. + * + * Usage: php tests/plugins-are-namespaced.test.php + * Exit status 0 = pass, 1 = fail. + * + * PHP version 7.4+ + * + * @category Tests + * @package FOGProject + * @author Tom Elliott + * @license http://opensource.org/licenses/gpl-3.0 GPLv3 + * @link https://fogproject.org + */ + +$root = dirname(__DIR__); +$fails = []; +$checked = 0; + +$skipTopLevel = ['tests', 'bin', '.github', '.git']; + +$pluginDirs = []; +foreach (scandir($root) as $entry) { + if ('.' === $entry || '..' === $entry) { + continue; + } + if (in_array($entry, $skipTopLevel, true)) { + continue; + } + if (!is_dir($root . '/' . $entry)) { + continue; + } + $pluginDirs[] = $entry; +} +sort($pluginDirs); + +/** + * Every `namespace ...;` declaration in a file, and every class_alias() + * call, found by walking the token stream rather than by regex -- a + * docblock or a string literal can contain the word "namespace" or + * "class_alias" without either being code. + * + * @param string $path file to scan + * + * @return array{namespaces: string[], hasClassAlias: bool} + */ +function scanFile($path) +{ + $namespaces = []; + $hasClassAlias = false; + $tokens = token_get_all(file_get_contents($path)); + $count = count($tokens); + for ($i = 0; $i < $count; $i++) { + if (!is_array($tokens[$i])) { + continue; + } + if (T_NAMESPACE === $tokens[$i][0]) { + // PHP 8 folds FOG\Plugins\Ldap into a single T_NAME_QUALIFIED + // token; 7.4 emits T_STRING/T_NS_SEPARATOR per segment. Handle + // both, same reasoning as core-references-are-qualified's + // T_NAME_FULLY_QUALIFIED handling for FQCNs. + $name = ''; + for ($j = $i + 1; $j < $count; $j++) { + if (is_array($tokens[$j]) + && in_array( + $tokens[$j][0], + array_filter([ + T_STRING, + T_NS_SEPARATOR, + defined('T_NAME_QUALIFIED') ? T_NAME_QUALIFIED : null, + ], static function ($t) { + return null !== $t; + }), + true + ) + ) { + $name .= $tokens[$j][1]; + continue; + } + if (is_array($tokens[$j]) && T_WHITESPACE === $tokens[$j][0]) { + continue; + } + break; + } + $namespaces[] = $name; + continue; + } + if (T_STRING === $tokens[$i][0] + && 0 === strcasecmp($tokens[$i][1], 'class_alias') + ) { + for ($j = $i + 1; $j < $count; $j++) { + if (is_array($tokens[$j]) && T_WHITESPACE === $tokens[$j][0]) { + continue; + } + if ('(' === $tokens[$j]) { + $hasClassAlias = true; + } + break; + } + } + } + return ['namespaces' => $namespaces, 'hasClassAlias' => $hasClassAlias]; +} + +foreach ($pluginDirs as $dir) { + $expected = 'fog\\plugins\\' . strtolower(ucfirst($dir)); + $walk = new RecursiveIteratorIterator( + new RecursiveDirectoryIterator($root . '/' . $dir) + ); + foreach ($walk as $file) { + $path = $file->getPathname(); + if (!$file->isFile()) { + continue; + } + if (!preg_match( + '/\.(class|hook|page|event|report|task)\.php$/', + $path + )) { + continue; + } + $rel = str_replace($root . '/', '', $path); + $checked++; + $scan = scanFile($path); + + if (0 === count($scan['namespaces'])) { + $fails[] = "$rel: declares no namespace (expected $expected)"; + continue; + } + if (count($scan['namespaces']) > 1) { + $fails[] = sprintf( + '%s: declares %d namespaces (%s), expected exactly one (%s)', + $rel, + count($scan['namespaces']), + implode(', ', $scan['namespaces']), + $expected + ); + continue; + } + $actual = strtolower($scan['namespaces'][0]); + if ($actual !== $expected) { + $fails[] = sprintf( + "%s: declares namespace '%s', expected '%s' (case-insensitive)", + $rel, + $scan['namespaces'][0], + $expected + ); + } + if ($scan['hasClassAlias']) { + $fails[] = "$rel: declares class_alias() -- not permitted in a " + . 'namespaced plugin (fogproject ADR 0013 §2)'; + } + } +} + +if (count($fails)) { + fwrite(STDERR, 'FAIL:' . PHP_EOL); + foreach (array_slice($fails, 0, 25) as $fail) { + fwrite(STDERR, " - $fail\n"); + } + if (count($fails) > 25) { + fwrite(STDERR, ' ... and ' . (count($fails) - 25) . " more\n"); + } + exit(1); +} + +printf( + "ok: %d plugin class file(s) across %d plugin director(ies), each " + . "namespaced FOG\\Plugins\\ with no class_alias()\n", + $checked, + count($pluginDirs) +); +exit(0); diff --git a/windowskey/class/windowskey.class.php b/windowskey/class/windowskey.class.php index 6ab869ab..c22e6599 100644 --- a/windowskey/class/windowskey.class.php +++ b/windowskey/class/windowskey.class.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Windowskey; + /** * The Windows Keys class. * diff --git a/windowskey/class/windowskeyassociation.class.php b/windowskey/class/windowskeyassociation.class.php index f6bb49e1..9e143781 100644 --- a/windowskey/class/windowskeyassociation.class.php +++ b/windowskey/class/windowskeyassociation.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Windowskey; + /** * The association between images and windows keys. * diff --git a/windowskey/class/windowskeyassociationmanager.class.php b/windowskey/class/windowskeyassociationmanager.class.php index 7a7baae8..81b630c1 100644 --- a/windowskey/class/windowskeyassociationmanager.class.php +++ b/windowskey/class/windowskeyassociationmanager.class.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Windowskey; + /** * Windows keys association manager class. * diff --git a/windowskey/class/windowskeymanager.class.php b/windowskey/class/windowskeymanager.class.php index 8694eb94..ed50917a 100644 --- a/windowskey/class/windowskeymanager.class.php +++ b/windowskey/class/windowskeymanager.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Windowskey; + /** * Windows Key manager mass management class * diff --git a/windowskey/hooks/addwindowskeyapi.hook.php b/windowskey/hooks/addwindowskeyapi.hook.php index bc26bb83..b1860796 100644 --- a/windowskey/hooks/addwindowskeyapi.hook.php +++ b/windowskey/hooks/addwindowskeyapi.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Windowskey; + /** * Injects windows key stuff into the api system. * diff --git a/windowskey/hooks/addwindowskeyimage.hook.php b/windowskey/hooks/addwindowskeyimage.hook.php index 128f5831..01a2d616 100644 --- a/windowskey/hooks/addwindowskeyimage.hook.php +++ b/windowskey/hooks/addwindowskeyimage.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Windowskey; + /** * Adds the windows keys choice to image. * diff --git a/windowskey/hooks/addwindowskeyjs.hook.php b/windowskey/hooks/addwindowskeyjs.hook.php index 1c392a4a..93bb7cf1 100644 --- a/windowskey/hooks/addwindowskeyjs.hook.php +++ b/windowskey/hooks/addwindowskeyjs.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Windowskey; + /** * Sets the javascript files up for this plugin. * diff --git a/windowskey/hooks/addwindowskeymenuitem.hook.php b/windowskey/hooks/addwindowskeymenuitem.hook.php index 9b3d3986..8c45f2bd 100644 --- a/windowskey/hooks/addwindowskeymenuitem.hook.php +++ b/windowskey/hooks/addwindowskeymenuitem.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Windowskey; + /** * Adds the windows keys menu item. * diff --git a/windowskey/hooks/changehostkey.hook.php b/windowskey/hooks/changehostkey.hook.php index dd2c988e..ec8b51da 100644 --- a/windowskey/hooks/changehostkey.hook.php +++ b/windowskey/hooks/changehostkey.hook.php @@ -11,6 +11,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Windowskey; + /** * Adds the windows key in the image to the host on * deploy completion. diff --git a/windowskey/hooks/windowskeydeletemassitems.hook.php b/windowskey/hooks/windowskeydeletemassitems.hook.php index 20455796..8803e69a 100644 --- a/windowskey/hooks/windowskeydeletemassitems.hook.php +++ b/windowskey/hooks/windowskeydeletemassitems.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Windowskey; + /** * Deletes the WindowsKey the elements en-mass. * diff --git a/windowskey/pages/windowskeymanagement.page.php b/windowskey/pages/windowskeymanagement.page.php index 1b62051f..2a19609b 100644 --- a/windowskey/pages/windowskeymanagement.page.php +++ b/windowskey/pages/windowskeymanagement.page.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Windowskey; + /** * Windows Keys management page. * diff --git a/windowskey/reports/windowskey_report.report.php b/windowskey/reports/windowskey_report.report.php index 2001a3cb..a935f688 100644 --- a/windowskey/reports/windowskey_report.report.php +++ b/windowskey/reports/windowskey_report.report.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Windowskey; + /** * Windows Key report. * diff --git a/wolbroadcast/class/wolbroadcast.class.php b/wolbroadcast/class/wolbroadcast.class.php index 9d8f559b..b461f5c4 100644 --- a/wolbroadcast/class/wolbroadcast.class.php +++ b/wolbroadcast/class/wolbroadcast.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Wolbroadcast; + /** * Wolbroadcast Class handler. * diff --git a/wolbroadcast/class/wolbroadcastmanager.class.php b/wolbroadcast/class/wolbroadcastmanager.class.php index f656d2c6..c45b5bdf 100644 --- a/wolbroadcast/class/wolbroadcastmanager.class.php +++ b/wolbroadcast/class/wolbroadcastmanager.class.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Wolbroadcast; + /** * Manager class for wolbroadcast * diff --git a/wolbroadcast/hooks/addbroadcastaddresses.hook.php b/wolbroadcast/hooks/addbroadcastaddresses.hook.php index 4cba9578..e8ae5ba9 100644 --- a/wolbroadcast/hooks/addbroadcastaddresses.hook.php +++ b/wolbroadcast/hooks/addbroadcastaddresses.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Wolbroadcast; + /** * Adds Broadcast addresses to wol info. * diff --git a/wolbroadcast/hooks/addwolbroadcastapi.hook.php b/wolbroadcast/hooks/addwolbroadcastapi.hook.php index 05061417..edde2c8f 100644 --- a/wolbroadcast/hooks/addwolbroadcastapi.hook.php +++ b/wolbroadcast/hooks/addwolbroadcastapi.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Wolbroadcast; + /** * Injects wol broadcast stuff into the api system. * diff --git a/wolbroadcast/hooks/addwolbroadcastjs.hook.php b/wolbroadcast/hooks/addwolbroadcastjs.hook.php index cebe7dd9..d37ab564 100644 --- a/wolbroadcast/hooks/addwolbroadcastjs.hook.php +++ b/wolbroadcast/hooks/addwolbroadcastjs.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Wolbroadcast; + /** * Sets the javascript files up for this plugin. * diff --git a/wolbroadcast/hooks/addwolbroadcastmenuitem.hook.php b/wolbroadcast/hooks/addwolbroadcastmenuitem.hook.php index c31114cd..6930edc1 100644 --- a/wolbroadcast/hooks/addwolbroadcastmenuitem.hook.php +++ b/wolbroadcast/hooks/addwolbroadcastmenuitem.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Wolbroadcast; + /** * Adds the wol menu item. * diff --git a/wolbroadcast/hooks/addwolbroadcasttype.hook.php b/wolbroadcast/hooks/addwolbroadcasttype.hook.php index 955fe3ca..b9774ff7 100644 --- a/wolbroadcast/hooks/addwolbroadcasttype.hook.php +++ b/wolbroadcast/hooks/addwolbroadcasttype.hook.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Wolbroadcast; + /** * Adds Broadcast type for export. * diff --git a/wolbroadcast/pages/wolbroadcastmanagement.page.php b/wolbroadcast/pages/wolbroadcastmanagement.page.php index 69b9ac00..874db36d 100644 --- a/wolbroadcast/pages/wolbroadcastmanagement.page.php +++ b/wolbroadcast/pages/wolbroadcastmanagement.page.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Wolbroadcast; + /** * The wol broadcast page. * diff --git a/wolbroadcast/reports/wolbroadcast_report.report.php b/wolbroadcast/reports/wolbroadcast_report.report.php index 67a32be4..f284135f 100644 --- a/wolbroadcast/reports/wolbroadcast_report.report.php +++ b/wolbroadcast/reports/wolbroadcast_report.report.php @@ -10,6 +10,9 @@ * @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @link https://fogproject.org */ + +namespace FOG\Plugins\Wolbroadcast; + /** * WOL Broadcast report. *