Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
+62
-15
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Plugin Model
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @since 25 Jul 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -172,8 +172,8 @@ class _Plugin extends \IPS\Node\Model
|
||||
public function form( &$form )
|
||||
{
|
||||
$form->addHeader( 'plugin_details' );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'plugin_name', $this->name, TRUE, array( 'maxLength' => 255 ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'plugin_location', $this->location, FALSE, array( 'disabled' => $this->_id ? TRUE : FALSE, 'maxLength' => 32, 'regex' => '/^[a-z0-9]*$/i' ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'plugin_name', $this->name, TRUE, array( 'maxLength' => 32 ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'plugin_location', $this->location, FALSE, array( 'disabled' => $this->_id ? TRUE : FALSE, 'maxLength' => 32, 'regex' => '/^[a-z][a-z0-9]*$/i' ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Url( 'plugin_update_check', $this->update_check ) );
|
||||
|
||||
$form->addHeader( 'plugin_author_details' );
|
||||
@@ -221,7 +221,7 @@ CODE;
|
||||
\file_put_contents( \IPS\ROOT_PATH . "/plugins/{$values['plugin_location']}/settings.rename.php", $defaultSettings );
|
||||
\file_put_contents( \IPS\ROOT_PATH . "/plugins/{$values['plugin_location']}/dev/jslang.php", "<?php\n\n\$lang = array(\n\n\n\n);\n" );
|
||||
\file_put_contents( \IPS\ROOT_PATH . "/plugins/{$values['plugin_location']}/dev/lang.php", "<?php\n\n\$lang = array(\n\n\n\n);\n" );
|
||||
\file_put_contents( \IPS\ROOT_PATH . "/plugins/{$values['plugin_location']}/dev/versions.json", json_encode( array( '10000' => '1.0.0' ) ) );
|
||||
\file_put_contents( \IPS\ROOT_PATH . "/plugins/{$values['plugin_location']}/dev/versions.json", json_encode( array() ) );
|
||||
\file_put_contents( \IPS\ROOT_PATH . "/plugins/{$values['plugin_location']}/dev/setup/install.php", preg_replace( '/(<\?php\s)\/*.+?\*\//s', '$1', str_replace(
|
||||
array(
|
||||
'{version_human} Upgrade',
|
||||
@@ -264,6 +264,9 @@ CODE;
|
||||
/* Clear templates to rebuild automatically */
|
||||
\IPS\Theme::deleteCompiledTemplate();
|
||||
|
||||
/* Make all disk template caches stale */
|
||||
\IPS\Theme::resetAllCacheKeys();
|
||||
|
||||
/* Clear javascript map to rebuild automatically */
|
||||
unset( \IPS\Data\Store::i()->javascript_file_map, \IPS\Data\Store::i()->javascript_map );
|
||||
}
|
||||
@@ -367,6 +370,12 @@ CODE;
|
||||
'title' => 'developer_mode',
|
||||
'link' => \IPS\Http\Url::internal( "app=core&module=applications&controller=plugins&do=developer&id={$this->_id}" ),
|
||||
);
|
||||
|
||||
$buttons['download'] = array(
|
||||
'icon' => 'download',
|
||||
'title' => 'download',
|
||||
'link' => \IPS\Http\Url::internal( "app=core&module=applications&controller=plugins&do=download&id={$this->_id}" ),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -446,9 +455,12 @@ CODE;
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
\IPS\Theme::removeTemplates( 'core', 'global', 'plugins', $this->id );
|
||||
\IPS\Theme::removeCss( 'core', 'front', 'custom', $this->id );
|
||||
\IPS\Theme::removeResources( 'core', 'global', 'plugins', $this->id );
|
||||
\IPS\Theme::removeTemplates( 'core', 'global', 'plugins', $this->id, TRUE );
|
||||
\IPS\Theme::removeCss( 'core', 'front', 'custom', $this->id, TRUE );
|
||||
\IPS\Theme::removeResources( 'core', 'global', 'plugins', $this->id, TRUE );
|
||||
|
||||
/* Make all disk template caches stale */
|
||||
\IPS\Theme::resetAllCacheKeys();
|
||||
|
||||
/* Get which templates need recompiling */
|
||||
$recompileTemplates = array();
|
||||
@@ -512,6 +524,15 @@ CODE;
|
||||
\IPS\Db::i()->update( 'core_widget_areas', array( 'widgets' => json_encode( $newWidgets ) ), array( 'id=?', $area['id'] ) );
|
||||
}
|
||||
|
||||
/* Call onOtherUninstall so that other applications may perform any necessary cleanup */
|
||||
foreach( \IPS\Application::allExtensions( 'core', 'Uninstall', FALSE ) as $extension )
|
||||
{
|
||||
if( method_exists( $extension, 'onOtherUninstall' ) )
|
||||
{
|
||||
$extension->onOtherUninstall( NULL, $this->id );
|
||||
}
|
||||
}
|
||||
|
||||
unset( \IPS\Data\Store::i()->settings );
|
||||
|
||||
/* Write the data file */
|
||||
@@ -585,12 +606,15 @@ CODE;
|
||||
{
|
||||
$contents = '';
|
||||
|
||||
$depth = 0;
|
||||
$inHereDoc = NULL;
|
||||
$inThemeHooks = FALSE;
|
||||
$depth = 0;
|
||||
$inHereDoc = NULL;
|
||||
$inThemeHooks = FALSE;
|
||||
$inComments = FALSE;
|
||||
|
||||
$fh = fopen( $file, 'r' );
|
||||
while ( $line = fgets( $fh ) )
|
||||
{
|
||||
/* Are we inside a theme hook? */
|
||||
if ( $inThemeHooks )
|
||||
{
|
||||
$inThemeHooks = !( trim( $line ) == '/* End Hook Data */' );
|
||||
@@ -599,11 +623,34 @@ CODE;
|
||||
{
|
||||
$inThemeHooks = ( trim( $line ) == '/* !Hook Data - DO NOT REMOVE */' );
|
||||
}
|
||||
|
||||
if ( !$inThemeHooks )
|
||||
|
||||
/* Are we inside comments? */
|
||||
$skipLastLine = FALSE;
|
||||
if ( $inComments )
|
||||
{
|
||||
$openBraces = mb_substr_count( $line, '{' );
|
||||
$closeBraces = mb_substr_count( $line, '}' );
|
||||
$inComments = !( mb_substr( rtrim( $line ), -2 ) == '*/' );
|
||||
|
||||
if( mb_substr( rtrim( $line ), -2 ) == '*/' )
|
||||
{
|
||||
$skipLastLine = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$inComments = ( mb_substr( ltrim( $line ), 0, 2 ) == '/*' AND mb_substr( rtrim( $line ), -2 ) != '*/');
|
||||
}
|
||||
|
||||
/* If this line is commented out, we should ignore it */
|
||||
if( mb_substr( ltrim( $line ), 0, 2 ) == '//' OR $inComments OR $skipLastLine )
|
||||
{
|
||||
$contents .= $line;
|
||||
}
|
||||
else if ( !$inThemeHooks )
|
||||
{
|
||||
/* Remove anything in quotes as they may contain braces as this confuses the open/close brace count */
|
||||
$bracesCheck = preg_replace( '#([\'"])(?:(?!\1|\\\).|\\\.)+?\1#', '', $line );
|
||||
$openBraces = mb_substr_count( $bracesCheck, '{' );
|
||||
$closeBraces = mb_substr_count( $bracesCheck, '}' );
|
||||
|
||||
$depth += $openBraces;
|
||||
$depth -= $closeBraces;
|
||||
|
||||
Reference in new issue
Block a user