Version 5.0.0 beta 10
This commit is contained in:
1 parent
56979f8ee8
commit
264eeb97e0
325 files changed
+6442
-1849
No files matched your search
@@ -13,13 +13,16 @@ namespace IPS\Helpers\CoverPhoto;
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use Exception;
|
||||
use IPS\Content;
|
||||
use IPS\Dispatcher;
|
||||
use IPS\Dispatcher\Controller as DispatcherController;
|
||||
use IPS\Helpers\CoverPhoto;
|
||||
use IPS\Helpers\Form;
|
||||
use IPS\Helpers\Form\Upload;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Node\Model;
|
||||
use IPS\Output;
|
||||
use IPS\Output\UI\UiExtension;
|
||||
use IPS\Request;
|
||||
use IPS\Session;
|
||||
use IPS\Theme;
|
||||
@@ -59,7 +62,16 @@ abstract class Controller extends DispatcherController
|
||||
$photo->delete();
|
||||
}
|
||||
catch ( Exception $e ) { }
|
||||
$this->_coverPhotoSet( new CoverPhoto( $values['cover_photo'], 0 ), 'new' );
|
||||
|
||||
$coverPhoto = new CoverPhoto( $values['cover_photo'], 0 );
|
||||
$this->_coverPhotoSet( $coverPhoto, 'new' );
|
||||
|
||||
/* Call any UI Extensions that might be linked to this object */
|
||||
if( $photo->object instanceof Content or $photo->object instanceof Model )
|
||||
{
|
||||
UiExtension::i()->run( $photo->object, 'formPostSave', [ [ 'cover_photo' => $coverPhoto ] ] );
|
||||
}
|
||||
|
||||
Output::i()->redirect( $this->_coverPhotoReturnUrl()->setQueryString( array( '_position' => 1 ) ) );
|
||||
}
|
||||
|
||||
@@ -94,6 +106,13 @@ abstract class Controller extends DispatcherController
|
||||
catch ( Exception $e ) { }
|
||||
|
||||
$this->_coverPhotoSet( new CoverPhoto( NULL, 0 ), 'remove' );
|
||||
|
||||
/* Call any UI Extensions that might be linked to this object */
|
||||
if( $photo->object instanceof Content or $photo->object instanceof Model )
|
||||
{
|
||||
UiExtension::i()->run( $photo->object, 'formPostSave', [ [ 'cover_photo' => null, 'cover_photo_offset' => 0 ] ] );
|
||||
}
|
||||
|
||||
if ( Request::i()->isAjax() )
|
||||
{
|
||||
Output::i()->json( 'OK' );
|
||||
@@ -120,6 +139,12 @@ abstract class Controller extends DispatcherController
|
||||
|
||||
$photo->offset = Request::i()->offset;
|
||||
$this->_coverPhotoSet( $photo, 'reposition' );
|
||||
|
||||
/* Call any UI Extensions that might be linked to this object */
|
||||
if( $photo->object instanceof Content or $photo->object instanceof Model )
|
||||
{
|
||||
UiExtension::i()->run( $photo->object, 'formPostSave', [ [ 'cover_photo_offset' => $photo->offset ] ] );
|
||||
}
|
||||
|
||||
if ( Request::i()->isAjax() )
|
||||
{
|
||||
|
||||
@@ -315,33 +315,19 @@ class Node extends FormAbstract
|
||||
{
|
||||
foreach ( $this->value as $node )
|
||||
{
|
||||
$title = isset( $node::$titleLangPrefix ) ? Member::loggedIn()->language()->addToStack( $node::$titleLangPrefix . $node->_id, FALSE, array( 'json' => TRUE, 'escape' => TRUE, 'striptags'=> TRUE ) ) : str_replace( "'", "'", htmlspecialchars( $node->_title, ENT_QUOTES | ENT_DISALLOWED, 'UTF-8', false ) );
|
||||
$title = str_replace( "'", "'", htmlspecialchars( $node->_title, ENT_QUOTES | ENT_DISALLOWED, 'UTF-8', false ) );
|
||||
|
||||
$selected[ !( $node instanceof $nodeClass ) ? "{$node->_id}.s" : $node->_id ] = array( 'title' => $title, 'parents' => array_values( array_map( function( $val ){
|
||||
if( isset( $val::$titleLangPrefix ) )
|
||||
{
|
||||
return Member::loggedIn()->language()->addToStack( $val::$titleLangPrefix . $val->_id, FALSE, array( 'json' => TRUE, 'escape' => TRUE, 'striptags'=> TRUE ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return str_replace( "'", "'", htmlspecialchars( $val->_title, ENT_QUOTES | ENT_DISALLOWED, 'UTF-8', false ) );
|
||||
}
|
||||
return str_replace( "'", "'", htmlspecialchars( $val->_title, ENT_QUOTES | ENT_DISALLOWED, 'UTF-8', false ) );
|
||||
}, iterator_to_array( $node->parents() ) ) ) );
|
||||
}
|
||||
}
|
||||
elseif ( $this->value instanceof Model )
|
||||
{
|
||||
$class = get_class( $this->value );
|
||||
$title = isset( $nodeClass::$titleLangPrefix ) ? Member::loggedIn()->language()->addToStack( $class::$titleLangPrefix . $this->value->_id, FALSE, array( 'json' => TRUE, 'escape' => TRUE, 'striptags'=> TRUE ) ) : str_replace( "'", "'", htmlspecialchars( $this->value->_title, ENT_QUOTES | ENT_DISALLOWED, 'UTF-8', false ) );
|
||||
$selected[ !( $this->value instanceof $nodeClass ) ? "{$this->value->_id}.s" : $this->value->_id ] = array( 'title' => $title, 'parents' => array_values( array_map( function( $val ){
|
||||
if( isset( $val::$titleLangPrefix ) )
|
||||
{
|
||||
return Member::loggedIn()->language()->addToStack( $val::$titleLangPrefix . $val->_id, FALSE, array( 'json' => TRUE, 'escape' => TRUE, 'striptags'=> TRUE ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return str_replace( "'", "'", htmlspecialchars( $val->_title, ENT_QUOTES | ENT_DISALLOWED, 'UTF-8', false ) );
|
||||
}
|
||||
$title = str_replace( "'", "'", htmlspecialchars( $this->value->_title, ENT_QUOTES | ENT_DISALLOWED, 'UTF-8', false ) );
|
||||
$selected[ !( $this->value instanceof $nodeClass ) ? "{$this->value->_id}.s" : $this->value->_id ] = array( 'title' => $title, 'parents' => array_values( array_map( function( $val ){
|
||||
return str_replace( "'", "'", htmlspecialchars( $val->_title, ENT_QUOTES | ENT_DISALLOWED, 'UTF-8', false ) );
|
||||
}, iterator_to_array( $this->value->parents() ) ) ) );
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user