Version 5.0.6
This commit is contained in:
1 parent
a3a4a9ccbd
commit
b89858b2ff
1214 files changed
+92828
-14859
No files matched your search
@@ -31,6 +31,7 @@ use IPS\Http\Url\Internal;
|
||||
use IPS\Output\Javascript;
|
||||
use IPS\Output\System as SystemOutput;
|
||||
use IPS\Session\Front;
|
||||
use IPS\Widget\Area;
|
||||
use OutOfRangeException;
|
||||
use RuntimeException;
|
||||
use UnderflowException;
|
||||
@@ -43,12 +44,18 @@ use function get_called_class;
|
||||
use function in_array;
|
||||
use function intval;
|
||||
use function is_array;
|
||||
use function json_encode;
|
||||
use function ob_start;
|
||||
use function stristr;
|
||||
use function strlen;
|
||||
use function strpos;
|
||||
use function strstr;
|
||||
use function substr;
|
||||
use const JSON_HEX_AMP;
|
||||
use const JSON_HEX_APOS;
|
||||
use const JSON_HEX_TAG;
|
||||
use const JSON_PRETTY_PRINT;
|
||||
use const JSON_UNESCAPED_SLASHES;
|
||||
use const LIVE_TOPICS_DEV;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
@@ -1165,7 +1172,17 @@ class Output
|
||||
/* VLE language bits now parseOutputForDisplay has run */
|
||||
if ( Lang::vleActive() )
|
||||
{
|
||||
$output = str_replace( '<!--ipsVleWords-->', 'var ipsVle = ' . json_encode( Member::loggedIn()->language()->vleForJson(), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS ) . ';', $output );
|
||||
if ( str_contains( $output, "<!--ipsVleWords-->" ) )
|
||||
{
|
||||
$vleObj = json_encode( Member::loggedIn()->language()->vleForJson(), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS );
|
||||
$vleScriptContent = <<<JS
|
||||
|
||||
window.ipsVle = window.ipsVle || {};
|
||||
Object.assign(window.ipsVle, $vleObj);
|
||||
JS;
|
||||
|
||||
$output = str_replace( '<!--ipsVleWords-->', $vleScriptContent, $output );
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for any autosave cookies */
|
||||
@@ -1615,6 +1632,37 @@ class Output
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load any areas that should be displayed on all pages
|
||||
* For example, the global footer is always loaded
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function loadGlobalAreas() : void
|
||||
{
|
||||
foreach( Db::i()->select( '*', 'core_widget_areas', [ 'app=? and module=? and controller=?', 'global', 'global', 'global'] ) as $row )
|
||||
{
|
||||
if( in_array( $row['area'], Area::$reservedAreas ) )
|
||||
{
|
||||
if( $row['tree'] )
|
||||
{
|
||||
$area = new Area( json_decode( $row['tree'], true ), $row['area'] );
|
||||
}
|
||||
elseif( $row['widgets'] )
|
||||
{
|
||||
$area = Area::create( $row['area'], json_decode( $row['widgets'], true ) );
|
||||
}
|
||||
|
||||
if( isset( $area ) )
|
||||
{
|
||||
$this->sidebar['widgetareas'] = $this->sidebar['widgetareas'] ?? [];
|
||||
$this->sidebar['widgetareas'][$area->id] = $area;
|
||||
$this->sidebar['widgets'][$area->id] = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks and rebuilds JS map if it is broken
|
||||
*
|
||||
|
||||
@@ -41,6 +41,7 @@ class Datetime
|
||||
{
|
||||
$return = array();
|
||||
$return['pre'] = '$val = ( ' . $data . ' instanceof \IPS\DateTime ) ? ' . $data . ' : \IPS\DateTime::ts( ' . $data . ' );';
|
||||
$useTitle = isset( $options['notitle'] ) ? "useTitle: false" : "useTitle: true";
|
||||
|
||||
if( isset( $options['dateonly'] ) )
|
||||
{
|
||||
@@ -52,15 +53,15 @@ class Datetime
|
||||
}
|
||||
elseif ( isset( $options['lowercase'] ) )
|
||||
{
|
||||
$return['return'] = '$val->html(FALSE)';
|
||||
$return['return'] = '$val->html(FALSE, ' . $useTitle . ')';
|
||||
}
|
||||
elseif ( isset( $options['short'] ) )
|
||||
{
|
||||
$return['return'] = '$val->html(TRUE, TRUE)';
|
||||
$return['return'] = '$val->html(TRUE, TRUE, ' . $useTitle . ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$return['return'] = '$val->html()';
|
||||
$return['return'] = '$val->html(' . $useTitle . ')';
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
||||
@@ -64,6 +64,9 @@ class Theme
|
||||
case 'custom_css_for_output':
|
||||
return "\IPS\Theme::i()->getCustomCssForOutput()";
|
||||
|
||||
case 'custom_css_for_theme_editor_codebox':
|
||||
return "\IPS\Theme::i()->getCustomCssForThemeEditorCodebox()";
|
||||
|
||||
case 'custom_css':
|
||||
return "\IPS\Theme::i()->custom_css";
|
||||
|
||||
@@ -92,7 +95,14 @@ class Theme
|
||||
return "\IPS\Theme::i()->getLayoutValue('{$variable}')";
|
||||
}
|
||||
|
||||
return ( array_key_exists( $data, SystemTheme::i()->settings ) ) ? "\IPS\Theme::i()->settings['{$data}']" : '';
|
||||
/* If we are still here, this is legacy syntax; treat it as a variable */
|
||||
$cssVariables = SystemTheme::i()->getCssVariables();
|
||||
if( array_key_exists( $data, $cssVariables ) )
|
||||
{
|
||||
return "\IPS\Theme::i()->getParsedCssVariableFromKey( '{$data}' )";
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
catch( InvalidArgumentException $e )
|
||||
{
|
||||
|
||||
@@ -99,11 +99,11 @@ abstract class Comment
|
||||
* Add custom sort options to the content table for this class
|
||||
* @note $comment will ALWAYS be null.
|
||||
*
|
||||
* @param BaseItem|null $comment
|
||||
* @param BaseComment|null $comment
|
||||
* @param Content $table
|
||||
* @return array
|
||||
*/
|
||||
public function contentTableSortOptions( ?BaseItem $comment, Content $table ) : array
|
||||
public function contentTableSortOptions( ?BaseComment $comment, Content $table ) : array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
@@ -114,12 +114,12 @@ abstract class Comment
|
||||
*
|
||||
* @note $comment will ALWAYS be null.
|
||||
*
|
||||
* @param BaseItem|null $comment
|
||||
* @param BaseComment|null $comment
|
||||
* @param Content $table
|
||||
* @param string $sortBy
|
||||
* @return string|null
|
||||
*/
|
||||
public function contentTableSortDirection( ?BaseItem $comment, Content $table, string $sortBy ) : string|null
|
||||
public function contentTableSortDirection( ?BaseComment $comment, Content $table, string $sortBy ) : string|null
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -128,11 +128,11 @@ abstract class Comment
|
||||
* Add custom filters to the content table for this class
|
||||
* @note $comment will ALWAYS be null.
|
||||
*
|
||||
* @param BaseItem|null $comment
|
||||
* @param BaseComment|null $comment
|
||||
* @param Content $table
|
||||
* @return array
|
||||
*/
|
||||
public function contentTableFilters( ?BaseItem $comment, Content $table ) : array
|
||||
public function contentTableFilters( ?BaseComment $comment, Content $table ) : array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
@@ -141,12 +141,26 @@ abstract class Comment
|
||||
* Add custom conditions to the where clause for a content table.
|
||||
* @note $comment will ALWAYS be null.
|
||||
*
|
||||
* @param BaseItem|null $comment
|
||||
* @param BaseComment|null $comment
|
||||
* @param Content $table
|
||||
* @return array
|
||||
*/
|
||||
public function contentTableWhere( ?BaseItem $comment, Content $table ) : array
|
||||
public function contentTableWhere( ?BaseComment $comment, Content $table ) : array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify the table rows before output
|
||||
*
|
||||
* @note $comment will always be null
|
||||
* @param BaseComment|null $comment
|
||||
* @param Content $table
|
||||
* @param array $rows
|
||||
* @return void
|
||||
*/
|
||||
public function contentTableGetRows( ?BaseComment $comment, Content $table, array &$rows ) : void
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -152,15 +152,32 @@ abstract class Item
|
||||
}
|
||||
|
||||
/**
|
||||
* Add custom conditions to the where clause for a content table.
|
||||
* Modify the where clause for a content table.
|
||||
* You can change existing where conditions, or add new ones
|
||||
*
|
||||
* @note $item will ALWAYS be null.
|
||||
*
|
||||
* @param BaseItem|null $item
|
||||
* @param Content $table
|
||||
* @return array
|
||||
* @param array $where
|
||||
* @return void
|
||||
*/
|
||||
public function contentTableWhere( ?BaseItem $item, Content $table ) : array
|
||||
public function contentTableWhere( ?BaseItem $item, Content $table, array &$where ) : void
|
||||
{
|
||||
return [];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify the table rows before output
|
||||
*
|
||||
* @note $item will always be null
|
||||
* @param BaseItem|null $item
|
||||
* @param Content $table
|
||||
* @param array $rows
|
||||
* @return void
|
||||
*/
|
||||
public function contentTableGetRows( ?BaseItem $item, Content $table, array &$rows ) : void
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,18 @@ abstract class MenuExtension
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a total notification count that will be displayed
|
||||
* on the mobile menu. Previously was just a report count,
|
||||
* now this allows for other extensions.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function mobileNotificationCount() : int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to add additional content to userbar
|
||||
*
|
||||
@@ -71,4 +83,27 @@ abstract class MenuExtension
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Add items to the Account Actions dropdown in the ACP member view
|
||||
*
|
||||
* @param MemberClass $member
|
||||
* @return array<MenuItem>
|
||||
*/
|
||||
public function acpAccountActionsMenu( MemberClass $member ) : array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return additional buttons that will be shown on the member list
|
||||
* Buttons should be constructed as an array typically used in ACP tables
|
||||
*
|
||||
* @param MemberClass $member
|
||||
* @return array<string,array>
|
||||
*/
|
||||
public function acpRowButtons( MemberClass $member ) : array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ namespace IPS\Output\UI;
|
||||
|
||||
|
||||
use IPS\Helpers\Form\FormAbstract;
|
||||
use IPS\Member\Club;
|
||||
use IPS\Node\Model;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
@@ -117,4 +118,45 @@ abstract class Node
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add elements to the Club Node form
|
||||
* This method returns all elements that will be added.
|
||||
* By default, all elements will be added in order at the end of the form.
|
||||
* To specify placement within the form, @see FormAbstract::setPosition().
|
||||
*
|
||||
* @param Model $node
|
||||
* @param Club $club
|
||||
* @return array<string,FormAbstract>
|
||||
*/
|
||||
public function clubFormElements( Model $node, Club $club ): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Any formatting necessary for custom fields added in clubFormElements
|
||||
*
|
||||
* @param Model $node
|
||||
* @param Club $club
|
||||
* @param array $values
|
||||
* @return array
|
||||
*/
|
||||
public function processClubForm( Model $node, Club $club, array $values ) : array
|
||||
{
|
||||
return $values;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the club Node form is saved
|
||||
*
|
||||
* @param Model $node
|
||||
* @param Club $club
|
||||
* @param array $values
|
||||
* @return void
|
||||
*/
|
||||
public function clubFormPostSave( Model $node, Club $club, array $values ): void
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user