Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Magic Template Class for advanced theme (designers) mode
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 06 Aug 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Theme\Advanced;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Advanced theming mode
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 06 Aug 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Theme\Advanced;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Magic Template Class for advanced theme (designers) mode
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 06 Aug 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Theme\Cache;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Magic Template Class for IN_DEV mode
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 18 Feb 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Theme\Dev;
|
||||
@@ -132,7 +131,7 @@ class _Template extends \IPS\Theme\Template
|
||||
$allowedScriptBlocks = array(
|
||||
'globalTemplate', 'blankTemplate', 'loginTemplate', 'includeJS', 'dashboard',
|
||||
'onlineUsers', 'registrations', 'viglink', 'linkedin', 'reddit', 'poll',
|
||||
'giftvoucherPrint', 'packingLabel', 'packingSheet', 'streamWrapper', 'embedExternal'
|
||||
'giftvoucherPrint', 'packingLabel', 'packingSheet', 'streamWrapper', 'embedExternal', 'embedInternal'
|
||||
);
|
||||
|
||||
/* Check we're not being naughty */
|
||||
@@ -148,7 +147,7 @@ class _Template extends \IPS\Theme\Template
|
||||
{
|
||||
trigger_error( "There is a inline JavaScript {$functionName}. Please move all JavaScript into JS files.", E_USER_ERROR );
|
||||
}
|
||||
if( !in_array( $bit, $allowedScriptBlocks ) and $this->templateName !== 'embed' and preg_match( "/<script((?!src).)*>/i", $output ) && $this->app != 'documentation' && $this->app != 'chat')
|
||||
if( !in_array( $bit, $allowedScriptBlocks ) and $this->templateName !== 'embed' and preg_match( "/<script((?!src).)*>/i", $output ) && $this->app != 'documentation' )
|
||||
{
|
||||
trigger_error( "There is a script block in {$functionName}. Please move all JavaScript into JS files.", E_USER_ERROR );
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief IN_DEV Skin Set
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 16 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Theme\Dev;
|
||||
@@ -320,7 +319,7 @@ class _Theme extends \IPS\Theme
|
||||
return \IPS\Settings::i()->base_url . "/applications/{$app}/interface/{$path}";
|
||||
}
|
||||
|
||||
$url = \IPS\Http\Url::createFromString( $baseUrl . str_replace( \IPS\ROOT_PATH . '/', '', static::_getResourcePath( $app, $location, $path ) ), false );
|
||||
$url = \IPS\Http\Url::createFromString( $baseUrl . str_replace( '\\', '/', str_replace( \IPS\ROOT_PATH . '/', '', static::_getResourcePath( $app, $location, $path ) ) ), false );
|
||||
if( $noProtocol and $url instanceof \IPS\Http\Url )
|
||||
{
|
||||
$url = $url->setScheme(NULL);
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Sameboxed Template
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 18 Feb 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Theme;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Setup Skin Set
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 25 Jun 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Theme\Setup;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Magic Template Class for BASIC mode
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 17 Oct 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Theme\System;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Basic template support
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 25 Jun 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Theme\System;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Template Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 18 Feb 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Theme;
|
||||
|
||||
+170
-59
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Skin Set
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 16 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS;
|
||||
@@ -196,6 +195,36 @@ class _Theme extends \IPS\Node\Model
|
||||
}
|
||||
return static::$setupSkin;
|
||||
}
|
||||
else if ( \IPS\RECOVERY_MODE )
|
||||
{
|
||||
if ( static::$memberTheme === NULL )
|
||||
{
|
||||
foreach( static::themes() as $theme )
|
||||
{
|
||||
if ( ! $theme->hasCustomizations() )
|
||||
{
|
||||
static::$memberTheme = $theme;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Still here because all themes are customized? */
|
||||
if ( static::$memberTheme === NULL )
|
||||
{
|
||||
$newTheme = new \IPS\Theme;
|
||||
$newTheme->permissions = \IPS\Member::loggedIn()->member_group_id;
|
||||
$newTheme->save();
|
||||
$newTheme->installThemeSettings();
|
||||
$newTheme->copyResourcesFromSet();
|
||||
|
||||
\IPS\Lang::saveCustom( 'core', "core_theme_set_title_" . $newTheme->id, "IPS Default" );
|
||||
|
||||
static::$memberTheme = $newTheme;
|
||||
}
|
||||
|
||||
return static::$memberTheme;
|
||||
}
|
||||
else if ( \IPS\Theme::designersModeEnabled() )
|
||||
{
|
||||
if ( \IPS\IN_DEV )
|
||||
@@ -517,11 +546,11 @@ class _Theme extends \IPS\Node\Model
|
||||
$paths = explode( '/', $file );
|
||||
$name = array_pop( $paths );
|
||||
$path = ( count( $paths ) ) ? implode( '/', $paths ) : '.';
|
||||
$cacheKey = $file . ',' . $app . ',' . $location;
|
||||
$cacheKey = $file . ',' . $app . ',' . $location . ',' . $this->_id;
|
||||
|
||||
if ( isset( $usedCss[ $cacheKey ] ) )
|
||||
if ( isset( static::$usedCss[ $cacheKey ] ) )
|
||||
{
|
||||
return $usedCss[ $cacheKey ];
|
||||
return static::$usedCss[ $cacheKey ];
|
||||
}
|
||||
|
||||
if ( $location === 'interface' )
|
||||
@@ -975,17 +1004,28 @@ class _Theme extends \IPS\Node\Model
|
||||
/**
|
||||
* Get sharer logo
|
||||
*
|
||||
* @return string|null
|
||||
* @return \IPS\Http\Url|string
|
||||
*/
|
||||
public function get_logo_sharer()
|
||||
{
|
||||
return $this->logoImage( 'sharer' );
|
||||
$url = $this->logoImage( 'sharer' );
|
||||
|
||||
if( $url !== '' AND !$url->data[ \IPS\Http\Url::COMPONENT_SCHEME ] )
|
||||
{
|
||||
$baseUrl = \IPS\Http\Url::createFromString( \IPS\Settings::i()->base_url );
|
||||
|
||||
return $url->setScheme( $baseUrl->data[ \IPS\Http\Url::COMPONENT_SCHEME ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get header logo
|
||||
*
|
||||
* @return string|null
|
||||
* @return \IPS\Http\Url|string
|
||||
*/
|
||||
public function get_logo_front()
|
||||
{
|
||||
@@ -995,7 +1035,7 @@ class _Theme extends \IPS\Node\Model
|
||||
/**
|
||||
* Get favicon logo
|
||||
*
|
||||
* @return string|null
|
||||
* @return \IPS\Http\Url|string
|
||||
*/
|
||||
public function get_logo_favicon()
|
||||
{
|
||||
@@ -1006,7 +1046,7 @@ class _Theme extends \IPS\Node\Model
|
||||
* Return logo image
|
||||
*
|
||||
* @param string $type Type of logo image
|
||||
* @return string|null
|
||||
* @return \IPS\Http\Url|string
|
||||
*/
|
||||
protected function logoImage( $type )
|
||||
{
|
||||
@@ -1082,6 +1122,27 @@ class _Theme extends \IPS\Node\Model
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $this->is_default or $this->is_acp_default )
|
||||
{
|
||||
if ( $this->is_default and $this->is_acp_default )
|
||||
{
|
||||
$message = 'default_no_parenthesis';
|
||||
}
|
||||
elseif ( $this->is_default )
|
||||
{
|
||||
$message = 'default_front_no_parenthesis';
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = 'default_acp_no_parenthesis';
|
||||
}
|
||||
|
||||
$badge = array(
|
||||
0 => 'positive ipsPos_right',
|
||||
1 => $message
|
||||
);
|
||||
}
|
||||
|
||||
if ( $this->update_data )
|
||||
{
|
||||
$data = json_decode( $this->update_data, TRUE );
|
||||
@@ -1106,26 +1167,6 @@ class _Theme extends \IPS\Node\Model
|
||||
);
|
||||
}
|
||||
}
|
||||
else if ( $this->is_default or $this->is_acp_default )
|
||||
{
|
||||
if ( $this->is_default and $this->is_acp_default )
|
||||
{
|
||||
$message = 'default_no_parenthesis';
|
||||
}
|
||||
elseif ( $this->is_default )
|
||||
{
|
||||
$message = 'default_front_no_parenthesis';
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = 'default_acp_no_parenthesis';
|
||||
}
|
||||
|
||||
$badge = array(
|
||||
0 => 'positive ipsPos_right',
|
||||
1 => $message
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $badge;
|
||||
@@ -1489,7 +1530,7 @@ class _Theme extends \IPS\Node\Model
|
||||
}
|
||||
}
|
||||
}
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'core_theme_set_editor_existing', $this->editor_skin, FALSE, array( 'options' => $skins ), NULL, NULL, NULL, 'core_theme_set_editor_existing' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'core_theme_set_editor_existing', $this->id ? $this->editor_skin : 'ips', FALSE, array( 'options' => $skins ), NULL, NULL, NULL, 'core_theme_set_editor_existing' ) );
|
||||
|
||||
if ( !\IPS\NO_WRITES and class_exists( 'ZipArchive', FALSE ) )
|
||||
{
|
||||
@@ -1521,9 +1562,10 @@ class _Theme extends \IPS\Node\Model
|
||||
}
|
||||
|
||||
$customTabs = array();
|
||||
foreach( \IPS\Db::i()->select( 'sc.*, sv.sv_value', array( 'core_theme_settings_fields', 'sc' ), array( 'sc.sc_set_id=?', $this->id ), 'sc_order' )
|
||||
->join( array( 'core_theme_settings_values', 'sv' ), 'sv.sv_id=sc.sc_id' ) as $data )
|
||||
{
|
||||
foreach( \IPS\Db::i()->select( 'sc.*, sv.sv_value', array( 'core_theme_settings_fields', 'sc' ), array( 'sc.sc_set_id=? AND app_enabled=1', $this->id ), 'sc_order' )
|
||||
->join( array( 'core_theme_settings_values', 'sv' ), 'sv.sv_id=sc.sc_id' )
|
||||
->join( array( 'core_applications', 'a' ), 'sc.sc_app=a.app_directory' )
|
||||
as $data ) {
|
||||
$customTabs[ $data['sc_tab_key'] ][] = $data;
|
||||
}
|
||||
|
||||
@@ -1642,6 +1684,9 @@ class _Theme extends \IPS\Node\Model
|
||||
$field = new $class( "core_theme_setting_title_{$row['sc_id']}", $value, false, $options, NULL, NULL, $suffix, 'theme_setting_' . $row['sc_key'] );
|
||||
}
|
||||
|
||||
$desc = $row['sc_title'] . '_desc';
|
||||
$field->description = \IPS\Member::loggedIn()->language()->addToStack( $desc, FALSE, array( 'returnBlank' => TRUE, 'returnInto' => \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->rowDesc( $desc, $field ) ) );
|
||||
|
||||
if ( \IPS\IN_DEV OR \IPS\Theme::designersModeEnabled() )
|
||||
{
|
||||
$field->label = \IPS\Theme::i()->getTemplate( 'customization', 'core', 'admin' )->themeSettingLabelWithKey( $row );
|
||||
@@ -1672,6 +1717,8 @@ class _Theme extends \IPS\Node\Model
|
||||
{
|
||||
$parentButtons[ $button['title'] ] = $button;
|
||||
}
|
||||
|
||||
unset( $parentButtons['edit']['data']['ipsDialog'], $parentButtons['edit']['data']['ipsDialog-title'] );
|
||||
|
||||
if ( $this->by_skin_gen AND \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'customization', 'theme_easy_editor' ) )
|
||||
{
|
||||
@@ -1697,7 +1744,6 @@ class _Theme extends \IPS\Node\Model
|
||||
|
||||
if ( ! $this->by_skin_gen )
|
||||
{
|
||||
unset( $parentButtons['edit']['data']['ipsDialog'],$parentButtons['edit']['data']['ipsDialog-title'] );
|
||||
$buttons['edit'] = $parentButtons['edit'];
|
||||
}
|
||||
|
||||
@@ -1854,7 +1900,7 @@ class _Theme extends \IPS\Node\Model
|
||||
unlink( $values['core_theme_set_editor_new'] );
|
||||
|
||||
/* IPS Cloud Resync */
|
||||
\IPS\IPS::resyncIPSCloud();
|
||||
\IPS\IPS::resyncIPSCloud('Added CKEditor theme');
|
||||
}
|
||||
|
||||
$dataChanged = false;
|
||||
@@ -1864,9 +1910,15 @@ class _Theme extends \IPS\Node\Model
|
||||
if ( $values['core_theme_set_logo'] )
|
||||
{
|
||||
$url = (string) $values['core_theme_set_logo'];
|
||||
$image = \IPS\Image::create( \IPS\File::get( 'core_Theme', $url )->contents() );
|
||||
|
||||
$this->_data['logo']['front'] = array( 'url' => $url, 'width' => $image->width, 'height' => $image->height );
|
||||
try
|
||||
{
|
||||
$image = \IPS\Image::create( \IPS\File::get( 'core_Theme', $url )->contents() );
|
||||
$this->_data['logo']['front'] = array( 'url' => $url, 'width' => $image->width, 'height' => $image->height );
|
||||
}
|
||||
catch ( \RuntimeException $e )
|
||||
{
|
||||
$this->_data['logo']['front'] = NULL;
|
||||
}
|
||||
|
||||
$dataChanged = true;
|
||||
}
|
||||
@@ -1880,9 +1932,15 @@ class _Theme extends \IPS\Node\Model
|
||||
if ( $values['core_theme_set_sharer_logo'] )
|
||||
{
|
||||
$url = (string) $values['core_theme_set_sharer_logo'];
|
||||
$image = \IPS\Image::create( \IPS\File::get( 'core_Theme', $url )->contents() );
|
||||
|
||||
$this->_data['logo']['sharer'] = array( 'url' => $url, 'width' => $image->width, 'height' => $image->height );
|
||||
try
|
||||
{
|
||||
$image = \IPS\Image::create( \IPS\File::get( 'core_Theme', $url )->contents() );
|
||||
$this->_data['logo']['sharer'] = array( 'url' => $url, 'width' => $image->width, 'height' => $image->height );
|
||||
}
|
||||
catch ( \RuntimeException $e )
|
||||
{
|
||||
$this->_data['logo']['sharer'] = NULL;
|
||||
}
|
||||
|
||||
$dataChanged = true;
|
||||
}
|
||||
@@ -2014,6 +2072,7 @@ class _Theme extends \IPS\Node\Model
|
||||
/* Designers mode needs specialist attention */
|
||||
if ( $creating and \IPS\Theme::designersModeEnabled() AND \IPS\IN_DEV === FALSE )
|
||||
{
|
||||
\IPS\Theme\Advanced\Theme::$buildingFiles = true;
|
||||
\IPS\Theme\Advanced\Theme::$currentThemeId = $this->id;
|
||||
|
||||
foreach( \IPS\Application::applications() as $app )
|
||||
@@ -2238,6 +2297,8 @@ class _Theme extends \IPS\Node\Model
|
||||
'sc_order' => $data['sc_order'],
|
||||
'sc_condition' => $data['sc_condition'],
|
||||
) );
|
||||
|
||||
\IPS\Db::i()->insert( 'core_theme_settings_values', array( 'sv_id' => $insertId, 'sv_value' => (string) $data['sc_default'] ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2278,6 +2339,7 @@ class _Theme extends \IPS\Node\Model
|
||||
$json[ $row['sc_key'] ] = $row['_value'];
|
||||
}
|
||||
|
||||
$this->_data['settings'] = $json;
|
||||
$this->template_settings = json_encode( $json );
|
||||
$this->save();
|
||||
}
|
||||
@@ -2443,7 +2505,6 @@ class _Theme extends \IPS\Node\Model
|
||||
if ( !class_exists( "IPS\\Theme\\{$data['class']}_tmp", FALSE ) )
|
||||
{
|
||||
/* Like code hooks, we should only attempt to load the files contents if it actually exists */
|
||||
/* @see https://community.invisionpower.com/4bugtrack/archived-reports/ipsipsmonkeypatch-r6333/ */
|
||||
if ( file_exists( \IPS\ROOT_PATH . '/' . $data['file'] ) )
|
||||
{
|
||||
try
|
||||
@@ -2699,8 +2760,8 @@ EOF;
|
||||
}
|
||||
|
||||
/* Unique key */
|
||||
$css['css_unique_key'] = md5( $data['set_id'] . ';' . $css['css_app'] . ';' . $css['css_location'] . ';' . $css['css_path'] . ';' . $css['css_name'] );
|
||||
|
||||
$css['css_unique_key'] = md5( $data['set_id'] . ';' . $css['css_added_to'] . ';' . $css['css_app'] . ';' . $css['css_location'] . ';' . $css['css_path'] . ';' . $css['css_name'] );
|
||||
|
||||
/* Test to make sure CSS isn't broken */
|
||||
try
|
||||
{
|
||||
@@ -2864,7 +2925,7 @@ EOF;
|
||||
}
|
||||
|
||||
/* Unique key */
|
||||
$template['template_unique_key'] = md5( $data['set_id'] . ';' . $template['template_app'] . ';' . $template['template_location'] . ';' . $template['template_group'] . ';' . mb_strtolower( $template['template_name'] ) );
|
||||
$template['template_unique_key'] = md5( $data['set_id'] . ';' . $template['template_added_to'] . ';' . $template['template_app'] . ';' . $template['template_location'] . ';' . $template['template_group'] . ';' . mb_strtolower( $template['template_name'] ) );
|
||||
|
||||
/* Test to make sure CSS isn't broken */
|
||||
try
|
||||
@@ -3685,6 +3746,32 @@ EOF;
|
||||
return array( 'templates' => $templates, 'css' => $css );
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this theme have any CSS/HTML/Resource customizations?
|
||||
* @note This will return true even if theme settings have been altered.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasCustomizations()
|
||||
{
|
||||
if ( \IPS\Db::i()->select( 'COUNT(*)', 'core_theme_css', array( 'css_set_id=? or css_added_to=?', $this->id, $this->id ) )->first() )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ( \IPS\Db::i()->select( 'COUNT(*)', 'core_theme_templates', array( 'template_set_id=? or template_added_to=?', $this->id, $this->id ) )->first() )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ( \IPS\Db::i()->select( 'COUNT(*)', 'core_theme_resources', array( 'resource_set_id=? and resource_user_edited=1', $this->id ) )->first() )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete compiled templates
|
||||
* Removes compiled templates bits for all themes that match the arguments
|
||||
@@ -4004,21 +4091,31 @@ EOF;
|
||||
/* Encode any {{PHP code}}, {$var}s and {tag=""} tags to stop phpQuery encoding it */
|
||||
$phpQueryI = 0;
|
||||
$phpQueryStore = array();
|
||||
$jsonAttrI = 0;
|
||||
$jsonAttrStore = array();
|
||||
|
||||
/* We sometimes need to use single quotes as the data attr contains json */
|
||||
$content = preg_replace_callback( "/([\d\w0-9-]+?)='\{([^']+?)\|raw\}'/", function( $matches ) use ( &$jsonAttrI, &$jsonAttrStore )
|
||||
{
|
||||
$jsonAttrStore[ ++$jsonAttrI ] = $matches;
|
||||
return $matches[1] . '="json--' . $jsonAttrI . '--"';
|
||||
}, $rawContent );
|
||||
|
||||
$content = preg_replace_callback( array( '/{{?(?>[^{}]|(?R))*}?}/', '/\{([a-z]+?=([\'"]).+?\\2 ?+)}/' ), function( $matches ) use ( &$phpQueryI, &$phpQueryStore )
|
||||
{
|
||||
$phpQueryStore[ ++$phpQueryI ] = $matches[0];
|
||||
return 'he-' . $phpQueryI . '--';
|
||||
}, $rawContent );
|
||||
|
||||
}, $content );
|
||||
|
||||
/* Swap out certain tags that confuse phpQuery */
|
||||
$content = preg_replace( '/<(\/)?(html|head|body)(>| (.+?))/', '<$1temp$2$3', $content );
|
||||
$content = str_replace( '<!DOCTYPE html>', '<tempdoctype></tempdoctype>', $content );
|
||||
|
||||
|
||||
/* Load phpQuery */
|
||||
require_once \IPS\ROOT_PATH . '/system/3rd_party/phpQuery/phpQuery.php';
|
||||
libxml_use_internal_errors(TRUE);
|
||||
$phpQuery = \phpQuery::newDocumentHTML( '<ipscontent id="ipscontent">' . $content . '</ipscontent>' );
|
||||
|
||||
|
||||
/* Loop through all the hooks on this template bit */
|
||||
foreach ( $hookData as $hook )
|
||||
{
|
||||
@@ -4040,7 +4137,7 @@ EOF;
|
||||
|
||||
/* Do stuff */
|
||||
$results = \pq( '#ipscontent ' . preg_replace( '/\b(html|head|body)\b/', 'temp$1', $hook['selector'] ) );
|
||||
|
||||
|
||||
switch ( $hook['type'] )
|
||||
{
|
||||
case 'add_before':
|
||||
@@ -4093,16 +4190,24 @@ EOF;
|
||||
}
|
||||
}
|
||||
|
||||
/* Put our {{PHP code}} back */
|
||||
$return = $phpQuery->find( '#ipscontent' )->html();
|
||||
|
||||
/* Put our single quoted data back */
|
||||
foreach( $jsonAttrStore as $id => $matches )
|
||||
{
|
||||
$return = preg_replace( '#' . $matches[1] . '="json--' . $id . '--"#', $matches[0], $return );
|
||||
}
|
||||
|
||||
/* Put our {{PHP code}} back */
|
||||
$return = preg_replace_callback( '/he-(.+?)--/', function( $matches ) use ( $phpQueryStore )
|
||||
{
|
||||
return isset( $phpQueryStore[ $matches[1] ] ) ? $phpQueryStore[ $matches[1] ] : '';
|
||||
}, $phpQuery->find( '#ipscontent' )->html() );
|
||||
}, $return );
|
||||
|
||||
/* Swap back certain tags that confuse phpQuery */
|
||||
$return = preg_replace( '/<(\/)?temp(html|head|body)(.*?)>/', '<$1$2$3>', $return );
|
||||
$return = str_replace( '<tempdoctype></tempdoctype>', '<!DOCTYPE html>', $return );
|
||||
|
||||
|
||||
/* Return */
|
||||
return $return;
|
||||
}
|
||||
@@ -4243,7 +4348,7 @@ EOF;
|
||||
{
|
||||
$content = $content . "\n<p id='elCopyright'>
|
||||
<span id='elCopyright_userLine'>{lang=\"copyright_line_value\"}</span>
|
||||
<a rel='nofollow' title='Community Software by Invision Power Services, Inc.' href='https://www.invisionpower.com/'>Community Software by Invision Power Services, Inc.</a><br><a href='http://ipbmafia.ru' style='display:none'>Поддержка IPS Community Suite 4 в России</a>
|
||||
<a rel='nofollow' title='Invision Community' href='https://www.invisioncommunity.com/'>Powered by Invision Community</a><br><a href='http://ipbmafia.ru' style='display:none'>Поддержка Invision Community в России</a>
|
||||
</p>";
|
||||
}
|
||||
|
||||
@@ -4673,7 +4778,7 @@ PHP;
|
||||
|
||||
/* Check for existing */
|
||||
$check = \IPS\Db::i()->select( 'template_id', 'core_theme_templates', array(
|
||||
'template_app=? AND template_location=? AND template_group=? AND template_name=LOWER(?) AND template_set_id=?',
|
||||
'template_app=? AND template_location=? AND template_group=? AND LOWER(template_name)=? AND template_set_id=?',
|
||||
mb_strtolower( $data['app'] ),
|
||||
mb_strtolower( $data['location'] ),
|
||||
mb_strtolower( $data['group'] ),
|
||||
@@ -4995,6 +5100,12 @@ PHP;
|
||||
*/
|
||||
public static function isUsingTemplateDiskCache()
|
||||
{
|
||||
if ( \IPS\CIC and ! \IPS\Settings::i()->theme_disk_cache_templates )
|
||||
{
|
||||
\IPS\Settings::i()->theme_disk_cache_templates = 1;
|
||||
\IPS\Settings::i()->theme_disk_cache_path = \IPS\ROOT_PATH . '/uploads';
|
||||
}
|
||||
|
||||
return \IPS\Settings::i()->theme_disk_cache_templates and \IPS\Settings::i()->theme_disk_cache_path and is_dir( \IPS\Settings::i()->theme_disk_cache_path );
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user