Plugin Directory

Changeset 3108589

Timestamp:
06/27/2024 11:07:06 AM (4 weeks ago)
Author:
averta
Message:

Committing 3.1.2 to trunk

Location:
depicter/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • depicter/trunk/app/hooks.php

    r3104895 r3108589  
    1212}
    1313
    14 // phpcs:ignore
    15 // add_action( 'some_action', 'some_function' );
    1614function depicter_add_thumbnail_size() {
    1715    add_image_size( 'depicter-thumbnail', 200, 9999, false );
     
    162160
    163161function depicter_check_activation() {
     162
    164163    if ( isset( $_GET['depicter_upgraded'] ) ) {
    165164        if ( \Depicter::client()->validateActivation() ) {
     
    171170        }
    172171    }
    173     if ( isset( $_GET['depicter_flush_tokens'] ) ) {
     172
     173    if ( isset( $_GET['depicter_flush_tokens'] ) && user_can( wp_get_current_user(), 'manage_options') ) {
    174174        \Depicter::client()->getRefreshToken( true );
    175175        \Depicter::client()->getAccessToken( true );
     
    205205add_action( 'admin_notices', 'depicter_renew_subscription_notice');
    206206function depicter_renew_subscription_notice() {
    207     $expiresAt = \Depicter::options()->get('subscription_expires_at' , '');
    208     if ( empty( $expiresAt ) || strtotime( $expiresAt ) > time() ) {
     207    if ( ! \Depicter::auth()->isSubscriptionExpired() ) {
    209208        return;
    210209    }
  • depicter/trunk/app/src/Database/Repository/MetaRepository.php

    r3103357 r3108589  
    2323     */
    2424    public function meta(): Meta{
    25         return new Meta();
     25        return ();
    2626    }
    2727
  • depicter/trunk/app/src/Document/Manager.php

    r3103357 r3108589  
    141141        // set document entity properties
    142142        $documentModel->setDocumentId( $documentId );
    143         $documentModel->setUnpublishedNotice( $documentId );
     143        $documentModel->setNotice( $documentId );
    144144        $documentModel->setEntityProperty( 'status', $this->getStatus( $documentId ) );
    145145
  • depicter/trunk/app/src/Document/Models/Document.php

    r3103357 r3108589  
    218218            $style = Html::style([],'
    219219                .depicter-admin-notices {
    220                     position:absolute; 
    221                     left: 20px; 
    222                     top: 20px; 
    223                     display: flex; 
    224                     gap:8px; 
     220                    position:absolute;
     221                    left: 20px;
     222                    top: 20px;
     223                    display: flex;
     224                    gap:8px;
    225225                    flex-direction: column;
    226226                    z-index: 50;
  • depicter/trunk/app/src/Document/Models/Traits/DocumentAdminNoticeTrait.php

    r3103357 r3108589  
    33
    44use Averta\Core\Utility\JSON;
     5
    56
    67trait DocumentAdminNoticeTrait {
     
    1112     * @var int|null
    1213     */
    13     protected $showUnpublishedNotice = false;
     14    protected $showNotice = false;
    1415
    1516    /**
     
    1819     * @return int|null
    1920     */
    20     public function showUnpublishedNotice() {
    21         return $this->showUnpublishedNotice;
     21    public function showNotice() {
     22        return $this->showNotice;
    2223    }
    2324
     
    2526     * Enables or disables unpublished notice of document
    2627     *
    27      * @param int $showUnpublishedNotice
     28     * @param int $showNotice
    2829     *
    2930     * @return mixed
    3031     */
    31     public function setUnpublishedNotice( $showUnpublishedNotice = false ) {
    32         $this->showUnpublishedNotice = $showUnpublishedNotice;
     32    public function setNotice = false ) {
     33        $this->showNotice;
    3334        return $this;
    3435    }
     
    4041     */
    4142    public function getUnpublishedChangesNotice() {
    42         if( ! $this->showUnpublishedNotice() || ! $this->getDocumentID() ) {
     43        if( ! $this->showNotice() || ! $this->getDocumentID() ) {
    4344            return '';
    4445        }
     
    7879     */
    7980    public function getExpiredSubscriptionNotice() {
    80         if( ! $this->getDocumentID() ) {
     81        if( ! $this->getDocumentID() ) {
    8182            return '';
    8283        }
     
    8687        }
    8788
    88         $documentType = \Depicter::documentRepository()->findOne( $this->getDocumentID() )->getProperty('type');
    89         if ( in_array( $documentType, ['popup', 'banner-bar'] ) ) {
     89        try{
     90            // skip admin notice display for popup and notification bars
     91            if ( in_array( \Depicter::documentRepository()->findOne( $this->getDocumentID() )->getProperty('type'), ['popup', 'banner-bar', 'notification-bar'] ) ) {
     92                return '';
     93            }
     94        }catch( \Exception $e ){
    9095            return '';
    9196        }
  • depicter/trunk/app/src/Front/Preview.php

    r3013596 r3108589  
    104104        try{
    105105            $documentModel = \Depicter::document()->getModel( $documentId, $where );
    106             $documentModel->setUnpublishedNotice( false );
     106            $documentModel->setNotice( false );
    107107            $viewArgs = $this->prepareToRender( $documentModel, $viewArgs );
    108108
     
    184184     */
    185185    protected function view( $args ){
    186         // JetPack compatibility issue 
     186        // JetPack compatibility issue
    187187        if ( class_exists( 'Filter_Embedded_HTML_Objects' ) ) {
    188188            remove_filter( 'pre_kses', array( 'Filter_Embedded_HTML_Objects', 'filter' ), 11 );
     
    191191        $view = \Depicter::view('canvas.php')->with( 'view_args', $args )->toString();
    192192
    193         // JetPack compatibility issue 
     193        // JetPack compatibility issue
    194194        if ( class_exists( 'Filter_Embedded_HTML_Objects' ) ) {
    195195            add_filter( 'pre_kses', array( 'Filter_Embedded_HTML_Objects', 'filter' ), 11 );
  • depicter/trunk/app/src/Front/Render.php

    r3043965 r3108589  
    3636            'echo'          => true,
    3737            'status'        => 'publish',
    38             'showUnpublishedNotice' => $isPrivilegedUser
     38            'showNotice' => $isPrivilegedUser
    3939        ]);
    4040
     
    9191            }
    9292
    93             if( ! $args['showUnpublishedNotice'] && ! \Depicter::document()->repository()->isPublishedBefore( $documentID ) ) {
     93            if( ! $args['showNotice'] && ! \Depicter::document()->repository()->isPublishedBefore( $documentID ) ) {
    9494                throw new DocumentNotPublished( __( 'Slider is not published yet and saved as "draft"', 'depicter' ), 0, $where );
    9595            }
     
    9797            if( $documentModel = \Depicter::document()->getModel( $documentID, $where ) ){
    9898
    99                 $documentModel->setUnpublishedNotice( $args['showUnpublishedNotice'] );
     99                $documentModel->setNotice'] );
    100100
    101101                $output .= $documentModel->prepare()->render();
     
    206206        $cacheFor      = !empty( $args['isPrivilegedUser'] ) ? 'admin_' : '';
    207207        // Include admin notice in document markup or not
    208         $isAdminNoticeEnabled = !empty( $args['showUnpublishedNotice'] ) ? 'notice_' : '';
     208        $isAdminNoticeEnabled = !empty( $args['showNotice'] ) ? 'notice_' : '';
    209209        // The last modified date of main document
    210210        $documentModifiedTime = strtotime( \Depicter::documentRepository()->getFieldValue( $documentID, 'modified_at') );
  • depicter/trunk/app/src/Services/AuthenticationService.php

    r3103357 r3108589  
    6464            $subExpiresAtTimestamp = strtotime($subExpiresAt." UTC");
    6565            $afterExpirationInSeconds = time() - $subExpiresAtTimestamp;
    66            
     66
    6767            if( $afterExpirationInSeconds > 5 * DAY_IN_SECONDS ) {
    6868                return 'expired';
     
    7272        }
    7373
    74         return $subExpiresAt;
     74        return ;
    7575    }
    7676
  • depicter/trunk/app/src/WordPress/FileUploaderService.php

    r2735350 r3108589  
    33
    44use Averta\WordPress\File\UploadsDirectory;
     5
    56use GuzzleHttp\Psr7\UploadedFile;
    67
     
    2627            }
    2728
    28             if ( !in_array( $file->getClientMediaType(), $allowedMimeTypes ) ) {
     29            $clientFileName = Sanitize::fileName( $file->getClientFilename() );
     30            // make sure that file mime type is allowed and the extension is not .php
     31            if ( !in_array( $file->getClientMediaType(), $allowedMimeTypes ) || substr( $clientFileName, -4 ) === '.php' ) {
    2932                $results[ $file->getClientFilename() ] = [
    3033                    'attachment'    => 0,
     
    3538                continue;
    3639            }
    37            
    38             $filename = $wp_upload_dir->getPath() . "/" . $file->getClientFilename();
     40
     41            $filename = $wp_upload_dir->getPath() . "/" . $;
    3942            $file->moveTo( $filename );
    4043            $attachment = array(
  • depicter/trunk/depicter.php

    r3104895 r3108589  
    44 * Plugin URI: https://depicter.com
    55 * Description: Build stunning sliders, popups, carousels, video sliders, post sliders, and WooCommerce sliders fast and easy.
    6  * Version: 3.1.1
     6 * Version: 3.1.
    77 * Requires at least: 5.3
    88 * Requires PHP: 7.4.0
     
    1818 */
    1919
    20 const DEPICTER_VERSION = '3.1.1';
     20const DEPICTER_VERSION = '3.1.';
    2121
    2222if ( ! defined( 'ABSPATH' ) ) {
  • depicter/trunk/readme.txt

    r3104895 r3108589  
    33Tags: slider, carousel slider, popup, post slider, slideshow
    44Requires at least: 5.3.0
    5 Tested up to: WordPress 6.5.4
     5Tested up to: WordPress 6.5.
    66Requires PHP: 7.4.0
    7 Stable tag: 3.1.1
     7Stable tag: 3.1.
    88License: GPL-2.0-only
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7070== Changelog ==
    7171
     72
     73
     74
     75
     76
    7277###3.1.1
    7378- *Released: 2024-06-20*
Note: See TracChangeset for help on using the changeset viewer.