if (!empty($this->pageIDs)) {
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('pageID IN (?)', [$this->pageIDs]);
- $sql = "SELECT pageID
- FROM wcf".WCF_N."_page
+ $sql = "SELECT pageID
+ FROM wcf".WCF_N."_page
" . $conditionBuilder;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
if (!empty($this->pageIDs)) {
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('pageID IN (?)', [$this->pageIDs]);
- $sql = "SELECT pageID
- FROM wcf".WCF_N."_page
+ $sql = "SELECT pageID
+ FROM wcf".WCF_N."_page
" . $conditionBuilder;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
/**
* Reads basic page parameters controlling type and i18n.
*
- * @throws IllegalLinkException
+ * @throws IllegalLinkException
*/
protected function readPageType() {
if (!empty($_REQUEST['isMultilingual'])) $this->isMultilingual = 1;
/**
* Validates page type.
*
- * @throws UserInputException
+ * @throws UserInputException
*/
protected function validatePageType() {
if (!in_array($this->pageType, Page::$availablePageTypes) || $this->pageType == 'system') {
/**
* Validates parent page id.
*
- * @throws UserInputException
+ * @throws UserInputException
*/
protected function validateParentPageID() {
if ($this->parentPageID) {
/**
* Validates package id.
*
- * @throws UserInputException
+ * @throws UserInputException
*/
protected function validateApplicationPackageID() {
if (!isset($this->availableApplications[$this->applicationPackageID])) {
/**
* Validates custom urls.
*
- * @throws UserInputException
+ * @throws UserInputException
*/
protected function validateCustomUrl() {
foreach ($this->customURL as $type => $customURL) {
/**
* Validates box ids.
*
- * @throws UserInputException
+ * @throws UserInputException
*/
protected function validateBoxIDs() {
foreach ($this->boxIDs as $boxID) {
/**
* Prepares box to page assignments
*
- * @return mixed[]
+ * @return mixed[]
*/
protected function getBoxToPage() {
$boxToPage = [];
/**
* @inheritDoc
*
- * @throws IllegalLinkException
+ * @throws IllegalLinkException
*/
public function readParameters() {
parent::readParameters();
* @package com.woltlab.wcf
* @subpackage data
* @category Community Framework
- * @since 2.2
+ * @since 2.2
*/
interface ITitledLinkObject extends ILinkableObject, ITitledObject {}
* @package com.woltlab.wcf
* @subpackage data.bbcode
* @category Community Framework
- *
+ *
* @property-read integer $bbcodeID
* @property-read string $bbcodeTag
* @property-read integer $packageID
* @property-read string $htmlOpen
* @property-read string $htmlClose
* @property-read string $className
- * @property-read integer $isBlockElement
+ * @property-read integer $isBlockElement
* @property-read string $wysiwygIcon
* @property-read string $buttonLabel
* @property-read integer $isSourceCode
use wcf\data\menu\Menu;
use wcf\data\menu\MenuCache;
use wcf\data\object\type\ObjectTypeCache;
+use wcf\system\box\IBoxController;
use wcf\system\box\IConditionBoxController;
use wcf\system\condition\ConditionHandler;
use wcf\data\page\Page;
/**
* Returns the box controller.
*
- * @return \wcf\system\box\IBoxController
+ * @return IBoxController
*/
public function getController() {
if ($this->controller === null && $this->objectTypeID) {
/**
* Returns the template name of this box.
*
- * @param integer $languageID
- * @return string
+ * @param integer $languageID
+ * @return string
*/
public function getTplName($languageID = null) {
if ($this->boxType == 'tpl') {
/**
* Returns box to page assignments.
*
- * @return integer[]
+ * @return integer[]
*/
public function getPageIDs() {
if ($this->pageIDs === null) {
- $sql = "SELECT pageID
- FROM wcf" . WCF_N . "_box_to_page
- WHERE boxID = ?";
+ $sql = "SELECT pageID
+ FROM wcf" . WCF_N . "_box_to_page
+ WHERE boxID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([$this->boxID]);
/**
* Returns the main menu or null.
*
- * @return Menu|null menu object
+ * @return Menu|null menu object
*/
public function getMainMenu() {
return $this->getMenuByID(MenuCacheBuilder::getInstance()->getData([], 'mainMenuID'));
WCF::getDB()->beginTransaction();
// unmark existing landing page
- $sql = "UPDATE wcf".WCF_N."_page
- SET isLandingPage = ?";
+ $sql = "UPDATE wcf".WCF_N."_page
+ SET isLandingPage = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([
0
]);
// set current page as landing page
- $sql = "UPDATE wcf".WCF_N."_page
- SET isLandingPage = ?
- WHERE pageID = ?";
+ $sql = "UPDATE wcf".WCF_N."_page
+ SET isLandingPage = ?
+ WHERE pageID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([
1,
/**
* Returns box to page assignments.
*
- * @return integer[]
+ * @return integer[]
*/
public function getBoxIDs() {
if ($this->boxIDs === null) {
- $sql = "SELECT boxID
- FROM wcf" . WCF_N . "_box_to_page
- WHERE pageID = ?";
+ $sql = "SELECT boxID
+ FROM wcf" . WCF_N . "_box_to_page
+ WHERE pageID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([$this->pageID]);
$this->boxIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
/**
* Returns the template name of this page.
*
- * @param integer $languageID
- * @return string
+ * @param integer $languageID
+ * @return string
*/
public function getTplName($languageID = null) {
if ($this->pageType == 'tpl') {
/**
* Returns the value of a generic phrase based upon a page's identifier.
*
- * @return string generic title
+ * @return string generic title
*/
protected function getGenericTitle() {
return WCF::getLanguage()->get('wcf.page.' . $this->identifier);
* @package com.woltlab.wcf
* @subpackage data.page
* @category Community Framework
- * @since 2.2
+ * @since 2.2
*/
class PageCache extends SingletonFactory {
/**
* Returns the localized page title by page id, optionally retrieving the title
* for given language id if it is a multilingual page.
*
- * @param integer $pageID page id
- * @param integer $languageID specific value by language id
- * @return string localized page title
+ * @param integer $pageID page id
+ * @param integer $languageID specific value by language id
+ * @return string localized page title
*/
public function getPageTitle($pageID, $languageID = null) {
if (isset($this->cache['pageTitles'][$pageID])) {
/**
* Returns the global landing page.
*
- * @return Page
+ * @return Page
*/
public function getLandingPage() {
return $this->cache['landingPage'];
}
// check if current user is ignored by target user
- $sql = "SELECT ignoreID
- FROM wcf".WCF_N."_user_ignore
- WHERE userID = ?
+ $sql = "SELECT ignoreID
+ FROM wcf".WCF_N."_user_ignore
+ WHERE userID = ?
AND ignoreUserID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([
UserStorageHandler::getInstance()->reset([WCF::getUser()->userID], 'ignoredUserIDs');
// check if target user is following the current user
- $sql = "SELECT *
- FROM wcf".WCF_N."_user_follow
- WHERE userID = ?
+ $sql = "SELECT *
+ FROM wcf".WCF_N."_user_follow
+ WHERE userID = ?
AND followUserID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([
/**
* Returns true if currently active request represents the landing page.
*
- * @return boolean
+ * @return boolean
*/
public static function isLandingPage() {
return RequestHandler::getInstance()->getActiveRequest()->isLandingPage();
/**
* Returns the main menu object.
*
- * @return Menu|null menu object
- * @since 2.2
+ * @return Menu|null menu object
+ * @since 2.2
*/
public function getFrontendMenu() {
return MenuCache::getInstance()->getMainMenu();
* are <iframe> or other embedded media that is allowed as a result of a bbcode, but
* not allowed to be directly provided by a user.
*
- * @author Alexander Ebert
- * @copyright 2001-2016 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package com.woltlab.wcf
- * @subpackage system.bbcode
- * @category Community Framework
- * @since 2.2
+ * @author Alexander Ebert
+ * @copyright 2001-2016 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.bbcode
+ * @category Community Framework
+ * @since 2.2
*/
class HtmlBBCodeParser extends BBCodeParser {
/**
/**
* Builds the bbcode output.
*
- * @param string $name bbcode identifier
- * @param array $attributes list of attributes
- * @return string parsed bbcode
+ * @param string $name bbcode identifier
+ * @param array $attributes list of attributes
+ * @return string parsed bbcode
*/
public function getHtmlOutput($name, array $attributes) {
if (isset($this->bbcodes[$name])) {
/**
* Builds a plain bbcode string, used for unknown bbcodes.
*
- * @param string $name bbcode identifier
- * @param array $attributes list of attributes
- * @param boolean $openingTagOnly only render the opening tag
- * @return string
+ * @param string $name bbcode identifier
+ * @param array $attributes list of attributes
+ * @param boolean $openingTagOnly only render the opening tag
+ * @return string
*/
public function buildBBCodeTag($name, $attributes, $openingTagOnly = false) {
if (!empty($attributes)) {
/**
* Returns the list of bbcodes that represent block elements.
*
- * @return string[] list of bbcode block elements
+ * @return string[] list of bbcode block elements
*/
public function getBlockBBCodes() {
$bbcodes = [];
/**
* Returns the list of bbcodes that represent source code elements.
*
- * @return string[] list of bbcode source code elements
+ * @return string[] list of bbcode source code elements
*/
public function getSourceBBCodes() {
$bbcodes = [];
/**
* Compiles tag fragments into the custom HTML element.
*
- * @param array $openingTag opening tag data
- * @param string $content content between opening and closing tag
- * @param array $closingTag closing tag data
- * @return string custom HTML element
+ * @param array $openingTag opening tag data
+ * @param string $content content between opening and closing tag
+ * @param array $closingTag closing tag data
+ * @return string custom HTML element
*/
protected function compileTag(array $openingTag, $content, array $closingTag) {
return $this->buildOpeningTag($openingTag) . $content . $this->buildClosingTag($closingTag);
/**
* Returns true if provided name is a valid bbcode identifier.
*
- * @param string $name bbcode identifier
- * @return boolean true if provided name is a valid bbcode identifier
+ * @param string $name bbcode identifier
+ * @return boolean true if provided name is a valid bbcode identifier
*/
protected function isValidBBCodeName($name) {
return preg_match($this->validBBCodePattern, $name) === 1;
/**
* Returns the database object of this box.
*
- * @return Box
+ * @return Box
*/
public function getBox();
/**
* Filters given user ids.
*
- * @param integer[] $userIDs
+ * @param integer[] $userIDs
*/
protected function filterUserIDs(&$userIDs) {
// does nothing, can be overwritten by child classes
* @package com.woltlab.wcf
* @subpackage system.cache.builder
* @category Community Framework
- * @since 2.2
+ * @since 2.2
*/
class PageCacheBuilder extends AbstractCacheBuilder {
/**
$data['pages'] = $pageList->getObjects();
// get page titles
- $sql = "SELECT pageID, languageID, title
- FROM wcf".WCF_N."_page_content";
+ $sql = "SELECT pageID, languageID, title
+ FROM wcf".WCF_N."_page_content";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute();
while ($row = $statement->fetchArray()) {
/**
* Reverts the object's text to the given EditHistoryEntry.
*
- * @param EditHistoryEntry $edit
+ * @param EditHistoryEntry $edit
*/
public function revertVersion(EditHistoryEntry $edit);
* Transforms bbcode markers into the custom HTML element `<woltlab-metacode>`. This process
* outputs well-formed markup with proper element nesting.
*
- * @author Alexander Ebert
- * @copyright 2001-2016 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package com.woltlab.wcf
- * @subpackage system.html.input.node
- * @category Community Framework
- * @since 2.2
+ * @author Alexander Ebert
+ * @copyright 2001-2016 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.html.input.node
+ * @category Community Framework
+ * @since 2.2
*/
class HtmlInputNodeWoltlabMetacodeMarker extends AbstractHtmlNode {
/**
* list of bbcodes that represent block elements
- * @var string[]
+ * @var string[]
*/
public $blockElements = [];
/**
* list of bbcodes that represent source code elements
- * @var string[]
+ * @var string[]
*/
public $sourceElements = [];
/**
* Transforms bbcode markers inside source code elements into their plain bbcode representation.
*
- * @param array $pairs list of bbcode marker pairs
- * @return array filtered list of bbcode marker pairs
+ * @param array $pairs list of bbcode marker pairs
+ * @return array filtered list of bbcode marker pairs
*/
protected function revertMarkerInsideCodeBlocks(array $pairs) {
$isInsideCode = function(\DOMElement $element) {
/**
* Builds the list of paired bbcode markers.
*
- * @param \DOMElement[] $elements list of marker elements
- * @return array list of paired bbcode markers
+ * @param \DOMElement[] $elements list of marker elements
+ * @return array list of paired bbcode markers
*/
protected function buildPairs(array $elements) {
$pairs = [];
/**
* Validates bbcode marker pairs to include both an opening and closing element.
*
- * @param array $pairs list of paired bbcode markers
- * @return array filtered list of paired bbcode markers
+ * @param array $pairs list of paired bbcode markers
+ * @return array filtered list of paired bbcode markers
*/
protected function validatePairs(array $pairs) {
foreach ($pairs as $uuid => $data) {
/**
* Groups bbcode marker pairs by their common bbcode identifier.
*
- * @param array $pairs list of paired bbcode markers
- * @return array grouped list of bbcode marker pairs
+ * @param array $pairs list of paired bbcode markers
+ * @return array grouped list of bbcode marker pairs
*/
protected function groupPairsByName(array $pairs) {
$groups = [];
/**
* Converts bbcode marker pairs into block- or inline-elements.
*
- * @param array $groups grouped list of bbcode marker pairs
+ * @param array $groups grouped list of bbcode marker pairs
*/
protected function convertGroups(array $groups) {
// process source elements first
/**
* Converts a block-level bbcode marker pair.
*
- * @param string $name bbcode identifier
- * @param \DOMElement $start start node
- * @param \DOMElement $end end node
- * @param string $attributes encoded attribute string
+ * @param string $name bbcode identifier
+ * @param \DOMElement $start start node
+ * @param \DOMElement $end end node
+ * @param string $attributes encoded attribute string
*/
protected function convertBlockElement($name, $start, $end, $attributes) {
// we need to ensure proper nesting, block elements are not allowed to
/**
* Converts an inline bbcode marker pair.
*
- * @param string $name bbcode identifier
- * @param \DOMElement $start start node
- * @param \DOMElement $end end node
- * @param string $attributes encoded attribute string
+ * @param string $name bbcode identifier
+ * @param \DOMElement $start start node
+ * @param \DOMElement $end end node
+ * @param string $attributes encoded attribute string
*/
protected function convertInlineElement($name, $start, $end, $attributes) {
if ($start->parentNode === $end->parentNode) {
* node and all previous siblings will be added to the element. The reverse takes place if
* `$endNode` is `null`.
*
- * @param string $name element tag name
- * @param string $attributes encoded attribute string
- * @param \DOMElement|null $startNode first node to wrap
- * @param \DOMElement|null $endNode last node to wrap
- * @return \DOMElement newly created element
+ * @param string $name element tag name
+ * @param string $attributes encoded attribute string
+ * @param \DOMElement|null $startNode first node to wrap
+ * @param \DOMElement|null $endNode last node to wrap
+ * @return \DOMElement newly created element
*/
protected function wrapContent($name, $attributes, $startNode, $endNode) {
if ($startNode === null && $endNode === null) {
/**
* Returns true if provided node is a block element.
*
- * @param \DOMNode $node node
- * @return boolean true for certain block elements
+ * @param \DOMNode $node node
+ * @return boolean true for certain block elements
*/
protected function isBlockElement(\DOMNode $node) {
switch ($node->nodeName) {
* Converts a bbcode marker pair into their plain bbcode representation. This method is used
* to convert markers inside source code elements.
*
- * @param array $pair bbcode marker pair
+ * @param array $pair bbcode marker pair
*/
protected function convertToBBCode(array $pair) {
/** @var \DOMElement $start */
*
* The fragment must be inserted into your returned DOM element.
*
- * @param \DOMDocumentFragment $fragment fragment containing all child nodes, must be appended to returned element
- * @param array $attributes list of attributes
- * @return \DOMElement new DOM element
+ * @param \DOMDocumentFragment $fragment fragment containing all child nodes, must be appended to returned element
+ * @param array $attributes list of attributes
+ * @return \DOMElement new DOM element
*/
public function convert(\DOMDocumentFragment $fragment, array $attributes);
/**
* Validates attributes before any DOM modification occurs.
*
- * @param array $attributes list of attributes
- * @return boolean false if attributes did not match the converter's expectation
+ * @param array $attributes list of attributes
+ * @return boolean false if attributes did not match the converter's expectation
*/
public function validateAttributes(array $attributes);
}
* @return integer
*/
protected function getItemOrder($position) {
- $sql = "SELECT MAX(showOrder) AS showOrder
+ $sql = "SELECT MAX(showOrder) AS showOrder
FROM wcf".WCF_N."_box
- WHERE position = ?";
+ WHERE position = ?";
$statement = WCF::getDB()->prepareStatement($sql, 1);
$statement->execute([$position]);
}
// save visibility exceptions
- $sql = "DELETE FROM wcf".WCF_N."_box_to_page
- WHERE boxID = ?";
+ $sql = "DELETE FROM wcf".WCF_N."_box_to_page
+ WHERE boxID = ?";
$deleteStatement = WCF::getDB()->prepareStatement($sql);
- $sql = "INSERT IGNORE wcf".WCF_N."_box_to_page
+ $sql = "INSERT IGNORE wcf".WCF_N."_box_to_page
(boxID, pageID, visible)
VALUES (?, ?, ?)";
$insertStatement = WCF::getDB()->prepareStatement($sql);
// get page ids
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('identifier IN (?)', [$pages]);
- $sql = "SELECT pageID
- FROM wcf".WCF_N."_page
+ $sql = "SELECT pageID
+ FROM wcf".WCF_N."_page
".$conditionBuilder;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
}
// handle visibility exceptions
- $sql = "DELETE FROM wcf".WCF_N."_box_to_page
- WHERE boxID = ?";
+ $sql = "DELETE FROM wcf".WCF_N."_box_to_page
+ WHERE boxID = ?";
$deleteStatement = WCF::getDB()->prepareStatement($sql);
- $sql = "INSERT IGNORE wcf".WCF_N."_box_to_page
+ $sql = "INSERT IGNORE wcf".WCF_N."_box_to_page
(boxID, pageID, visible)
- VALUES (?, ?, ?)";
+ VALUES (?, ?, ?)";
$insertStatement = WCF::getDB()->prepareStatement($sql);
foreach ($this->boxData as $identifier => $data) {
// connect box with menu
// get page ids
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('identifier IN (?)', [$this->visibilityExceptions[$identifier]]);
- $sql = "SELECT pageID
- FROM wcf" . WCF_N . "_page
+ $sql = "SELECT pageID
+ FROM wcf" . WCF_N . "_page
" . $conditionBuilder;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
* @package com.woltlab.wcf
* @subpackage system.page
* @category Community Framework
- * @since 2.2
+ * @since 2.2
*/
class PageLocationManager extends SingletonFactory {
/**
* Appends a parent location to the stack, the later it is added the lower
* is its assumed priority when matching suitable menu items.
*
- * @param string $identifier internal page identifier
- * @param integer $pageObjectID page object id
- * @param ITitledLinkObject $locationObject optional label for breadcrumbs usage
+ * @param string $identifier internal page identifier
+ * @param integer $pageObjectID page object id
+ * @param ITitledLinkObject $locationObject optional label for breadcrumbs usage
* @throws SystemException
*/
public function addParentLocation($identifier, $pageObjectID = 0, ITitledLinkObject $locationObject = null) {
* @param string $application application identifier
* @param string $controller url controller
* @param boolean $isAcpRequest true if this is an ACP request
- * @return mixed array containing className, controller and pageType or a string containing the controller name for aliased controllers
+ * @return mixed array containing className, controller and pageType or a string containing the controller name for aliased controllers
* @throws SystemException
*/
public function resolve($application, $controller, $isAcpRequest) {
/**
* Returns true if currently active request represents the landing page.
*
- * @param string[] $classData
- * @param array $metaData
- * @return boolean
+ * @param string[] $classData
+ * @param array $metaData
+ * @return boolean
*/
public function isLandingPage(array $classData, array $metaData) {
if ($classData['className'] !== $this->landingPages['wcf'][2]) {
<?php
namespace wcf\system\search;
+use wcf\data\search\ISearchResultObject;
use wcf\form\IForm;
use wcf\system\database\util\PreparedStatementConditionBuilder;
* Returns the object with the given object id.
*
* @param integer $objectID
- * @return \wcf\data\search\ISearchResultObject
+ * @return ISearchResultObject
*/
public function getObject($objectID);
/**
* Shows the form part of this object type.
*
- * @param \wcf\form\IForm $form instance of the form class where the search has taken place
+ * @param IForm $form instance of the form class where the search has taken place
*/
public function show(IForm $form = null);
/**
* Returns the search conditions of this message type.
*
- * @param \wcf\form\IForm $form
- * @return \wcf\system\database\util\PreparedStatementConditionBuilder
+ * @param IForm $form
+ * @return PreparedStatementConditionBuilder
*/
public function getConditions(IForm $form = null);
* Replaces the outer SQL query with a custom version. Querying the search index requires the
* placeholder {WCF_SEARCH_INNER_JOIN} within an empty INNER JOIN() statement.
*
- * @param string $q
- * @param \wcf\system\database\util\PreparedStatementConditionBuilder $searchIndexConditions
- * @param \wcf\system\database\util\PreparedStatementConditionBuilder $additionalConditions
+ * @param string $q
+ * @param PreparedStatementConditionBuilder $searchIndexConditions
+ * @param PreparedStatementConditionBuilder $additionalConditions
* @return string
*/
public function getOuterSQLQuery($q, PreparedStatementConditionBuilder &$searchIndexConditions = null, PreparedStatementConditionBuilder &$additionalConditions = null);
/**
* Sets the location in menu/breadcrumbs.
*
- * @since 2.2
+ * @since 2.2
*/
public function setLocation();
/**
* Suffix used to tell ACP and frontend cookies apart
*
- * @param string $cookieSuffix cookie suffix
+ * @param string $cookieSuffix cookie suffix
*/
public function setCookieSuffix($cookieSuffix) {
$this->cookieSuffix = $cookieSuffix;
/**
* Provides helper methods to work with PHP's DOM implementation.
*
- * @author Alexander Ebert
- * @copyright 2001-2016 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package com.woltlab.wcf
- * @subpackage util
- * @category Community Framework
+ * @author Alexander Ebert
+ * @copyright 2001-2016 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage util
+ * @category Community Framework
*/
final class DOMUtil {
/**
* Moves all child nodes from given element into a document fragment.
*
- * @param \DOMElement $element element
- * @return \DOMDocumentFragment document fragment containing all child nodes from `$element`
+ * @param \DOMElement $element element
+ * @return \DOMDocumentFragment document fragment containing all child nodes from `$element`
*/
public static function childNodesToFragment(\DOMElement $element) {
$fragment = $element->ownerDocument->createDocumentFragment();
/**
* Returns true if `$ancestor` contains the node `$node`.
*
- * @param \DOMNode $ancestor ancestor node
- * @param \DOMNode $node node
- * @return boolean true if `$ancestor` contains the node `$node`
+ * @param \DOMNode $ancestor ancestor node
+ * @param \DOMNode $node node
+ * @return boolean true if `$ancestor` contains the node `$node`
*/
public static function contains(\DOMNode $ancestor, \DOMNode $node) {
// nodes cannot contain themselves
/**
* Returns the common ancestor of both nodes.
*
- * @param \DOMNode $node1 first node
- * @param \DOMNode $node2 second node
- * @return \DOMElement|null common ancestor or null
+ * @param \DOMNode $node1 first node
+ * @param \DOMNode $node2 second node
+ * @return \DOMElement|null common ancestor or null
*/
public static function getCommonAncestor(\DOMNode $node1, \DOMNode $node2) {
// abort if both elements share a common element or are both direct descendants
* Returns the immediate parent element before provided ancenstor element. Returns null if
* the ancestor element is the direct parent of provided node.
*
- * @param \DOMNode $node node
- * @param \DOMElement $ancestor ancestor node
- * @return \DOMElement|null immediate parent element before ancestor element
+ * @param \DOMNode $node node
+ * @param \DOMElement $ancestor ancestor node
+ * @return \DOMElement|null immediate parent element before ancestor element
*/
public static function getParentBefore(\DOMNode $node, \DOMElement $ancestor) {
if ($node->parentNode === $ancestor) {
/**
* Returns the parent node of given node.
*
- * @param \DOMNode $node node
- * @return \DOMNode parent node, can be `\DOMElement` or `\DOMDocument`
+ * @param \DOMNode $node node
+ * @return \DOMNode parent node, can be `\DOMElement` or `\DOMDocument`
*/
public static function getParentNode(\DOMNode $node) {
return ($node->parentNode) ?: $node->ownerDocument;
/**
* Returns all ancestors nodes for given node.
*
- * @param \DOMNode $node node
- * @param boolean $reverseOrder reversing the order causes the most top ancestor to appear first
- * @return \DOMElement[] list of ancestor nodes
+ * @param \DOMNode $node node
+ * @param boolean $reverseOrder reversing the order causes the most top ancestor to appear first
+ * @return \DOMElement[] list of ancestor nodes
*/
public static function getParents(\DOMNode $node, $reverseOrder = false) {
$parents = [];
/**
* Determines the relative position of two nodes to each other.
*
- * @param \DOMNode $node1 first node
- * @param \DOMNode $node2 second node
- * @return string
+ * @param \DOMNode $node1 first node
+ * @param \DOMNode $node2 second node
+ * @return string
*/
public static function getRelativePosition(\DOMNode $node1, \DOMNode $node2) {
if ($node1->ownerDocument !== $node2->ownerDocument) {
/**
* Inserts given DOM node after the reference node.
*
- * @param \DOMNode $node node
- * @param \DOMNode $refNode reference node
+ * @param \DOMNode $node node
+ * @param \DOMNode $refNode reference node
*/
public static function insertAfter(\DOMNode $node, \DOMNode $refNode) {
if ($refNode->nextSibling) {
/**
* Inserts given node before the reference node.
*
- * @param \DOMNode $node node
- * @param \DOMNode $refNode reference node
+ * @param \DOMNode $node node
+ * @param \DOMNode $refNode reference node
*/
public static function insertBefore(\DOMNode $node, \DOMNode $refNode) {
self::getParentNode($refNode)->insertBefore($node, $refNode);
/**
* Returns true if this node is empty.
*
- * @param \DOMNode $node node
- * @return boolean true if node is empty
+ * @param \DOMNode $node node
+ * @return boolean true if node is empty
*/
public static function isEmpty(\DOMNode $node) {
if ($node->nodeType === XML_TEXT_NODE) {
/**
* Returns true if given node is the first node of its given ancestor.
*
- * @param \DOMNode $node node
- * @param \DOMElement $ancestor ancestor element
- * @return boolean true if `$node` is the first node of its given ancestor
+ * @param \DOMNode $node node
+ * @param \DOMElement $ancestor ancestor element
+ * @return boolean true if `$node` is the first node of its given ancestor
*/
public static function isFirstNode(\DOMNode $node, \DOMElement $ancestor) {
if ($node->previousSibling === null) {
/**
* Returns true if given node is the last node of its given ancestor.
*
- * @param \DOMNode $node node
- * @param \DOMElement $ancestor ancestor element
- * @return boolean true if `$node` is the last node of its given ancestor
+ * @param \DOMNode $node node
+ * @param \DOMElement $ancestor ancestor element
+ * @return boolean true if `$node` is the last node of its given ancestor
*/
public static function isLastNode(\DOMNode $node, \DOMElement $ancestor) {
if ($node->nextSibling === null) {
* Returns true if provided element is a void element. Void elements are elements
* that neither contain content nor have a closing tag, such as `<br>`.
*
- * @param \DOMElement $element element
- * @return boolean true if provided element is a void element
+ * @param \DOMElement $element element
+ * @return boolean true if provided element is a void element
*/
public static function isVoidElement(\DOMElement $element) {
if (preg_match('~^(area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$~', $element->nodeName)) {
* in which nodes will be considered for moving is determined by the logical position
* of `$lastElement`.
*
- * @param \DOMElement $container destination element
- * @param \DOMElement $lastElement last element to move
- * @param \DOMElement $commonAncestor common ancestor of `$container` and `$lastElement`
+ * @param \DOMElement $container destination element
+ * @param \DOMElement $lastElement last element to move
+ * @param \DOMElement $commonAncestor common ancestor of `$container` and `$lastElement`
*/
public static function moveNodesInto(\DOMElement $container, \DOMElement $lastElement, \DOMElement $commonAncestor) {
if (!self::contains($commonAncestor, $container)) {
/**
* Prepends a node to provided element.
*
- * @param \DOMNode $node node
- * @param \DOMElement $element target element
+ * @param \DOMNode $node node
+ * @param \DOMElement $element target element
*/
public static function prepend(\DOMNode $node, \DOMElement $element) {
if ($element->firstChild === null) {
/**
* Removes a node, optionally preserves the child nodes if `$node` is an element.
*
- * @param \DOMNode $node target node
- * @param boolean $preserveChildNodes preserve child nodes, only supported for elements
+ * @param \DOMNode $node target node
+ * @param boolean $preserveChildNodes preserve child nodes, only supported for elements
*/
public static function removeNode(\DOMNode $node, $preserveChildNodes = false) {
if ($preserveChildNodes) {
/**
* Replaces a DOM element with another, preserving all child nodes by default.
*
- * @param \DOMElement $oldElement old element
- * @param \DOMElement $newElement new element
- * @param boolean $preserveChildNodes true if child nodes should be moved, otherwise they'll be implicitly removed
+ * @param \DOMElement $oldElement old element
+ * @param \DOMElement $newElement new element
+ * @param boolean $preserveChildNodes true if child nodes should be moved, otherwise they'll be implicitly removed
*/
public static function replaceElement(\DOMElement $oldElement, \DOMElement $newElement, $preserveChildNodes = true) {
self::insertBefore($newElement, $oldElement);
* extraction of DOM parts while preserving nesting for both the extracted nodes
* and the remaining siblings.
*
- * @param \DOMNode $node reference node
- * @param \DOMElement $ancestor ancestor element that should not be split
- * @param boolean $splitBefore true if nodes before `$node` should be moved into a new node, false to split nodes after `$node`
- * @return \DOMElement parent node containing `$node`, direct child of `$ancestor`
+ * @param \DOMNode $node reference node
+ * @param \DOMElement $ancestor ancestor element that should not be split
+ * @param boolean $splitBefore true if nodes before `$node` should be moved into a new node, false to split nodes after `$node`
+ * @return \DOMElement parent node containing `$node`, direct child of `$ancestor`
*/
public static function splitParentsUntil(\DOMNode $node, \DOMElement $ancestor, $splitBefore = true) {
if (!self::contains($ancestor, $node)) {