diff --git a/admin/class-admin-settings.php b/admin/class-admin-settings.php index 4e4aa18..ac3bb49 100644 --- a/admin/class-admin-settings.php +++ b/admin/class-admin-settings.php @@ -122,12 +122,12 @@ private function render_help_section() { teacher_mode 0 - + teacher_mode_visible 1 - + show_download diff --git a/assets/js/elp-upload.js b/assets/js/elp-upload.js index 6919d67..e499db7 100644 --- a/assets/js/elp-upload.js +++ b/assets/js/elp-upload.js @@ -234,7 +234,7 @@ }, teacherModeVisible: { type: 'boolean', - default: true, + default: false, }, showDownload: { type: 'boolean', @@ -344,7 +344,7 @@ previewUrl: undefined, title: undefined, hasPreview: false, - teacherModeVisible: true, + teacherModeVisible: false, }); } @@ -410,8 +410,9 @@ step: 10, }), el( ToggleControl, { - label: __( 'Show Teacher Mode toggler', 'exelearning' ), - checked: attributes.teacherModeVisible !== false, + label: __( 'Show teacher layer selector', 'exelearning' ), + help: __( 'If disabled, the teacher layer selector is hidden in the embedded eXeLearning content.', 'exelearning' ), + checked: attributes.teacherModeVisible === true, onChange: function( value ) { setAttributes( { teacherModeVisible: value } ); }, diff --git a/docs/SHORTCODES.md b/docs/SHORTCODES.md index 05f31d7..cee3c53 100644 --- a/docs/SHORTCODES.md +++ b/docs/SHORTCODES.md @@ -30,26 +30,31 @@ Library, e.g. in the URL `…/upload.php?item=123`). |-----------|------|---------|----------------|-------------| | `id` | int | `0` | Any attachment ID | **Required.** Media Library attachment ID of the `.elpx` package. Nothing renders without a valid ID. | | `height` | int | `600` | Pixels | Height of the preview iframe (and of the screenshot poster) in pixels. | -| `teacher_mode` | bool | `0` | `0`/`1`, `false`/`true`, `no`/`yes` | When enabled, the embedded content loads with **teacher mode active**, so teacher-only content is shown from the start. | -| `teacher_mode_visible` | bool | `1` | `0`/`1`, `false`/`true`, `no`/`yes` | Controls whether the teacher-mode **toggle button** is visible inside the embed. Set to `0` to hide it. | +| `teacher_mode` | bool | `0` | `0`/`1`, `false`/`true`, `no`/`yes` | When enabled, the **teacher layer selector** is offered in the embed so viewers can reveal teacher-only content. It no longer auto-reveals on load — the viewer turns it on. | +| `teacher_mode_visible` | bool | `0` | `0`/`1`, `false`/`true`, `no`/`yes` | Controls whether the **teacher layer selector** is available inside the embed. Off by default; set to `1` to make it available. | | `show_download` | bool | `0` | `0`/`1`, `false`/`true`, `no`/`yes` | When enabled, renders a multi-format download button in the toolbar. | | `download_formats` | string | *(empty → all)* | Comma-separated list of `elpx`, `html5`, `scorm12`, `ims`, `epub3` | Restricts the download button to the listed formats. Empty means all available formats. Only applies when `show_download` is enabled. | | `screenshot` | string | `no` | `no`, `poster`, `only` | Controls whether the package screenshot is shown. See [Screenshots](#screenshots). | ### Teacher mode -eXeLearning packages can mark content as *teacher-only*. The embedded viewer -ships a toggle that switches teacher mode on and off; the two attributes above -control it independently: +eXeLearning packages can mark content as *teacher-only*. Exported packages hide +that content by default and expose an in-page **teacher layer selector** to +reveal it through the `?exe-teacher=1` URL parameter. The plugin appends that +parameter to the embed instead of injecting any CSS or JavaScript into the +package: -- `teacher_mode` decides the **initial state** (off by default). -- `teacher_mode_visible` decides whether the **toggle button** is shown. +- `teacher_mode_visible` (default `0`) decides whether the **selector is + available** in the embed. It is hidden by default; set it to `1` to make it + available. +- `teacher_mode` (default `0`), when enabled, also makes the selector available. + It no longer auto-reveals teacher content on load — the selector is shown but + stays off until the viewer turns it on. -They compose freely. For example, to always present teacher content and hide the -toggle so visitors cannot switch it off: +For example, to offer the selector explicitly: ```text -[exelearning id="123" teacher_mode="1" teacher_mode_visible="0"] +[exelearning id="123" teacher_mode_visible="1"] ``` ### Screenshots @@ -81,16 +86,17 @@ Custom height: [exelearning id="123" height="800"] ``` -Activate teacher mode on load: +Offer the teacher layer selector (hidden by default): ```text -[exelearning id="123" teacher_mode="1"] +[exelearning id="123" teacher_mode_visible="1"] ``` -Hide the teacher-mode toggle: +The selector is hidden unless you enable it, so a bare embed keeps teacher-only +content hidden: ```text -[exelearning id="123" teacher_mode_visible="0"] +[exelearning id="123"] ``` Show a download button limited to specific formats: diff --git a/includes/class-elp-upload-block.php b/includes/class-elp-upload-block.php index a5daa56..00822f6 100644 --- a/includes/class-elp-upload-block.php +++ b/includes/class-elp-upload-block.php @@ -122,7 +122,7 @@ public function register_block() { ), 'teacherModeVisible' => array( 'type' => 'boolean', - 'default' => true, + 'default' => false, ), 'showDownload' => array( 'type' => 'boolean', @@ -189,7 +189,7 @@ private function prepare_block_render_data( $attributes ) { 'extracted_dir' => get_post_meta( $attachment_id, '_exelearning_extracted', true ), 'has_preview' => get_post_meta( $attachment_id, '_exelearning_has_preview', true ), 'height' => isset( $attributes['height'] ) ? absint( $attributes['height'] ) : 600, - 'teacher_mode_visible' => ! isset( $attributes['teacherModeVisible'] ) || (bool) $attributes['teacherModeVisible'], + 'teacher_mode_visible' => isset( $attributes['teacherModeVisible'] ) && (bool) $attributes['teacherModeVisible'], 'show_download' => isset( $attributes['showDownload'] ) && (bool) $attributes['showDownload'], 'download_formats' => isset( $attributes['downloadFormats'] ) ? ExeLearning_Download_Formats::sanitize( $attributes['downloadFormats'] ) @@ -220,7 +220,17 @@ private function maybe_render_download_button( $data ) { * @return string Escaped preview URL. */ private function build_preview_url( $data ) { - return esc_url( ExeLearning_Content_Proxy::get_proxy_url( $data['extracted_dir'] ) ); + $url = ExeLearning_Content_Proxy::get_proxy_url( $data['extracted_dir'] ); + + // eXeLearning core hides teacher-only content by default and exposes an in-page + // "teacher layer" selector via ?exe-teacher=1 (shown but off until the viewer + // turns it on). No host-side CSS/JS injection is needed — opt in by carrying the + // parameter on the iframe src when this block should offer the selector. + if ( ! empty( $data['teacher_mode_visible'] ) ) { + $url .= ( false === strpos( $url, '?' ) ? '?' : '&' ) . 'exe-teacher=1'; + } + + return esc_url( $url ); } /** @@ -287,25 +297,6 @@ private function render_block_preview( $data, $download_html ) { esc_attr( get_the_title( $data['attachment_id'] ) ) ); - if ( ! $data['teacher_mode_visible'] ) { - $html .= $this->teacher_mode_hide_script( $data['container_id'] ); - } - return $html; } - - /** - * Inline script that hides the teacher-mode toggler inside the preview - * iframe. The iframe is same-origin, so we inject a small stylesheet into - * its document on load. - * - * @param string $container_id Wrapper element id. - * @return string Script HTML. - */ - private function teacher_mode_hide_script( $container_id ) { - return sprintf( - '', - esc_js( $container_id ) - ); - } } diff --git a/languages/exelearning-ca-4cf813b039eac98ce62f176afa8fc8fe.json b/languages/exelearning-ca-4cf813b039eac98ce62f176afa8fc8fe.json index d1df3b1..6c6262d 100644 --- a/languages/exelearning-ca-4cf813b039eac98ce62f176afa8fc8fe.json +++ b/languages/exelearning-ca-4cf813b039eac98ce62f176afa8fc8fe.json @@ -43,8 +43,11 @@ "This is an eXeLearning v2 source file. The content will be displayed on the frontend if exported HTML is available.": [ "Aquest \u00e9s un fitxer font d'eXeLearning v2. El contingut es mostrar\u00e0 al frontend si hi ha HTML exportat disponible." ], - "Show Teacher Mode toggler": [ - "Mostra el commutador de Mode Professor" + "Show teacher layer selector": [ + "Mostrar el selector de capa docent" + ], + "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content.": [ + "Si es desactiva, el selector de capa docent s'ocultar\u00e0 al contingut eXeLearning incrustat." ], "More download formats": [ "M\u00e9s formats de baixada" diff --git a/languages/exelearning-ca.mo b/languages/exelearning-ca.mo index be66f39..51a3084 100644 Binary files a/languages/exelearning-ca.mo and b/languages/exelearning-ca.mo differ diff --git a/languages/exelearning-ca.po b/languages/exelearning-ca.po index 6b8edc9..8fcc41e 100644 --- a/languages/exelearning-ca.po +++ b/languages/exelearning-ca.po @@ -393,8 +393,8 @@ msgid "File copy appears truncated." msgstr "La còpia del fitxer sembla estar truncada." #: assets/js/elp-upload.js:413 -msgid "Show Teacher Mode toggler" -msgstr "Mostra el commutador de Mode Professor" +msgid "Show teacher layer selector" +msgstr "Mostrar el selector de capa docent" #: includes/class-exelearning-editor.php:179 #: includes/class-exelearning-editor.php:212 @@ -652,12 +652,13 @@ msgid "Height of the preview, in pixels." msgstr "Alçada de la previsualització, en píxels." #: admin/class-admin-settings.php:125 -msgid "When enabled, the content loads with teacher mode active." -msgstr "Quan s'activa, el contingut es carrega amb el mode docent actiu." +msgid "When enabled, the teacher layer selector is offered so viewers can reveal teacher content." +msgstr "Quan s'activa, s'ofereix el selector de capa docent perquè qui el vegi pugui mostrar el contingut docent." #: admin/class-admin-settings.php:130 -msgid "Whether the teacher-mode toggle button is shown." -msgstr "Si es mostra el botó per commutar el mode docent." +#: assets/js/elp-upload.js:414 +msgid "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content." +msgstr "Si es desactiva, el selector de capa docent s'ocultarà al contingut eXeLearning incrustat." #: admin/class-admin-settings.php:135 msgid "When enabled, shows a multi-format download button." diff --git a/languages/exelearning-ca_valencia-4cf813b039eac98ce62f176afa8fc8fe.json b/languages/exelearning-ca_valencia-4cf813b039eac98ce62f176afa8fc8fe.json index efe3822..9bcbd8d 100644 --- a/languages/exelearning-ca_valencia-4cf813b039eac98ce62f176afa8fc8fe.json +++ b/languages/exelearning-ca_valencia-4cf813b039eac98ce62f176afa8fc8fe.json @@ -43,8 +43,11 @@ "This is an eXeLearning v2 source file. The content will be displayed on the frontend if exported HTML is available.": [ "Este \u00e9s un fitxer font d'eXeLearning v2. El contingut es mostrar\u00e0 en el frontend si hi ha HTML exportat disponible." ], - "Show Teacher Mode toggler": [ - "Mostrar el commutador de Mode Professor" + "Show teacher layer selector": [ + "Mostrar el selector de capa docent" + ], + "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content.": [ + "Si es desactiva, el selector de capa docent s'ocultar\u00e0 al contingut eXeLearning incrustat." ], "More download formats": [ "M\u00e9s formats de baixada" diff --git a/languages/exelearning-ca_valencia.mo b/languages/exelearning-ca_valencia.mo index 20ab3ec..1d89c86 100644 Binary files a/languages/exelearning-ca_valencia.mo and b/languages/exelearning-ca_valencia.mo differ diff --git a/languages/exelearning-ca_valencia.po b/languages/exelearning-ca_valencia.po index 249cd1d..deb0073 100644 --- a/languages/exelearning-ca_valencia.po +++ b/languages/exelearning-ca_valencia.po @@ -393,8 +393,8 @@ msgid "File copy appears truncated." msgstr "La còpia del fitxer pareix estar truncada." #: assets/js/elp-upload.js:413 -msgid "Show Teacher Mode toggler" -msgstr "Mostrar el commutador de Mode Professor" +msgid "Show teacher layer selector" +msgstr "Mostrar el selector de capa docent" #: includes/class-exelearning-editor.php:179 #: includes/class-exelearning-editor.php:212 @@ -652,12 +652,13 @@ msgid "Height of the preview, in pixels." msgstr "Alçada de la previsualització, en píxels." #: admin/class-admin-settings.php:125 -msgid "When enabled, the content loads with teacher mode active." -msgstr "Quan s'activa, el contingut es carrega amb el mode docent actiu." +msgid "When enabled, the teacher layer selector is offered so viewers can reveal teacher content." +msgstr "Quan s'activa, s'ofereix el selector de capa docent perquè qui el veja puga mostrar el contingut docent." #: admin/class-admin-settings.php:130 -msgid "Whether the teacher-mode toggle button is shown." -msgstr "Si es mostra el botó per commutar el mode docent." +#: assets/js/elp-upload.js:414 +msgid "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content." +msgstr "Si es desactiva, el selector de capa docent s'ocultarà al contingut eXeLearning incrustat." #: admin/class-admin-settings.php:135 msgid "When enabled, shows a multi-format download button." diff --git a/languages/exelearning-de_DE-4cf813b039eac98ce62f176afa8fc8fe.json b/languages/exelearning-de_DE-4cf813b039eac98ce62f176afa8fc8fe.json index b88c90c..38e1faa 100644 --- a/languages/exelearning-de_DE-4cf813b039eac98ce62f176afa8fc8fe.json +++ b/languages/exelearning-de_DE-4cf813b039eac98ce62f176afa8fc8fe.json @@ -43,8 +43,11 @@ "This is an eXeLearning v2 source file. The content will be displayed on the frontend if exported HTML is available.": [ "Dies ist eine eXeLearning v2-Quelldatei. Der Inhalt wird im Frontend angezeigt, wenn exportiertes HTML verf\u00fcgbar ist." ], - "Show Teacher Mode toggler": [ - "Umschalter f\u00fcr Lehrermodus anzeigen" + "Show teacher layer selector": [ + "Lehrerebenen-Auswahl anzeigen" + ], + "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content.": [ + "Wenn deaktiviert, wird die Lehrerebenen-Auswahl im eingebetteten eXeLearning-Inhalt ausgeblendet." ], "More download formats": [ "Weitere Download-Formate" diff --git a/languages/exelearning-de_DE.mo b/languages/exelearning-de_DE.mo index 36913fe..fd16002 100644 Binary files a/languages/exelearning-de_DE.mo and b/languages/exelearning-de_DE.mo differ diff --git a/languages/exelearning-de_DE.po b/languages/exelearning-de_DE.po index e221a1b..9c9efe8 100644 --- a/languages/exelearning-de_DE.po +++ b/languages/exelearning-de_DE.po @@ -393,8 +393,8 @@ msgid "File copy appears truncated." msgstr "Die Dateikopie scheint abgeschnitten zu sein." #: assets/js/elp-upload.js:413 -msgid "Show Teacher Mode toggler" -msgstr "Umschalter für Lehrermodus anzeigen" +msgid "Show teacher layer selector" +msgstr "Lehrerebenen-Auswahl anzeigen" #: includes/class-exelearning-editor.php:179 #: includes/class-exelearning-editor.php:212 @@ -652,12 +652,13 @@ msgid "Height of the preview, in pixels." msgstr "Höhe der Vorschau in Pixeln." #: admin/class-admin-settings.php:125 -msgid "When enabled, the content loads with teacher mode active." -msgstr "Wenn aktiviert, wird der Inhalt mit aktivem Lehrermodus geladen." +msgid "When enabled, the teacher layer selector is offered so viewers can reveal teacher content." +msgstr "Wenn aktiviert, wird die Lehrerebenen-Auswahl angeboten, damit Betrachter Lehrinhalte einblenden können." #: admin/class-admin-settings.php:130 -msgid "Whether the teacher-mode toggle button is shown." -msgstr "Legt fest, ob die Umschaltfläche für den Lehrermodus angezeigt wird." +#: assets/js/elp-upload.js:414 +msgid "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content." +msgstr "Wenn deaktiviert, wird die Lehrerebenen-Auswahl im eingebetteten eXeLearning-Inhalt ausgeblendet." #: admin/class-admin-settings.php:135 msgid "When enabled, shows a multi-format download button." diff --git a/languages/exelearning-eo-4cf813b039eac98ce62f176afa8fc8fe.json b/languages/exelearning-eo-4cf813b039eac98ce62f176afa8fc8fe.json index d11377b..bfaaeba 100644 --- a/languages/exelearning-eo-4cf813b039eac98ce62f176afa8fc8fe.json +++ b/languages/exelearning-eo-4cf813b039eac98ce62f176afa8fc8fe.json @@ -43,8 +43,11 @@ "This is an eXeLearning v2 source file. The content will be displayed on the frontend if exported HTML is available.": [ "\u0108i tio estas eXeLearning v2 fontdosiero. La enhavo estos montrata en la fasado se eksportita HTML estas disponebla." ], - "Show Teacher Mode toggler": [ - "Montri la \u015daltilon de Instruista Re\u011dimo" + "Show teacher layer selector": [ + "Montri la elekton de instruista tavolo" + ], + "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content.": [ + "Se mal\u015daltita, la elekto de instruista tavolo estas ka\u015dita en la enkorpigita eXeLearning-enhavo." ], "More download formats": [ "Pliaj el\u015dutformatoj" diff --git a/languages/exelearning-eo.mo b/languages/exelearning-eo.mo index 2eb3203..c989fcd 100644 Binary files a/languages/exelearning-eo.mo and b/languages/exelearning-eo.mo differ diff --git a/languages/exelearning-eo.po b/languages/exelearning-eo.po index 82dbb9e..2eebdfe 100644 --- a/languages/exelearning-eo.po +++ b/languages/exelearning-eo.po @@ -393,8 +393,8 @@ msgid "File copy appears truncated." msgstr "La dosiera kopio ŝajnas esti trunkita." #: assets/js/elp-upload.js:413 -msgid "Show Teacher Mode toggler" -msgstr "Montri la ŝaltilon de Instruista Reĝimo" +msgid "Show teacher layer selector" +msgstr "Montri la elekton de instruista tavolo" #: includes/class-exelearning-editor.php:179 #: includes/class-exelearning-editor.php:212 @@ -652,12 +652,13 @@ msgid "Height of the preview, in pixels." msgstr "Alteco de la antaŭrigardo, en bilderoj." #: admin/class-admin-settings.php:125 -msgid "When enabled, the content loads with teacher mode active." -msgstr "Kiam ŝaltita, la enhavo ŝargiĝas kun la instruista reĝimo aktiva." +msgid "When enabled, the teacher layer selector is offered so viewers can reveal teacher content." +msgstr "Kiam ŝaltita, la elekto de instruista tavolo estas proponata por ke spektantoj povu malkaŝi instruistan enhavon." #: admin/class-admin-settings.php:130 -msgid "Whether the teacher-mode toggle button is shown." -msgstr "Ĉu la ŝaltbutono de la instruista reĝimo estas montrata." +#: assets/js/elp-upload.js:414 +msgid "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content." +msgstr "Se malŝaltita, la elekto de instruista tavolo estas kaŝita en la enkorpigita eXeLearning-enhavo." #: admin/class-admin-settings.php:135 msgid "When enabled, shows a multi-format download button." diff --git a/languages/exelearning-es_ES-4cf813b039eac98ce62f176afa8fc8fe.json b/languages/exelearning-es_ES-4cf813b039eac98ce62f176afa8fc8fe.json index cf446d4..e9cb5ea 100644 --- a/languages/exelearning-es_ES-4cf813b039eac98ce62f176afa8fc8fe.json +++ b/languages/exelearning-es_ES-4cf813b039eac98ce62f176afa8fc8fe.json @@ -46,8 +46,8 @@ "Height (px)": [ "Altura (px)" ], - "Show Teacher Mode toggler": [ - "Mostrar el conmutador de Modo Docente" + "Show teacher layer selector": [ + "Mostrar el selector de capa docente" ], "Download options": [ "Opciones de descarga" @@ -67,6 +67,9 @@ "This is an eXeLearning v2 source file. The content will be displayed on the frontend if exported HTML is available.": [ "Este es un archivo fuente de eXeLearning v2. El contenido se mostrar\u00e1 en el frontend si hay HTML exportado disponible." ], + "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content.": [ + "Si se desactiva, se ocultar\u00e1 el selector de capa docente en el contenido eXeLearning embebido." + ], "Web (_web.zip)": [ "Web (_web.zip)" ], diff --git a/languages/exelearning-es_ES.mo b/languages/exelearning-es_ES.mo index 3bab426..1b693e3 100644 Binary files a/languages/exelearning-es_ES.mo and b/languages/exelearning-es_ES.mo differ diff --git a/languages/exelearning-es_ES.po b/languages/exelearning-es_ES.po index a76667a..3650f9f 100644 --- a/languages/exelearning-es_ES.po +++ b/languages/exelearning-es_ES.po @@ -890,8 +890,8 @@ msgid "Height (px)" msgstr "Altura (px)" #: assets/js/elp-upload.js:413 -msgid "Show Teacher Mode toggler" -msgstr "Mostrar el conmutador de Modo Docente" +msgid "Show teacher layer selector" +msgstr "Mostrar el selector de capa docente" #: assets/js/elp-upload.js:425 msgid "Download options" @@ -958,12 +958,13 @@ msgid "Height of the preview, in pixels." msgstr "Altura de la previsualización, en píxeles." #: admin/class-admin-settings.php:125 -msgid "When enabled, the content loads with teacher mode active." -msgstr "Cuando se activa, el contenido se carga con el modo docente activo." +msgid "When enabled, the teacher layer selector is offered so viewers can reveal teacher content." +msgstr "Cuando se activa, se ofrece el selector de capa docente para que quien lo vea pueda mostrar el contenido docente." #: admin/class-admin-settings.php:130 -msgid "Whether the teacher-mode toggle button is shown." -msgstr "Si se muestra el botón para conmutar el modo docente." +#: assets/js/elp-upload.js:414 +msgid "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content." +msgstr "Si se desactiva, se ocultará el selector de capa docente en el contenido eXeLearning embebido." #: admin/class-admin-settings.php:135 msgid "When enabled, shows a multi-format download button." diff --git a/languages/exelearning-eu-4cf813b039eac98ce62f176afa8fc8fe.json b/languages/exelearning-eu-4cf813b039eac98ce62f176afa8fc8fe.json index 4a494e8..dc65694 100644 --- a/languages/exelearning-eu-4cf813b039eac98ce62f176afa8fc8fe.json +++ b/languages/exelearning-eu-4cf813b039eac98ce62f176afa8fc8fe.json @@ -43,8 +43,11 @@ "This is an eXeLearning v2 source file. The content will be displayed on the frontend if exported HTML is available.": [ "Hau eXeLearning v2 iturburu fitxategia da. Edukia frontend-ean bistaratuko da esportatutako HTML eskuragarri badago." ], - "Show Teacher Mode toggler": [ - "Erakutsi Irakasle Moduaren txandakatzailea" + "Show teacher layer selector": [ + "Erakutsi irakasle-geruza hautatzailea" + ], + "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content.": [ + "Desaktibatuta badago, irakasle-geruza hautatzailea ezkutatuko da eXeLearning eduki txertatuan." ], "More download formats": [ "Deskarga-formatu gehiago" diff --git a/languages/exelearning-eu.mo b/languages/exelearning-eu.mo index fa088ac..16012f4 100644 Binary files a/languages/exelearning-eu.mo and b/languages/exelearning-eu.mo differ diff --git a/languages/exelearning-eu.po b/languages/exelearning-eu.po index 2279471..0221dad 100644 --- a/languages/exelearning-eu.po +++ b/languages/exelearning-eu.po @@ -393,8 +393,8 @@ msgid "File copy appears truncated." msgstr "Fitxategiaren kopia moztuta dagoela dirudi." #: assets/js/elp-upload.js:413 -msgid "Show Teacher Mode toggler" -msgstr "Erakutsi Irakasle Moduaren txandakatzailea" +msgid "Show teacher layer selector" +msgstr "Erakutsi irakasle-geruza hautatzailea" #: includes/class-exelearning-editor.php:179 #: includes/class-exelearning-editor.php:212 @@ -652,12 +652,13 @@ msgid "Height of the preview, in pixels." msgstr "Aurrebistaren altuera, pixeletan." #: admin/class-admin-settings.php:125 -msgid "When enabled, the content loads with teacher mode active." -msgstr "Gaituta dagoenean, edukia irakasle modua aktibatuta kargatzen da." +msgid "When enabled, the teacher layer selector is offered so viewers can reveal teacher content." +msgstr "Aktibatzen denean, irakasle-geruza hautatzailea eskaintzen da ikusleek irakasle-edukia ager dezaten." #: admin/class-admin-settings.php:130 -msgid "Whether the teacher-mode toggle button is shown." -msgstr "Irakasle moduaren txandakatze-botoia erakusten den ala ez." +#: assets/js/elp-upload.js:414 +msgid "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content." +msgstr "Desaktibatuta badago, irakasle-geruza hautatzailea ezkutatuko da eXeLearning eduki txertatuan." #: admin/class-admin-settings.php:135 msgid "When enabled, shows a multi-format download button." diff --git a/languages/exelearning-gl_ES-4cf813b039eac98ce62f176afa8fc8fe.json b/languages/exelearning-gl_ES-4cf813b039eac98ce62f176afa8fc8fe.json index bd8a632..c8765a2 100644 --- a/languages/exelearning-gl_ES-4cf813b039eac98ce62f176afa8fc8fe.json +++ b/languages/exelearning-gl_ES-4cf813b039eac98ce62f176afa8fc8fe.json @@ -43,8 +43,11 @@ "This is an eXeLearning v2 source file. The content will be displayed on the frontend if exported HTML is available.": [ "Este \u00e9 un ficheiro fonte de eXeLearning v2. O contido mostrarase no frontend se hai HTML exportado dispo\u00f1ible." ], - "Show Teacher Mode toggler": [ - "Mostrar o conmutador de Modo Profesor" + "Show teacher layer selector": [ + "Amosar o selector de capa docente" + ], + "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content.": [ + "Se se desactiva, ocultarase o selector de capa docente no contido eXeLearning embebido." ], "More download formats": [ "M\u00e1is formatos de descarga" diff --git a/languages/exelearning-gl_ES.mo b/languages/exelearning-gl_ES.mo index b7178af..32f83e7 100644 Binary files a/languages/exelearning-gl_ES.mo and b/languages/exelearning-gl_ES.mo differ diff --git a/languages/exelearning-gl_ES.po b/languages/exelearning-gl_ES.po index 128776d..d998c55 100644 --- a/languages/exelearning-gl_ES.po +++ b/languages/exelearning-gl_ES.po @@ -393,8 +393,8 @@ msgid "File copy appears truncated." msgstr "A copia do ficheiro parece estar truncada." #: assets/js/elp-upload.js:413 -msgid "Show Teacher Mode toggler" -msgstr "Mostrar o conmutador de Modo Profesor" +msgid "Show teacher layer selector" +msgstr "Amosar o selector de capa docente" #: includes/class-exelearning-editor.php:179 #: includes/class-exelearning-editor.php:212 @@ -652,12 +652,13 @@ msgid "Height of the preview, in pixels." msgstr "Altura da vista previa, en píxeles." #: admin/class-admin-settings.php:125 -msgid "When enabled, the content loads with teacher mode active." -msgstr "Cando se activa, o contido cárgase co modo docente activo." +msgid "When enabled, the teacher layer selector is offered so viewers can reveal teacher content." +msgstr "Cando se activa, ofrécese o selector de capa docente para que quen o vexa poida amosar o contido docente." #: admin/class-admin-settings.php:130 -msgid "Whether the teacher-mode toggle button is shown." -msgstr "Se se amosa o botón para conmutar o modo docente." +#: assets/js/elp-upload.js:414 +msgid "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content." +msgstr "Se se desactiva, ocultarase o selector de capa docente no contido eXeLearning embebido." #: admin/class-admin-settings.php:135 msgid "When enabled, shows a multi-format download button." diff --git a/languages/exelearning-it_IT-4cf813b039eac98ce62f176afa8fc8fe.json b/languages/exelearning-it_IT-4cf813b039eac98ce62f176afa8fc8fe.json index 24c74bb..2c7cd85 100644 --- a/languages/exelearning-it_IT-4cf813b039eac98ce62f176afa8fc8fe.json +++ b/languages/exelearning-it_IT-4cf813b039eac98ce62f176afa8fc8fe.json @@ -43,8 +43,11 @@ "This is an eXeLearning v2 source file. The content will be displayed on the frontend if exported HTML is available.": [ "Questo \u00e8 un file sorgente eXeLearning v2. Il contenuto sar\u00e0 visualizzato nel frontend se \u00e8 disponibile l'HTML esportato." ], - "Show Teacher Mode toggler": [ - "Mostra il commutatore Modalit\u00e0 Docente" + "Show teacher layer selector": [ + "Mostra il selettore del livello docente" + ], + "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content.": [ + "Se disattivato, il selettore del livello docente \u00e8 nascosto nel contenuto eXeLearning incorporato." ], "More download formats": [ "Altri formati di download" diff --git a/languages/exelearning-it_IT.mo b/languages/exelearning-it_IT.mo index fdd7d1c..16f0af3 100644 Binary files a/languages/exelearning-it_IT.mo and b/languages/exelearning-it_IT.mo differ diff --git a/languages/exelearning-it_IT.po b/languages/exelearning-it_IT.po index 6626e91..9b9092b 100644 --- a/languages/exelearning-it_IT.po +++ b/languages/exelearning-it_IT.po @@ -393,8 +393,8 @@ msgid "File copy appears truncated." msgstr "La copia del file sembra essere troncata." #: assets/js/elp-upload.js:413 -msgid "Show Teacher Mode toggler" -msgstr "Mostra il commutatore Modalità Docente" +msgid "Show teacher layer selector" +msgstr "Mostra il selettore del livello docente" #: includes/class-exelearning-editor.php:179 #: includes/class-exelearning-editor.php:212 @@ -652,12 +652,13 @@ msgid "Height of the preview, in pixels." msgstr "Altezza dell'anteprima, in pixel." #: admin/class-admin-settings.php:125 -msgid "When enabled, the content loads with teacher mode active." -msgstr "Se attivato, il contenuto viene caricato con la modalità docente attiva." +msgid "When enabled, the teacher layer selector is offered so viewers can reveal teacher content." +msgstr "Se attivato, viene offerto il selettore del livello docente così gli spettatori possono mostrare i contenuti per docenti." #: admin/class-admin-settings.php:130 -msgid "Whether the teacher-mode toggle button is shown." -msgstr "Indica se viene mostrato il pulsante di attivazione della modalità docente." +#: assets/js/elp-upload.js:414 +msgid "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content." +msgstr "Se disattivato, il selettore del livello docente è nascosto nel contenuto eXeLearning incorporato." #: admin/class-admin-settings.php:135 msgid "When enabled, shows a multi-format download button." diff --git a/languages/exelearning-pt_PT-4cf813b039eac98ce62f176afa8fc8fe.json b/languages/exelearning-pt_PT-4cf813b039eac98ce62f176afa8fc8fe.json index b6965fd..74e7886 100644 --- a/languages/exelearning-pt_PT-4cf813b039eac98ce62f176afa8fc8fe.json +++ b/languages/exelearning-pt_PT-4cf813b039eac98ce62f176afa8fc8fe.json @@ -43,8 +43,11 @@ "This is an eXeLearning v2 source file. The content will be displayed on the frontend if exported HTML is available.": [ "Este \u00e9 um ficheiro fonte eXeLearning v2. O conte\u00fado ser\u00e1 apresentado no frontend se houver HTML exportado dispon\u00edvel." ], - "Show Teacher Mode toggler": [ - "Mostrar o comutador do Modo Professor" + "Show teacher layer selector": [ + "Mostrar o seletor de camada docente" + ], + "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content.": [ + "Se desativado, o seletor de camada docente fica oculto no conte\u00fado eXeLearning incorporado." ], "More download formats": [ "Mais formatos de transfer\u00eancia" diff --git a/languages/exelearning-pt_PT.mo b/languages/exelearning-pt_PT.mo index 176e497..e9a1810 100644 Binary files a/languages/exelearning-pt_PT.mo and b/languages/exelearning-pt_PT.mo differ diff --git a/languages/exelearning-pt_PT.po b/languages/exelearning-pt_PT.po index 1b9d8be..4fd2ace 100644 --- a/languages/exelearning-pt_PT.po +++ b/languages/exelearning-pt_PT.po @@ -393,8 +393,8 @@ msgid "File copy appears truncated." msgstr "A cópia do ficheiro parece estar truncada." #: assets/js/elp-upload.js:413 -msgid "Show Teacher Mode toggler" -msgstr "Mostrar o comutador do Modo Professor" +msgid "Show teacher layer selector" +msgstr "Mostrar o seletor de camada docente" #: includes/class-exelearning-editor.php:179 #: includes/class-exelearning-editor.php:212 @@ -652,12 +652,13 @@ msgid "Height of the preview, in pixels." msgstr "Altura da pré-visualização, em pixels." #: admin/class-admin-settings.php:125 -msgid "When enabled, the content loads with teacher mode active." -msgstr "Quando ativado, o conteúdo carrega com o modo professor ativo." +msgid "When enabled, the teacher layer selector is offered so viewers can reveal teacher content." +msgstr "Quando ativado, o seletor de camada docente é disponibilizado para que os visitantes possam revelar o conteúdo para docentes." #: admin/class-admin-settings.php:130 -msgid "Whether the teacher-mode toggle button is shown." -msgstr "Define se o botão de alternância do modo professor é mostrado." +#: assets/js/elp-upload.js:414 +msgid "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content." +msgstr "Se desativado, o seletor de camada docente fica oculto no conteúdo eXeLearning incorporado." #: admin/class-admin-settings.php:135 msgid "When enabled, shows a multi-format download button." diff --git a/languages/exelearning-ro_RO-4cf813b039eac98ce62f176afa8fc8fe.json b/languages/exelearning-ro_RO-4cf813b039eac98ce62f176afa8fc8fe.json index 7665876..7144eb7 100644 --- a/languages/exelearning-ro_RO-4cf813b039eac98ce62f176afa8fc8fe.json +++ b/languages/exelearning-ro_RO-4cf813b039eac98ce62f176afa8fc8fe.json @@ -43,8 +43,11 @@ "This is an eXeLearning v2 source file. The content will be displayed on the frontend if exported HTML is available.": [ "Acesta este un fi\u0219ier surs\u0103 eXeLearning v2. Con\u021binutul va fi afi\u0219at \u00een frontend dac\u0103 HTML-ul exportat este disponibil." ], - "Show Teacher Mode toggler": [ - "Afi\u0219eaz\u0103 comutatorul Mod Profesor" + "Show teacher layer selector": [ + "Afi\u0219eaz\u0103 selectorul stratului pentru profesori" + ], + "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content.": [ + "Dac\u0103 este dezactivat, selectorul stratului pentru profesori este ascuns \u00een con\u021binutul eXeLearning \u00eencorporat." ], "More download formats": [ "Mai multe formate de desc\u0103rcare" diff --git a/languages/exelearning-ro_RO.mo b/languages/exelearning-ro_RO.mo index bb01541..99776f9 100644 Binary files a/languages/exelearning-ro_RO.mo and b/languages/exelearning-ro_RO.mo differ diff --git a/languages/exelearning-ro_RO.po b/languages/exelearning-ro_RO.po index e5bfbe8..a0b33da 100644 --- a/languages/exelearning-ro_RO.po +++ b/languages/exelearning-ro_RO.po @@ -394,8 +394,8 @@ msgid "File copy appears truncated." msgstr "Copia fișierului pare a fi trunchiată." #: assets/js/elp-upload.js:413 -msgid "Show Teacher Mode toggler" -msgstr "Afișează comutatorul Mod Profesor" +msgid "Show teacher layer selector" +msgstr "Afișează selectorul stratului pentru profesori" #: includes/class-exelearning-editor.php:179 #: includes/class-exelearning-editor.php:212 @@ -656,12 +656,13 @@ msgid "Height of the preview, in pixels." msgstr "Înălțimea previzualizării, în pixeli." #: admin/class-admin-settings.php:125 -msgid "When enabled, the content loads with teacher mode active." -msgstr "Când este activat, conținutul se încarcă cu modul profesor activ." +msgid "When enabled, the teacher layer selector is offered so viewers can reveal teacher content." +msgstr "Când este activat, selectorul stratului pentru profesori este oferit pentru ca vizitatorii să poată afișa conținutul pentru profesori." #: admin/class-admin-settings.php:130 -msgid "Whether the teacher-mode toggle button is shown." -msgstr "Dacă este afișat butonul de comutare a modului profesor." +#: assets/js/elp-upload.js:414 +msgid "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content." +msgstr "Dacă este dezactivat, selectorul stratului pentru profesori este ascuns în conținutul eXeLearning încorporat." #: admin/class-admin-settings.php:135 msgid "When enabled, shows a multi-format download button." diff --git a/languages/exelearning.pot b/languages/exelearning.pot index 929c2e6..7381a5a 100644 --- a/languages/exelearning.pot +++ b/languages/exelearning.pot @@ -89,11 +89,12 @@ msgid "Height of the preview, in pixels." msgstr "" #: admin/class-admin-settings.php:125 -msgid "When enabled, the content loads with teacher mode active." +msgid "When enabled, the teacher layer selector is offered so viewers can reveal teacher content." msgstr "" #: admin/class-admin-settings.php:130 -msgid "Whether the teacher-mode toggle button is shown." +#: assets/js/elp-upload.js:414 +msgid "If disabled, the teacher layer selector is hidden in the embedded eXeLearning content." msgstr "" #: admin/class-admin-settings.php:135 @@ -997,7 +998,7 @@ msgid "Height (px)" msgstr "" #: assets/js/elp-upload.js:413 -msgid "Show Teacher Mode toggler" +msgid "Show teacher layer selector" msgstr "" #: assets/js/elp-upload.js:425 diff --git a/public/class-shortcodes.php b/public/class-shortcodes.php index e58d1f6..ddba178 100644 --- a/public/class-shortcodes.php +++ b/public/class-shortcodes.php @@ -43,7 +43,7 @@ public function display_exelearning( $atts, $content = null ) { // phpcs:ignore 'id' => 0, 'height' => 600, 'teacher_mode' => '0', - 'teacher_mode_visible' => '1', + 'teacher_mode_visible' => '0', 'show_download' => '0', 'download_formats' => '', 'screenshot' => 'no', @@ -313,6 +313,17 @@ private function render_preview( $title, $preview_url, $height, $file_url, $teac $unique_id = 'exelearning-' . wp_unique_id(); $is_poster = '' !== $poster_url; + // Teacher-mode visibility is owned by eXeLearning core: exported packages hide + // teacher-only content by default and expose an in-page "teacher layer" selector + // through ?exe-teacher=1 (the selector appears but stays off until the viewer + // turns it on). No host-side CSS/JS injection is needed — we carry the request on + // the iframe src whenever this embed should offer the selector. The legacy + // teacher_mode attribute (activate-on-load) folds into the same opt-in, since + // core deliberately no longer auto-reveals from the URL. + if ( $teacher_mode_visible || $teacher_mode ) { + $preview_url .= ( false === strpos( $preview_url, '?' ) ? '?' : '&' ) . 'exe-teacher=1'; + } + $fallback_download = sprintf( ' @@ -379,24 +390,23 @@ class="exelearning-iframe" esc_attr__( 'View fullscreen', 'exelearning' ), $poster_html, $iframe_html, - $this->render_preview_script( $unique_id, $teacher_mode_visible, $teacher_mode, $is_poster ) + $this->render_preview_script( $unique_id, $is_poster ) ); } /** * Build the inline behavior script for a preview iframe. * - * Optional behaviors (poster click-to-load, hiding the teacher-mode toggler, - * activating teacher mode) are only emitted when requested, so the rendered - * markup stays minimal when they are not in use. + * Teacher-mode visibility is handled by eXeLearning core through the + * ?exe-teacher=1 query parameter on the iframe src, so no host-side CSS/JS + * injection is emitted here. The script only wires the optional poster + * click-to-load behavior. * - * @param string $unique_id Container element ID. - * @param bool $teacher_mode_visible Whether the teacher-mode toggler stays visible. - * @param bool $teacher_mode Whether teacher mode should be activated on load. - * @param bool $is_poster Whether the iframe loads lazily from a poster. + * @param string $unique_id Container element ID. + * @param bool $is_poster Whether the iframe loads lazily from a poster. * @return string Inline