Skip to content

Commit 589e650

Browse files
author
Matthias Schmidt
committed
Fix code for several codeboxes
1 parent d9666a7 commit 589e650

File tree

4 files changed

+39
-39
lines changed

4 files changed

+39
-39
lines changed

docs/php/api/sitemaps.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ Other optional methods are:
2727
As an example, the implementation for users looks like this:
2828

2929
{jinja{ codebox(
30-
"php",
31-
"php/api/sitemaps/UserSitemapObject.class.php",
32-
"files/lib/system/sitemap/object/UserSitemapObject.class.php"
30+
title="files/lib/system/sitemap/object/UserSitemapObject.class.php",
31+
language="php",
32+
filepath="php/api/sitemaps/UserSitemapObject.class.php"
3333
) }}
3434

3535
Next, the sitemap object must be registered as an object type:

docs/php/api/user_notifications.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@ WoltLab Suite includes a powerful user notification system that supports notific
88
For any type of object related to events, you have to define an object type for the object type definition `com.woltlab.wcf.notification.objectType`:
99

1010
{jinja{ codebox(
11-
"xml",
12-
"php/api/user_notifications/objectType.xml",
13-
"objectType.xml"
11+
title="objectType.xml",
12+
language="xml",
13+
filepath="php/api/user_notifications/objectType.xml"
1414
) }}
1515

1616
The referenced class `FooUserNotificationObjectType` has to implement the [IUserNotificationObjectType](https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/system/user/notification/object/type/IUserNotificationObjectType.class.php) interface, which should be done by extending [AbstractUserNotificationObjectType](https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/system/user/notification/object/type/AbstractUserNotificationObjectType.class.php).
1717

1818
{jinja{ codebox(
19-
"php",
20-
"php/api/user_notifications/FooUserNotificationObjectType.class.php",
21-
"files/lib/system/user/notification/object/type/FooUserNotificationObjectType.class.php"
19+
title="files/lib/system/user/notification/object/type/FooUserNotificationObjectType.class.php",
20+
language="php",
21+
filepath="php/api/user_notifications/FooUserNotificationObjectType.class.php"
2222
) }}
2323

2424
You have to set the class names of the database object (`$objectClassName`) and the related list (`$objectListClassName`).
2525
Additionally, you have to create a class that implements the [IUserNotificationObject](https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/system/user/notification/object/IUserNotificationObject.class.php) whose name you have to set as the value of the `$decoratorClassName` property.
2626

2727
{jinja{ codebox(
28-
"php",
29-
"php/api/user_notifications/FooUserNotificationObject.class.php",
30-
"files/lib/system/user/notification/object/FooUserNotificationObject.class.php"
28+
title="files/lib/system/user/notification/object/FooUserNotificationObject.class.php",
29+
language="php",
30+
filepath="php/api/user_notifications/FooUserNotificationObject.class.php"
3131
) }}
3232

