This repository has been archived on 2024-08-19. You can view files and clone it, but cannot push or open issues or pull requests.
core/Zotlabs/Module
2018-07-25 10:19:19 +02:00
..
Admin
Settings
Achievements.php
Acl.php
Admin.php
Api.php
Appman.php
Apporder.php
Apps.php don't provide manage apps button when viewing all available 2018-07-05 22:03:41 -07:00
Article_edit.php
Articles.php
Attach.php
Authorize.php
Authtest.php
Block.php
Blocks.php
Bookmarks.php
Branchtopic.php
Cal.php
Card_edit.php add cancel button to editor, fix issue with autosave of categories 2018-05-10 20:54:48 -07:00
Cards.php
Cdav.php
Changeaddr.php
Channel.php apply changes to slider defaults across all modules that use buildQuery for updates 2018-06-15 15:21:19 -07:00
Chanview.php
Chat.php
Chatsvc.php
Cloud_tiles.php
Cloud.php
Common.php
Connect.php
Connections.php
Connedit.php
Contactgroup.php
Cover_photo.php imagick converter: -thumbnail doesn't preserve exif, -resize does 2018-06-26 17:19:32 -07:00
Dav.php
Defperms.php
Directory.php
Dirsearch.php
Display.php apply changes to slider defaults across all modules that use buildQuery for updates 2018-06-15 15:21:19 -07:00
Dreport.php
Editblock.php
Editlayout.php
Editpost.php
Editwebpage.php add cancel button to editor, fix issue with autosave of categories 2018-05-10 20:54:48 -07:00
Email_resend.php
Email_validation.php
Embedphotos.php
Events.php
Fbrowser.php
Feed.php
Fhublocs.php
File_upload.php
Filer.php
Filerm.php
Filestorage.php admin delete of files 2018-05-02 20:08:59 -07:00
Follow.php
Getfile.php
Go.php
Group.php
Hashtags.php
Hcard.php
Help.php
Home.php re-implement/refactor getQuotaInfo() on DAV storage 2018-06-14 20:40:25 -07:00
Hostxrd.php
Hq.php missing permission description 2018-05-21 09:25:57 +02:00
Impel.php
Import_items.php
Import.php
Invite.php
Item.php
Lang.php
Layouts.php
Like.php
Linkinfo.php
Lockview.php
Locs.php
Login.php refactor the 'where does the register link point?' logic 2018-05-14 19:19:25 -07:00
Logout.php
Lostpass.php
Magic.php query filter was a bit greedy 2018-07-19 09:21:14 +02:00
Mail.php
Manage.php mangled urls on redirects 2018-07-19 09:19:33 +02:00
Menu.php
Message.php
Mitem.php
Moderate.php
Mood.php
Network.php
New_channel.php
Nojs.php
Notes.php
Notifications.php
Notify.php
Oauth2testvehicle.php
Oauthinfo.php update response types 2018-05-21 19:34:03 -07:00
Ochannel.php
Oembed.php
Oep.php
Oexchange.php
Ofeed.php
Online.php
Owa.php
Page.php
Pconfig.php
Pdledit.php
Permcat.php
Photo.php Merge branch '3.6RC' 2018-07-25 10:19:19 +02:00
Photos.php
Ping.php
Poco.php
Poke.php
Post.php
Prate.php
Pretheme.php
Probe.php
Profile_photo.php
Profile.php
Profiles.php
Profperm.php
Pubsites.php
Pubstream.php apply changes to slider defaults across all modules that use buildQuery for updates 2018-06-15 15:21:19 -07:00
Randprof.php
Rate.php
Ratings.php
Ratingsearch.php
Rbmark.php
React.php
README.md
Regdir.php
Register.php refactor the 'where does the register link point?' logic 2018-05-14 19:19:25 -07:00
Regmod.php
Regver.php
Removeaccount.php
Removeme.php wrong default param for pubstream_incl (this checkin also picked up a few minor and hopefully non-significant changes) 2018-05-18 16:57:45 -07:00
Rmagic.php
Rpost.php
Search_ac.php
Search.php
Service_limits.php
Settings.php
Setup.php
Share.php
Sharedwithme.php
Siteinfo.php
Sitelist.php
Smilies.php
Snap.php
Sources.php
Sslify.php
Starred.php
Subthread.php
Suggest.php
Tagger.php
Tagrm.php
Tasks.php
Theme_info.php
Thing.php
Toggle_mobile.php
Toggle_safesearch.php
Token.php
Uexport.php
Update.php
View.php
Viewconnections.php
Viewsrc.php fix issue #1219 2018-06-09 16:38:15 +02:00
Wall_attach.php
Wall_upload.php
Webfinger.php
Webpages.php
Well_known.php
Wfinger.php
Wiki.php
Xchan.php
Xpoco.php
Xrd.php
Xref.php
Zfinger.php
Zotfeed.php
Zping.php

Zotlabs/Module

This directory contains controller modules for handling web requests. The lowercase class name indicates the head of the URL path which this module handles. There are other methods of attaching (routing) URL paths to controllers, but this is the primary method used in this project.

Module controllers MUST reside in this directory and namespace to be autoloaded (unless other specific routing methods are employed). They typically use and extend the class definition in Zotlabs/Web/Controller as a template.

Template:

<?php

namespace Zotlabs\Web;


class Controller {

	function init() {}
	function post() {}
	function get() {}

}

Typical Module declaration for the '/foo' URL route:

<?php
namespace Zotlabs\Module;

class Foo extends \Zotlabs\Web\Controller {

	function init() {
		// init() handler goes here
	}

	function post() {
		// post handler goes here
	}

	function get() {
		return 'Hello world.' . EOL;
	}

}

This model provides callbacks for public functions named init(), post(), and get(). init() is always called. post() is called if $_POST variables are present, and get() is called if none of the prior functions terminated the handler. The get() method typically retuns a string which represents the contents of the content region of the resulting page. Modules which emit json, xml or other machine-readable formats typically emit their contents inside the init() function and call 'killme()' to terminate the Module.

Modules are passed the URL path as argc,argv arguments. For a path such as

https://mysite.something/foo/bar/baz

The app will typically invoke the Module class 'Foo' and pass it

$x = argc(); // $x = 3

$x = argv(0); // $x = 'foo'
$x = argv(1); // $x = 'bar'
$x = argv(2); // $x = 'baz'

These are handled in a similar fashion to their counterparts in the Unix shell or C/C++ languages. Do not confuse the argc(),argv() functions with the global variables $argc,$argv which are passed to command line programs. These are handled separately by command line and Zotlabs/Daemon class functions.