Plugin Directory

Changeset 3070758


Ignore:
Timestamp:
04/15/2024 12:36:01 PM (23 months ago)
Author:
onlyoffice
Message:

dev v2.0.0

Location:
onlyoffice/trunk
Files:
43 added
5 deleted
57 edited

Legend:

Unmodified
Added
Removed
  • onlyoffice/trunk/CHANGELOG.md

    r2976437 r3070758  
    11# Change Log
     2
     3## 2.0.0
     4## Added
     5- multisite support
     6- stub for onlyoffice-wordpress-block that displays error information if the document server is not accessible or the file is not found
     7- settings for onlyoffice block (width, height, align, show open in onlyoffice button)
     8- button copy link to editor, in the table with files
     9- ability to insert a link to the editor on the page
     10- access for an anonymous user, open the document for viewing in the editor if the document is attached to a public post
     11- filling pdf
     12
     13## Changed
     14- editor url
     15- displaying the onlyoffice-wordpress-block component in the Gutenberg editor
     16- remove filling for oform
     17- supported formats updated
    218
    319## 1.1.0
  • onlyoffice/trunk/admin/class-onlyoffice-plugin-admin.php

    r2976437 r3070758  
    1212/**
    1313 *
    14  * (c) Copyright Ascensio System SIA 2023
     14 * (c) Copyright Ascensio System SIA 2024
    1515 *
    1616 * This program is free software; you can redistribute it and/or
     
    4242
    4343    /**
    44      * The ID of this plugin.
    45      *
    46      * @since    1.0.0
    47      * @access   private
    48      * @var      string    $plugin_name    The ID of this plugin.
    49      */
    50     private $plugin_name;
    51 
    52     /**
    53      * The version of this plugin.
    54      *
    55      * @since    1.0.0
    56      * @access   private
    57      * @var      string    $version    The current version of this plugin.
    58      */
    59     private $version;
    60 
    61     /**
    62      * Initialize the class and set its properties.
    63      *
    64      * @since    1.0.0
    65      * @param      string $plugin_name       The name of this plugin.
    66      * @param      string $version    The version of this plugin.
    67      */
    68     public function __construct( $plugin_name, $version ) {
    69         $this->plugin_name = $plugin_name;
    70         $this->version     = $version;
    71     }
    72 
    73     /**
    7444     * Register the stylesheets for the admin area.
    7545     *
     
    8656    public function enqueue_scripts() {
    8757        wp_enqueue_script(
    88             $this->plugin_name . '-media-script',
    89             plugin_dir_url( __FILE__ ) . 'js/onlyoffice-admin-media.js',
    90             array( 'jquery' ),
    91             $this->version,
     58            ONLYOFFICE_PLUGIN_NAME . '-formats-utils',
     59            ONLYOFFICE_PLUGIN_URL . 'assets-onlyoffice/js/formatsUtils.js',
     60            array(),
     61            ONLYOFFICE_PLUGIN_VERSION,
    9262            true
    9363        );
    9464
    9565        wp_localize_script(
    96             $this->plugin_name . '-media-script',
    97             'oo_media',
     66            ONLYOFFICE_PLUGIN_NAME . '-formats-utils',
     67            'ONLYOFFICE',
    9868            array(
    99                 'formats'   => Onlyoffice_Plugin_Document_Manager::get_viewable_extensions(),
     69                'formats'   => Onlyoffice_Plugin_Document_Manager::get_onlyoffice_formats(),
    10070                'mimeTypes' => get_allowed_mime_types(),
    10171            )
  • onlyoffice/trunk/admin/css/onlyoffice-wordpress-admin.css

    r2976437 r3070758  
    44
    55.wp-list-table .column-format {
    6     width: 15%;
     6    width: 18%;
    77}
    88
    99.wp-list-table .column-date {
    10     width: 15%;
     10    width: 18%;
    1111}
    1212
    1313.wp-list-table .column-size {
    14     width: 15%;
     14    width: 12%;
    1515}
     16
     17.wp-list-table .column-link {
     18    width: 12%;
     19}
     20
     21.onlyoffice-editor-link.button-link.has-icon:hover {
     22    svg {
     23        fill: #0096dd;
     24    }
     25}
     26
     27.onlyoffice_files .copy-to-clipboard-container .success {
     28    position: absolute;
     29    transform: translate(-36%, -115%);
     30    background: #000;
     31    color: #fff;
     32    border-radius: 5px;
     33    margin: 0;
     34    padding: 2px 5px;
     35}
  • onlyoffice/trunk/controllers/class-onlyoffice-plugin-frontend-controller.php

    r2976437 r3070758  
    1212/**
    1313 *
    14  * (c) Copyright Ascensio System SIA 2023
     14 * (c) Copyright Ascensio System SIA 2024
    1515 *
    1616 * This program is free software; you can redistribute it and/or
     
    5252            __DIR__ . '/../onlyoffice-wordpress-block',
    5353            array(
    54                 'description'     => __( 'Add ONLYOFFICE editor on page', 'onlyoffice-plugin' ),
     54                'description'     => __( 'Add ONLYOFFICE Docs editor on page', 'onlyoffice-plugin' ),
    5555                'render_callback' => array( $this, 'onlyoffice_block_render_callback' ),
    5656            ),
     
    5858
    5959        if ( function_exists( 'wp_set_script_translations' ) ) {
    60             wp_set_script_translations( 'onlyoffice-plugin', 'onlyoffice-plugin' );
     60            wp_set_script_translations(
     61                'onlyoffice-wordpress-onlyoffice-editor-script',
     62                'onlyoffice-plugin',
     63                plugin_dir_path( ONLYOFFICE_PLUGIN_FILE ) . 'languages/'
     64            );
    6165        }
    6266    }
     
    8791
    8892        $defaults_atts = array(
    89             'id'       => '',
    90             'fileName' => '',
     93            'id'             => '',
     94            'fileName'       => '',
     95            'documentView'   => 'embedded',
     96            'inNewTab'       => true,
     97            'align'          => '',
     98            'width'          => '100%',
     99            'height'         => '500px',
     100            'showOpenButton' => 'true',
     101            'openButtonText' => __( 'Open in ONLYOFFICE', 'onlyoffice-plugin' ),
    91102        );
    92103
    93104        $atts = shortcode_atts( $defaults_atts, $attr, 'onlyoffice' );
    94105
     106        if ( empty( $atts['width'] ) ) {
     107            $atts['width'] = $defaults_atts['width'];
     108        }
     109
     110        if ( empty( $atts['height'] ) ) {
     111            $atts['height'] = $defaults_atts['height'];
     112        }
     113
     114        wp_enqueue_style(
     115            'wp-block-onlyoffice-wordpress-styles',
     116            ONLYOFFICE_PLUGIN_URL . 'onlyoffice-wordpress-block/src/styles.css',
     117            array(),
     118            ONLYOFFICE_PLUGIN_VERSION
     119        );
     120
     121        if ( 'link' === $atts['documentView'] ) {
     122            return $this->render_link( $atts, $instance );
     123        }
     124
     125        return $this->render_embedded( $atts, $instance );
     126    }
     127
     128    /**
     129     * ONLYOFFICE Embedded Template.
     130     *
     131     * @param array $atts List of attributes that where included in the Shortcode.
     132     * @param int   $instance Element number on page.
     133     * @return string Link Template.
     134     */
     135    private function render_embedded( $atts, $instance ) {
    95136        add_action(
    96137            'wp_enqueue_scripts',
     
    98139                $api_js_url = Onlyoffice_Plugin_Url_Manager::get_api_js_url();
    99140                wp_enqueue_script( 'onlyoffice_editor_api', $api_js_url, array(), ONLYOFFICE_PLUGIN_VERSION, false );
     141                wp_enqueue_script(
     142                    'wp-block-onlyoffice-wordpress-js',
     143                    ONLYOFFICE_PLUGIN_URL . 'controllers/js/frontend-controller.js',
     144                    array( 'wp-util', 'wp-i18n' ),
     145                    ONLYOFFICE_PLUGIN_VERSION,
     146                    false
     147                );
     148                wp_enqueue_style(
     149                    'wp-block-onlyoffice-wordpress-css',
     150                    ONLYOFFICE_PLUGIN_URL . 'controllers/css/frontend-controller.css',
     151                    array(),
     152                    ONLYOFFICE_PLUGIN_VERSION
     153                );
     154
     155                if ( function_exists( 'wp_set_script_translations' ) ) {
     156                    wp_set_script_translations(
     157                        'wp-block-onlyoffice-wordpress-js',
     158                        'onlyoffice-plugin',
     159                        plugin_dir_path( ONLYOFFICE_PLUGIN_FILE ) . 'languages/'
     160                    );
     161                }
    100162            }
    101163        );
     
    118180        $config = Onlyoffice_Plugin_Config_Manager::get_config( $attachment_id, $type, $mode, $perm_edit, $callback, null, true );
    119181
    120         $output  = '<div style="height: 650px; maxWidth: inherit, padding: 20px">';
    121         $output .= '<div id="editorOnlyoffice-' . $instance . '"></div>';
    122         $output .= '<script type="text/javascript">new DocsAPI.DocEditor("editorOnlyoffice-' . $instance . '", ' . wp_json_encode( $config ) . '); </script>';
     182        $align = ! empty( $atts['align'] ) ? 'align' . $atts['align'] : '';
     183        $size  = ! empty( $atts['width'] ) && ! ( 'full' === $atts['align'] ) ? 'width: ' . $atts['width'] . ';' : '';
     184        $size .= ! empty( $atts['height'] ) ? 'height: ' . $atts['height'] . ';' : '';
     185
     186        $output  = '<div class="wp-block-onlyoffice-wordpress-onlyoffice ' . $align . ' size-full" style="' . $size . '">';
     187        $output .= '<div id="editorOnlyoffice-' . $instance . '" data-config="' . htmlspecialchars( wp_json_encode( $config ), ENT_QUOTES, 'UTF-8' ) . '" data-instance="' . $instance . '" class="wp-block-onlyoffice-wordpress-onlyoffice__target" ></div>';
    123188        $output .= '</div>';
    124189
    125190        return apply_filters( 'wp_onlyoffice_shortcode', $output, $atts );
    126191    }
     192
     193    /**
     194     * ONLYOFFICE Link Template.
     195     *
     196     * @param array $atts List of attributes that where included in the Shortcode.
     197     * @param int   $instance Element number on page.
     198     * @return string Link Template.
     199     */
     200    private function render_link( $atts, $instance ) {
     201        $target = true === $atts['inNewTab'] ? 'target="_blank"' : '';
     202        $align  = ! empty( $atts['align'] ) ? 'align' . $atts['align'] : '';
     203
     204        $output  = '<div class="wp-block-onlyoffice-wordpress-onlyoffice ' . $align . '">';
     205        $output .= '<a id="linkToOnlyofficeEditor-' . $instance . '" href="' . Onlyoffice_Plugin_Url_Manager::get_editor_url( $atts['id'] ) . '" ' . $target . '>' . $atts['fileName'] . '</a>';
     206
     207        if ( $atts['showOpenButton'] ) {
     208            $output .= '<a href="' . Onlyoffice_Plugin_Url_Manager::get_editor_url( $atts['id'] ) . '" ' . $target . ' class="wp-block-onlyoffice-wordpress__button wp-element-button">' . $atts['openButtonText'] . '</a>';
     209        }
     210
     211        $output .= '</div>';
     212
     213        return apply_filters( 'wp_onlyoffice_shortcode', $output, $atts );
     214    }
     215
     216    /**
     217     *  ONLYOFFICE error template.
     218     *
     219     * @return void
     220     */
     221    public function onlyoffice_error_template() {
     222        ?>
     223        <script type="text/html" id="tmpl-onlyoffice-error">
     224            <div class="onlyoffice-error" >
     225                <div class="onlyoffice-error-body">
     226                    <div class="onlyoffice-error-table js">
     227                        <div>
     228                            <img src="<?php echo esc_url( ONLYOFFICE_PLUGIN_URL . 'controllers/images/onlyoffice.svg' ); ?>" style="width: 50%" />
     229                        </div>
     230                        <div style="padding: 16px;">
     231                            <img src="<?php echo esc_url( ONLYOFFICE_PLUGIN_URL . 'controllers/images/error.svg' ); ?>" style="width: 100%"/>
     232                        </div>
     233                        <div>{{{data.email}}}</div>
     234                    </div>
     235                </div>
     236            </div>
     237        </script>
     238        <?php
     239    }
    127240}
  • onlyoffice/trunk/includes/class-onlyoffice-plugin-activator.php

    r2976437 r3070758  
    1212/**
    1313 *
    14  * (c) Copyright Ascensio System SIA 2023
     14 * (c) Copyright Ascensio System SIA 2024
    1515 *
    1616 * This program is free software; you can redistribute it and/or
     
    4646     */
    4747    public static function activate() {
    48         if ( empty( get_option( 'onlyoffice-plugin-uuid' ) ) ) {
    49             add_option( 'onlyoffice-plugin-uuid', wp_generate_uuid4() );
     48        if ( empty( get_site_option( 'onlyoffice-plugin-uuid' ) ) ) {
     49            update_site_option( 'onlyoffice-plugin-uuid', wp_generate_uuid4() );
    5050        }
    51         if ( empty( get_option( 'onlyoffice-plugin-bytes' ) ) ) {
     51        if ( empty( get_site_option( 'onlyoffice-plugin-bytes' ) ) ) {
    5252            $ivlen = openssl_cipher_iv_length( 'aes-256-ctr' );
    5353            $iv    = openssl_random_pseudo_bytes( $ivlen );
    54             add_option( 'onlyoffice-plugin-bytes', bin2hex( $iv ) );
     54            update_site_option( 'onlyoffice-plugin-bytes', bin2hex( $iv ) );
    5555        }
    5656
    57         if ( empty( get_option( 'onlyoffice-formats' ) ) ) {
    58             $formats = array();
    59 
    60             $path_to_formats_json = plugin_dir_path( __DIR__ ) . '/public/assets/document-formats/onlyoffice-docs-formats.json';
    61 
    62             if ( file_exists( $path_to_formats_json ) === true ) {
    63                 $formats = json_decode( file_get_contents( $path_to_formats_json ), true );
    64                 add_option( 'onlyoffice-formats', $formats );
    65             }
    66         }
     57        Onlyoffice_Plugin_Document_Manager::init();
    6758    }
    6859}
  • onlyoffice/trunk/includes/class-onlyoffice-plugin-deactivator.php

    r2976437 r3070758  
    1212/**
    1313 *
    14  * (c) Copyright Ascensio System SIA 2023
     14 * (c) Copyright Ascensio System SIA 2024
    1515 *
    1616 * This program is free software; you can redistribute it and/or
  • onlyoffice/trunk/includes/class-onlyoffice-plugin-i18n.php

    r2976437 r3070758  
    1212/**
    1313 *
    14  * (c) Copyright Ascensio System SIA 2023
     14 * (c) Copyright Ascensio System SIA 2024
    1515 *
    1616 * This program is free software; you can redistribute it and/or
  • onlyoffice/trunk/includes/class-onlyoffice-plugin-loader.php

    r2976437 r3070758  
    1212/**
    1313 *
    14  * (c) Copyright Ascensio System SIA 2023
     14 * (c) Copyright Ascensio System SIA 2024
    1515 *
    1616 * This program is free software; you can redistribute it and/or
  • onlyoffice/trunk/includes/class-onlyoffice-plugin.php

    r2976437 r3070758  
    1515/**
    1616 *
    17  * (c) Copyright Ascensio System SIA 2023
     17 * (c) Copyright Ascensio System SIA 2024
    1818 *
    1919 * This program is free software; you can redistribute it and/or
     
    8686    public function __construct() {
    8787        $this->version     = ONLYOFFICE_PLUGIN_VERSION;
    88         $this->plugin_name = 'onlyoffice-plugin';
     88        $this->plugin_name = ONLYOFFICE_PLUGIN_NAME;
    8989
    9090        $this->load_dependencies();
     
    151151     */
    152152    private function define_admin_hooks() {
    153         $plugin_admin = new Onlyoffice_Plugin_Admin( $this->get_plugin_name(), $this->get_version() );
     153        $plugin_admin = new Onlyoffice_Plugin_Admin();
    154154
    155155        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
     
    165165     */
    166166    private function define_public_hooks() {
    167         $plugin_public = new Onlyoffice_Plugin_Public( $this->get_plugin_name(), $this->get_version() );
     167        $plugin_public = new Onlyoffice_Plugin_Public();
    168168
    169169        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
     
    185185        $plugin_settings = new Onlyoffice_Plugin_Settings();
    186186        $this->loader->add_action( 'admin_menu', $plugin_settings, 'init_menu' );
     187        $this->loader->add_action( 'network_admin_menu', $plugin_settings, 'init_menu' );
    187188        $this->loader->add_action( 'admin_init', $plugin_settings, 'init' );
    188189
     
    190191        $this->loader->add_action( 'init', $plugin_frontend_controller, 'init_shortcodes' );
    191192        $this->loader->add_action( 'init', $plugin_frontend_controller, 'onlyoffice_custom_block' );
     193        $this->loader->add_action( 'wp_footer', $plugin_frontend_controller, 'onlyoffice_error_template', 30 );
    192194    }
    193195
  • onlyoffice/trunk/includes/files/class-onlyoffice-plugin-files-list-table.php

    r2976437 r3070758  
    1212/**
    1313 *
    14  * (c) Copyright Ascensio System SIA 2023
     14 * (c) Copyright Ascensio System SIA 2024
    1515 *
    1616 * This program is free software; you can redistribute it and/or
     
    6262        add_action(
    6363            'admin_enqueue_scripts',
    64             function ( $hook ) {
     64            function () {
     65                wp_enqueue_script(
     66                    ONLYOFFICE_PLUGIN_NAME . '-media-script',
     67                    plugin_dir_url( __FILE__ ) . 'js/onlyoffice-files-list-table.js',
     68                    array( 'jquery', 'clipboard', 'wp-a11y' ),
     69                    ONLYOFFICE_PLUGIN_FILE,
     70                    true
     71                );
     72
    6573                wp_enqueue_style( 'onlyoffice_files_table', ONLYOFFICE_PLUGIN_URL . 'admin/css/onlyoffice-wordpress-admin.css', array(), ONLYOFFICE_PLUGIN_VERSION );
    6674            }
     
    8189     */
    8290    public function no_items() {
    83         esc_html_e( 'No files found for editing or viewing in ONLYOFFICE.', 'onlyoffice-plugin' );
     91        esc_html_e( 'No files found for editing or viewing in ONLYOFFICE Docs editor.', 'onlyoffice-plugin' );
    8492    }
    8593    /**
     
    97105            case 'date':
    98106            case 'size':
     107            case 'link':
    99108                return $item[ $column_name ];
    100109            default:
     
    116125            'date'   => array( 'date', false ),
    117126            'size'   => array( 'size', false ),
     127            'link'   => array( 'link', false ),
    118128        );
    119129    }
     
    132142            'date'   => __( 'Date' ),
    133143            'size'   => __( 'Size' ),
     144            'link'   => __( 'Link' ),
    134145        );
    135146        return $columns;
     
    190201                continue;
    191202            }
    192             if ( Onlyoffice_Plugin_Document_Manager::is_editable( $filename ) || Onlyoffice_Plugin_Document_Manager::is_viewable( $filename ) ) {
     203            if ( ( Onlyoffice_Plugin_Document_Manager::is_editable( $filename )
     204                        || Onlyoffice_Plugin_Document_Manager::is_viewable( $filename ) )
     205                    && Onlyoffice_Plugin_Document_Manager::can_user_view_attachment( $attachment->ID ) ) {
    193206                array_push(
    194207                    $attachments,
     
    197210                        'title'  => pathinfo( $attached_file, PATHINFO_FILENAME ),
    198211                        'format' => strtoupper( pathinfo( $attached_file, PATHINFO_EXTENSION ) ),
     212                        'date'   => $attachment->post_modified,
    199213                        'size'   => size_format( filesize( $attached_file ) ),
     214                        'link'   => Onlyoffice_Plugin_Url_Manager::get_editor_url( $attachment->ID ),
    200215                    )
    201216                );
     
    244259        $title    = wp_basename( $attached );
    245260
    246         $wp_nonce   = wp_create_nonce( 'wp_rest' );
    247         $editor_url = add_query_arg( '_wpnonce', $wp_nonce, Onlyoffice_Plugin_Url_Manager::get_editor_url( $item['id'] ) );
     261        $editor_url = Onlyoffice_Plugin_Url_Manager::get_editor_url( $item['id'] );
    248262
    249263        ?>
     
    280294
    281295    /**
     296     * Handles the post link column output.
     297     *
     298     * @since 1.0.0
     299     * @param array $item The item.
     300     */
     301    public function column_link( $item ) {
     302        $file = get_post( $item['id'] );
     303        ?>
     304        <span class="copy-to-clipboard-container">
     305            <button type="button" data-clipboard-text="<?php echo esc_url( Onlyoffice_Plugin_Url_Manager::get_editor_url( $item['id'] ) ); ?>" class="onlyoffice-editor-link button-link has-icon" title="<?php esc_attr_e( 'Copy URL' ); ?>" aria-label="<?php esc_attr_e( 'Link' ); ?>">
     306                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M15.6 7.2H14v1.5h1.6c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.8 0 5.2-2.3 5.2-5.2 0-2.9-2.3-5.2-5.2-5.2zM4.7 12.4c0-2 1.7-3.7 3.7-3.7H10V7.2H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H10v-1.5H8.4c-2 0-3.7-1.7-3.7-3.7zm4.6.9h5.3v-1.5H9.3v1.5z"></path></svg>
     307            </button>
     308            <span class="success hidden" aria-hidden="true"><?php esc_html_e( 'Copied!' ); ?>
     309        </span>
     310        <?php
     311    }
     312
     313    /**
    282314     * Displays the search box.
    283315     *
  • onlyoffice/trunk/includes/files/class-onlyoffice-plugin-files.php

    r2976437 r3070758  
    1212/**
    1313 *
    14  * (c) Copyright Ascensio System SIA 2023
     14 * (c) Copyright Ascensio System SIA 2024
    1515 *
    1616 * This program is free software; you can redistribute it and/or
     
    5151        if ( $can_upload_files ) {
    5252            add_menu_page(
    53                 __( 'ONLYOFFICE', 'onlyoffice-plugin' ),
    54                 'ONLYOFFICE',
     53                __( 'ONLYOFFICE Docs', 'onlyoffice-plugin' ),
     54                'ONLYOFFICE Docs',
    5555                'upload_files',
    5656                'onlyoffice-files',
    5757                array( $this, 'files_page' ),
    58                 'data:image/svg+xml;base64,' . base64_encode( $logo_svg )
     58                'data:image/svg+xml;base64,' . base64_encode( $logo_svg ) // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
    5959            );
    6060
    6161            $hook = add_submenu_page(
    6262                'onlyoffice-files',
    63                 'ONLYOFFICE',
     63                'ONLYOFFICE Docs',
    6464                __( 'Files', 'onlyoffice-plugin' ),
    6565                'upload_files',
     
    103103        <div class="wrap">
    104104            <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
    105             <p><?php esc_html_e( 'Files that can be edited and opened in ONLYOFFICE will be displayed here', 'onlyoffice-plugin' ); ?></p>
     105            <p><?php esc_html_e( 'Files that can be edited and opened in ONLYOFFICE Docs editor are displayed here.', 'onlyoffice-plugin' ); ?></p>
    106106            <form method="get">
    107107                <?php $onlyoffice_plugin_files_list_table->search_box( __( 'Search' ), 'onlyoffice_file' ); ?>
  • onlyoffice/trunk/includes/managers/class-onlyoffice-plugin-callback-manager.php

    r2976437 r3070758  
    1212/**
    1313 *
    14  * (c) Copyright Ascensio System SIA 2023
     14 * (c) Copyright Ascensio System SIA 2024
    1515 *
    1616 * This program is free software; you can redistribute it and/or
  • onlyoffice/trunk/includes/managers/class-onlyoffice-plugin-config-manager.php

    r2976437 r3070758  
    1212/**
    1313 *
    14  * (c) Copyright Ascensio System SIA 2023
     14 * (c) Copyright Ascensio System SIA 2024
    1515 *
    1616 * This program is free software; you can redistribute it and/or
     
    5151     */
    5252    public static function get_config( $attachment_id, $type, $mode, $perm_edit, $callback_url, $go_back_url, $unic_key ) {
    53         $post     = get_post( $attachment_id );
    54         $user     = wp_get_current_user();
    55         $author   = get_user_by( 'id', $post->post_author )->display_name;
    56         $filepath = get_attached_file( $attachment_id );
    57         $filename = wp_basename( $filepath );
    58         $filetype = strtolower( pathinfo( $filepath, PATHINFO_EXTENSION ) );
    59         $file_url = Onlyoffice_Plugin_Url_Manager::get_download_url( $attachment_id );
    60         $lang     = get_user_locale( $user->ID );
     53        $post = get_post( $attachment_id );
     54
     55        if ( ! $post ) {
     56            return null;
     57        }
     58
     59        $user      = wp_get_current_user();
     60        $author    = get_user_by( 'id', $post->post_author )->display_name;
     61        $filepath  = get_attached_file( $attachment_id );
     62        $filename  = wp_basename( $filepath );
     63        $filetype  = strtolower( pathinfo( $filepath, PATHINFO_EXTENSION ) );
     64        $file_url  = Onlyoffice_Plugin_Url_Manager::get_download_url( $attachment_id );
     65        $lang      = get_user_locale( $user->ID );
     66        $perm_fill = false;
     67
     68        if ( Onlyoffice_Plugin_Document_Manager::is_fillable( $filename ) ) {
     69            $perm_fill = true;
     70            $perm_edit = false;
     71        }
    6172
    6273        $config = array(
     
    6778                'url'         => $file_url,
    6879                'fileType'    => $filetype,
    69                 'key'         => base64_encode( $post->post_modified ) . $attachment_id,
     80                'key'         => base64_encode( $post->post_modified ) . $attachment_id, // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
    7081                'info'        => array(
    7182                    'owner'    => $author,
     
    7384                ),
    7485                'permissions' => array(
    75                     'download' => true,
    76                     'edit'     => $perm_edit,
     86                    'download'  => true,
     87                    'edit'      => $perm_edit,
     88                    'fillForms' => $perm_fill,
    7789                ),
    7890            ),
  • onlyoffice/trunk/includes/managers/class-onlyoffice-plugin-document-manager.php

    r2976437 r3070758  
    1212/**
    1313 *
    14  * (c) Copyright Ascensio System SIA 2023
     14 * (c) Copyright Ascensio System SIA 2024
    1515 *
    1616 * This program is free software; you can redistribute it and/or
     
    5151
    5252    /**
     53     * Init Onlyoffice_Plugin_Document_Manager.
     54     */
     55    public static function init() {
     56        $path_to_formats_json = plugin_dir_path( ONLYOFFICE_PLUGIN_FILE ) . '/public/assets/document-formats/onlyoffice-docs-formats.json';
     57
     58        if ( file_exists( $path_to_formats_json ) === true ) {
     59            $formats = wp_json_file_decode( $path_to_formats_json );
     60            update_site_option( 'onlyoffice-formats', $formats );
     61            update_site_option( 'onlyoffice-formats-version', ONLYOFFICE_PLUGIN_VERSION );
     62        }
     63    }
     64
     65    /**
    5366     * Returns the type of the document (word, cell, slide).
    5467     *
     
    6275
    6376        foreach ( $formats as $format ) {
    64             if ( $format['name'] === $ext ) {
    65                 return $format['type'];
     77            if ( $format->name === $ext ) {
     78                return $format->type;
    6679            }
    6780        }
     
    8295
    8396        foreach ( $formats as $format ) {
    84             if ( $format['name'] === $ext ) {
    85                 return in_array( 'edit', $format['actions'], true );
     97            if ( $format->name === $ext ) {
     98                return in_array( 'edit', $format->actions, true );
    8699            }
    87100        }
     
    102115
    103116        foreach ( $formats as $format ) {
    104             if ( $format['name'] === $ext ) {
    105                 return in_array( 'fill', $format['actions'], true );
     117            if ( $format->name === $ext ) {
     118                return in_array( 'fill', $format->actions, true );
    106119            }
    107120        }
     
    122135
    123136        foreach ( $formats as $format ) {
    124             if ( $format['name'] === $ext ) {
    125                 return in_array( 'view', $format['actions'], true );
     137            if ( $format->name === $ext ) {
     138                return in_array( 'view', $format->actions, true );
    126139            }
    127140        }
     
    138151
    139152        foreach ( $formats as $format ) {
    140             if ( in_array( 'view', $format['actions'], true ) ) {
    141                 array_push( $extensions, $format['name'] );
     153            if ( in_array( 'view', $format->actions, true ) ) {
     154                array_push( $extensions, $format->name );
    142155            }
    143156        }
     
    147160
    148161    /**
     162     * Returns true if user can view attachment.
     163     *
     164     * @param string $attachment_id The attachment id.
     165     * @return bool
     166     */
     167    public static function can_user_view_attachment( $attachment_id ) {
     168        $attachment = get_post( $attachment_id );
     169
     170        if ( ! $attachment || 'attachment' !== $attachment->post_type ) {
     171            return false;
     172        }
     173
     174        return current_user_can( 'read_post', $attachment_id );
     175    }
     176
     177    /**
     178     * Returns true if anonymous user can view attachment.
     179     *
     180     * @param string $attachment_id The attachment id.
     181     * @return bool
     182     */
     183    public static function can_anonymous_user_view_attachment( $attachment_id ) {
     184        $attachment = get_post( $attachment_id );
     185
     186        if ( ! $attachment || 'attachment' !== $attachment->post_type ) {
     187            return false;
     188        }
     189
     190        $is_public = get_post_meta( $attachment_id, '_wp_attachment_metadata', true );
     191
     192        if ( ! $is_public ) {
     193            return false;
     194        }
     195
     196        $parent_post_id = $attachment->post_parent;
     197        $parent_post    = get_post( $parent_post_id );
     198
     199        if ( ! $parent_post ) {
     200            return false;
     201        }
     202
     203        if ( 'publish' !== $parent_post->post_status ) {
     204            return false;
     205        }
     206
     207        return true;
     208    }
     209
     210    /**
    149211     * Returns true if user can edit attachment.
    150212     *
    151      * @param string $attachment_id The request.
    152      * @return bool
    153      */
    154     public static function has_edit_capability( $attachment_id ) {
    155         $has_edit_cap = false;
    156         foreach ( self::EDIT_CAPS as $capability ) {
    157             $has_edit_cap = $has_edit_cap || current_user_can( $capability, $attachment_id );
    158         }
    159         return $has_edit_cap;
     213     * @param string $attachment_id The attachment id.
     214     * @return bool
     215     */
     216    public static function can_user_edit_attachment( $attachment_id ) {
     217        $attachment = get_post( $attachment_id );
     218
     219        if ( ! $attachment ) {
     220            return false;
     221        }
     222
     223        return current_user_can( 'edit_post', $attachment_id );
    160224    }
    161225
     
    177241
    178242    /**
    179      * Return option onlyoffice-formats.
     243     * Return supported ONLYOFFICE formats.
    180244     */
    181245    public static function get_onlyoffice_formats() {
    182         $formats = get_option( 'onlyoffice-formats' );
     246        $onlyoffice_formats_version = get_site_option( 'onlyoffice-formats-version' );
     247        if ( empty( $onlyoffice_formats_version ) || ONLYOFFICE_PLUGIN_VERSION !== $onlyoffice_formats_version ) {
     248            self::init();
     249        }
     250
     251        $formats = get_site_option( 'onlyoffice-formats' );
    183252        if ( ! empty( $formats ) ) {
    184253            return $formats;
  • onlyoffice/trunk/includes/managers/class-onlyoffice-plugin-jwt-manager.php

    r2976437 r3070758  
    1212/**
    1313 *
    14  * (c) Copyright Ascensio System SIA 2023
     14 * (c) Copyright Ascensio System SIA 2024
    1515 *
    1616 * This program is free software; you can redistribute it and/or
     
    8080     */
    8181    public static function jwt_decode( $token, $secret ) {
    82         return JWT::decode( $token, new Key( $secret, 'HS256' ) );
     82        $jwt_reflection_class = new ReflectionClass( '\Firebase\JWT\JWT' );
     83        $methods              = $jwt_reflection_class->getMethods();
     84
     85        $filtered_methods = array_filter(
     86            $methods,
     87            function ( $method ) {
     88                return strpos( $method->getName(), 'getKey' ) === 0;
     89            }
     90        );
     91
     92        if ( empty( $filtered_methods ) ) {
     93            $allowed_algs = array( 'HS256' );
     94            return JWT::decode( $token, $secret, $allowed_algs );
     95        } else {
     96            return JWT::decode( $token, new Key( $secret, 'HS256' ) );
     97        }
    8398    }
    8499}
  • onlyoffice/trunk/includes/managers/class-onlyoffice-plugin-url-manager.php

    r2976437 r3070758  
    1212/**
    1313 *
    14  * (c) Copyright Ascensio System SIA 2023
     14 * (c) Copyright Ascensio System SIA 2024
    1515 *
    1616 * This program is free software; you can redistribute it and/or
     
    4040    private const PATH_CALLBACK_PUBLIC_FORMS = '/onlyoffice/oo.callback-public-forms/';
    4141    private const PATH_DOWNLOAD              = '/onlyoffice/oo.getfile/';
    42     private const PATH_EDITOR                = '/onlyoffice/oo.editor/';
    4342    private const PATH_API_JS                = 'web-apps/apps/api/documents/api.js';
    4443
     
    108107     */
    109108    public static function get_editor_url( $attachment_id ) {
    110         $hidden_id = self::encode_openssl_data( $attachment_id );
    111 
    112         return get_rest_url( null, self::PATH_EDITOR . $hidden_id );
     109        return ONLYOFFICE_PLUGIN_URL . 'editor.php?attachment_id=' . $attachment_id;
    113110    }
    114111
     
    121118     */
    122119    private static function encode_openssl_data( $data ) {
    123         $passphrase = get_option( 'onlyoffice-plugin-uuid' );
    124         $iv         = hex2bin( get_option( 'onlyoffice-plugin-bytes' ) );
     120        $passphrase = get_site_option( 'onlyoffice-plugin-uuid' );
     121        $iv         = hex2bin( get_site_option( 'onlyoffice-plugin-bytes' ) );
    125122
    126123        $encrypt = openssl_encrypt( $data, 'aes-256-ctr', $passphrase, $options = 0, $iv );
     
    136133     */
    137134    public static function decode_openssl_data( $data ) {
    138         $passphrase = get_option( 'onlyoffice-plugin-uuid' );
    139         $iv         = hex2bin( get_option( 'onlyoffice-plugin-bytes' ) );
     135        $passphrase = get_site_option( 'onlyoffice-plugin-uuid' );
     136        $iv         = hex2bin( get_site_option( 'onlyoffice-plugin-bytes' ) );
    140137
    141138        $data = urldecode( str_replace( ',', '%', $data ) );
  • onlyoffice/trunk/includes/settings/class-onlyoffice-plugin-settings.php

    r2976437 r3070758  
    1515/**
    1616 *
    17  * (c) Copyright Ascensio System SIA 2023
     17 * (c) Copyright Ascensio System SIA 2024
    1818 *
    1919 * This program is free software; you can redistribute it and/or
     
    5656
    5757    /**
     58     * ID setting allowed_owerwrite_network_settings.
     59     */
     60    const ALLOWED_OWERWRITE_NETWORK_SETTINGS = 'onlyoffice_settings_allowed_owerwrite_network_settings';
     61
     62    /**
     63     * ID setting inherit_network_settings.
     64     */
     65    const INHERIT_NETWORK_SETTINGS = 'onlyoffice_settings_inherit_network_settings';
     66
     67    /**
    5868     * Init menu.
    5969     *
     
    6474        $can_manage_settings = current_user_can( 'manage_options' );
    6575        $can_upload_files    = current_user_can( 'upload_files' );
    66 
    67         if ( $can_manage_settings && ! $can_upload_files ) {
    68             add_menu_page(
    69                 __( 'ONLYOFFICE', 'onlyoffice-plugin' ),
    70                 'ONLYOFFICE',
    71                 'manage_options',
     76        $can_manage_network  = current_user_can( 'manage_network' );
     77
     78        if ( $can_manage_settings ) {
     79            if ( $can_upload_files ) {
     80                $hook = add_submenu_page(
     81                    'onlyoffice-files',
     82                    __( 'ONLYOFFICE Docs Settings', 'onlyoffice-plugin' ),
     83                    __( 'Settings', 'onlyoffice-plugin' ),
     84                    'manage_options',
     85                    'onlyoffice-settings',
     86                    array( $this, 'options_page' )
     87                );
     88            } else {
     89                $hook = add_menu_page(
     90                    __( 'ONLYOFFICE Docs Settings', 'onlyoffice-plugin' ),
     91                    'ONLYOFFICE Docs',
     92                    'manage_options',
     93                    'onlyoffice-settings',
     94                    array( $this, 'options_page' ),
     95                    'data:image/svg+xml;base64,' . base64_encode( $logo_svg ) // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
     96                );
     97            }
     98        }
     99
     100        if ( $can_manage_network && is_network_admin() ) {
     101            $hook = add_menu_page(
     102                __( 'ONLYOFFICE Docs Settings', 'onlyoffice-plugin' ),
     103                'ONLYOFFICE Docs',
     104                'manage_network',
    72105                'onlyoffice-settings',
    73106                array( $this, 'options_page' ),
    74                 'data:image/svg+xml;base64,' . base64_encode( $logo_svg )
     107                'data:image/svg+xml;base64,' . base64_encode( $logo_svg ) // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
    75108            );
    76109        }
    77         if ( $can_manage_settings && $can_upload_files ) {
    78             add_submenu_page(
    79                 'onlyoffice-files',
    80                 'ONLYOFFICE',
    81                 __( 'Settings', 'onlyoffice-plugin' ),
    82                 'manage_options',
    83                 'onlyoffice-settings',
    84                 array( $this, 'options_page' )
    85             );
     110
     111        if ( isset( $hook ) ) {
     112            add_action( "load-$hook", array( $this, 'update_plugin_settings' ) );
    86113        }
    87114    }
     
    102129        );
    103130
     131        if ( is_multisite() ) {
     132            if ( ! is_network_admin() ) {
     133                add_settings_field(
     134                    self::INHERIT_NETWORK_SETTINGS,
     135                    __( 'Connection Settings', 'onlyoffice-plugin' ),
     136                    array( $this, 'input_checkbox' ),
     137                    'onlyoffice_settings_group',
     138                    'onlyoffice_settings_general_section',
     139                    array(
     140                        'id'          => self::INHERIT_NETWORK_SETTINGS,
     141                        'checked'     => self::inherit_network_settings(),
     142                        'disabled'    => ! $this->allowed_owerwrite_network_settings(),
     143                        'description' => __( 'Inherit Network Settings', 'onlyoffice-plugin' ),
     144                    ),
     145                );
     146            }
     147        }
     148
    104149        add_settings_field(
    105             'onlyoffice_settings_docserver_url',
     150            self::DOCSERVER_URL,
    106151            __( 'Document Editing Service address', 'onlyoffice-plugin' ),
    107             array( $this, 'input_cb' ),
     152            array( $this, 'input_text' ),
    108153            'onlyoffice_settings_group',
    109154            'onlyoffice_settings_general_section',
    110155            array(
    111                 'label_for' => self::DOCSERVER_URL,
    112                 'desc'      => '',
     156                'id'          => self::DOCSERVER_URL,
     157                'value'       => $this->get_onlyoffice_current_value_setting( self::DOCSERVER_URL ),
     158                'disabled'    => is_multisite() && ! is_network_admin() && ( ! $this->allowed_owerwrite_network_settings() || self::inherit_network_settings() ),
     159                'description' => '',
    113160            )
    114161        );
    115162
    116163        add_settings_field(
    117             'onlyoffice_settings_docserver_jwt',
     164            self::DOCSERVER_JWT,
    118165            __( 'Document server JWT secret key', 'onlyoffice-plugin' ),
    119             array( $this, 'input_cb' ),
     166            array( $this, 'input_text' ),
    120167            'onlyoffice_settings_group',
    121168            'onlyoffice_settings_general_section',
    122169            array(
    123                 'label_for' => self::DOCSERVER_JWT,
    124                 'desc'      => __( 'Secret key (leave blank to disable)', 'onlyoffice-plugin' ),
     170                'id'          => self::DOCSERVER_JWT,
     171                'value'       => $this->get_onlyoffice_current_value_setting( self::DOCSERVER_JWT ),
     172                'disabled'    => is_multisite() && ! is_network_admin() && ( ! $this->allowed_owerwrite_network_settings() || self::inherit_network_settings() ),
     173                'description' => __( 'Secret key (leave blank to disable)', 'onlyoffice-plugin' ),
    125174            )
    126175        );
    127176
    128177        add_settings_field(
    129             'onlyoffice_settings_jwt_header',
     178            self::JWT_HEADER,
    130179            __( 'Authorization header', 'onlyoffice-plugin' ),
    131             array( $this, 'input_cb' ),
     180            array( $this, 'input_text' ),
    132181            'onlyoffice_settings_group',
    133182            'onlyoffice_settings_general_section',
    134183            array(
    135                 'label_for' => self::JWT_HEADER,
    136                 'desc'      => __( 'Leave blank to use default header', 'onlyoffice-plugin' ),
     184                'id'          => self::JWT_HEADER,
     185                'value'       => $this->get_onlyoffice_current_value_setting( self::JWT_HEADER ),
     186                'disabled'    => is_multisite() && ! is_network_admin() && ( ! $this->allowed_owerwrite_network_settings() || self::inherit_network_settings() ),
     187                'description' => __( 'Leave blank to use default header', 'onlyoffice-plugin' ),
    137188            )
    138189        );
    139     }
    140 
    141     /**
    142      * Input cb
     190
     191        if ( is_multisite() ) {
     192            if ( is_network_admin() ) {
     193                add_settings_field(
     194                    self::ALLOWED_OWERWRITE_NETWORK_SETTINGS,
     195                    '',
     196                    array( $this, 'input_checkbox' ),
     197                    'onlyoffice_settings_group',
     198                    'onlyoffice_settings_general_section',
     199                    array(
     200                        'id'          => self::ALLOWED_OWERWRITE_NETWORK_SETTINGS,
     201                        'checked'     => self::allowed_owerwrite_network_settings(),
     202                        'disabled'    => '',
     203                        'description' => __( 'Allow site administrators to configure plugin for their sites', 'onlyoffice-plugin' ),
     204                    )
     205                );
     206            }
     207        }
     208    }
     209
     210    /**
     211     * Input text
    143212     *
    144213     * @param array $args Args.
     
    146215     * @return void
    147216     */
    148     public function input_cb( array $args ) {
     217    public function input_text( array $args ) {
    149218        ?>
    150         <input id="<?php echo esc_attr( $args['label_for'] ); ?>" type="text" class="regular-text" name="onlyoffice_settings[<?php echo esc_attr( $args['label_for'] ); ?>]" value="<?php echo esc_attr( $this->get_onlyoffice_setting( $args['label_for'] ) ); ?>">
    151         <p class="description">
    152             <?php echo esc_attr( $args['desc'] ); ?>
     219        <input id="<?php echo esc_attr( $args['id'] ); ?>" name="<?php echo esc_attr( $args['id'] ); ?>" value="<?php echo esc_attr( $args['value'] ); ?>" <?php disabled( $args['disabled'] ); ?> type="text" class="regular-text">
     220        <p class="description"><?php echo esc_attr( $args['description'] ); ?></p>
     221        <?php
     222    }
     223
     224    /**
     225     * Input checkbox
     226     *
     227     * @param array $args Args.
     228     *
     229     * @return void
     230     */
     231    public function input_checkbox( array $args ) {
     232        ?>
     233        <input id="<?php echo esc_attr( $args['id'] ); ?>" name="<?php echo esc_attr( $args['id'] ); ?>" <?php checked( $args['checked'] ); ?> <?php disabled( $args['disabled'] ); ?> type="checkbox" value="1">
     234        <label for="<?php echo esc_attr( $args['id'] ); ?>"><?php echo esc_attr( $args['description'] ); ?></label>
     235        <?php
     236    }
     237
     238    /**
     239     * General section callback.
     240     *
     241     * @param array $args Args.
     242     *
     243     * @return void
     244     */
     245    public function general_section_callback( $args ) {
     246        settings_errors();
     247        ?>
     248        <p id="<?php echo esc_attr( $args['id'] ); ?>">
     249        <?php
     250        if ( is_multisite() ) {
     251            if ( is_network_admin() ) {
     252                esc_html_e( 'Configure ONLYOFFICE Docs plugin settings for the whole network.', 'onlyoffice-plugin' );
     253            } else {
     254                printf(
     255                    wp_kses(
     256                        /* translators: %s: Title WP Site. */
     257                        __( 'Configure ONLYOFFICE Docs plugin settings for %s site.', 'onlyoffice-plugin' ),
     258                        array(
     259                            'strong' => array(
     260                                'class' => array(),
     261                            ),
     262                        ),
     263                    ),
     264                    '<a href="' . esc_attr( get_bloginfo( 'url' ) ) . '">' . esc_attr( get_bloginfo() ) . '</a>'
     265                );
     266
     267                if ( ! $this->allowed_owerwrite_network_settings() ) {
     268                    ?>
     269                    <div class="onlyoffice-settings-notice">
     270                        <p>
     271                            <?php esc_html_e( 'Blocked from changing settings by the Network administrator', 'onlyoffice-plugin' ); ?>
     272                        </p>
     273                    </div>
     274                    <?php
     275                }
     276            }
     277        } else {
     278            ?>
     279            <p id="<?php echo esc_attr( $args['id'] ); ?>"><?php esc_html_e( 'Configure ONLYOFFICE Docs plugin settings.', 'onlyoffice-plugin' ); ?></p>
     280            <?php
     281        }
     282        ?>
    153283        </p>
    154         <?php
    155     }
    156 
    157     /**
    158      * General section callback.
    159      *
    160      * @param array $args Args.
    161      *
    162      * @return void
    163      */
    164     public function general_section_callback( $args ) {
    165         ?>
    166         <p id="<?php echo esc_attr( $args['id'] ); ?>"><?php esc_html_e( 'Configure ONLYOFFICE connector settings', 'onlyoffice-plugin' ); ?></p>
    167284        <?php
    168285    }
     
    177294
    178295        wp_enqueue_style(
    179             'onlyoffice-settings',
     296            ONLYOFFICE_PLUGIN_NAME . '-settings',
     297            ONLYOFFICE_PLUGIN_URL . 'admin/css/settings.css',
     298            array(),
     299            ONLYOFFICE_PLUGIN_VERSION
     300        );
     301
     302        wp_enqueue_style(
     303            ONLYOFFICE_PLUGIN_NAME . '-cloud-banner',
    180304            ONLYOFFICE_PLUGIN_URL . 'admin/css/banner/onlyoffice-cloud-banner.css',
    181305            array(),
     
    183307        );
    184308
    185         if ( ! empty( $_GET['settings-updated'] ) && sanitize_key( $_GET['settings-updated'] ) === 'true' ) {
    186             add_settings_error( 'onlyoffice_settings_messages', 'onlyoffice_message', __( 'Settings Saved', 'onlyoffice-plugin' ), 'updated' ); // ToDo: can also check if settings are valid e.g. make connection to docServer.
    187         }
    188 
    189         settings_errors( 'onlyoffice_settings_messages' );
     309        wp_enqueue_script(
     310            ONLYOFFICE_PLUGIN_NAME . '-settings',
     311            ONLYOFFICE_PLUGIN_URL . 'admin/js/settings.js',
     312            array( 'jquery' ),
     313            ONLYOFFICE_PLUGIN_VERSION,
     314            true
     315        );
     316
     317        if ( function_exists( 'wp_set_script_translations' ) ) {
     318            wp_set_script_translations(
     319                ONLYOFFICE_PLUGIN_NAME . '-settings',
     320                'onlyoffice-plugin',
     321                plugin_dir_path( ONLYOFFICE_PLUGIN_FILE ) . 'languages/'
     322            );
     323        }
     324
    190325        ?>
    191326        <div class="wrap">
    192327            <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
    193             <form action="options.php" method="post">
     328            <form id="onlyoffice-settings-form" action="admin.php?page=onlyoffice-settings" method="post">
    194329                <?php
    195330                settings_fields( 'onlyoffice_settings_group' );
    196331                do_settings_sections( 'onlyoffice_settings_group' );
    197                 submit_button( __( 'Save Settings', 'onlyoffice-plugin' ) );
     332
     333                $submit_button_args = array(
     334                    'id' => 'onlyoffice-settings-submit-button',
     335                );
     336                if ( is_multisite() && ! is_network_admin() && ! $this->allowed_owerwrite_network_settings() ) {
     337                    $submit_button_args = array(
     338                        'disabled' => '',
     339                    );
     340                }
     341
     342                submit_button(
     343                    __( 'Save Settings', 'onlyoffice-plugin' ),
     344                    'primary',
     345                    '',
     346                    true,
     347                    $submit_button_args
     348                );
    198349                ?>
    199350            </form>
     
    212363        </div>
    213364        <?php
    214     }
    215 
    216     /**
    217      * Return ONLYOFFICE  Setting
     365        $this->wp_print_onlyoffice_setting_confirm_dialog();
     366    }
     367
     368    /**
     369     * Update settings.
     370     */
     371    public function update_plugin_settings() {
     372        switch ( $this->current_action() ) {
     373            case 'update':
     374                check_admin_referer( 'onlyoffice_settings_group-options' );
     375
     376                if ( is_multisite() && ! is_network_admin() && ! $this->allowed_owerwrite_network_settings() ) {
     377                    wp_die( 'Blocked from changing settings by the Network administrator!', '', array( 'response' => 403 ) );
     378                }
     379
     380                $value = array();
     381
     382                if ( isset( $_POST[ self::DOCSERVER_URL ] ) ) {
     383                    $value[ self::DOCSERVER_URL ] = sanitize_text_field( wp_unslash( $_POST[ self::DOCSERVER_URL ] ) );
     384                }
     385
     386                if ( isset( $_POST[ self::DOCSERVER_JWT ] ) ) {
     387                    $value[ self::DOCSERVER_JWT ] = sanitize_text_field( wp_unslash( $_POST[ self::DOCSERVER_JWT ] ) );
     388                }
     389
     390                if ( isset( $_POST[ self::JWT_HEADER ] ) ) {
     391                    $value[ self::JWT_HEADER ] = sanitize_text_field( wp_unslash( $_POST[ self::JWT_HEADER ] ) );
     392                }
     393
     394                if ( is_multisite() ) {
     395                    if ( is_network_admin() ) {
     396                        if ( isset( $_POST[ self::ALLOWED_OWERWRITE_NETWORK_SETTINGS ] ) ) {
     397                            $value[ self::ALLOWED_OWERWRITE_NETWORK_SETTINGS ] = sanitize_text_field( wp_unslash( $_POST[ self::ALLOWED_OWERWRITE_NETWORK_SETTINGS ] ) );
     398                        } else {
     399                            $value[ self::ALLOWED_OWERWRITE_NETWORK_SETTINGS ] = 0;
     400                        }
     401
     402                        $current_options = get_site_option( 'onlyoffice_settings', array() );
     403                        $new_options     = array_merge( $current_options, $value );
     404
     405                        update_site_option( 'onlyoffice_settings', $new_options );
     406                    } else {
     407                        if ( isset( $_POST[ self::INHERIT_NETWORK_SETTINGS ] ) ) {
     408                            $value[ self::INHERIT_NETWORK_SETTINGS ] = sanitize_text_field( wp_unslash( $_POST[ self::INHERIT_NETWORK_SETTINGS ] ) );
     409
     410                            if ( $value[ self::INHERIT_NETWORK_SETTINGS ] ) {
     411                                $value = array(
     412                                    self::INHERIT_NETWORK_SETTINGS => $value[ self::INHERIT_NETWORK_SETTINGS ],
     413                                );
     414                            }
     415                        } else {
     416                            $value[ self::INHERIT_NETWORK_SETTINGS ] = 0;
     417                        }
     418
     419                        $current_options = get_option( 'onlyoffice_settings', array() );
     420                        $new_options     = array_merge( $current_options, $value );
     421
     422                        update_option( 'onlyoffice_settings', $new_options );
     423                    }
     424                } else {
     425                    $current_options = get_site_option( 'onlyoffice_settings', array() );
     426                    $new_options     = array_merge( $current_options, $value );
     427
     428                    update_option( 'onlyoffice_settings', $new_options );
     429                }
     430
     431                add_settings_error( 'general', 'settings_updated', __( 'Settings saved.' ), 'success' );
     432                set_transient( 'settings_errors', get_settings_errors(), 30 );
     433
     434                if ( is_network_admin() ) {
     435                    wp_safe_redirect( network_admin_url( 'admin.php?page=onlyoffice-settings&settings-updated=true' ) );
     436                } else {
     437                    wp_safe_redirect( admin_url( 'admin.php?page=onlyoffice-settings&settings-updated=true' ) );
     438                }
     439
     440                exit;
     441        }
     442    }
     443
     444    /**
     445     * Return ONLYOFFICE Docs plugin Settings
    218446     *
    219447     * @param string $key Setting key.
     
    221449     */
    222450    public static function get_onlyoffice_setting( $key, $def = '' ) {
    223         $options = get_option( 'onlyoffice_settings' );
     451        if ( is_multisite() ) {
     452            if ( ! self::allowed_owerwrite_network_settings() || self::inherit_network_settings() ) {
     453                $options = get_site_option( 'onlyoffice_settings' );
     454            } else {
     455                $options = get_option( 'onlyoffice_settings' );
     456            }
     457        } else {
     458            $options = get_option( 'onlyoffice_settings' );
     459        }
     460
    224461        if ( ! empty( $options ) && array_key_exists( $key, $options ) ) {
    225462            return $options[ $key ];
     
    228465        return $def;
    229466    }
     467
     468    /**
     469     * Return ONLYOFFICE Docs plugin settings value
     470     *
     471     * @param string $key Setting key.
     472     * @param string $def Default value.
     473     */
     474    private function get_onlyoffice_current_value_setting( $key, $def = '' ) {
     475        if ( is_multisite() ) {
     476            if ( is_network_admin() ) {
     477                $options = get_site_option( 'onlyoffice_settings' );
     478            } else {
     479                $options = get_option( 'onlyoffice_settings' );
     480            }
     481        } else {
     482            $options = get_option( 'onlyoffice_settings' );
     483        }
     484
     485        if ( ! empty( $options ) && array_key_exists( $key, $options ) ) {
     486            return $options[ $key ];
     487        }
     488
     489        return $def;
     490    }
     491
     492    /**
     493     * Return current actrion.
     494     */
     495    private function current_action() {
     496        global $filter_action, $action;
     497        wp_reset_vars( array( 'filter_action', 'action' ) );
     498
     499        if ( ! empty( $filter_action ) ) {
     500            return false;
     501        }
     502
     503        if ( ! empty( $action ) && -1 !== $action ) {
     504            return $action;
     505        }
     506
     507        return false;
     508    }
     509
     510    /**
     511     * Return setting allowed_owerwrite_network_settings.
     512     */
     513    private static function allowed_owerwrite_network_settings() {
     514        $options = get_site_option( 'onlyoffice_settings' );
     515        if ( ! empty( $options ) && array_key_exists( self::ALLOWED_OWERWRITE_NETWORK_SETTINGS, $options ) ) {
     516            return $options[ self::ALLOWED_OWERWRITE_NETWORK_SETTINGS ];
     517        }
     518
     519        return false;
     520    }
     521
     522    /**
     523     * Return setting inherit_network_settings.
     524     */
     525    private static function inherit_network_settings() {
     526        $options = get_option( 'onlyoffice_settings' );
     527        if ( ! empty( $options ) && array_key_exists( self::INHERIT_NETWORK_SETTINGS, $options ) ) {
     528            return $options[ self::INHERIT_NETWORK_SETTINGS ];
     529        }
     530
     531        return true;
     532    }
     533
     534    /**
     535     * Return confirm update settings dialog.
     536     */
     537    private function wp_print_onlyoffice_setting_confirm_dialog() {
     538        ?>
     539        <div id="onlyoffice-setting-confirm-dialog" class="notification-dialog-wrap hidden">
     540            <div class="notification-dialog-background"></div>
     541            <div class="notification-dialog" role="dialog" tabindex="0">
     542                <div class="onlyoffice-setting-confirm-dialog-content">
     543                    <h1><?php esc_html_e( 'Settings update', 'onlyoffice-plugin' ); ?></h1>
     544                    <div class="onlyoffice-setting-confirm-message"></div>
     545                    <p>
     546                        <a class="button onlyoffice-setting-confirm-dialog-cancel"><?php esc_html_e( 'Cancel' ); ?></a>
     547                        <button type="button" class="onlyoffice-setting-confirm-dialog-ok button button-primary"><?php esc_html_e( 'OK' ); ?></button>
     548                    </p>
     549                </div>
     550            </div>
     551        </div>
     552        <?php
     553    }
    230554}
  • onlyoffice/trunk/languages/onlyoffice-plugin-de_DE.po

    r2976437 r3070758  
    1111"Content-Transfer-Encoding: 8bit\n"
    1212"Plural-Forms: nplurals=2; plural=(n != 1);\n"
    13 "X-Generator: Poedit 3.0.1\n"
    14 
    15 msgid "General Settings"
    16 msgstr "Allgemeine Einstellungen"
     13"X-Generator: Poedit 3.4.1\n"
    1714
    1815msgid "Document Editing Service address"
     
    3128msgstr "Leer lassen, um die standardmäßige Kopfzeile zu verwenden"
    3229
    33 msgid "Settings Saved"
    34 msgstr "Die Einstellungen werden gespeichert"
    35 
    3630msgid "Open in ONLYOFFICE"
    3731msgstr "In ONLYOFFICE öffnen"
     
    4943msgstr "Einstellungen"
    5044
    51 msgid "General settings section"
    52 msgstr "Allgemeine Einstellungen"
    53 
    5445msgid "Files"
    5546msgstr "Dateien"
    5647
    57 msgid "Configure ONLYOFFICE connector settings"
    58 msgstr "ONLYOFFICE-Konnektor konfigurieren"
     48msgid "ONLYOFFICE Docs Settings"
     49msgstr "ONLYOFFICE Docs Einstellungen "
    5950
    60 msgid "ONLYOFFICE cannot be reached. Please contact admin"
    61 msgstr "ONLYOFFICE ist nicht zugänglich. Bitte wende Dich an Deinen Administrator"
     51msgid "Configure ONLYOFFICE Docs plugin settings."
     52msgstr "Einstellungen von ONLYOFFICE Docs konfigurieren"
    6253
    63 msgid "Files that can be edited and opened in ONLYOFFICE will be displayed here"
    64 msgstr "Hier werden die Dateien zugänglich, die Sie in ONLYOFFICE öffnen und bearbeiten können"
     54msgid "Configure ONLYOFFICE Docs plugin settings for the whole network."
     55msgstr "Konfigurieren Sie die Einstellungen des Plugins ONLYOFFICE Docs für das gesamte Netzwerk."
    6556
    66 msgid "No files found for editing or viewing in ONLYOFFICE."
    67 msgstr "Keine Dateien zum Öffnen oder Bearbeiten in ONLYOFFICE gefunden."
     57msgid "Configure ONLYOFFICE Docs plugin settings for %s site."
     58msgstr "Konfigurieren Sie die Einstellungen des Plugins ONLYOFFICE Docs für die Website %s."
    6859
    69 msgid "Add ONLYOFFICE editor on page"
    70 msgstr "ONLYOFFICE-Editor zur Seite hinzufügen"
     60msgid "Blocked from changing settings by the Network administrator"
     61msgstr "Der Netzwerkadministrator hat die Änderung der Einstellungen verhindert"
     62
     63msgid "Allow site administrators to configure plugin for their sites"
     64msgstr "Erlauben Sie Site-Administratoren, Plugins für ihre Sites zu konfigurieren"
     65
     66msgid "Inherit Network Settings"
     67msgstr "Netzwerkeinstellungen übernehmen"
     68
     69msgid "Connection Settings"
     70msgstr "Verbindungseinstellungen"
     71
     72#: controllers/js/frontend-controller.js
     73msgid "ONLYOFFICE Docs cannot be reached. Please contact admin."
     74msgstr "ONLYOFFICE Docs ist nicht zugänglich. Bitte wende Dich an Deinen Administrator."
     75
     76msgid "Files that can be edited and opened in ONLYOFFICE Docs editor are displayed here."
     77msgstr "Hier werden die Dateien angezeigt, die Sie in ONLYOFFICE Docs öffnen und bearbeiten können."
     78
     79msgid "No files found for editing or viewing in ONLYOFFICE Docs editor."
     80msgstr "Keine Dateien zum Öffnen oder Bearbeiten in ONLYOFFICE Docs gefunden."
     81
     82msgid "Add ONLYOFFICE Docs editor on page"
     83msgstr "ONLYOFFICE Docs zur Seite hinzufügen"
    7184
    7285msgid "ONLYOFFICE Docs Cloud"
     
    7891msgid "Get Now"
    7992msgstr "Jetzt erhalten"
     93
     94#: onlyoffice-wordpress-block/build/index.js
     95msgid "Embedded"
     96msgstr "Eingebettet"
     97
     98#: onlyoffice-wordpress-block/build/index.js
     99msgid "Document view"
     100msgstr "Dokument-Ansicht"
     101
     102#: onlyoffice-wordpress-block/build/index.js
     103msgid "Open in ONLYOFFICE"
     104msgstr "In ONLYOFFICE öffnen"
     105
     106#: onlyoffice-wordpress-block/build/index.js
     107msgid "Show Open in ONLYOFFICE button"
     108msgstr "Schaltfläche 'In ONLYOFFICE öffnen' anzeigen"
     109
     110#: onlyoffice-wordpress-block/build/index.js
     111#: controllers/js/frontend-controller.js
     112msgid "File not found!"
     113msgstr "Datei nicht gefunden!"
     114
     115msgid "Settings update"
     116msgstr "Einstellungen aktualisieren"
     117
     118#: admin/js/settings.js
     119msgid "Do you want to allow sites administrators to configure the plugin themselves?"
     120msgstr "Möchten Sie Site-Administratoren erlauben, das Plugin selbst zu konfigurieren?"
     121
     122#: admin/js/settings.js
     123msgid "Do you want to apply these settings to all sites?"
     124msgstr "Möchten Sie diese Einstellungen auf alle Websites anwenden?"
     125
     126#: admin/js/settings.js
     127msgid "Do you want to apply the network settings?"
     128msgstr "Möchten Sie die Netzwerkeinstellungen übernehmen?"
  • onlyoffice/trunk/languages/onlyoffice-plugin-en.po

    r2976437 r3070758  
    1111"Content-Transfer-Encoding: 8bit\n"
    1212"Plural-Forms: nplurals=2; plural=(n != 1);\n"
    13 "X-Generator: Poedit 3.0.1\n"
    14 
    15 msgid "General Settings"
    16 msgstr "General Settings"
     13"X-Generator: Poedit 3.4.1\n"
    1714
    1815msgid "Document Editing Service address"
     
    3128msgstr "Leave blank to use default header"
    3229
    33 msgid "Settings Saved"
    34 msgstr "Settings Saved"
    35 
    3630msgid "Open in ONLYOFFICE"
    3731msgstr "Open in ONLYOFFICE"
     
    4943msgstr "Settings"
    5044
    51 msgid "General settings section"
    52 msgstr "General settings section"
    53 
    5445msgid "Files"
    5546msgstr "Files"
    5647
    57 msgid "Configure ONLYOFFICE connector settings"
    58 msgstr "Configure ONLYOFFICE connector settings"
     48msgid "ONLYOFFICE Docs Settings"
     49msgstr "ONLYOFFICE Docs Settings"
    5950
    60 msgid "ONLYOFFICE cannot be reached. Please contact admin"
    61 msgstr "ONLYOFFICE cannot be reached. Please contact admin"
     51msgid "Configure ONLYOFFICE Docs plugin settings."
     52msgstr "Configure ONLYOFFICE Docs plugin settings."
    6253
    63 msgid "Files that can be edited and opened in ONLYOFFICE will be displayed here"
    64 msgstr "Files that can be edited and opened in ONLYOFFICE will be displayed here"
     54msgid "Configure ONLYOFFICE Docs plugin settings for the whole network."
     55msgstr "Configure ONLYOFFICE Docs plugin settings for the whole network."
    6556
    66 msgid "No files found for editing or viewing in ONLYOFFICE."
    67 msgstr "No files found for editing or viewing in ONLYOFFICE."
     57msgid "Configure ONLYOFFICE Docs plugin settings for %s site."
     58msgstr "Configure ONLYOFFICE Docs plugin settings for %s site."
    6859
    69 msgid "Add ONLYOFFICE editor on page"
    70 msgstr "Add ONLYOFFICE editor on page"
     60msgid "Blocked from changing settings by the Network administrator"
     61msgstr "Blocked from changing settings by the Network administrator"
     62
     63msgid "Allow site administrators to configure plugin for their sites"
     64msgstr "Allow site administrators to configure plugin for their sites"
     65
     66msgid "Inherit Network Settings"
     67msgstr "Inherit Network Settings"
     68
     69msgid "Connection Settings"
     70msgstr "Connection Settings"
     71
     72#: controllers/js/frontend-controller.js
     73msgid "ONLYOFFICE Docs cannot be reached. Please contact admin."
     74msgstr "ONLYOFFICE Docs cannot be reached. Please contact admin."
     75
     76msgid "Files that can be edited and opened in ONLYOFFICE Docs editor are displayed here."
     77msgstr "Files that can be edited and opened in ONLYOFFICE Docs editor are displayed here."
     78
     79msgid "No files found for editing or viewing in ONLYOFFICE Docs editor."
     80msgstr "No files found for editing or viewing in ONLYOFFICE Docs editor."
     81
     82msgid "Add ONLYOFFICE Docs editor on page"
     83msgstr "Add ONLYOFFICE Docs editor on page"
    7184
    7285msgid "ONLYOFFICE Docs Cloud"
     
    7891msgid "Get Now"
    7992msgstr "Get Now"
     93
     94#: onlyoffice-wordpress-block/build/index.js
     95msgid "Embedded"
     96msgstr "Embedded"
     97
     98#: onlyoffice-wordpress-block/build/index.js
     99msgid "Document view"
     100msgstr "Document view"
     101
     102#: onlyoffice-wordpress-block/build/index.js
     103msgid "Open in ONLYOFFICE"
     104msgstr "Open in ONLYOFFICE"
     105
     106#: onlyoffice-wordpress-block/build/index.js
     107msgid "Show Open in ONLYOFFICE button"
     108msgstr "Show Open in ONLYOFFICE button"
     109
     110#: onlyoffice-wordpress-block/build/index.js
     111#: controllers/js/frontend-controller.js
     112msgid "File not found!"
     113msgstr "File not found!"
     114
     115msgid "Settings update"
     116msgstr "Settings update"
     117
     118#: admin/js/settings.js
     119msgid "Do you want to allow sites administrators to configure the plugin themselves?"
     120msgstr "Do you want to allow sites administrators to configure the plugin themselves?"
     121
     122#: admin/js/settings.js
     123msgid "Do you want to apply these settings to all sites?"
     124msgstr "Do you want to apply these settings to all sites?"
     125
     126#: admin/js/settings.js
     127msgid "Do you want to apply the network settings?"
     128msgstr "Do you want to apply the network settings?"
  • onlyoffice/trunk/languages/onlyoffice-plugin-es_ES.po

    r2976437 r3070758  
    1111"Content-Transfer-Encoding: 8bit\n"
    1212"Plural-Forms: nplurals=2; plural=(n != 1);\n"
    13 "X-Generator: Poedit 3.0.1\n"
    14 
    15 msgid "General Settings"
    16 msgstr "Ajustes generales"
     13"X-Generator: Poedit 3.4.1\n"
    1714
    1815msgid "Document Editing Service address"
     
    3128msgstr "Dejar en blanco para utilizar el encabezado predeterminado"
    3229
    33 msgid "Settings Saved"
    34 msgstr "Los ajustes se han guardado"
    35 
    3630msgid "Open in ONLYOFFICE"
    3731msgstr "Abrir en ONLYOFFICE"
     
    4943msgstr "Ajustes"
    5044
    51 msgid "General settings section"
    52 msgstr "Sección de ajustes generales"
    53 
    5445msgid "Files"
    5546msgstr "Archivos"
    5647
    57 msgid "Configure ONLYOFFICE connector settings"
    58 msgstr "Configurar los ajustes del conector de ONLYOFFICE"
     48msgid "ONLYOFFICE Docs Settings"
     49msgstr "Ajustes de ONLYOFFICE Docs"
    5950
    60 msgid "ONLYOFFICE cannot be reached. Please contact admin"
    61 msgstr "No se puede establecer contacto con ONLYOFFICE. Por favor, contacte con admin"
     51msgid "Configure ONLYOFFICE Docs plugin settings."
     52msgstr "Configurar los ajustes del plugin de ONLYOFFICE Docs"
    6253
    63 msgid "Files that can be edited and opened in ONLYOFFICE will be displayed here"
    64 msgstr "Los archivos que se pueden editar y abrir en ONLYOFFICE se mostrarán aquí"
     54msgid "Configure ONLYOFFICE Docs plugin settings for the whole network."
     55msgstr "Configurar los ajustes del plugin ONLYOFFICE Docs para toda la red."
    6556
    66 msgid "No files found for editing or viewing in ONLYOFFICE."
    67 msgstr "No se han encontrado archivos para editar o ver en ONLYOFFICE."
     57msgid "Configure ONLYOFFICE Docs plugin settings for %s site."
     58msgstr "Configurar los ajustes del plugin ONLYOFFICE Docs para el sitio %s."
    6859
    69 msgid "Add ONLYOFFICE editor on page"
    70 msgstr "Añadir el editor de ONLYOFFICE en la página"
     60msgid "Blocked from changing settings by the Network administrator"
     61msgstr "El administrador de la red no le permite cambiar los ajustes"
     62
     63msgid "Allow site administrators to configure plugin for their sites"
     64msgstr "Permitir a los administradores de los sitios configurar el plugin para sus sitios"
     65
     66msgid "Inherit Network Settings"
     67msgstr "Aplicar los ajustes de red"
     68
     69msgid "Connection Settings"
     70msgstr "Ajustes de conexión"
     71
     72#: controllers/js/frontend-controller.js
     73msgid "ONLYOFFICE Docs cannot be reached. Please contact admin."
     74msgstr "No se puede acceder a ONLYOFFICE Docs. Por favor, contacte con el administrador."
     75
     76msgid "Files that can be edited and opened in ONLYOFFICE Docs editor are displayed here."
     77msgstr "Los archivos que se pueden editar y abrir en el editor de ONLYOFFICE Docs se mostrarán aquí."
     78
     79msgid "No files found for editing or viewing in ONLYOFFICE Docs editor."
     80msgstr "No se han encontrado archivos para editar o ver en el editor de ONLYOFFICE Docs."
     81
     82msgid "Add ONLYOFFICE Docs editor on page"
     83msgstr "Añadir el editor de ONLYOFFICE Docs a la página"
    7184
    7285msgid "ONLYOFFICE Docs Cloud"
     
    7891msgid "Get Now"
    7992msgstr "Obtener ahora"
     93
     94#: onlyoffice-wordpress-block/build/index.js
     95msgid "Embedded"
     96msgstr "Incorporado"
     97
     98#: onlyoffice-wordpress-block/build/index.js
     99msgid "Document view"
     100msgstr "Visualización de documento"
     101
     102#: onlyoffice-wordpress-block/build/index.js
     103msgid "Open in ONLYOFFICE"
     104msgstr "Abrir en ONLYOFFICE"
     105
     106#: onlyoffice-wordpress-block/build/index.js
     107msgid "Show Open in ONLYOFFICE button"
     108msgstr "Mostrar el botón Abrir en ONLYOFFICE"
     109
     110#: onlyoffice-wordpress-block/build/index.js
     111#: controllers/js/frontend-controller.js
     112msgid "File not found!"
     113msgstr "¡No se ha encontrado el archivo!"
     114
     115msgid "Settings update"
     116msgstr "Actualización de los ajustes"
     117
     118#: admin/js/settings.js
     119msgid "Do you want to allow sites administrators to configure the plugin themselves?"
     120msgstr "¿Desea permitir a los administradores de los sitios que configuren ellos mismos el plugin?"
     121
     122#: admin/js/settings.js
     123msgid "Do you want to apply these settings to all sites?"
     124msgstr "¿Desea aplicar estos ajustes a todos los sitios?"
     125
     126#: admin/js/settings.js
     127msgid "Do you want to apply the network settings?"
     128msgstr "¿Desea aplicar los ajustes de red?"
  • onlyoffice/trunk/languages/onlyoffice-plugin-fr_FR.po

    r2976437 r3070758  
    1111"Content-Transfer-Encoding: 8bit\n"
    1212"Plural-Forms: nplurals=2; plural=(n > 1);\n"
    13 "X-Generator: Poedit 3.0.1\n"
    14 
    15 msgid "General Settings"
    16 msgstr "Paramètres généraux"
     13"X-Generator: Poedit 3.4.1\n"
    1714
    1815msgid "Document Editing Service address"
     
    3128msgstr "Laissez vide pour utiliser l'en-tête par défaut"
    3229
    33 msgid "Settings Saved"
    34 msgstr "Paramètres sauvegardés"
    35 
    3630msgid "Open in ONLYOFFICE"
    3731msgstr "Ouvrir dans ONLYOFFICE"
     
    4943msgstr "Paramètres"
    5044
    51 msgid "General settings section"
    52 msgstr "Section des paramètres généraux"
    53 
    5445msgid "Files"
    5546msgstr "Fichiers"
    5647
    57 msgid "Configure ONLYOFFICE connector settings"
    58 msgstr "Configurer les paramètres du connecteur ONLYOFFICE"
     48msgid "ONLYOFFICE Docs Settings"
     49msgstr "Paramètres d'ONLYOFFICE Docs"
    5950
    60 msgid "ONLYOFFICE cannot be reached. Please contact admin"
    61 msgstr "Impossible de joindre ONLYOFFICE. Veuillez contacter l'administrateur"
     51msgid "Configure ONLYOFFICE Docs plugin settings."
     52msgstr "Configurer les paramètres du connecteur ONLYOFFICE Docs"
    6253
    63 msgid "Files that can be edited and opened in ONLYOFFICE will be displayed here"
    64 msgstr "Les fichiers qui peuvent être édités et ouverts dans ONLYOFFICE seront affichés ici"
     54msgid "Configure ONLYOFFICE Docs plugin settings for the whole network."
     55msgstr "Configurez les paramètres du plugin ONLYOFFICE Docs pour l'ensemble du réseau."
    6556
    66 msgid "No files found for editing or viewing in ONLYOFFICE."
    67 msgstr "Aucun fichier trouvé pour être édité ou affiché dans ONLYOFFICE."
     57msgid "Configure ONLYOFFICE Docs plugin settings for %s site."
     58msgstr "Configurez les paramètres du plugin ONLYOFFICE Docs pour le site %s."
    6859
    69 msgid "Add ONLYOFFICE editor on page"
    70 msgstr "Ajouter l'éditeur ONLYOFFICE à la page"
     60msgid "Blocked from changing settings by the Network administrator"
     61msgstr "L'administrateur du réseau a bloqué la modification des paramètres"
     62
     63msgid "Allow site administrators to configure plugin for their sites"
     64msgstr "Permettez aux administrateurs de sites de configurer le plugin pour leurs sites"
     65
     66msgid "Inherit Network Settings"
     67msgstr "Appliquer les paramètres réseau"
     68
     69msgid "Connection Settings"
     70msgstr "Paramètres de connexion"
     71
     72#: controllers/js/frontend-controller.js
     73msgid "ONLYOFFICE Docs cannot be reached. Please contact admin."
     74msgstr "Impossible de joindre ONLYOFFICE Docs. Veuillez contacter l'administrateur."
     75
     76msgid "Files that can be edited and opened in ONLYOFFICE Docs editor are displayed here."
     77msgstr "Les fichiers qui peuvent être édités et ouverts dans l'éditeur ONLYOFFICE Docs sont affichés ici."
     78
     79msgid "No files found for editing or viewing in ONLYOFFICE Docs editor."
     80msgstr "Aucun fichier trouvé pour être édité ou affiché dans ONLYOFFICE Docs."
     81
     82msgid "Add ONLYOFFICE Docs editor on page"
     83msgstr "Ajouter l'éditeur ONLYOFFICE Docs à la page"
    7184
    7285msgid "ONLYOFFICE Docs Cloud"
     
    7891msgid "Get Now"
    7992msgstr "Obtenir maintenant"
     93
     94#: onlyoffice-wordpress-block/build/index.js
     95msgid "Embedded"
     96msgstr "Intégré"
     97
     98#: onlyoffice-wordpress-block/build/index.js
     99msgid "Document view"
     100msgstr "Vue du document"
     101
     102#: onlyoffice-wordpress-block/build/index.js
     103msgid "Open in ONLYOFFICE"
     104msgstr "Ouvrir dans ONLYOFFICE"
     105
     106#: onlyoffice-wordpress-block/build/index.js
     107msgid "Show Open in ONLYOFFICE button"
     108msgstr "Afficher le bouton Ouvrir dans ONLYOFFICE"
     109
     110#: onlyoffice-wordpress-block/build/index.js
     111#: controllers/js/frontend-controller.js
     112msgid "File not found!"
     113msgstr "Fichier non trouvé !"
     114
     115msgid "Settings update"
     116msgstr "Actualiser les paramètres"
     117
     118#: admin/js/settings.js
     119msgid "Do you want to allow sites administrators to configure the plugin themselves?"
     120msgstr "Souhaitez-vous permettre aux administrateurs de sites de configurer eux-mêmes le plugin ?"
     121
     122#: admin/js/settings.js
     123msgid "Do you want to apply these settings to all sites?"
     124msgstr "Souhaitez-vous appliquer ces paramètres à tous les sites ?"
     125
     126#: admin/js/settings.js
     127msgid "Do you want to apply the network settings?"
     128msgstr "Souhaitez-vous appliquer les paramètres du réseau ?"
  • onlyoffice/trunk/languages/onlyoffice-plugin-it_IT.po

    r2976437 r3070758  
    1111"Content-Transfer-Encoding: 8bit\n"
    1212"Plural-Forms: nplurals=2; plural=(n != 1);\n"
    13 "X-Generator: Poedit 3.0.1\n"
    14 
    15 msgid "General Settings"
    16 msgstr "Impostazioni generali"
     13"X-Generator: Poedit 3.4.1\n"
    1714
    1815msgid "Document Editing Service address"
     
    3128msgstr "Lascia vuoto per utilizzare l'intestazione predefinita"
    3229
    33 msgid "Settings Saved"
    34 msgstr "Le impostazioni sono state salvate"
    35 
    3630msgid "Open in ONLYOFFICE"
    3731msgstr "Aprire in ONLYOFFICE"
     
    4943msgstr "Impostazioni"
    5044
    51 msgid "General settings section"
    52 msgstr "Sezione Impostazioni generali"
    53 
    5445msgid "Files"
    5546msgstr "File"
    5647
    57 msgid "Configure ONLYOFFICE connector settings"
    58 msgstr "Configurare le impostazioni del connettore ONLYOFFICE"
     48msgid "ONLYOFFICE Docs Settings"
     49msgstr "Impostazioni di ONLYOFFICE Docs"
    5950
    60 msgid "ONLYOFFICE cannot be reached. Please contact admin"
    61 msgstr "Impossibile raggiungere ONLYOFFICE. Si prega di contattare l'amministratore"
     51msgid "Configure ONLYOFFICE Docs plugin settings."
     52msgstr "Configura le impostazioni del plugin di ONLYOFFICE Docs"
    6253
    63 msgid "Files that can be edited and opened in ONLYOFFICE will be displayed here"
    64 msgstr "I file che possono essere modificati e aperti in ONLYOFFICE verranno visualizzati qui"
     54msgid "Configure ONLYOFFICE Docs plugin settings for the whole network."
     55msgstr "Configura le impostazioni del plugin di ONLYOFFICE Docs per l'intera rete."
    6556
    66 msgid "No files found for editing or viewing in ONLYOFFICE."
    67 msgstr "Nessun file trovato per la modifica o la visualizzazione in ONLYOFFICE"
     57msgid "Configure ONLYOFFICE Docs plugin settings for %s site."
     58msgstr "Configura le impostazioni del plugin di ONLYOFFICE Docs per il sito di %s."
    6859
    69 msgid "Add ONLYOFFICE editor on page"
    70 msgstr "Aggiungere l'editor ONLYOFFICE alla pagina"
     60msgid "Blocked from changing settings by the Network administrator"
     61msgstr "Bloccato dalle modifiche delle impostazioni da parte dell'amministratore di rete"
     62
     63msgid "Allow site administrators to configure plugin for their sites"
     64msgstr "Consenti agli amministratori del sito di configurare il plugin per i loro siti"
     65
     66msgid "Inherit Network Settings"
     67msgstr "Eredita le impostazioni di rete"
     68
     69msgid "Connection Settings"
     70msgstr "Impostazioni della connessione"
     71
     72#: controllers/js/frontend-controller.js
     73msgid "ONLYOFFICE Docs cannot be reached. Please contact admin."
     74msgstr "Impossibile raggiungere ONLYOFFICE Docs. Ti preghiamo di contattare l'amministratore."
     75
     76msgid "Files that can be edited and opened in ONLYOFFICE Docs editor are displayed here."
     77msgstr "I file che possono essere modificati e aperti nell'editor di ONLYOFFICE Docs vengono visualizzati qui."
     78
     79msgid "No files found for editing or viewing in ONLYOFFICE Docs editor."
     80msgstr "Nessun file trovato per la modifica o la visualizzazione nell'editor di ONLYOFFICE Docs."
     81
     82msgid "Add ONLYOFFICE Docs editor on page"
     83msgstr "Aggiungi l'editor di ONLYOFFICE Docs alla pagina"
    7184
    7285msgid "ONLYOFFICE Docs Cloud"
    73 msgstr "ONLYOFFICE Docs nel Cloud"
     86msgstr "ONLYOFFICE Docs Cloud"
    7487
    7588msgid "Easily launch the editors in the cloud without downloading and installation"
     
    7891msgid "Get Now"
    7992msgstr "Ottieni ora"
     93
     94#: onlyoffice-wordpress-block/build/index.js
     95msgid "Embedded"
     96msgstr "Incorporato"
     97
     98#: onlyoffice-wordpress-block/build/index.js
     99msgid "Document view"
     100msgstr "Visualizzazione del documento"
     101
     102#: onlyoffice-wordpress-block/build/index.js
     103msgid "Open in ONLYOFFICE"
     104msgstr "Aprire in ONLYOFFICE"
     105
     106#: onlyoffice-wordpress-block/build/index.js
     107msgid "Show Open in ONLYOFFICE button"
     108msgstr "Mostra il pulsante Apri in ONLYOFFICE"
     109
     110#: onlyoffice-wordpress-block/build/index.js
     111#: controllers/js/frontend-controller.js
     112msgid "File not found!"
     113msgstr "File non trovato!"
     114
     115msgid "Settings update"
     116msgstr "Aggiornamento delle impostazioni"
     117
     118#: admin/js/settings.js
     119msgid "Do you want to allow sites administrators to configure the plugin themselves?"
     120msgstr "Vuoi consentire agli amministratori dei siti di configurare il plugin autonomamente?"
     121
     122#: admin/js/settings.js
     123msgid "Do you want to apply these settings to all sites?"
     124msgstr "Vuoi applicare queste impostazioni a tutti i siti?"
     125
     126#: admin/js/settings.js
     127msgid "Do you want to apply the network settings?"
     128msgstr "Vuoi applicare le impostazioni di rete?"
  • onlyoffice/trunk/languages/onlyoffice-plugin-ja.po

    r2976437 r3070758  
    1111"Content-Transfer-Encoding: 8bit\n"
    1212"Plural-Forms: nplurals=1; plural=0;\n"
    13 "X-Generator: Poedit 3.0.1\n"
    14 
    15 msgid "General Settings"
    16 msgstr "一般設定"
     13"X-Generator: Poedit 3.4.1\n"
    1714
    1815msgid "Document Editing Service address"
     
    3128msgstr "デフォルトのヘッダーを使用したい場合は空白にしてください"
    3229
    33 msgid "Settings Saved"
    34 msgstr "設定が保存されました"
    35 
    3630msgid "Open in ONLYOFFICE"
    3731msgstr "ONLYOFFICEで開く"
     
    4943msgstr "設定"
    5044
    51 msgid "General settings section"
    52 msgstr "一般設定セクション"
    53 
    5445msgid "Files"
    5546msgstr "ファイル"
    5647
    57 msgid "Configure ONLYOFFICE connector settings"
    58 msgstr "ONLYOFFICEコネクタ設定を構成する"
     48msgid "ONLYOFFICE Docs Settings"
     49msgstr "ONLYOFFICE Docsの設定"
    5950
    60 msgid "ONLYOFFICE cannot be reached. Please contact admin"
    61 msgstr "ONLYOFFICE に接続できません。管理者にお問い合わせください"
     51msgid "Configure ONLYOFFICE Docs plugin settings."
     52msgstr "ONLYOFFICE Docsプラグインの設定"
    6253
    63 msgid "Files that can be edited and opened in ONLYOFFICE will be displayed here"
    64 msgstr "ONLYOFFICEで開いて、編集することができるファイルがここに表示されます"
     54msgid "Configure ONLYOFFICE Docs plugin settings for the whole network."
     55msgstr "ネットワーク全体のONLYOFFICE Docsプラグイン設定を行う"
    6556
    66 msgid "No files found for editing or viewing in ONLYOFFICE."
    67 msgstr "ONLYOFFICEで編集または表示するファイルが見つかりません。"
     57msgid "Configure ONLYOFFICE Docs plugin settings for %s site."
     58msgstr "%s サイトのONLYOFFICE Docsプラグイン設定を行う"
    6859
    69 msgid "Add ONLYOFFICE editor on page"
    70 msgstr "ページにONLYOFFICEエディターを追加する"
     60msgid "Blocked from changing settings by the Network administrator"
     61msgstr "ネットワーク管理者による設定の変更がブロックされています"
     62
     63msgid "Allow site administrators to configure plugin for their sites"
     64msgstr "サイト管理者が自分のサイトのプラグインを設定できるようにする"
     65
     66msgid "Inherit Network Settings"
     67msgstr "ネットワーク設定の継承"
     68
     69msgid "Connection Settings"
     70msgstr "接続設定"
     71
     72#: controllers/js/frontend-controller.js
     73msgid "ONLYOFFICE Docs cannot be reached. Please contact admin."
     74msgstr "ONLYOFFICE Docsにアクセスできません。管理者にお問い合わせください。"
     75
     76msgid "Files that can be edited and opened in ONLYOFFICE Docs editor are displayed here."
     77msgstr "ここではONLYOFFICE Docsエディタで編集・閲覧可能なファイルが表示されます。"
     78
     79msgid "No files found for editing or viewing in ONLYOFFICE Docs editor."
     80msgstr "ONLYOFFICE Docsエディタで編集・閲覧可能なファイルは見つかりませんでした。"
     81
     82msgid "Add ONLYOFFICE Docs editor on page"
     83msgstr "ONLYOFFICE Docsエディタ追加ページ"
    7184
    7285msgid "ONLYOFFICE Docs Cloud"
    73 msgstr "ONLYOFFICE Docs Cloud"
     86msgstr "ONLYOFFICEドキュメントエディタをページに追加する"
    7487
    7588msgid "Easily launch the editors in the cloud without downloading and installation"
     
    7891msgid "Get Now"
    7992msgstr "今すぐ使ってみる"
     93
     94#: onlyoffice-wordpress-block/build/index.js
     95msgid "Embedded"
     96msgstr "埋め込み"
     97
     98#: onlyoffice-wordpress-block/build/index.js
     99msgid "Document view"
     100msgstr "ドキュメント表示"
     101
     102#: onlyoffice-wordpress-block/build/index.js
     103msgid "Open in ONLYOFFICE"
     104msgstr "ONLYOFFICEで開く"
     105
     106#: onlyoffice-wordpress-block/build/index.js
     107msgid "Show Open in ONLYOFFICE button"
     108msgstr "「ONLYOFFICEで開く」ボタンを表示"
     109
     110#: onlyoffice-wordpress-block/build/index.js
     111#: controllers/js/frontend-controller.js
     112msgid "File not found!"
     113msgstr "ファイルが見つかりません!"
     114
     115msgid "Settings update"
     116msgstr "設定の更新"
     117
     118#: admin/js/settings.js
     119msgid "Do you want to allow sites administrators to configure the plugin themselves?"
     120msgstr "サイト管理者自身がプラグインを設定できるようにしますか?"
     121
     122#: admin/js/settings.js
     123msgid "Do you want to apply these settings to all sites?"
     124msgstr "これらの設定をすべてのサイトに適用しますか?"
     125
     126#: admin/js/settings.js
     127msgid "Do you want to apply the network settings?"
     128msgstr "ネットワーク設定を適用しますか?"
  • onlyoffice/trunk/languages/onlyoffice-plugin-ru_RU.po

    r2976437 r3070758  
    1111"Content-Transfer-Encoding: 8bit\n"
    1212"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
    13 "X-Generator: Poedit 3.0.1\n"
    14 
    15 msgid "General Settings"
    16 msgstr "Основные настройки"
     13"X-Generator: Poedit 3.4.1\n"
    1714
    1815msgid "Document Editing Service address"
     
    3128msgstr "Оставьте пустым, чтобы использовать заголовок по умолчанию"
    3229
    33 msgid "Settings Saved"
    34 msgstr "Настройки сохранены"
    35 
    3630msgid "Open in ONLYOFFICE"
    3731msgstr "Открыть в ONLYOFFICE"
     
    4943msgstr "Настройки"
    5044
    51 msgid "General settings section"
    52 msgstr "Раздел основных настроек"
    53 
    5445msgid "Files"
    5546msgstr "Файлы"
    5647
    57 msgid "Configure ONLYOFFICE connector settings"
    58 msgstr "Настройка параметров коннектора ONLYOFFICE"
     48msgid "ONLYOFFICE Docs Settings"
     49msgstr "Настройки ONLYOFFICE Docs"
    5950
    60 msgid "ONLYOFFICE cannot be reached. Please contact admin"
    61 msgstr "Приложение ONLYOFFICE недоступно. Пожалуйста, свяжитесь с администратором"
     51msgid "Configure ONLYOFFICE Docs plugin settings."
     52msgstr "Настройте параметры плагина ONLYOFFICE Docs."
    6253
    63 msgid "Files that can be edited and opened in ONLYOFFICE will be displayed here"
    64 msgstr "Здесь будут отражены файлы, которые можно редактировать и открывать в ONLYOFFICE"
     54msgid "Configure ONLYOFFICE Docs plugin settings for the whole network."
     55msgstr "Настройте параметры плагина ONLYOFFICE Docs для всей сети."
    6556
    66 msgid "No files found for editing or viewing in ONLYOFFICE."
    67 msgstr "Не найдены файлы для редактирования или просмотра в ONLYOFFICE."
     57msgid "Configure ONLYOFFICE Docs plugin settings for %s site."
     58msgstr "Настройте параметры плагина ONLYOFFICE Docs для сайта %s."
    6859
    69 msgid "Add ONLYOFFICE editor on page"
    70 msgstr "Добавить редактор ONLYOFFICE на страницу"
     60msgid "Blocked from changing settings by the Network administrator"
     61msgstr "Администратор сети заблокировал изменение настроек."
     62
     63msgid "Allow site administrators to configure plugin for their sites"
     64msgstr "Разрешить администраторам сайта настраивать плагин для своих сайтов"
     65
     66msgid "Inherit Network Settings"
     67msgstr "Наследовать настройки сети"
     68
     69msgid "Connection Settings"
     70msgstr "Настройки соединения"
     71
     72#: controllers/js/frontend-controller.js
     73msgid "ONLYOFFICE Docs cannot be reached. Please contact admin."
     74msgstr "Приложение ONLYOFFICE Docs недоступно. Пожалуйста, свяжитесь с администратором."
     75
     76msgid "Files that can be edited and opened in ONLYOFFICE Docs editor are displayed here."
     77msgstr "Здесь отображаются файлы, которые можно редактировать и открывать в редакторе ONLYOFFICE Docs."
     78
     79msgid "No files found for editing or viewing in ONLYOFFICE Docs editor."
     80msgstr "Не найдены файлы для редактирования или просмотра в редакторе ONLYOFFICE Docs."
     81
     82msgid "Add ONLYOFFICE Docs editor on page"
     83msgstr "Добавить редактор ONLYOFFICE Docs на страницу"
    7184
    7285msgid "ONLYOFFICE Docs Cloud"
     
    7891msgid "Get Now"
    7992msgstr "Получить сейчас"
     93
     94#: onlyoffice-wordpress-block/build/index.js
     95msgid "Embedded"
     96msgstr "Встроенный"
     97
     98#: onlyoffice-wordpress-block/build/index.js
     99msgid "Document view"
     100msgstr "Просмотр документа"
     101
     102#: onlyoffice-wordpress-block/build/index.js
     103msgid "Open in ONLYOFFICE"
     104msgstr "Открыть в ONLYOFFICE"
     105
     106#: onlyoffice-wordpress-block/build/index.js
     107msgid "Show Open in ONLYOFFICE button"
     108msgstr "Показать кнопку Открыть в ONLYOFFICE"
     109
     110#: onlyoffice-wordpress-block/build/index.js
     111#: controllers/js/frontend-controller.js
     112msgid "File not found!"
     113msgstr "Файл не найден!"
     114
     115msgid "Settings update"
     116msgstr "Обновление настроек"
     117
     118#: admin/js/settings.js
     119msgid "Do you want to allow sites administrators to configure the plugin themselves?"
     120msgstr "Хотите разрешить администраторам сайтов самостоятельно настраивать плагин?"
     121
     122#: admin/js/settings.js
     123msgid "Do you want to apply these settings to all sites?"
     124msgstr "Хотите применить эти настройки ко всем сайтам?"
     125
     126#: admin/js/settings.js
     127msgid "Do you want to apply the network settings?"
     128msgstr "Хотите применить настройки сети?"
  • onlyoffice/trunk/languages/onlyoffice-plugin-zh_CN.po

    r2976437 r3070758  
    1111"Content-Transfer-Encoding: 8bit\n"
    1212"Plural-Forms: nplurals=1; plural=0;\n"
    13 "X-Generator: Poedit 3.0.1\n"
    14 
    15 msgid "General Settings"
    16 msgstr "一般设置"
     13"X-Generator: Poedit 3.4.1\n"
    1714
    1815msgid "Document Editing Service address"
     
    3128msgstr "留空以使用默认的标头"
    3229
    33 msgid "Settings Saved"
    34 msgstr "设置已保存"
    35 
    3630msgid "Open in ONLYOFFICE"
    3731msgstr "用 ONLYOFFICE 打开"
     
    4943msgstr "设置"
    5044
    51 msgid "General settings section"
    52 msgstr "通用设置部分"
    53 
    5445msgid "Files"
    5546msgstr "文件"
    5647
    57 msgid "Configure ONLYOFFICE connector settings"
    58 msgstr "配置ONLYOFFICE连接器设置"
     48msgid "ONLYOFFICE Docs Settings"
     49msgstr "ONLYOFFICE 文档设置"
    5950
    60 msgid "ONLYOFFICE cannot be reached. Please contact admin"
    61 msgstr "无法联系到ONLYOFFICE。请联系管理员"
     51msgid "Configure ONLYOFFICE Docs plugin settings"
     52msgstr "配置 ONLYOFFICE 文档插件设置"
    6253
    63 msgid "Files that can be edited and opened in ONLYOFFICE will be displayed here"
    64 msgstr "可在ONLYOFFICE中编辑并打开的文件将在这里显示"
     54msgid "Configure ONLYOFFICE Docs plugin settings for the whole network."
     55msgstr "为整个网络进行 ONLYOFFICE 文档插件设置。"
    6556
    66 msgid "No files found for editing or viewing in ONLYOFFICE."
    67 msgstr "未发现可在ONLYOFFICE中编辑或查看的文件。"
     57msgid "Configure ONLYOFFICE Docs plugin settings for %s site."
     58msgstr "为 %s 站点进行 ONLYOFFICE 文档插件设置。"
    6859
    69 msgid "Add ONLYOFFICE editor on page"
    70 msgstr "将ONLYOFFICE编辑器添加到页面上"
     60msgid "Blocked from changing settings by the Network administrator"
     61msgstr "更改设置已被网络管理员阻止"
     62
     63msgid "Allow site administrators to configure plugin for their sites"
     64msgstr "允许站点管理员为其站点配置插件"
     65
     66msgid "Inherit Network Settings"
     67msgstr "继承网络设置"
     68
     69msgid "Connection Settings"
     70msgstr "连接设置"
     71
     72#: controllers/js/frontend-controller.js
     73msgid "ONLYOFFICE Docs cannot be reached. Please contact admin."
     74msgstr "无法连接到 ONLYOFFICE 文档。请联系管理员。"
     75
     76msgid "Files that can be edited and opened in ONLYOFFICE Docs editor are displayed here."
     77msgstr "可在 ONLYOFFICE 文档中编辑并打开的文件在这里显示。"
     78
     79msgid "No files found for editing or viewing in ONLYOFFICE Docs editor."
     80msgstr "未找到可在 ONLYOFFICE 文档编辑器中编辑或查看的文件。"
     81
     82msgid "Add ONLYOFFICE Docs editor on page"
     83msgstr "将 ONLYOFFICE 文档编辑器添加到页面上"
    7184
    7285msgid "ONLYOFFICE Docs Cloud"
     
    7891msgid "Get Now"
    7992msgstr "立即获取"
     93
     94#: onlyoffice-wordpress-block/build/index.js
     95msgid "Embedded"
     96msgstr "嵌入式"
     97
     98#: onlyoffice-wordpress-block/build/index.js
     99msgid "Document view"
     100msgstr "文档视图"
     101
     102#: onlyoffice-wordpress-block/build/index.js
     103msgid "Open in ONLYOFFICE"
     104msgstr "用 ONLYOFFICE 打开"
     105
     106#: onlyoffice-wordpress-block/build/index.js
     107msgid "Show Open in ONLYOFFICE button"
     108msgstr "显示在 ONLYOFFICE 中打开按钮"
     109
     110#: onlyoffice-wordpress-block/build/index.js
     111#: controllers/js/frontend-controller.js
     112msgid "File not found!"
     113msgstr "未找到文件!"
     114
     115msgid "Settings update"
     116msgstr "设置更新"
     117
     118#: admin/js/settings.js
     119msgid "Do you want to allow sites administrators to configure the plugin themselves?"
     120msgstr "您是否允许站点管理员自己配置插件?"
     121
     122#: admin/js/settings.js
     123msgid "Do you want to apply these settings to all sites?"
     124msgstr "是否将这些设置应用到所有站点?"
     125
     126#: admin/js/settings.js
     127msgid "Do you want to apply the network settings?"
     128msgstr "是否应用网络设置?"
  • onlyoffice/trunk/languages/onlyoffice-plugin.pot

    r2976437 r3070758  
    33"Content-Type: text/plain; charset=UTF-8\n"
    44
    5 msgid "General Settings"
    6 msgstr ""
     5
     6
     7
     8
     9
     10
     11
     12
     13
    714
    815msgid "Document Editing Service address"
     
    1926
    2027msgid "Leave blank to use default header"
    21 msgstr ""
    22 
    23 msgid "Settings Saved"
    2428msgstr ""
    2529
     
    3943msgstr ""
    4044
    41 msgid "General settings section"
    42 msgstr ""
    43 
    4445msgid "Files"
    4546msgstr ""
    4647
    47 msgid "Configure ONLYOFFICE connector settings"
     48msgid "ONLYOFFICE Docs Settings"
    4849msgstr ""
    4950
    50 msgid "ONLYOFFICE cannot be reached. Please contact admin"
     51msgid "Configure ONLYOFFICE Docs plugin settings."
    5152msgstr ""
    5253
    53 msgid "Files that can be edited and opened in ONLYOFFYCE will be displayed here"
     54msgid "Configure ONLYOFFICE Docs plugin settings for the whole network."
    5455msgstr ""
    5556
    56 msgid "No files found for editing or viewing in ONLYOFFICE."
     57msgid "Configure ONLYOFFICE Docs plugin settings for %s site."
    5758msgstr ""
    5859
    59 msgid "Add ONLYOFFICE editor on page"
     60msgid "Blocked from changing settings by the Network administrator"
     61msgstr ""
     62
     63msgid "Allow site administrators to configure plugin for their sites"
     64msgstr ""
     65
     66msgid "Inherit Network Settings"
     67msgstr ""
     68
     69msgid "Connection Settings"
     70msgstr ""
     71
     72#: controllers/js/frontend-controller.js
     73msgid "ONLYOFFICE Docs cannot be reached. Please contact admin."
     74msgstr ""
     75
     76msgid "Files that can be edited and opened in ONLYOFFICE Docs editor are displayed here."
     77msgstr ""
     78
     79msgid "No files found for editing or viewing in ONLYOFFICE Docs editor."
     80msgstr ""
     81
     82msgid "Add ONLYOFFICE Docs editor on page"
    6083msgstr ""
    6184
     
    6891msgid "Get Now"
    6992msgstr ""
     93
     94#: onlyoffice-wordpress-block/build/index.js
     95msgid "Embedded"
     96msgstr ""
     97
     98#: onlyoffice-wordpress-block/build/index.js
     99msgid "Document view"
     100msgstr ""
     101
     102#: onlyoffice-wordpress-block/build/index.js
     103msgid "Open in ONLYOFFICE"
     104msgstr ""
     105
     106#: onlyoffice-wordpress-block/build/index.js
     107msgid "Show Open in ONLYOFFICE button"
     108msgstr ""
     109
     110#: onlyoffice-wordpress-block/build/index.js
     111#: controllers/js/frontend-controller.js
     112msgid "File not found!"
     113msgstr ""
     114
     115msgid "Settings update"
     116msgstr ""
     117
     118#: admin/js/settings.js
     119msgid "Do you want to allow sites administrators to configure the plugin themselves?"
     120msgstr ""
     121
     122#: admin/js/settings.js
     123msgid "Do you want to apply these settings to all sites?"
     124msgstr ""
     125
     126#: admin/js/settings.js
     127msgid "Do you want to apply the network settings?"
     128msgstr ""
  • onlyoffice/trunk/licenses/3rd-Party.license

    r2976437 r3070758  
    1 ONLYOFFICE WordPress plugin uses code from the following 3rd party projects.
     1ONLYOFFICE Docs plugin uses code from the following 3rd party projects.
    22
    33JWT           - A simple library to encode and decode JSON Web Tokens (JWT) in PHP. (https://github.com/firebase/php-jwt)
  • onlyoffice/trunk/onlyoffice-tinymce/onlyoffice-tinymce.js

    r2976437 r3070758  
    1 /*
    2  * (c) Copyright Ascensio System SIA 2023
     1/**
     2 * JS for ONLYOFFICE Docs TinyMCE.
    33 *
    4  * This program is free software; you can redistribute it and/or
    5  * modify it under the terms of the GNU General Public License
    6  * as published by the Free Software Foundation; either version 2
    7  * of the License, or (at your option) any later version.
    8  *
    9  * This program is distributed in the hope that it will be useful,
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  * GNU General Public License for more details.
    13  *
    14  * You should have received a copy of the GNU General Public License
    15  * along with this program; if not, write to the Free Software
    16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    17 */
     4 * @package Onlyoffice_Wordpress
     5 */
    186
    19 (function() {
    20     tinymce.PluginManager.add("onlyoffice-tinymce", function(editor) {
    21         editor.addButton("onlyoffice-tinymce", {
    22             tooltip: "ONLYOFFICE",
    23             onclick:  function() {
    24                 let frameOnlyoffice = wp.media.frames.onlyoffice;
     7( function ( ) {
     8    tinymce.PluginManager.add(
     9        "onlyoffice-tinymce",
     10        function ( editor ) {
     11            editor.addButton(
     12                "onlyoffice-tinymce",
     13                {
     14                    tooltip: "ONLYOFFICE",
     15                    onclick: function () {
     16                        let frameOnlyoffice = wp.media.frames.onlyoffice;
    2517
    26                 if (frameOnlyoffice) {
    27                     frameOnlyoffice.open();
    28                     return;
    29                 }
     18                        if (frameOnlyoffice) {
     19                            frameOnlyoffice.open();
     20                            return;
     21                        }
    3022
    31                 const onlyofficeAllowedExts = oo_media.formats.toString().split(" ").join("").split(".").join("").split(",");
    32                 let onlyofficeAllowedMimes = [];
     23                        let onlyofficeAllowedMimes = [];
    3324
    34                 for (let ext of onlyofficeAllowedExts) {
    35                     var mimeType = getMimeType(ext);
     25                        for (let ext of ONLYOFFICE.formatsUtils.getViewableExtensions()) {
     26                            var mimeType = getMimeType( ext );
    3627
    37                     if (mimeType){
    38                         onlyofficeAllowedMimes.push(mimeType);
    39                     }
    40                 }
     28                            if ( mimeType ) {
     29                                onlyofficeAllowedMimes.push( mimeType );
     30                            }
     31                        }
    4132
    42                 frameOnlyoffice = wp.media.frames.onlyoffice = wp.media({
    43                     title: wp.i18n.__("Select or Upload Media"),
    44                     library: {
    45                         type: onlyofficeAllowedMimes
    46                     }
    47                 });
     33                        frameOnlyoffice = wp.media.frames.onlyoffice = wp.media(
     34                            {
     35                                title: wp.i18n.__( "Select or Upload Media" ),
     36                                library: {
     37                                    type: onlyofficeAllowedMimes
     38                                }
     39                            }
     40                        );
    4841
    49                 frameOnlyoffice.on("select", function() {
    50                     const selectedAttachment = frameOnlyoffice.state().get('selection').first();
     42                        frameOnlyoffice.on(
     43                            "select",
     44                            function () {
     45                                const selectedAttachment = frameOnlyoffice.state().get( 'selection' ).first();
    5146
    52                     let params = {
    53                         id: selectedAttachment.id,
    54                         fileName: selectedAttachment.attributes.filename,
    55                     }
     47                                let params = {
     48                                    id: selectedAttachment.id,
     49                                    fileName: selectedAttachment.attributes.filename,
     50                                }
    5651
    57                     const wpOnlyofficeBlock = `<!-- wp:onlyoffice-wordpress/onlyoffice ${JSON.stringify(params)} -->`;
     52                                const wpOnlyofficeBlock = "<!-- wp:onlyoffice-wordpress/onlyoffice " + JSON.stringify( params ) + " -->";
    5853
    59                     let wpOnlyofficeBody = "[onlyoffice id=" + selectedAttachment.id + " /]";
     54                                let wpOnlyofficeBody = "[onlyoffice id=" + selectedAttachment.id + " /]";
    6055
    61                     let wpOnlyofficeBlockEnd = "<!-- /wp:onlyoffice-wordpress/onlyoffice -->"
     56                                let wpOnlyofficeBlockEnd = "<!-- /wp:onlyoffice-wordpress/onlyoffice -->"
    6257
    63                     editor.insertContent(wpOnlyofficeBlock + wpOnlyofficeBody + wpOnlyofficeBlockEnd);
    64                 });
     58                                editor.insertContent( wpOnlyofficeBlock + wpOnlyofficeBody + wpOnlyofficeBlockEnd );
     59                            }
     60                        );
    6561
    66                 frameOnlyoffice.open();
    67             }
    68         });
    69     });
     62                        frameOnlyoffice.open();
     63                    }
     64                }
     65            );
     66        }
     67    );
    7068
    71     var getMimeType = function( name ) {
    72         var allTypes = oo_media.mimeTypes;
     69    var getMimeType = function ( name ) {
     70        var allTypes = ONLYOFFICE.mimeTypes;
    7371
    74         if (allTypes[name] !== undefined) {
    75             return allTypes[name];
    76         }
     72        if ( allTypes[name] !== undefined ) {
     73            return allTypes[name];
     74        }
    7775
    78         for(var key in allTypes) {
    79             if(key.indexOf(name) !== -1) {
    80                 return allTypes[key];
    81             }
    82         }
     76        for ( var key in allTypes ) {
     77            if ( key.indexOf( name ) !== -1 ) {
     78                return allTypes[key];
     79            }
     80        }
    8381
    84         return false;
    85     };
     82        return false;
     83    };
    8684})();
  • onlyoffice/trunk/onlyoffice-tinymce/onlyoffice-tinymce.php

    r2976437 r3070758  
    99/**
    1010 *
    11  * (c) Copyright Ascensio System SIA 2023
     11 * (c) Copyright Ascensio System SIA 2024
    1212 *
    1313 * This program is free software; you can redistribute it and/or
  • onlyoffice/trunk/onlyoffice-wordpress-block/block.json

    r2976437 r3070758  
    33    "apiVersion": 2,
    44    "name": "onlyoffice-wordpress/onlyoffice",
    5     "title": "ONLYOFFICE",
     5    "title": "ONLYOFFICE Docs",
    66    "category": "media",
    77    "editorScript": "file:./build/index.js",
     8    "editorStyle": "file:build/index.css",
    89    "keywords": ["onlyoffice"],
    910    "textdomain": "onlyoffice-plugin",
     
    1415        "fileName": {
    1516            "type": "string"
     17        },
     18        "documentView": {
     19            "type": "string"
     20        },
     21        "inNewTab": {
     22            "type": "boolean",
     23            "default": true
     24        },
     25        "width":  {
     26            "type": "string"
     27        },
     28        "height":{
     29            "type": "string"
     30        },
     31        "showOpenButton":{
     32            "type": "boolean",
     33            "default": true
     34        },
     35        "openButtonText":{
     36            "type": "string"
    1637        }
     38    },
     39    "supports": {
     40        "align": true
    1741    }
    1842}
  • onlyoffice/trunk/onlyoffice-wordpress-block/build/index.asset.php

    r2976437 r3070758  
    1 <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '704b791d5149e64f7dcc');
     1<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '4f7c984e58f9263b6891');
  • onlyoffice/trunk/onlyoffice-wordpress-block/build/index.js

    r2976437 r3070758  
    1 !function(){"use strict";var e={d:function(t,l){for(var n in l)e.o(l,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:l[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}};e.d({},{l:function(){return r},i:function(){return d}});var t=window.wp.element,l=window.wp.blocks,n=JSON.parse('{"u2":"onlyoffice-wordpress/onlyoffice"}'),i=window.wp.blockEditor,o=window.wp.components,a=window.wp.i18n;const r={padding:"20px"},d=(0,t.createElement)("svg",{width:"66",height:"60",viewBox:"0 0 66 60",fill:"black",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)("path",{opacity:"0.5",fillRule:"evenodd",clipRule:"evenodd",d:"M28.9406 59.2644L2.20792 46.9066C-0.0693069 45.8277 -0.0693069 44.1604 2.20792 43.1796L11.5148 38.8642L28.8416 46.9066C31.1188 47.9854 34.7822 47.9854 36.9604 46.9066L54.2871 38.8642L63.5941 43.1796C65.8713 44.2585 65.8713 45.9258 63.5941 46.9066L36.8614 59.2644C34.7822 60.2452 31.1188 60.2452 28.9406 59.2644Z",fill:"black"}),(0,t.createElement)("path",{opacity:"0.75",fillRule:"evenodd",clipRule:"evenodd",d:"M28.9406 44.0606L2.20792 31.7028C-0.069307 30.6239 -0.069307 28.9566 2.20792 27.9758L11.3168 23.7584L28.9406 31.8989C31.2178 32.9778 34.8812 32.9778 37.0594 31.8989L54.6832 23.7584L63.7921 27.9758C66.0693 29.0547 66.0693 30.722 63.7921 31.7028L37.0594 44.0606C34.7822 45.1395 31.1188 45.1395 28.9406 44.0606Z",fill:"black"}),(0,t.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M28.9406 29.2518L2.20792 16.8939C-0.069307 15.8151 -0.069307 14.1478 2.20792 13.167L28.9406 0.809144C31.2178 -0.269715 34.8812 -0.269715 37.0594 0.809144L63.7921 13.167C66.0693 14.2458 66.0693 15.9132 63.7921 16.8939L37.0594 29.2518C34.7822 30.2325 31.1188 30.2325 28.9406 29.2518Z",fill:"black"}));(0,l.registerBlockType)(n.u2,{icon:d,edit:e=>{let{attributes:l,setAttributes:n}=e;const c=oo_media.formats;let s=[];const p=function(e){var t=oo_media.mimeTypes;if(void 0!==t[e])return t[e];for(var l in t)if(-1!==l.indexOf(e))return t[l];return!1};for(let e of c){let t=p(e);t&&s.push(t)}const f=(0,i.useBlockProps)({style:r});return l.id?(0,t.createElement)("div",f,(0,t.createElement)(i.InspectorControls,{key:"setting"},(0,t.createElement)(o.PanelBody,{title:(0,a.__)("Settings")},(0,t.createElement)(o.__experimentalInputControl,{label:(0,a.__)("Name"),value:l.fileName,onChange:e=>n({fileName:e})}))),(0,t.createElement)("p",{style:{display:"flex"}},d,(0,t.createElement)("p",{style:{marginLeft:"25px"}}," ",l.fileName||"")),(0,t.createElement)(i.BlockControls,null,(0,t.createElement)(i.MediaReplaceFlow,{mediaId:l.id,allowedTypes:s,accept:s.join(),onSelect:e=>{e&&e.hasOwnProperty("id")&&n({id:e.id,fileName:e.filename||e.guid.raw.substring(e.guid.raw.lastIndexOf("/")+1)})},name:(0,a.__)("Replace")}))):(0,t.createElement)(i.MediaPlaceholder,{labels:{title:"ONLYOFFICE"},allowedTypes:s,accept:s.join(),onSelect:e=>{e&&e.hasOwnProperty("id")&&n({id:e.id,fileName:e.filename||e.guid.raw.substring(e.guid.raw.lastIndexOf("/")+1)})}})},save:e=>{let{attributes:l}=e;return(0,t.createElement)(t.RawHTML,null,`[onlyoffice id=${l.id} /]`)}})}();
     1(()=>{"use strict";var e={d:(t,l)=>{for(var n in l)e.o(l,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:l[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};e.d({},{V:()=>p});const t=window.React,l=window.wp.blocks,n=JSON.parse('{"UU":"onlyoffice-wordpress/onlyoffice"}'),i=window.wp.blockEditor,a=window.wp.components,o=window.wp.i18n,C=(0,t.createElement)("svg",{width:"161",height:"205",viewBox:"0 0 161 205",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)("path",{d:"M152.45 37.2371V191.59C152.45 192.738 151.994 193.84 151.182 194.652C150.37 195.464 149.268 195.92 148.12 195.92H12.88C11.7316 195.92 10.6302 195.464 9.81821 194.652C9.00618 193.84 8.54999 192.738 8.54999 191.59V12.88C8.54999 11.7316 9.00618 10.6302 9.81822 9.81822C10.6302 9.00618 11.7316 8.54999 12.88 8.54999H123.763L152.45 37.2371Z",fill:"#214479",stroke:"#1A3661"}),(0,t.createElement)("path",{opacity:"0.2",d:"M151.5 37.03H128.8C127.519 37.03 126.29 36.5211 125.385 35.6153C124.479 34.7095 123.97 33.481 123.97 32.2V9.5L151.5 37.03Z",fill:"black"}),(0,t.createElement)("path",{d:"M70.9538 167.902L68.2292 178.61H65.6437L64.1936 172.985C64.1643 172.878 64.1252 172.714 64.0764 172.494C64.0275 172.275 63.9763 172.035 63.9226 171.776C63.8688 171.513 63.82 171.266 63.7761 171.037C63.737 170.802 63.7102 170.617 63.6955 170.48C63.6809 170.617 63.6516 170.8 63.6076 171.029C63.5686 171.259 63.5222 171.503 63.4685 171.762C63.4196 172.021 63.3708 172.262 63.322 172.487C63.2731 172.712 63.2341 172.882 63.2048 173L61.7619 178.61H59.1838L56.4519 167.902H58.6857L60.0554 173.747C60.0944 173.922 60.1384 174.132 60.1872 174.377C60.2409 174.621 60.2922 174.877 60.341 175.146C60.3947 175.409 60.4411 175.666 60.4802 175.915C60.5241 176.159 60.5559 176.371 60.5754 176.552C60.5998 176.366 60.6315 176.151 60.6706 175.907C60.7097 175.658 60.7512 175.407 60.7951 175.153C60.8439 174.894 60.8928 174.655 60.9416 174.435C60.9904 174.215 61.0344 174.037 61.0734 173.901L62.6335 167.902H64.7795L66.3396 173.901C66.3737 174.032 66.4128 174.211 66.4567 174.435C66.5056 174.655 66.5544 174.894 66.6032 175.153C66.6521 175.412 66.696 175.666 66.7351 175.915C66.779 176.159 66.8107 176.371 66.8303 176.552C66.8645 176.308 66.9108 176.012 66.9694 175.666C67.0329 175.314 67.0988 174.965 67.1672 174.618C67.2404 174.272 67.3039 173.981 67.3576 173.747L68.7199 167.902H70.9538ZM82.0207 173.241C82.0207 174.067 81.9182 174.818 81.7131 175.497C81.508 176.171 81.1955 176.752 80.7756 177.24C80.3605 177.729 79.8332 178.105 79.1936 178.368C78.5539 178.627 77.7971 178.756 76.923 178.756C76.049 178.756 75.2922 178.627 74.6525 178.368C74.0129 178.105 73.4831 177.729 73.0632 177.24C72.6481 176.752 72.3381 176.169 72.133 175.49C71.9279 174.811 71.8254 174.057 71.8254 173.227C71.8254 172.118 72.0061 171.154 72.3674 170.334C72.7336 169.508 73.2951 168.869 74.052 168.415C74.8088 167.961 75.7707 167.734 76.9377 167.734C78.0998 167.734 79.0544 167.961 79.8015 168.415C80.5534 168.869 81.1101 169.508 81.4714 170.334C81.8376 171.159 82.0207 172.128 82.0207 173.241ZM74.2058 173.241C74.2058 173.988 74.2985 174.633 74.4841 175.175C74.6745 175.712 74.9699 176.127 75.3703 176.42C75.7707 176.708 76.2883 176.852 76.923 176.852C77.5676 176.852 78.09 176.708 78.4904 176.42C78.8908 176.127 79.1813 175.712 79.362 175.175C79.5476 174.633 79.6403 173.988 79.6403 173.241C79.6403 172.118 79.4304 171.234 79.0104 170.59C78.5905 169.945 77.8996 169.623 76.9377 169.623C76.298 169.623 75.7756 169.77 75.3703 170.063C74.9699 170.351 74.6745 170.766 74.4841 171.308C74.2985 171.845 74.2058 172.489 74.2058 173.241ZM87.3601 167.902C88.3317 167.902 89.1325 168.019 89.7624 168.254C90.3972 168.488 90.8684 168.842 91.176 169.316C91.4836 169.789 91.6374 170.387 91.6374 171.11C91.6374 171.598 91.5446 172.026 91.3591 172.392C91.1735 172.758 90.9294 173.068 90.6267 173.322C90.3239 173.576 89.9968 173.783 89.6452 173.944L92.7946 178.61H90.2751L87.7189 174.501H86.5104V178.61H84.2399V167.902H87.3601ZM87.1989 169.762H86.5104V172.655H87.2429C87.9948 172.655 88.5319 172.531 88.8542 172.282C89.1813 172.028 89.3449 171.657 89.3449 171.169C89.3449 170.661 89.1691 170.299 88.8176 170.085C88.4709 169.87 87.9313 169.762 87.1989 169.762ZM103.027 173.153C103.027 174.359 102.795 175.368 102.331 176.178C101.872 176.984 101.205 177.592 100.331 178.002C99.4572 178.407 98.405 178.61 97.1745 178.61H94.1423V167.902H97.5041C98.6271 167.902 99.6013 168.102 100.426 168.503C101.252 168.898 101.891 169.486 102.345 170.268C102.8 171.044 103.027 172.006 103.027 173.153ZM100.668 173.212C100.668 172.421 100.551 171.772 100.317 171.264C100.087 170.751 99.7453 170.373 99.2912 170.129C98.842 169.884 98.2854 169.762 97.6213 169.762H96.4128V176.735H97.3869C98.4953 176.735 99.3181 176.44 99.8552 175.849C100.397 175.258 100.668 174.379 100.668 173.212Z",fill:"white"}),(0,t.createElement)("path",{d:"M109.158 77.28L99.015 120.75L87.745 77.28H82.915H78.085L66.815 120.75L56.672 77.28H47.334L61.019 132.02H71.323L82.915 87.101L94.507 132.02H104.811L118.496 77.28H109.158Z",fill:"white"})),r=(0,t.createElement)("svg",{width:"161",height:"205",viewBox:"0 0 161 205",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)("path",{d:"M123.763 9.01997L152.45 37.7071V192.06C152.45 193.208 151.994 194.31 151.182 195.122C150.37 195.934 149.268 196.39 148.12 196.39H12.88C11.7316 196.39 10.6302 195.934 9.81822 195.122L9.46466 195.475L9.81821 195.122C9.00618 194.31 8.54999 193.208 8.54999 192.06V13.35C8.54999 12.2016 9.00618 11.1002 9.81822 10.2882C10.6302 9.47617 11.7316 9.01997 12.88 9.01997H123.763Z",fill:"#1F7244",stroke:"#195B36"}),(0,t.createElement)("path",{opacity:"0.2",d:"M151.5 37.47H128.833C127.551 37.47 126.322 36.9783 125.416 36.1031C124.509 35.228 124 34.041 124 32.8033V9.96997L151.5 37.47Z",fill:"black"}),(0,t.createElement)("path",{d:"M68.5777 170.108C68.1431 170.108 67.7574 170.193 67.4204 170.364C67.0884 170.53 66.8077 170.772 66.5782 171.089C66.3536 171.407 66.1827 171.79 66.0655 172.239C65.9483 172.688 65.8897 173.194 65.8897 173.755C65.8897 174.512 65.9825 175.159 66.168 175.696C66.3584 176.228 66.6514 176.636 67.0469 176.919C67.4424 177.198 67.9527 177.337 68.5777 177.337C69.0122 177.337 69.4468 177.288 69.8814 177.19C70.3208 177.093 70.7969 176.953 71.3096 176.773V178.677C70.836 178.872 70.3697 179.012 69.9107 179.095C69.4517 179.182 68.9366 179.226 68.3653 179.226C67.2618 179.226 66.3536 178.999 65.6407 178.545C64.9327 178.086 64.4078 177.447 64.066 176.626C63.7242 175.801 63.5533 174.839 63.5533 173.741C63.5533 172.93 63.6631 172.188 63.8828 171.514C64.1026 170.84 64.4248 170.257 64.8496 169.764C65.2745 169.27 65.7994 168.89 66.4244 168.621C67.0494 168.352 67.7671 168.218 68.5777 168.218C69.1099 168.218 69.6421 168.286 70.1744 168.423C70.7115 168.555 71.2242 168.738 71.7124 168.973L70.98 170.818C70.5796 170.628 70.1768 170.462 69.7715 170.32C69.3662 170.179 68.9683 170.108 68.5777 170.108ZM79.7618 179.08H73.5948V168.372H79.7618V170.232H75.8653V172.583H79.4908V174.444H75.8653V177.205H79.7618V179.08ZM82.003 179.08V168.372H84.2735V177.205H88.6167V179.08H82.003ZM90.4844 179.08V168.372H92.7549V177.205H97.0982V179.08H90.4844Z",fill:"white"}),(0,t.createElement)("path",{d:"M84.9275 99.6943L103.04 72.92H94.185L80.5 93.1416L66.815 72.92H57.96L76.0725 99.6943L57.155 127.66H66.01L80.5 106.247L94.99 127.66H103.845L84.9275 99.6943Z",fill:"white"})),c=(0,t.createElement)("svg",{width:"161",height:"206",viewBox:"0 0 161 206",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)("path",{d:"M152.45 37.8027V192.557C152.45 193.709 151.993 194.813 151.181 195.628C150.369 196.442 149.268 196.899 148.12 196.899H12.88C11.732 196.899 10.6308 196.442 9.81867 195.628C9.0065 194.813 8.54999 193.709 8.54999 192.557V13.3834C8.54999 12.2313 9.0065 11.1266 9.81867 10.3123C10.6308 9.49806 11.732 9.04086 12.88 9.04086H123.762L152.45 37.8027Z",fill:"#DD682B",stroke:"#B15322"}),(0,t.createElement)("path",{opacity:"0.2",d:"M151.5 37.596H128.8C127.519 37.596 126.29 37.0858 125.385 36.1776C124.479 35.2695 123.97 34.0378 123.97 32.7535V9.97L151.5 37.596Z",fill:"black"}),(0,t.createElement)("path",{d:"M68.0131 176.528C68.0131 177.163 67.8593 177.714 67.5517 178.183C67.2441 178.652 66.7949 179.013 66.2041 179.267C65.6181 179.521 64.9052 179.648 64.0654 179.648C63.6943 179.648 63.3305 179.624 62.9741 179.575C62.6225 179.526 62.2832 179.455 61.956 179.362C61.6337 179.265 61.3261 179.145 61.0332 179.003V176.894C61.541 177.119 62.0683 177.321 62.6152 177.502C63.1621 177.683 63.7041 177.773 64.2412 177.773C64.6123 177.773 64.9101 177.724 65.1347 177.627C65.3642 177.529 65.5302 177.395 65.6328 177.224C65.7353 177.053 65.7866 176.857 65.7866 176.638C65.7866 176.369 65.6962 176.14 65.5156 175.949C65.3349 175.759 65.0859 175.581 64.7685 175.415C64.456 175.249 64.102 175.07 63.7065 174.88C63.4575 174.763 63.1865 174.621 62.8935 174.455C62.6005 174.284 62.3222 174.077 62.0585 173.833C61.7949 173.588 61.5776 173.293 61.4067 172.946C61.2407 172.595 61.1577 172.175 61.1577 171.687C61.1577 171.047 61.3042 170.5 61.5971 170.046C61.8901 169.592 62.3076 169.245 62.8496 169.006C63.3964 168.762 64.041 168.64 64.7832 168.64C65.3398 168.64 65.8696 168.706 66.3725 168.837C66.8803 168.964 67.4101 169.15 67.9619 169.394L67.2294 171.159C66.7363 170.959 66.2944 170.805 65.9038 170.698C65.5131 170.585 65.1152 170.529 64.7099 170.529C64.4267 170.529 64.185 170.576 63.9848 170.669C63.7846 170.756 63.6333 170.883 63.5307 171.049C63.4282 171.21 63.3769 171.398 63.3769 171.613C63.3769 171.867 63.4501 172.082 63.5966 172.258C63.748 172.429 63.9726 172.595 64.2705 172.756C64.5732 172.917 64.9492 173.105 65.3984 173.32C65.9453 173.579 66.4116 173.85 66.7973 174.133C67.1879 174.411 67.4882 174.741 67.6982 175.122C67.9082 175.498 68.0131 175.966 68.0131 176.528ZM69.9541 179.502V168.794H72.2246V177.627H76.5678V179.502H69.9541ZM78.4355 179.502V168.794H80.706V179.502H78.4355ZM92.2856 174.045C92.2856 175.251 92.0537 176.259 91.5898 177.07C91.1308 177.876 90.4643 178.483 89.5903 178.894C88.7163 179.299 87.664 179.502 86.4335 179.502H83.4013V168.794H86.7631C87.8862 168.794 88.8603 168.994 89.6855 169.394C90.5107 169.79 91.1503 170.378 91.6044 171.159C92.0585 171.936 92.2856 172.898 92.2856 174.045ZM89.9272 174.104C89.9272 173.313 89.81 172.663 89.5756 172.155C89.3461 171.643 89.0043 171.264 88.5502 171.02C88.101 170.776 87.5444 170.654 86.8803 170.654H85.6718V177.627H86.6459C87.7543 177.627 88.5771 177.331 89.1142 176.74C89.6562 176.149 89.9272 175.271 89.9272 174.104ZM100.672 179.502H94.5048V168.794H100.672V170.654H96.7753V173.005H100.401V174.865H96.7753V177.627H100.672V179.502Z",fill:"white"}),(0,t.createElement)("path",{d:"M80.5 111.848C87.332 111.848 93.8841 109.127 98.7151 104.283C103.546 99.44 106.26 92.8709 106.26 86.0212H80.5V60.1944C73.668 60.1944 67.1159 62.9154 62.2849 67.7589C57.454 72.6024 54.74 79.1715 54.74 86.0212C54.74 92.8709 57.454 99.44 62.2849 104.283C67.1159 109.127 73.668 111.848 80.5 111.848Z",fill:"white"}),(0,t.createElement)("path",{d:"M85.33 55.3519V81.1787H111.09C111.09 74.329 108.376 67.7598 103.545 62.9164C98.7141 58.0729 92.162 55.3519 85.33 55.3519Z",fill:"white"}),(0,t.createElement)("path",{d:"M120.75 144.131H40.25V147.36H120.75V144.131Z",fill:"white"}),(0,t.createElement)("path",{d:"M120.75 134.446H40.25V137.675H120.75V134.446Z",fill:"white"}),(0,t.createElement)("path",{d:"M120.75 124.761H40.25V127.99H120.75V124.761Z",fill:"white"})),d=(0,t.createElement)("svg",{width:"163",height:"205",viewBox:"0 0 163 205",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)("path",{d:"M154.4 37.126V192.087C154.4 193.371 153.888 194.603 152.977 195.511C152.065 196.419 150.829 196.929 149.54 196.929H13.46C12.171 196.929 10.9349 196.419 10.0234 195.511C9.11201 194.603 8.59998 193.371 8.59998 192.087V12.9134C8.59998 11.6291 9.11201 10.3974 10.0234 9.4892C10.9349 8.58105 12.171 8.07086 13.46 8.07086H125.24L154.4 37.126Z",fill:"#F8F8F8"}),(0,t.createElement)("path",{opacity:"0.2",d:"M125.24 8.07086H13.46C12.171 8.07086 10.9349 8.58105 10.0234 9.4892C9.11201 10.3974 8.59998 11.6291 8.59998 12.9134V192.087C8.59998 193.371 9.11201 194.603 10.0234 195.511C10.9349 196.419 12.171 196.929 13.46 196.929H149.54C150.829 196.929 152.065 196.419 152.977 195.511C153.888 194.603 154.4 193.371 154.4 192.087V37.126L125.24 8.07086ZM152.78 192.087C152.78 192.943 152.439 193.764 151.831 194.369C151.223 194.975 150.399 195.315 149.54 195.315H13.46C12.6007 195.315 11.7766 194.975 11.1689 194.369C10.5613 193.764 10.22 192.943 10.22 192.087V12.9134C10.22 12.0572 10.5613 11.236 11.1689 10.6306C11.7766 10.0252 12.6007 9.68504 13.46 9.68504H124.576L125.24 10.3468V32.2835C125.24 33.5678 125.752 34.7995 126.663 35.7076C127.575 36.6158 128.811 37.126 130.1 37.126H152.116L152.78 37.7878V192.087Z",fill:"black"}),(0,t.createElement)("g",{opacity:"0.2"},(0,t.createElement)("path",{opacity:"0.2",d:"M122 138.819H81.5V142.047H122V138.819Z",fill:"black"}),(0,t.createElement)("path",{opacity:"0.2",d:"M122 129.134H41V132.362H122V129.134Z",fill:"black"}),(0,t.createElement)("path",{opacity:"0.2",d:"M122 119.449H41V122.677H122V119.449Z",fill:"black"}),(0,t.createElement)("path",{opacity:"0.2",d:"M122 109.764H41V112.992H122V109.764Z",fill:"black"}),(0,t.createElement)("path",{opacity:"0.2",d:"M122 100.079H41V103.307H122V100.079Z",fill:"black"}),(0,t.createElement)("path",{opacity:"0.2",d:"M79.88 69.4094H41V72.6378H79.88V69.4094Z",fill:"black"}),(0,t.createElement)("path",{opacity:"0.2",d:"M71.78 59.7244H41V62.9527H71.78V59.7244Z",fill:"black"}))),h=window.wp.element,p={height:"500px"},w=(0,t.createElement)("svg",{width:"66",height:"60",viewBox:"0 0 66 60",fill:"black",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)("path",{opacity:"0.5",fillRule:"evenodd",clipRule:"evenodd",d:"M28.9406 59.2644L2.20792 46.9066C-0.0693069 45.8277 -0.0693069 44.1604 2.20792 43.1796L11.5148 38.8642L28.8416 46.9066C31.1188 47.9854 34.7822 47.9854 36.9604 46.9066L54.2871 38.8642L63.5941 43.1796C65.8713 44.2585 65.8713 45.9258 63.5941 46.9066L36.8614 59.2644C34.7822 60.2452 31.1188 60.2452 28.9406 59.2644Z",fill:"black"}),(0,t.createElement)("path",{opacity:"0.75",fillRule:"evenodd",clipRule:"evenodd",d:"M28.9406 44.0606L2.20792 31.7028C-0.069307 30.6239 -0.069307 28.9566 2.20792 27.9758L11.3168 23.7584L28.9406 31.8989C31.2178 32.9778 34.8812 32.9778 37.0594 31.8989L54.6832 23.7584L63.7921 27.9758C66.0693 29.0547 66.0693 30.722 63.7921 31.7028L37.0594 44.0606C34.7822 45.1395 31.1188 45.1395 28.9406 44.0606Z",fill:"black"}),(0,t.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M28.9406 29.2518L2.20792 16.8939C-0.069307 15.8151 -0.069307 14.1478 2.20792 13.167L28.9406 0.809144C31.2178 -0.269715 34.8812 -0.269715 37.0594 0.809144L63.7921 13.167C66.0693 14.2458 66.0693 15.9132 63.7921 16.8939L37.0594 29.2518C34.7822 30.2325 31.1188 30.2325 28.9406 29.2518Z",fill:"black"}));(0,l.registerBlockType)(n.UU,{icon:w,edit:({attributes:e,setAttributes:l})=>{const[n,h]=(0,t.useState)(null),w=["core/bold","core/image","core/italic","core/strikethrough","core/text-color","core/code","core/keyboard","core/subscript","core/superscript"];let s=[];const m=[{label:(0,o.__)("Embedded","onlyoffice-plugin"),value:"embedded"},{label:(0,o.__)("Link"),value:"link"}];(0,t.useEffect)((()=>{e.id&&ONLYOFFICE.formatsUtils.getFileName(e.id).then((e=>{const t=ONLYOFFICE.formatsUtils.getDocumentType(e);h(t)}))}),[e.id]),e.hasOwnProperty("width")&&e.width.length>0&&(p.width=e.width),e.hasOwnProperty("height")&&e.height.length>0&&(p.height=e.height);let H=!0;"full"===e.align&&(delete p.width,H=!1);const f=function(e){var t=ONLYOFFICE.mimeTypes;if(void 0!==t[e])return t[e];for(var l in t)if(-1!==l.indexOf(e))return t[l];return!1};for(let e of ONLYOFFICE.formatsUtils.getViewableExtensions()){let t=f(e);t&&s.push(t)}const u="link"!==e.documentView&&e.id?(0,i.useBlockProps)({style:p}):(0,i.useBlockProps)({style:null});return(0,t.createElement)("div",{...u},e.id?(0,t.createElement)(t.Fragment,null,(0,t.createElement)(i.InspectorControls,{key:"setting"},(0,t.createElement)(a.PanelBody,{title:(0,o.__)("Settings")},(0,t.createElement)(a.__experimentalInputControl,{label:(0,o.__)("Name"),value:e.fileName,onChange:e=>l({fileName:e})}),(0,t.createElement)(a.SelectControl,{label:(0,o.__)("Document view","onlyoffice-plugin"),value:e.documentView,options:m,onChange:e=>{l({documentView:e})}}),"link"===e.documentView?(0,t.createElement)("div",null,(0,t.createElement)(a.ToggleControl,{checked:e.inNewTab,label:(0,o.__)("Open in new tab"),onChange:e=>l({inNewTab:e})}),(0,t.createElement)(a.ToggleControl,{checked:e.showOpenButton,label:(0,o.__)("Show Open in ONLYOFFICE button","onlyoffice-plugin"),onChange:e=>l({showOpenButton:e})})):(0,t.createElement)("div",null,H?(0,t.createElement)(i.HeightControl,{label:(0,o.__)("Width","onlyoffice-docspace-plugin"),value:e.width,onChange:e=>l({width:e})}):"",(0,t.createElement)(i.HeightControl,{label:(0,o.__)("Height","onlyoffice-docspace-plugin"),value:e.height,onChange:e=>l({height:e})})))),"link"===e.documentView?(0,t.createElement)("div",null,(0,t.createElement)(i.RichText,{tagName:"a",allowedFormats:w,onChange:e=>l({fileName:e}),value:e.fileName}),e.showOpenButton?(0,t.createElement)("div",{class:"wp-block-onlyoffice-wordpress-onlyoffice__button-richtext-wrapper"},(0,t.createElement)(i.RichText,{tagName:"div",className:"wp-element-button",value:e.openButtonText||(0,o.__)("Open in ONLYOFFICE","onlyoffice-plugin"),allowedFormats:w,onChange:e=>l({openButtonText:e}),placeholder:(0,o.__)("Add text...")})):""):(0,t.createElement)("div",{className:`wp-block-onlyoffice-wordpress-onlyoffice__embedded ${n}`},(0,t.createElement)("div",null,(e=>{switch(e){case"word":return C;case"cell":return r;case"slide":return c;default:return d}})(n),(0,t.createElement)("p",null," ",n?e.fileName||"":(0,o.__)("File not found!","onlyoffice-plugin")))),(0,t.createElement)(i.BlockControls,{group:"other"},(0,t.createElement)(i.MediaReplaceFlow,{mediaId:e.id,allowedTypes:s,accept:s.join(),onSelect:e=>{e&&e.hasOwnProperty("id")&&l({id:e.id,fileName:e.filename||e.guid.raw.substring(e.guid.raw.lastIndexOf("/")+1)})},name:(0,o.__)("Replace")}))):(0,t.createElement)(i.MediaPlaceholder,{labels:{title:"ONLYOFFICE Docs"},allowedTypes:s,accept:s.join(),onSelect:e=>{e&&e.hasOwnProperty("id")&&l({id:e.id,fileName:e.filename||e.guid.raw.substring(e.guid.raw.lastIndexOf("/")+1)})}}))},save:({attributes:e})=>{if(!e.id)return"";let l="";return e.hasOwnProperty("id")&&(l+="id="+e.id+" "),e.hasOwnProperty("documentView")&&e.documentView.length>0&&(l+="documentView="+e.documentView+" "),e.hasOwnProperty("inNewTab")&&(l+="inNewTab="+e.inNewTab+" "),e.hasOwnProperty("align")&&e.align.length>0&&(l+="align="+e.align+" "),e.hasOwnProperty("width")&&e.width.length>0&&(l+="width="+e.width+" "),e.hasOwnProperty("height")&&e.height.length>0&&(l+="height="+e.height+" "),e.hasOwnProperty("showOpenButton")&&(l+="showOpenButton="+e.showOpenButton+" "),e.hasOwnProperty("openButtonText")&&e.openButtonText.length>0&&(l+="openButtonText="+e.openButtonText+" "),(0,t.createElement)(h.RawHTML,null,`[onlyoffice ${l} /]`)}})})();
  • onlyoffice/trunk/onlyoffice-wordpress-block/src/edit.js

    r2976437 r3070758  
    11/*
    2  * (c) Copyright Ascensio System SIA 2023
     2 * (c) Copyright Ascensio System SIA 2024
    33 *
    44 * This program is free software; you can redistribute it and/or
     
    2323    MediaReplaceFlow,
    2424    InspectorControls,
     25    RichText,
     26    HeightControl
    2527} from '@wordpress/block-editor';
    2628import {
    2729    PanelBody,
     30    ToggleControl,
     31    SelectControl,
    2832    __experimentalInputControl as InputControl
    2933} from '@wordpress/components';
     
    3135import { blockStyle } from "./index";
    3236import { __ } from '@wordpress/i18n';
     37import { useState, useEffect } from 'react';
     38import { getLogoByDocumentType } from "./logos";
    3339
    3440const Edit = ({attributes, setAttributes}) => {
    35     const onlyofficeAllowedExts = oo_media.formats;
     41    const [documentType, setDocumentType] = useState(null);
     42
     43    const richTextAllowedFormats = [ 'core/bold', 'core/image', 'core/italic', 'core/strikethrough', 'core/text-color', 'core/code', 'core/keyboard' , 'core/subscript', 'core/superscript' ];
    3644    let onlyofficeAllowedMimes = [];
     45    const viewOptions = [
     46        {
     47            label: __('Embedded', 'onlyoffice-plugin'),
     48            value: 'embedded'
     49        },
     50        {
     51            label: __('Link'),
     52            value: 'link'
     53        }
     54    ];
     55
     56    useEffect(() => {
     57        if (attributes.id) {
     58            ONLYOFFICE.formatsUtils.getFileName(attributes.id).then((fileName) => {
     59                const documentType = ONLYOFFICE.formatsUtils.getDocumentType(fileName);
     60                setDocumentType(documentType);
     61            });
     62        }
     63    }, [attributes.id]);
     64
     65    if (attributes.hasOwnProperty('width') && attributes.width.length > 0) {
     66        blockStyle.width = attributes.width;
     67    }
     68
     69    if (attributes.hasOwnProperty('height') && attributes.height.length > 0) {
     70        blockStyle.height = attributes.height;
     71    }
     72
     73    let showWidthControl = true;
     74
     75    if (attributes.align === "full") {
     76        delete blockStyle.width;
     77        showWidthControl = false;
     78    }
    3779
    3880    const getMimeType = function( name ) {
    39         var allTypes = oo_media.mimeTypes;
     81        var allTypes = ONLYOFFICE.mimeTypes;
    4082
    4183        if (allTypes[name] !== undefined) {
     
    5294    };
    5395
    54     for (let ext of onlyofficeAllowedExts) {
     96    for (let ext of ONLYOFFICE.formatsUtils.getViewableExtensions()) {
    5597        let mimeType = getMimeType(ext);
    5698
     
    60102    }
    61103
    62     const blockProps = useBlockProps( { style: blockStyle } );
     104    const blockProps = attributes.documentView === 'link' || ! attributes.id ?  useBlockProps( { style: null } ) : useBlockProps( { style: blockStyle } );
    63105    return (
    64         attributes.id ?
    65             <div {...blockProps}>
     106        <div {...blockProps}>
     107        {attributes.id ?
     108            <>
    66109                <InspectorControls key="setting">
    67110                    <PanelBody title={__('Settings')}>
    68111                        <InputControl label={__('Name')} value={attributes.fileName} onChange={ ( value ) => setAttributes({ fileName: value }) } />
     112                        <SelectControl
     113                            label={__('Document view', 'onlyoffice-plugin')}
     114                            value={attributes.documentView}
     115                            options={viewOptions}
     116                            onChange={(value) => {setAttributes({ documentView: value })}}
     117                            />
     118                        {
     119                            attributes.documentView === 'link' ?
     120                                <div>
     121                                    <ToggleControl
     122                                        checked={attributes.inNewTab}
     123                                        label={__('Open in new tab')}
     124                                        onChange={(value) => setAttributes({ inNewTab: value })}
     125                                        />
     126                                    <ToggleControl
     127                                        checked={attributes.showOpenButton}
     128                                        label={__('Show Open in ONLYOFFICE button', 'onlyoffice-plugin')}
     129                                        onChange={(value) => setAttributes({ showOpenButton: value })}
     130                                        />
     131                                </div>
     132                                :
     133                                <div>
     134                                    {
     135                                        showWidthControl ?
     136                                            <HeightControl label={ __("Width", "onlyoffice-docspace-plugin") } value={attributes.width} onChange={ ( value ) => setAttributes({ width: value }) }/>
     137                                            :
     138                                            ''
     139                                        }
     140                                    <HeightControl label={ __("Height", "onlyoffice-docspace-plugin") } value={attributes.height} onChange={ ( value ) => setAttributes({ height: value }) }/>
     141                                </div>
     142                        }
    69143                    </PanelBody>
    70144                </InspectorControls>
    71145
    72                 <p style={{display: 'flex'}}>
    73                     {onlyofficeIcon}
    74                     <p style={{marginLeft: '25px'}}> {attributes.fileName || ""}</p>
    75                 </p>
    76                 <BlockControls>
     146                {
     147                    attributes.documentView === 'link' ?
     148                        <div>
     149                            <RichText
     150                                tagName="a"
     151                                allowedFormats={ richTextAllowedFormats }
     152                                onChange={ ( value ) => setAttributes({ fileName: value }) }
     153                                value={ attributes.fileName }
     154                            />
     155                            {
     156                                attributes.showOpenButton ?
     157                                    <div class="wp-block-onlyoffice-wordpress-onlyoffice__button-richtext-wrapper">
     158                                        <RichText
     159                                            tagName="div"
     160                                            className = {'wp-element-button'}
     161                                            value= { attributes.openButtonText || __('Open in ONLYOFFICE', 'onlyoffice-plugin') }
     162                                            allowedFormats={ richTextAllowedFormats }
     163                                            onChange={ ( openButtonText ) => setAttributes( { openButtonText } ) }
     164                                            placeholder={ __('Add text...') }
     165                                        />
     166                                    </div>
     167                                    :
     168                                    ''
     169                            }
     170                        </div>
     171
     172                        :
     173                        <div className={ `wp-block-onlyoffice-wordpress-onlyoffice__embedded ${documentType}`}>
     174                            <div>
     175                                {getLogoByDocumentType(documentType)}
     176                                <p> {documentType ? attributes.fileName || "" : __('File not found!', 'onlyoffice-plugin')}</p>
     177                            </div>
     178                        </div>
     179                }
     180
     181                <BlockControls group="other">
    77182                    <MediaReplaceFlow
    78183                        mediaId={ attributes.id }
     
    87192                    />
    88193                </BlockControls>
    89             </div>
     194            </>
    90195            :
    91196            <MediaPlaceholder
    92                 labels={{title: 'ONLYOFFICE'}}
     197                labels={{title: 'ONLYOFFICE Docs'}}
    93198                allowedTypes={onlyofficeAllowedMimes}
    94199                accept={onlyofficeAllowedMimes.join()}
     
    99204                }}
    100205            />
     206        }
     207        </div>
    101208    )
    102209};
  • onlyoffice/trunk/onlyoffice-wordpress-block/src/index.js

    r2976437 r3070758  
    11/*
    2  * (c) Copyright Ascensio System SIA 2023
     2 * (c) Copyright Ascensio System SIA 2024
    33 *
    44 * This program is free software; you can redistribute it and/or
     
    1919import { registerBlockType } from '@wordpress/blocks';
    2020
     21import "./styles.css"
     22
    2123import block from '../block.json';
    2224import edit from './edit';
     
    2426
    2527export const blockStyle = {
    26     padding: '20px',
     28    height: '500px',
    2729};
    2830
  • onlyoffice/trunk/onlyoffice-wordpress-block/src/save.js

    r2976437 r3070758  
    11/*
    2  * (c) Copyright Ascensio System SIA 2023
     2 * (c) Copyright Ascensio System SIA 2024
    33 *
    44 * This program is free software; you can redistribute it and/or
     
    2020
    2121const Save = ( { attributes } ) => {
    22     return <RawHTML>{ `[onlyoffice id=${ attributes.id } /]` }</RawHTML>;
     22    if ( !attributes.id ) {
     23        return '';
     24    }
     25
     26    let parameters = '';
     27
     28    if ( attributes.hasOwnProperty('id')) {
     29        parameters += 'id=' + attributes.id + ' ';
     30    }
     31
     32    if ( attributes.hasOwnProperty('documentView') && attributes.documentView.length > 0 ) {
     33        parameters += 'documentView=' + attributes.documentView + ' ';
     34    }
     35
     36    if ( attributes.hasOwnProperty('inNewTab')) {
     37        parameters += 'inNewTab=' + attributes.inNewTab + ' ';
     38    }
     39
     40    if ( attributes.hasOwnProperty('align') && attributes.align.length > 0 ) {
     41        parameters += 'align=' + attributes.align + ' ';
     42    }
     43
     44    if ( attributes.hasOwnProperty('width') && attributes.width.length > 0 ) {
     45        parameters += 'width=' + attributes.width + ' ';
     46    }
     47
     48    if ( attributes.hasOwnProperty('height') && attributes.height.length > 0 ) {
     49        parameters += 'height=' + attributes.height + ' ';
     50    }
     51
     52    if ( attributes.hasOwnProperty('showOpenButton') ) {
     53        parameters += 'showOpenButton=' + attributes.showOpenButton + ' ';
     54    }
     55
     56    if ( attributes.hasOwnProperty('openButtonText') && attributes.openButtonText.length > 0 ) {
     57        parameters += 'openButtonText=' + attributes.openButtonText + ' ';
     58    }
     59
     60    return <RawHTML>{ `[onlyoffice ${ parameters } /]` }</RawHTML>;
    2361};
    2462export default Save;
  • onlyoffice/trunk/onlyoffice-wordpress.php

    r2976437 r3070758  
    55 * @package           Onlyoffice_Plugin
    66 *
    7  * Plugin Name:       ONLYOFFICE
     7 * Plugin Name:       ONLYOFFICE Docs
    88 * Plugin URI:        https://github.com/ONLYOFFICE/onlyoffice-wordpress
    9  * Description:       Add ONLYOFFICE editor on page
    10  * Version:           1.1.0
     9 * Description:       Add ONLYOFFICE Docs blocks to posts to allow your site visitors to view the inserted file without downloading. Edit and collaborate on office documents from the admin dashboard.
     10 * Version:           2.0.0
    1111 * Requires at least: 5.7
    1212 * Requires PHP:      7.4
     
    2121/**
    2222 *
    23  * (c) Copyright Ascensio System SIA 2023
     23 * (c) Copyright Ascensio System SIA 2024
    2424 *
    2525 * This program is free software; you can redistribute it and/or
     
    4141 * Currently plugin version.
    4242 */
    43 define( 'ONLYOFFICE_PLUGIN_VERSION', '1.1.0' );
     43define( 'ONLYOFFICE_PLUGIN_NAME', 'onlyoffice-plugin' );
     44define( 'ONLYOFFICE_PLUGIN_VERSION', '2.0.0' );
    4445define( 'ONLYOFFICE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
     46define( 'ONLYOFFICE_PLUGIN_FILE', __FILE__ );
    4547
    4648
     
    6668 */
    6769function uninstall_onlyoffice_wordpress_plugin() {
    68     delete_option( 'onlyoffice_settings' );
    69     delete_option( 'onlyoffice-plugin-uuid' );
    70     delete_option( 'onlyoffice-plugin-bytes' );
     70    delete_site_option( 'onlyoffice_settings' );
     71    delete_site_option( 'onlyoffice-plugin-uuid' );
     72    delete_site_option( 'onlyoffice-plugin-bytes' );
     73    delete_site_option( 'onlyoffice-formats' );
    7174}
    7275
     
    99102
    100103/**
    101  * Data about additional ONLYOFFICE formats.
     104 * Data about additional ONLYOFFICE Docs formats.
    102105 *
    103106 * @since    2.0.0
     
    107110 */
    108111function onlyoffice_forms_mime_types( $mimes ) {
    109     $mimes['oform'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document.oform';
    110112    $mimes['docxf'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document.docxf';
    111113
     
    127129    $ext = pathinfo( $filename, PATHINFO_EXTENSION );
    128130    switch ( $ext ) {
    129         case 'oform':
    130             $data['ext']  = 'oform';
    131             $data['type'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document.oform';
    132             break;
    133131        case 'docxf':
    134132            $data['ext']  = 'docxf';
  • onlyoffice/trunk/public/assets/document-formats/CHANGELOG.md

    r2976437 r3070758  
    11# Change Log
    22
     3##
     4- fb2 additional mime
     5
     6## 1.1.0
     7- filling pdf
    38- conversion formats for txt, csv
    49- formats for auto conversion
  • onlyoffice/trunk/public/assets/document-formats/onlyoffice-docs-formats.json

    r2976437 r3070758  
    3232        "type": "word",
    3333        "actions": ["view", "edit"],
    34         "convert": ["docx", "bmp", "docm", "dotm", "dotx", "epub", "fb2", "gif", "html", "jpg", "odt", "oform", "ott", "pdf", "pdfa", "png", "rtf", "txt"],
     34        "convert": ["docx", "bmp", "docm", "dotm", "dotx", "epub", "fb2", "gif", "html", "jpg", "odt", "ott", "pdf", "pdfa", "png", "rtf", "txt"],
    3535        "mime": ["application/vnd.openxmlformats-officedocument.wordprocessingml.document.docxf"]
    3636    },
     
    6868        "actions": ["view", "lossy-edit", "auto-convert"],
    6969        "convert": ["docx", "docxf", "bmp", "docm", "dotm", "dotx", "epub", "gif", "html", "jpg", "odt", "ott", "pdf", "pdfa", "png", "rtf", "txt"],
    70         "mime": ["text/fb2+xml"]
     70        "mime": ["text/fb2+xml", "application/x-fictionbook+xml"]
    7171    },
    7272    {
     
    115115        "name": "oform",
    116116        "type": "word",
    117         "actions": ["view", "fill"],
     117        "actions": ["view"],
    118118        "convert": ["pdf"],
    119119        "mime": ["application/vnd.openxmlformats-officedocument.wordprocessingml.document.oform"]
     
    136136        "name": "pdf",
    137137        "type": "word",
    138         "actions": ["view"],
     138        "actions": ["view", "fill"],
    139139        "convert": ["docx", "docxf", "bmp", "docm", "dotm", "dotx", "epub", "fb2", "gif", "html", "jpg", "odt", "ott", "pdfa", "png", "rtf", "txt"],
    140140        "mime": ["application/pdf", "application/acrobat", "application/nappdf", "application/x-pdf", "image/pdf"]
     
    398398        "convert": ["pptx", "bmp", "gif", "jpg", "odp", "otp", "pdf", "pdfa", "png", "potm", "potx", "ppsm", "ppsx", "pptm"],
    399399        "mime": ["application/vnd.sun.xml.impress"]
     400    },
     401    {
     402        "name": "bmp",
     403        "type": "",
     404        "actions": [],
     405        "convert": [],
     406        "mime": ["image/bmp"]
     407    },
     408    {
     409        "name": "gif",
     410        "type": "",
     411        "actions": [],
     412        "convert": [],
     413        "mime": ["image/gif"]
     414    },
     415    {
     416        "name": "jpg",
     417        "type": "",
     418        "actions": [],
     419        "convert": [],
     420        "mime": ["image/jpeg"]
     421    },
     422    {
     423        "name": "pdfa",
     424        "type": "",
     425        "actions": [],
     426        "convert": [],
     427        "mime": ["application/pdf", "application/acrobat", "application/nappdf", "application/x-pdf", "image/pdf"]
     428    },
     429    {
     430        "name": "png",
     431        "type": "",
     432        "actions": [],
     433        "convert": [],
     434        "mime": ["image/png"]
     435    },
     436    {
     437        "name": "zip",
     438        "type": "",
     439        "actions": [],
     440        "convert": [],
     441        "mime": ["application/zip"]
    400442    }
    401443]
  • onlyoffice/trunk/public/class-onlyoffice-plugin-public.php

    r2976437 r3070758  
    1212/**
    1313 *
    14  * (c) Copyright Ascensio System SIA 2023
     14 * (c) Copyright Ascensio System SIA 2024
    1515 *
    1616 * This program is free software; you can redistribute it and/or
     
    4242
    4343    /**
    44      * The ID of this plugin.
    45      *
    46      * @since    1.0.0
    47      * @access   private
    48      * @var      string    $plugin_name    The ID of this plugin.
    49      */
    50     private $plugin_name;
    51 
    52     /**
    53      * The version of this plugin.
    54      *
    55      * @since    1.0.0
    56      * @access   private
    57      * @var      string    $version    The current version of this plugin.
    58      */
    59     private $version;
    60 
    61     /**
    62      * Initialize the class and set its properties.
    63      *
    64      * @since    1.0.0
    65      * @param      string $plugin_name       The name of the plugin.
    66      * @param      string $version    The version of this plugin.
    67      */
    68     public function __construct( $plugin_name, $version ) {
    69         $this->plugin_name = $plugin_name;
    70         $this->version     = $version;
    71     }
    72 
    73     /**
    7444     * Register the stylesheets for the public-facing side of the site.
    7545     *
     
    9565        require_once plugin_dir_path( __FILE__ ) . 'views/class-onlyoffice-plugin-callback.php';
    9666        require_once plugin_dir_path( __FILE__ ) . 'views/class-onlyoffice-plugin-download.php';
    97         require_once plugin_dir_path( __FILE__ ) . 'views/class-onlyoffice-plugin-editor.php';
    9867
    9968        $callback = new Onlyoffice_Plugin_Callback();
    10069        $download = new Onlyoffice_Plugin_Download();
    101         $editor   = new Onlyoffice_Plugin_Editor();
    10270
    10371        // "oo."-prefix is needed to keep the connector working in conjunction with the plugin "Force Lowercase URLs"
    10472        // (https://wordpress.org/plugins/force-lowercase-urls/)
    105 
    106         register_rest_route(
    107             'onlyoffice',
    108             '/oo.editor/(?P<id>[^\/\n\r]+)',
    109             array(
    110                 'methods'             => WP_REST_Server::READABLE,
    111                 'callback'            => array( $editor, 'editor' ),
    112                 'permission_callback' => array( $this, 'check_attachment_id' ),
    113             )
    114         );
    11573
    11674        register_rest_route(
  • onlyoffice/trunk/public/views/class-onlyoffice-plugin-callback.php

    r2976437 r3070758  
    1212/**
    1313 *
    14  * (c) Copyright Ascensio System SIA 2023
     14 * (c) Copyright Ascensio System SIA 2024
    1515 *
    1616 * This program is free software; you can redistribute it and/or
     
    113113        $param = urldecode( str_replace( ',', '%', $req->get_params()['id'] ) );
    114114
    115         $attachemnt_id = intval( Onlyoffice_Plugin_Url_Manager::decode_openssl_data( $param, get_option( 'onlyoffice-plugin-uuid' ) ) );
     115        $attachemnt_id = intval( Onlyoffice_Plugin_Url_Manager::decode_openssl_data( $param, get_site_option( 'onlyoffice-plugin-uuid' ) ) );
    116116        $user_id       = isset( $body['actions'] ) ? $body['actions'][0]['userid'] : null;
    117117
     
    136136                break;
    137137            case 'MustSave':
    138                 $can_edit = Onlyoffice_Plugin_Document_Manager::has_edit_capability( $attachemnt_id );
     138                $can_edit = Onlyoffice_Plugin_Document_Manager::can_user_edit_attachment( $attachemnt_id );
    139139                if ( ! $can_edit ) {
    140140                    wp_die( 'No edit capability', '', array( 'response' => 403 ) );
  • onlyoffice/trunk/public/views/class-onlyoffice-plugin-download.php

    r2976437 r3070758  
    1212/**
    1313 *
    14  * (c) Copyright Ascensio System SIA 2023
     14 * (c) Copyright Ascensio System SIA 2024
    1515 *
    1616 * This program is free software; you can redistribute it and/or
     
    4343     * @param array $req The request.
    4444     *
    45      * @return void
     45     * @return void|WP_Error
    4646     */
    4747    public function get_file( $req ) {
     48        global $wp_filesystem;
    4849
    4950        if ( Onlyoffice_Plugin_JWT_Manager::is_jwt_enabled() ) {
     
    9192        }
    9293
    93         $filepath = get_attached_file( $attachment_id );
     94        if ( ! function_exists( 'WP_Filesystem' ) ) {
     95            include ABSPATH . '/wp-admin/includes/file.php';
     96        }
    9497
    95         header( 'Content-Length: ' . filesize( $filepath ) );
    96         header( 'Content-Disposition: attachment; filename*=UTF-8\'\'' . urldecode( basename( $filepath ) ) );
    97         header( 'Content-Type: ' . Onlyoffice_Plugin_Document_Manager::get_mime_type( $filepath ) );
     98        if ( ! WP_Filesystem() ) {
     99            return new WP_Error( 'filesystem_error', 'Unable to initialize the filesystem.' );
     100        }
    98101
    99         readfile( $filepath );
    100         flush();
    101         exit;
     102        $file_path = get_attached_file( $attachment_id );
     103
     104        if ( $wp_filesystem->is_file( $file_path ) ) {
     105            header( 'Content-Length: ' . filesize( $file_path ) );
     106            header( 'Content-Disposition: attachment; filename*=UTF-8\'\'' . urldecode( basename( $file_path ) ) );
     107            header( 'Content-Type: ' . Onlyoffice_Plugin_Document_Manager::get_mime_type( $file_path ) );
     108
     109            $file_content = $wp_filesystem->get_contents( $file_path );
     110            echo $file_content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     111
     112            exit;
     113        } else {
     114                return new WP_Error( 'file_not_found', 'File not found.' );
     115        }
    102116    }
    103117}
  • onlyoffice/trunk/readme.txt

    r2976437 r3070758  
    1 === ONLYOFFICE ===
     1=== ONLYOFFICE Docs ===
    22Contributors: onlyoffice
    3 Tags: onlyoffice, integration, collaboration, editor, office, document, spreadsheet, presentation
     3Tags: onlyoffice, collaboration, editor, office, document, spreadsheet, presentation, forms, pdf
    44Requires at least: 5.7
    55Tested up to: 6.1
    6 Stable tag: 1.1.0
     6Stable tag: 2.0.0
    77Requires PHP: 7.4
    88License: GPLv2
    99License URI: https://github.com/ONLYOFFICE/onlyoffice-wordpress/blob/main/LICENSE
    1010
    11 ONLYOFFICE plugin allows users to edit and view office documents from WordPress using ONLYOFFICE Docs.
     11ONLYOFFICE Docs plugin allows users to edit and view office documents from WordPress using ONLYOFFICE Docs.
    1212
    1313== Description ==
    1414
    15 ONLYOFFICE integration plugin allows WordPress administrators to open documents, spreadsheets, and presentations for collaborative editing using ONLYOFFICE Docs (online document editors). In published posts, the editors are visible to all WordPress site visitors (both authorized and unauthorized) in the Embedded mode only.
     15ONLYOFFICE Docs integration plugin allows WordPress administrators to open documents, spreadsheets, and presentations for collaborative editing using ONLYOFFICE Docs (online document editors). In published posts, the editors are visible to all WordPress site visitors (both authorized and unauthorized) in the Embedded mode only.
    1616
    1717**Editing files uploaded to Wordpress**
    1818
    19 All uploaded files from the Media section will appear on the ONLYOFFICE -> Files page. The editor opens in the same tab by clicking on the file name. Users with administrator rights are able to co-edit documents. All the changes are saved in the same file.
     19All uploaded files from the Media section will appear on the ONLYOFFICE Docs -> Files page. The editor opens in the same tab by clicking on the file name. Users with administrator rights are able to co-edit documents. All the changes are saved in the same file.
    2020
    2121**Creating a post**
    2222
    23 When creating a post, you can add the ONLYOFFICE element (block) and then upload a new file or select one from the Media Library. The added file will be displayed as the ONLYOFFICE logo with the file name in the currently edited post. After the post is published (when you press the Publish or Update button), your WordPress site visitors will have access to this file for viewing in the Embedded mode.
     23When creating a post, you can add the ONLYOFFICE Docs element (block) and then upload a new file or select one from the Media Library. The added file will be displayed as the ONLYOFFICE logo with the file name in the currently edited post. After the post is published (when you press the Publish or Update button), your WordPress site visitors will have access to this file for viewing in the Embedded mode.
    2424
    2525== Frequently Asked Questions ==
     
    3131= How to configure the plugin? =
    3232
    33 Go to WordPress administrative dashboard -> ONLYOFFICE -> Settings. Specify the URL of the installed ONLYOFFICE Document Server and the Secret key.
     33Go to WordPress administrative dashboard -> ONLYOFFICE Docs -> Settings. Specify the URL of the installed ONLYOFFICE Document Server and the Secret key.
    3434
    3535Please note: Starting from version 7.2 of ONLYOFFICE Docs, JWT is enabled by default and the secret key is generated automatically to restrict the access to ONLYOFFICE Docs and for security reasons and data integrity. Specify your own secret key in the WordPress administrative configuration. In the ONLYOFFICE Docs [config file](https://api.onlyoffice.com/editors/signature/), specify the same secret key and enable the validation.
     
    4141== Screenshots ==
    4242
    43 1. ONLYOFFICE plugin configuration settings within the WordPress administrative dashboard.
    44 2. ONLYOFFICE -> Files page within the WordPress administrative dashboard.
    45 3. ONLYOFFICE document editor opened from the WordPress admin dashboard.
    46 4. Adding ONLYOFFICE block when creating a post.
    47 5. Uploading a new file or selecting one from the Media Library to the ONLYOFFICE block.
     431. ONLYOFFICE Docs plugin configuration settings within the WordPress administrative dashboard.
     442. ONLYOFFICE Docs -> Files page within the WordPress administrative dashboard.
     453. ONLYOFFICE Docs editor opened from the WordPress admin dashboard.
     464. Adding ONLYOFFICE Docs block when creating a post.
     475. Uploading a new file or selecting one from the Media Library to the ONLYOFFICE Docs block.
    48486. Added file displayed as the ONLYOFFICE logo with the file name in the currently edited post.
    49497. ONLYOFFICE file available for viewing in the Embedded mode to the WordPress site visitors.
    5050
    5151== Changelog ==
     52= 2.0.0 =
     53* multisite support
     54* stub for onlyoffice-wordpress-block that displays error information if the document server is not accessible or the file is not found
     55* settings for onlyoffice block (width, height, align, show open in onlyoffice button)
     56* button copy link to editor, in the table with files
     57* ability to insert a link to the editor on the page
     58* access for an anonymous user, open the document for viewing in the editor if the document is attached to a public post
     59* filling pdf
     60* editor url
     61* displaying the onlyoffice-wordpress-block component in the Gutenberg editor
     62* remove filling for oform
     63* supported formats updated
     64
     65= 1.1.0 =
     66* extended list of supported formats
     67* support docxf and oform formats
     68* support for the connector to work in conjunction with the plugin "Force Lowercase URLs" (https://wordpress.org/plugins/force-lowercase-urls)
     69* setting authorization header
     70* compatible with classic editor TinyMCE
     71* Link to docs cloud
    5272
    5373= 1.0.2 =
     
    6585* set favicon on editor page
    6686* added goBack url for document editor
    67 
    68 == Upgrade Notice ==
    69 
    70 = 1.0 =
    71 This is the first version of the plugin.
  • onlyoffice/trunk/vendor/autoload.php

    r2976472 r3070758  
    2323require_once __DIR__ . '/composer/autoload_real.php';
    2424
    25 return ComposerAutoloaderInit38bfbb3e5772cda36e94ef9ca1a3fa4f::getLoader();
     25return ComposerAutoloaderInit233fba0d7a41b0f5c532bee7586a2e7b::getLoader();
  • onlyoffice/trunk/vendor/composer/autoload_real.php

    r2976472 r3070758  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit38bfbb3e5772cda36e94ef9ca1a3fa4f
     5class ComposerAutoloaderInit233fba0d7a41b0f5c532bee7586a2e7b
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit38bfbb3e5772cda36e94ef9ca1a3fa4f', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit233fba0d7a41b0f5c532bee7586a2e7b', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit38bfbb3e5772cda36e94ef9ca1a3fa4f', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit233fba0d7a41b0f5c532bee7586a2e7b', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInit38bfbb3e5772cda36e94ef9ca1a3fa4f::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInit233fba0d7a41b0f5c532bee7586a2e7b::getInitializer($loader));
    3333
    3434        $loader->register(true);
  • onlyoffice/trunk/vendor/composer/autoload_static.php

    r2976472 r3070758  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit38bfbb3e5772cda36e94ef9ca1a3fa4f
     7class ComposerStaticInit233fba0d7a41b0f5c532bee7586a2e7b
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    2828    {
    2929        return \Closure::bind(function () use ($loader) {
    30             $loader->prefixLengthsPsr4 = ComposerStaticInit38bfbb3e5772cda36e94ef9ca1a3fa4f::$prefixLengthsPsr4;
    31             $loader->prefixDirsPsr4 = ComposerStaticInit38bfbb3e5772cda36e94ef9ca1a3fa4f::$prefixDirsPsr4;
    32             $loader->classMap = ComposerStaticInit38bfbb3e5772cda36e94ef9ca1a3fa4f::$classMap;
     30            $loader->prefixLengthsPsr4 = ComposerStaticInit233fba0d7a41b0f5c532bee7586a2e7b::$prefixLengthsPsr4;
     31            $loader->prefixDirsPsr4 = ComposerStaticInit233fba0d7a41b0f5c532bee7586a2e7b::$prefixDirsPsr4;
     32            $loader->classMap = ComposerStaticInit233fba0d7a41b0f5c532bee7586a2e7b::$classMap;
    3333
    3434        }, null, ClassLoader::class);
  • onlyoffice/trunk/vendor/composer/installed.json

    r2976472 r3070758  
    33        {
    44            "name": "firebase/php-jwt",
    5             "version": "v6.9.0",
    6             "version_normalized": "6.9.0.0",
     5            "version": "v6.10.0",
     6            "version_normalized": "6.10.0.0",
    77            "source": {
    88                "type": "git",
    99                "url": "https://github.com/firebase/php-jwt.git",
    10                 "reference": "f03270e63eaccf3019ef0f32849c497385774e11"
     10                "reference": "a49db6f0a5033aef5143295342f1c95521b075ff"
    1111            },
    1212            "dist": {
    1313                "type": "zip",
    14                 "url": "https://api.github.com/repos/firebase/php-jwt/zipball/f03270e63eaccf3019ef0f32849c497385774e11",
    15                 "reference": "f03270e63eaccf3019ef0f32849c497385774e11",
     14                "url": "https://api.github.com/repos/firebase/php-jwt/zipball/a49db6f0a5033aef5143295342f1c95521b075ff",
     15                "reference": "a49db6f0a5033aef5143295342f1c95521b075ff",
    1616                "shasum": ""
    1717            },
     
    3131                "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present"
    3232            },
    33             "time": "2023-10-05T00:24:42+00:00",
     33            "time": "2023-12-01T16:26:39+00:00",
    3434            "type": "library",
    3535            "installation-source": "dist",
     
    6363            "support": {
    6464                "issues": "https://github.com/firebase/php-jwt/issues",
    65                 "source": "https://github.com/firebase/php-jwt/tree/v6.9.0"
     65                "source": "https://github.com/firebase/php-jwt/tree/v6.10.0"
    6666            },
    6767            "install-path": "../firebase/php-jwt"
  • onlyoffice/trunk/vendor/composer/installed.php

    r2976472 r3070758  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '165dea0488ea93230789f01c30f2fa34fa319c15',
     6        'reference' => 'eb4282d29affcb188143d0992bcc70993ad7578d',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => '165dea0488ea93230789f01c30f2fa34fa319c15',
     16            'reference' => 'eb4282d29affcb188143d0992bcc70993ad7578d',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
     
    2121        ),
    2222        'firebase/php-jwt' => array(
    23             'pretty_version' => 'v6.9.0',
    24             'version' => '6.9.0.0',
    25             'reference' => 'f03270e63eaccf3019ef0f32849c497385774e11',
     23            'pretty_version' => 'v6.10.0',
     24            'version' => '6.10.0.0',
     25            'reference' => 'a49db6f0a5033aef5143295342f1c95521b075ff',
    2626            'type' => 'library',
    2727            'install_path' => __DIR__ . '/../firebase/php-jwt',
  • onlyoffice/trunk/vendor/firebase/php-jwt/CHANGELOG.md

    r2976472 r3070758  
    11# Changelog
     2
     3## [6.10.0](https://github.com/firebase/php-jwt/compare/v6.9.0...v6.10.0) (2023-11-28)
     4
     5
     6### Features
     7
     8* allow typ header override ([#546](https://github.com/firebase/php-jwt/issues/546)) ([79cb30b](https://github.com/firebase/php-jwt/commit/79cb30b729a22931b2fbd6b53f20629a83031ba9))
    29
    310## [6.9.0](https://github.com/firebase/php-jwt/compare/v6.8.1...v6.9.0) (2023-10-04)
  • onlyoffice/trunk/vendor/firebase/php-jwt/src/JWT.php

    r2976472 r3070758  
    204204        array $head = null
    205205    ): string {
    206         $header = ['typ' => 'JWT', 'alg' => $alg];
     206        $header = ['typ' => 'JWT'];
     207        if (isset($head) && \is_array($head)) {
     208            $header = \array_merge($header, $head);
     209        }
     210        $header['alg'] = $alg;
    207211        if ($keyId !== null) {
    208212            $header['kid'] = $keyId;
    209         }
    210         if (isset($head) && \is_array($head)) {
    211             $header = \array_merge($head, $header);
    212213        }
    213214        $segments = [];
Note: See TracChangeset for help on using the changeset viewer.