3333
- The `getTitle()` method returns the title of the object.
@@ -44,19 +44,19 @@ Each event that you fire in your package needs to be registered using the [user
4444
An example file might look like this:
4545

4646
{jinja{ codebox(
47-
"xml",
48-
"php/api/user_notifications/userNotificationEvent.xml",
49-
"userNotificationEvent.xml"
47+
title="userNotificationEvent.xml",
48+
language="xml",
49+
filepath="php/api/user_notifications/userNotificationEvent.xml"
5050
) }}
5151

5252
Here, you reference the user notification object type created via `objectType.xml`.
5353
The referenced class in the `<classname>` element has to implement the [IUserNotificationEvent](https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/system/user/notification/event/IUserNotificationEvent.class.php) interface by extending the [AbstractUserNotificationEvent](https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/system/user/notification/event/AbstractUserNotificationEvent.class.php) class or the [AbstractSharedUserNotificationEvent](https://github.com/WoltLab/WCF/blob/master/wcfsetup/install/files/lib/system/user/notification/event/AbstractSharedUserNotificationEvent.class.php) class if you want to pre-load additional data before processing notifications.
5454
In `AbstractSharedUserNotificationEvent::prepare()`, you can, for example, tell runtime caches to prepare to load certain objects which then are loaded all at once when the objects are needed.
5555

5656
{jinja{ codebox(
57-
"php",
58-
"php/api/user_notifications/FooUserNotificationEvent.class.php",
59-
"files/lib/system/user/notification/event/FooUserNotificationEvent.class.php"
57+
title="files/lib/system/user/notification/event/FooUserNotificationEvent.class.php",
58+
language="php",
59+
filepath="php/api/user_notifications/FooUserNotificationEvent.class.php"
6060
) }}
6161

6262
- The `$stackable` property is `false` by default and has to be explicitly set to `true` if stacking of notifications should be enabled.

docs/php/code-style.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ $className = Example::class;
146146
Some database objects provide static getters, either if they are decorators or for a unique combination of database table columns, like `wcf\data\box\Box::getBoxByIdentifier()`:
147147

148148
{jinja{ codebox(
149-
"php",
150-
"php/code-style/Box.class.php",
151-
"files/lib/data/box/Box.class.php"
149+
title="files/lib/data/box/Box.class.php",
150+
language="php",
151+
filepath="php/code-style/Box.class.php"
152152
) }}
153153

154154
Such methods should always either return the desired object or `null` if the object does not exist.

docs/php/database-objects.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ Developers are required to provide the proper DatabaseObject implementations the
1010
The basic model derives from `wcf\data\DatabaseObject` and provides a convenient constructor to fetch a single row or construct an instance using pre-loaded rows.
1111

1212
{jinja{ codebox(
13-
"php",
14-
"php/database-objects/Example.class.php",
15-
"files/lib/data/example/Example.class.php"
13+
title="files/lib/data/example/Example.class.php",
14+
language="php",
15+
filepath="php/database-objects/Example.class.php"
1616
) }}
1717

1818
The class is intended to be empty by default and there only needs to be code if you want to add additional logic to your model. Both the class name and primary key are determined by `DatabaseObject` using the namespace and class name of the derived class. The example above uses the namespace `wcf\…` which is used as table prefix and the class name `Example` is converted into `exampleID`, resulting in the database table name `wcfN_example` with the primary key `exampleID`.
@@ -25,9 +25,9 @@ You can prevent this automatic guessing by setting the class properties `$databa
2525
If you already have a `DatabaseObject` class and would like to extend it with additional data or methods, for example by providing a class `ViewableExample` which features view-related changes without polluting the original object, you can use `DatabaseObjectDecorator` which a default implementation of a decorator for database objects.
2626

2727
{jinja{ codebox(
28-
"php",
29-
"php/database-objects/ViewableExample.class.php",
30-
"files/lib/data/example/ViewableExample.class.php"
28+
title="files/lib/data/example/ViewableExample.class.php",
29+
language="php",
30+
filepath="php/database-objects/ViewableExample.class.php"
3131
) }}
3232

3333
It is mandatory to set the static `$baseClass` property to the name of the decorated class.
@@ -43,9 +43,9 @@ You can access the decorated objects directly via `DatabaseObjectDecorator::getD
4343
Adding, editing and deleting models is done using the `DatabaseObjectEditor` class that decorates a `DatabaseObject` and uses its data to perform the actions.
4444

4545
{jinja{ codebox(
46-
"php",
47-
"php/database-objects/ExampleEditor.class.php",
48-
"files/lib/data/example/ExampleEditor.class.php"
46+
title="files/lib/data/example/ExampleEditor.class.php",
47+
language="php",
48+
filepath="php/database-objects/ExampleEditor.class.php"
4949
) }}
5050

5151
The editor class requires you to provide the fully qualified name of the model, that is the class name including the complete namespace. Database table name and index key will be pulled directly from the model.
@@ -103,9 +103,9 @@ $exampleEditor->delete();
103103
Every row is represented as a single instance of the model, but the instance creation deals with single rows only. Retrieving larger sets of rows would be quite inefficient due to the large amount of queries that will be dispatched. This is solved with the `DatabaseObjectList` object that exposes an interface to query the database table using arbitrary conditions for data selection. All rows will be fetched using a single query and the resulting rows are automatically loaded into separate models.
104104

105105
{jinja{ codebox(
106-
"php",
107-
"php/database-objects/ExampleList.class.php",
108-
"files/lib/data/example/ExampleList.class.php"
106+
title="files/lib/data/example/ExampleList.class.php",
107+
language="php",
108+
filepath="php/database-objects/ExampleList.class.php"
109109
) }}
110110

111111
The following code listing illustrates loading a large set of examples and iterating over the list to retrieve the objects.
@@ -163,9 +163,9 @@ $exampleList->decoratorClassName = \wcf\data\example\ViewableExample::class;
163163
Of course, you do not have to set the property after creating the list object, you can also set it by creating a dedicated class:
164164

165165
{jinja{ codebox(
166-
"php",
167-
"php/database-objects/ViewableExampleList.class.php",
168-
"files/lib/data/example/ViewableExampleList.class.php"
166+
title="files/lib/data/example/ViewableExampleList.class.php",
167+
language="php",
168+
filepath="php/database-objects/ViewableExampleList.class.php"
169169
) }}
170170

171171

@@ -179,9 +179,9 @@ Row creation and manipulation can be performed using the aforementioned `Databas
179179
The `AbstractDatabaseObjectAction` solves both problems by wrapping around the editor class and thus provide an additional layer between the action that should be taken and the actual process. The first problem is solved by a fixed set of events being fired, the second issue is addressed by having a single entry point for all data editing.
180180

181181
{jinja{ codebox(
182-
"php",
183-
"php/database-objects/ExampleAction.class.php",
184-
"files/lib/data/example/ExampleAction.class.php"
182+
title="files/lib/data/example/ExampleAction.class.php",
183+
language="php",
184+
filepath="php/database-objects/ExampleAction.class.php"
185185
) }}
186186

187187
### Executing an Action

0 commit comments

Comments
 (0)