Version 4.3.0

This commit is contained in:
Neo committed 2025-12-19 05:47:12 -08:00
1 parent 96997ddd8e
commit fe1acf984a
1349 files changed
+116159 -67711

No files matched your search

+58 -20
View File
@@ -245,14 +245,7 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
*/
public static function resetPath( $folderId )
{
try
{
$path = \IPS\cms\Pages\Folder::load( $folderId )->path;
}
catch ( \OutOfRangeException $ex )
{
throw new \OutOfRangeException;
}
$path = $folderId ? \IPS\cms\Pages\Folder::load( $folderId )->path : '';
$children = static::getChildren( $folderId );
@@ -502,10 +495,13 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
/**
* Removes all include objects from all pages
*
* @param boolean $url The URL to find and remove
* @param boolean $url The URL to find and remove
* @param NULL|int $storageConfiguration Delete the cached includes from an alternate storage configuration
* @note This method is called by \IPS\cms\extensions\core\FileStorage\Pages.php during a move, and in that process we want to remove resources
from the old storage configuration, not the new one (which is what happens when the configuration id is not passed in to \IPS\File and a move is in progress)
* @return void
*/
static public function deleteCachedIncludes( $url=NULL )
static public function deleteCachedIncludes( $url=NULL, $storageConfiguration=NULL )
{
/* Remove them all */
if ( $url === NULL )
@@ -516,7 +512,7 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
\IPS\Db::i()->update( 'cms_pages', array( 'page_js_css_objects' => NULL ) );
}
/* Remove from file system */
\IPS\File::getClass( 'cms_Pages')->deleteContainer('page_objects');
\IPS\File::getClass( $storageConfiguration ?: 'cms_Pages' )->deleteContainer('page_objects');
}
else
{
@@ -708,8 +704,9 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
{
$jsincludes[ $obj->key ] = \IPS\cms\Templates::readableGroupName( $obj->group ) . '/' . \IPS\cms\Templates::readableGroupName( $obj->title );
}
ksort( $jsincludes );
$return['page_includes_js'] = new \IPS\Helpers\Form\Select( 'page_includes_js', $item ? $item->js_includes : FALSE, FALSE, array( 'options' => $jsincludes, 'multiple' => true ), NULL, NULL, NULL, 'page_includes_js' );
$return['page_includes_js'] = new \IPS\Helpers\Form\CheckboxSet( 'page_includes_js', $item ? $item->js_includes : FALSE, FALSE, array( 'options' => $jsincludes, 'multiple' => true ), NULL, NULL, NULL, 'page_includes_js' );
}
if ( count( $css ) )
@@ -719,8 +716,9 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
{
$cssincludes[ $obj->key ] = \IPS\cms\Templates::readableGroupName( $obj->group ) . '/' . \IPS\cms\Templates::readableGroupName( $obj->title );
}
$return['page_includes_css'] = new \IPS\Helpers\Form\Select( 'page_includes_css', $item ? $item->css_includes : FALSE, FALSE, array( 'options' => $cssincludes, 'multiple' => true ), NULL, NULL, NULL, 'page_includes_css' );
ksort( $cssincludes );
$return['page_includes_css'] = new \IPS\Helpers\Form\CheckboxSet( 'page_includes_css', $item ? $item->css_includes : FALSE, FALSE, array( 'options' => $cssincludes, 'multiple' => true ), NULL, NULL, NULL, 'page_includes_css' );
}
}
@@ -754,7 +752,7 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
$tags['cms_tag_pages']['{pageurl="' . $page['page_full_path'] . '"}' ] = \IPS\Member::loggedIn()->language()->addToStack( static::$titleLangPrefix . $page['page_id'] );
}
$return['page_content'] = new \IPS\Helpers\Form\Codemirror( 'page_content', $item ? htmlentities( $item->content, \IPS\HTMLENTITIES, 'UTF-8', TRUE ) : NULL, FALSE, array( 'tags' => $tags, 'height' => 600 ), function( $val )
$return['page_content'] = new \IPS\Helpers\Form\Codemirror( 'page_content', $item ? htmlentities( $item->content, ENT_DISALLOWED, 'UTF-8', TRUE ) : NULL, FALSE, array( 'tags' => $tags, 'height' => 600 ), function( $val )
{
/* Test */
try
@@ -1063,6 +1061,14 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
/* Empty? Lets take a look and see if we need to compile anything */
if ( empty( $this->_data['js_css_objects'] ) )
{
/* Lock it up to prevent a race condition */
if ( \IPS\Theme::checkLock( "page_object_build" . $this->id ) )
{
return NULL;
}
\IPS\Theme::lock( "page_object_build" . $this->id );
if ( count( $this->js_includes ) )
{
/* Build a file object for each JS */
@@ -1107,6 +1113,8 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
$this->js_css_objects = json_encode( $return );
$this->save();
}
\IPS\Theme::unlock( "page_object_build" . $this->id );
}
else
{
@@ -1187,7 +1195,15 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
{
$contents = @file_get_contents( \IPS\ROOT_PATH . '/themes/cms/pages/' . $this->full_path );
$contents = preg_replace( '#^<ips:pages.+?/>(\r\n?|\n)#', '', $contents );
\IPS\Theme::runProcessFunction( \IPS\Theme::compileTemplate( $contents, $functionName, null, true ), $functionName );
try
{
\IPS\Theme::runProcessFunction( \IPS\Theme::compileTemplate( $contents, $functionName, null, true ), $functionName );
}
catch( \Exception $e )
{
\IPS\Log::log( $e, 'pages_error' );
return '';
}
}
else
{
@@ -1634,6 +1650,8 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
{
throw new \InvalidArgumentException( \IPS\Member::loggedIn()->language()->addToStack('content_err_page_save_exception', FALSE, array( 'sprintf' => \IPS\Member::loggedIn()->language()->addToStack( $ex->getMessage() ) ) ) );
}
\IPS\Content\Search\Index::i()->index( $this->item() );
}
/**
@@ -1760,7 +1778,7 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
preg_match_all( '/(.+?)='.$array[2].'(.+?)'.$array[2].'\s?/', $array[1], $submatches );
$plugin = array_shift( $submatches[1] );
$pluginClass = 'IPS\\Output\\Plugin\\' . ucfirst( $plugin );
$pluginClass = 'IPS\\Output\\Plugin\\' . mb_ucfirst( $plugin );
$value = array_shift( $submatches[2] );
$options = array();
@@ -1777,9 +1795,9 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
{
foreach ( \IPS\Application::applications() as $app )
{
if ( file_exists( \IPS\ROOT_PATH . "/applications/{$app->directory}/extensions/core/OutputPlugins/" . ucfirst( $plugin ) . ".php" ) )
if ( file_exists( \IPS\ROOT_PATH . "/applications/{$app->directory}/extensions/core/OutputPlugins/" . mb_ucfirst( $plugin ) . ".php" ) )
{
$pluginClass = 'IPS\\' . $app->directory . '\\extensions\\core\\OutputPlugins\\' . ucfirst( $plugin );
$pluginClass = 'IPS\\' . $app->directory . '\\extensions\\core\\OutputPlugins\\' . mb_ucfirst( $plugin );
}
}
}
@@ -2009,6 +2027,8 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
{
static::cleanUpDesignersModeFiles();
}
\IPS\Content\Search\Index::i()->removeFromSearchIndex( $this->item() );
}
/**
@@ -2063,6 +2083,8 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
}
}
catch( \Exception $e ) { }
\IPS\Content\Search\Index::i()->index( $this->item() );
}
/**
@@ -2084,7 +2106,7 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
if ( $this->full_path and \IPS\Theme::designersModeEnabled() )
{
static::exportDesignersMode( $this->id );
}
}
}
/**
@@ -2493,4 +2515,20 @@ class _Page extends \IPS\Node\Model implements \IPS\Node\Permissions
}
}
}
/**
* Get item
*
* @return \IPS\nexus\Package\Item
*/
public function item()
{
$data = array();
foreach ( $this->_data as $k => $v )
{
$data[ 'page_' . $k ] = $v;
}
return \IPS\cms\Pages\PageItem::constructFromData( $data );
}
}