mirror of
https://github.com/WenPai-org/lelms-copyright.git
synced 2025-08-03 04:08:45 +08:00
升级至1.1.5 稳定版本
添加了访客模式、自定义水印文本、自定义文章类型、权限管理等
This commit is contained in:
parent
aef5b25392
commit
ee72143cbb
5 changed files with 902 additions and 156 deletions
Binary file not shown.
|
@ -1,141 +1,321 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: LeLMS Copyright\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-03-08 12:18+0800\n"
|
||||
"PO-Revision-Date: 2025-03-08 04:37+0000\n"
|
||||
"POT-Creation-Date: 2025-04-06 21:57+0800\n"
|
||||
"PO-Revision-Date: 2025-04-06 21:58+0800\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: 简体中文\n"
|
||||
"Language-Team: \n"
|
||||
"Language: zh_CN\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Generator: Poedit 3.6\n"
|
||||
"X-Poedit-Basepath: ..\n"
|
||||
"X-Poedit-Flags-xgettext: --add-comments=translators:\n"
|
||||
"X-Poedit-WPHeader: lelms-copyright.php\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
|
||||
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
|
||||
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
||||
"X-Loco-Version: 2.6.11; wp-6.7.2\n"
|
||||
"X-Poedit-KeywordsList: "
|
||||
"__;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
||||
"X-Poedit-SearchPath-0: .\n"
|
||||
"X-Poedit-SearchPathExcluded-0: *.min.js\n"
|
||||
"X-Poedit-SearchPathExcluded-1: lib/plugin-update-checker/vendor\n"
|
||||
|
||||
#. Description of the plugin
|
||||
msgid "Adds watermark with username and prevents unauthorized screenshots"
|
||||
msgstr "添加用户名水印并防止未经授权的截图和录屏"
|
||||
#: lelms-copyright.php:65
|
||||
msgid "LeLMS Copyright Settings"
|
||||
msgstr "LeLMS 版权设置"
|
||||
|
||||
#: lelms-copyright.php:146
|
||||
msgid "Block printing of the page to protect your content."
|
||||
msgstr "阻止打印页面以保护您的内容。"
|
||||
|
||||
#: lelms-copyright.php:131
|
||||
msgid "Choose the color of the watermark text."
|
||||
msgstr "选择水印文本的颜色。"
|
||||
|
||||
#: lelms-copyright.php:53
|
||||
#: lelms-copyright.php:66
|
||||
msgid "Copyright"
|
||||
msgstr "版权"
|
||||
|
||||
#: lelms-copyright.php:75
|
||||
#: lelms-copyright.php:78 lelms-copyright.php:394
|
||||
msgid "Watermark Settings"
|
||||
msgstr "水印设置"
|
||||
|
||||
#: lelms-copyright.php:85 lelms-copyright.php:395
|
||||
msgid "Advanced Settings"
|
||||
msgstr "高级设置"
|
||||
|
||||
#: lelms-copyright.php:95
|
||||
msgid ""
|
||||
"Customize the watermark appearance and protection settings to secure your "
|
||||
"content."
|
||||
msgstr "自定义水印外观和保护设置以保护您的内容。"
|
||||
|
||||
#: lelms-copyright.php:121
|
||||
msgid "Define the font size of the watermark text in pixels."
|
||||
msgstr "以像素为单位定义水印文本的字体大小。"
|
||||
|
||||
#: lelms-copyright.php:151
|
||||
msgid "Disable copying of text and right-click menus outside of form fields."
|
||||
msgstr "禁用表单字段外的文本和右键菜单的复制。"
|
||||
|
||||
#: lelms-copyright.php:149
|
||||
msgid "Enable Copy Protection"
|
||||
msgstr "启用复制保护"
|
||||
|
||||
#: lelms-copyright.php:139
|
||||
msgid "Enable DevTools Protection"
|
||||
msgstr "启用 DevTools 保护"
|
||||
|
||||
#: lelms-copyright.php:144
|
||||
msgid "Enable Print Protection"
|
||||
msgstr "启用打印保护"
|
||||
|
||||
#. Author URI of the plugin
|
||||
msgid "https://lelms.com"
|
||||
msgstr "https://lelms.com"
|
||||
|
||||
#. URI of the plugin
|
||||
msgid "https://wenpai.org/plugins/lelms-copyright"
|
||||
msgstr "https://wenpai.org/plugins/lelms-copyright"
|
||||
|
||||
#. Name of the plugin
|
||||
msgid "LeLMS Copyright"
|
||||
msgstr "LeLMS 版权"
|
||||
|
||||
#: lelms-copyright.php:52 lelms-copyright.php:207
|
||||
msgid "LeLMS Copyright Settings"
|
||||
msgstr "LeLMS 版权设置"
|
||||
|
||||
#. Author of the plugin
|
||||
msgid "LeLMS.com"
|
||||
msgstr "乐尔达思"
|
||||
|
||||
#: lelms-copyright.php:141
|
||||
#: lelms-copyright.php:101
|
||||
msgid ""
|
||||
"Prevent users from opening browser developer tools (e.g., F12 or "
|
||||
"Ctrl+Shift+I)."
|
||||
msgstr "阻止用户打开浏览器开发人员工具(例如 F12 或 Ctrl+Shift+I)。"
|
||||
"Configure advanced options to exclude specific post types or user roles from "
|
||||
"watermark and protection."
|
||||
msgstr "配置高级选项以从水印和保护中排除特定的文章类型或用户角色。"
|
||||
|
||||
#: lelms-copyright.php:212
|
||||
msgid "Save Changes"
|
||||
msgstr "保存更改"
|
||||
#: lelms-copyright.php:188
|
||||
msgid "Watermark Opacity"
|
||||
msgstr "水印不透明度"
|
||||
|
||||
#: lelms-copyright.php:126
|
||||
msgid "Set the distance between each watermark in pixels."
|
||||
msgstr "设置每个水印之间的距离(以像素为单位)。"
|
||||
|
||||
#: lelms-copyright.php:136
|
||||
msgid ""
|
||||
"Set the rotation angle of the watermark text in degrees (e.g., -45 for "
|
||||
"diagonal)."
|
||||
msgstr "以度为单位设置水印文本的旋转角度(例如,对角线为 -45)。"
|
||||
|
||||
#: lelms-copyright.php:116
|
||||
#: lelms-copyright.php:191
|
||||
msgid ""
|
||||
"Set the transparency of the watermark (0 = fully transparent, 1 = fully "
|
||||
"opaque)."
|
||||
msgstr "设置水印的透明度(0 = 完全透明,1 = 完全不透明)。"
|
||||
|
||||
#: lelms-copyright.php:228
|
||||
msgid "This action is disabled on this site."
|
||||
msgstr "此操作在此站点上已被禁用。"
|
||||
|
||||
#: lelms-copyright.php:134
|
||||
msgid "Watermark Angle"
|
||||
msgstr "水印角度"
|
||||
|
||||
#: lelms-copyright.php:129
|
||||
msgid "Watermark Color"
|
||||
msgstr "水印颜色"
|
||||
|
||||
#: lelms-copyright.php:113
|
||||
msgid "Watermark Opacity"
|
||||
msgstr "水印不透明度"
|
||||
|
||||
#: lelms-copyright.php:65
|
||||
msgid "Watermark Settings"
|
||||
msgstr "水印设置"
|
||||
|
||||
#: lelms-copyright.php:119
|
||||
#: lelms-copyright.php:194
|
||||
msgid "Watermark Size (px)"
|
||||
msgstr "水印尺寸 (px)"
|
||||
|
||||
#: lelms-copyright.php:124
|
||||
#: lelms-copyright.php:196
|
||||
msgid "Define the font size of the watermark text in pixels."
|
||||
msgstr "以像素为单位定义水印文本的字体大小。"
|
||||
|
||||
#: lelms-copyright.php:199
|
||||
msgid "Watermark Spacing (px)"
|
||||
msgstr "水印间距 (px)"
|
||||
|
||||
#: lelms-copyright.php:201
|
||||
msgid "Set the distance between each watermark in pixels."
|
||||
msgstr "设置每个水印之间的距离(以像素为单位)。"
|
||||
|
||||
#: lelms-copyright.php:204
|
||||
msgid "Watermark Color"
|
||||
msgstr "水印颜色"
|
||||
|
||||
#: lelms-copyright.php:206
|
||||
msgid "Choose the color of the watermark text."
|
||||
msgstr "选择水印文本的颜色。"
|
||||
|
||||
#: lelms-copyright.php:209
|
||||
msgid "Watermark Angle"
|
||||
msgstr "水印角度"
|
||||
|
||||
#: lelms-copyright.php:211
|
||||
msgid ""
|
||||
"Set the rotation angle of the watermark text in degrees (e.g., -45 for "
|
||||
"diagonal)."
|
||||
msgstr "以度为单位设置水印文本的旋转角度(例如,对角线为 -45)。"
|
||||
|
||||
#: lelms-copyright.php:214
|
||||
msgid "Watermark Type"
|
||||
msgstr "水印类型"
|
||||
|
||||
#: lelms-copyright.php:216
|
||||
msgid ""
|
||||
"Choose the type of watermark to display for logged-in users (overridden by "
|
||||
"custom watermark if enabled)."
|
||||
msgstr ""
|
||||
"选择向登录用户显示的水印类型(如果勾选启用自定义水印,此设置将被覆盖)。"
|
||||
|
||||
#: lelms-copyright.php:218
|
||||
msgid "Username"
|
||||
msgstr "用户名"
|
||||
|
||||
#: lelms-copyright.php:219
|
||||
msgid "Nickname"
|
||||
msgstr "昵称"
|
||||
|
||||
#: lelms-copyright.php:220
|
||||
msgid "Email"
|
||||
msgstr "邮箱"
|
||||
|
||||
#: lelms-copyright.php:221
|
||||
msgid "Timestamp"
|
||||
msgstr "时间戳"
|
||||
|
||||
#: lelms-copyright.php:225
|
||||
msgid "Enable DevTools Protection"
|
||||
msgstr "启用 DevTools 保护"
|
||||
|
||||
#: lelms-copyright.php:227
|
||||
msgid ""
|
||||
"Prevent users from opening browser developer tools (e.g., F12 or "
|
||||
"Ctrl+Shift+I)."
|
||||
msgstr "阻止用户打开浏览器开发人员工具(例如 F12 或 Ctrl+Shift+I)。"
|
||||
|
||||
#: lelms-copyright.php:230
|
||||
msgid "Enable Print Protection"
|
||||
msgstr "启用打印保护"
|
||||
|
||||
#: lelms-copyright.php:232
|
||||
msgid "Block printing of the page to protect your content."
|
||||
msgstr "阻止打印页面以保护您的内容。"
|
||||
|
||||
#: lelms-copyright.php:235
|
||||
msgid "Enable Copy Protection"
|
||||
msgstr "启用复制保护"
|
||||
|
||||
#: lelms-copyright.php:237
|
||||
msgid "Disable copying of text and right-click menus outside of form fields."
|
||||
msgstr "禁用表单字段外的文本和右键菜单的复制。"
|
||||
|
||||
#: lelms-copyright.php:240
|
||||
msgid "Enable Guest Mode"
|
||||
msgstr "启用访客模式"
|
||||
|
||||
#: lelms-copyright.php:242
|
||||
msgid ""
|
||||
"Enable protection features for non-logged-in users. Additional options will "
|
||||
"appear when checked."
|
||||
msgstr "为未登录用户启用保护功能。选中后将显示附加选项。"
|
||||
|
||||
#: lelms-copyright.php:245
|
||||
msgid "Enable Protection Only for Guests"
|
||||
msgstr "为访客仅启用保护"
|
||||
|
||||
#: lelms-copyright.php:247
|
||||
msgid "Apply only protection features (no watermark) to non-logged-in users."
|
||||
msgstr "仅对未登录用户应用保护功能(无水印)。"
|
||||
|
||||
#: lelms-copyright.php:250
|
||||
msgid "Show Custom Watermark for Guests"
|
||||
msgstr "为访客显示自定义水印"
|
||||
|
||||
#: lelms-copyright.php:252
|
||||
msgid ""
|
||||
"Display the custom watermark text (defined below) for non-logged-in users."
|
||||
msgstr "为未登录的用户显示自定义水印文本(定义如下)。"
|
||||
|
||||
#: lelms-copyright.php:255
|
||||
msgid "Enable Custom Watermark"
|
||||
msgstr "启用自定义水印"
|
||||
|
||||
#: lelms-copyright.php:257
|
||||
msgid "Use a custom watermark text instead of the selected watermark type."
|
||||
msgstr "使用自定义水印文本代替选定的水印类型。"
|
||||
|
||||
#: lelms-copyright.php:260
|
||||
msgid "Custom Watermark Text"
|
||||
msgstr "自定义水印文本"
|
||||
|
||||
#: lelms-copyright.php:262
|
||||
msgid ""
|
||||
"Enter custom watermark text (applies if \"Enable Custom Watermark\" or "
|
||||
"\"Show Custom Watermark for Guests\" is checked). If empty, \"LeLMS "
|
||||
"Copyright\" will be used."
|
||||
msgstr ""
|
||||
"输入自定义水印文本(如果勾选了“启用自定义水印”或“为访客显示自定义水印”,则适"
|
||||
"用)。留空,则将使用“LeLMS Copyright”。"
|
||||
|
||||
#: lelms-copyright.php:285
|
||||
msgid "Excluded Post Types"
|
||||
msgstr "排除的文章类型"
|
||||
|
||||
#: lelms-copyright.php:287
|
||||
msgid "Select post types where watermark and protection should not apply."
|
||||
msgstr "选择不适合使用水印和保护的文章类型。"
|
||||
|
||||
#: lelms-copyright.php:291
|
||||
msgid "Excluded User Roles"
|
||||
msgstr "排除的用户角色"
|
||||
|
||||
#: lelms-copyright.php:293
|
||||
msgid "Select user roles exempt from watermark and protection."
|
||||
msgstr "选择不受水印和保护的用户角色。"
|
||||
|
||||
#: lelms-copyright.php:331
|
||||
msgid "Guest (Not Logged In)"
|
||||
msgstr "访客(未登录)"
|
||||
|
||||
#: lelms-copyright.php:388
|
||||
#, php-format
|
||||
msgid "Version: %s"
|
||||
msgstr "版本:%s"
|
||||
|
||||
#: lelms-copyright.php:389
|
||||
msgid "Document"
|
||||
msgstr "文档"
|
||||
|
||||
#: lelms-copyright.php:390
|
||||
msgid "Support"
|
||||
msgstr "支持"
|
||||
|
||||
#: lelms-copyright.php:396
|
||||
msgid "About"
|
||||
msgstr "关于"
|
||||
|
||||
#: lelms-copyright.php:409
|
||||
msgid "How to Use LeLMS Copyright"
|
||||
msgstr "如何使用 LeLMS 版权"
|
||||
|
||||
#: lelms-copyright.php:410
|
||||
msgid ""
|
||||
"This plugin adds a watermark and protection features to your WordPress site. "
|
||||
"Here’s how to configure it:"
|
||||
msgstr "此插件可为您的 WordPress 网站添加水印和保护功能。配置方法如下:"
|
||||
|
||||
#: lelms-copyright.php:412
|
||||
msgid "Watermark Settings: Adjust opacity, size, spacing, color, and angle."
|
||||
msgstr "水印设置:调整不透明度、大小、间距、颜色和角度。"
|
||||
|
||||
#: lelms-copyright.php:413
|
||||
msgid ""
|
||||
"Protection Features: Enable options to block DevTools, printing, and copying."
|
||||
msgstr "保护功能:启用选项以阻止 DevTools、打印和复制。"
|
||||
|
||||
#: lelms-copyright.php:414
|
||||
msgid ""
|
||||
"Guest Mode: Enable protection and/or custom watermark for non-logged-in "
|
||||
"users."
|
||||
msgstr "访客模式:为未登录的用户启用保护和/或自定义水印。"
|
||||
|
||||
#: lelms-copyright.php:415
|
||||
msgid "Custom Watermark: Enable and set a custom text."
|
||||
msgstr "自定义水印:启用并设置自定义文本。"
|
||||
|
||||
#: lelms-copyright.php:419
|
||||
msgid "Save Changes"
|
||||
msgstr "保存更改"
|
||||
|
||||
#: lelms-copyright.php:420
|
||||
msgid "Reset to Defaults"
|
||||
msgstr "重置为默认"
|
||||
|
||||
#: lelms-copyright.php:495
|
||||
msgid "Are you sure you want to reset all settings to defaults?"
|
||||
msgstr "您确定要将所有设置重置为默认值吗?"
|
||||
|
||||
#: lelms-copyright.php:505
|
||||
msgid ""
|
||||
"Settings have been reset to defaults. Please refresh the page to see the "
|
||||
"changes."
|
||||
msgstr "设置已重置为默认值。请刷新页面以查看更改。"
|
||||
|
||||
#: lelms-copyright.php:508
|
||||
msgid "Failed to reset settings."
|
||||
msgstr "无法重置设置。"
|
||||
|
||||
#: lelms-copyright.php:512
|
||||
msgid "An error occurred while resetting settings."
|
||||
msgstr "重置设置时发生错误。"
|
||||
|
||||
#: lelms-copyright.php:573
|
||||
msgid "This action is disabled on this site."
|
||||
msgstr "此操作在此站点上已被禁用。"
|
||||
|
||||
#. Plugin Name of the plugin/theme
|
||||
msgid "LeLMS Copyright"
|
||||
msgstr "LeLMS 版权"
|
||||
|
||||
#. Plugin URI of the plugin/theme
|
||||
msgid "https://wenpai.org/plugins/lelms-copyright"
|
||||
msgstr "https://wenpai.org/plugins/lelms-copyright"
|
||||
|
||||
#. Description of the plugin/theme
|
||||
msgid "Adds watermark with username and prevents unauthorized screenshots"
|
||||
msgstr "添加用户名水印并防止未经授权的截图和录屏"
|
||||
|
||||
#. Author of the plugin/theme
|
||||
msgid "LeLMS.com"
|
||||
msgstr "乐尔达思"
|
||||
|
||||
#. Author URI of the plugin/theme
|
||||
msgid "https://lelms.com"
|
||||
msgstr "https://lelms.com"
|
||||
|
||||
#~ msgid "Advanced"
|
||||
#~ msgstr "高级"
|
||||
|
||||
#~ msgid "For support, visit"
|
||||
#~ msgstr "如需支持,请访问"
|
||||
|
||||
#~ msgid "Help"
|
||||
#~ msgstr "帮助"
|
||||
|
||||
#~ msgid "Settings"
|
||||
#~ msgstr "设置"
|
||||
|
|
|
@ -3,7 +3,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: LeLMS Copyright\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-03-08 04:47+0000\n"
|
||||
"POT-Creation-Date: 2025-04-06 13:13+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: \n"
|
||||
|
@ -20,44 +20,156 @@ msgstr ""
|
|||
msgid "Adds watermark with username and prevents unauthorized screenshots"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:146
|
||||
#: lelms-copyright.php:395
|
||||
msgid "Advanced"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:85
|
||||
msgid "Advanced Settings"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:513
|
||||
msgid "An error occurred while resetting settings."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:247
|
||||
msgid "Apply only protection features (no watermark) to non-logged-in users."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:496
|
||||
msgid "Are you sure you want to reset all settings to defaults?"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:232
|
||||
msgid "Block printing of the page to protect your content."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:131
|
||||
#: lelms-copyright.php:206
|
||||
msgid "Choose the color of the watermark text."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:53
|
||||
#: lelms-copyright.php:216
|
||||
msgid ""
|
||||
"Choose the type of watermark to display for logged-in users (overridden by "
|
||||
"custom watermark if enabled)."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:101
|
||||
msgid ""
|
||||
"Configure advanced options to exclude specific post types or user roles from "
|
||||
"watermark and protection."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:66
|
||||
msgid "Copyright"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:75
|
||||
#: lelms-copyright.php:260
|
||||
msgid "Custom Watermark Text"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:415
|
||||
msgid "Custom Watermark: Enable and set a custom text."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:95
|
||||
msgid ""
|
||||
"Customize the watermark appearance and protection settings to secure your "
|
||||
"content."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:121
|
||||
#: lelms-copyright.php:196
|
||||
msgid "Define the font size of the watermark text in pixels."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:151
|
||||
#: lelms-copyright.php:237
|
||||
msgid "Disable copying of text and right-click menus outside of form fields."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:149
|
||||
#: lelms-copyright.php:252
|
||||
msgid ""
|
||||
"Display the custom watermark text (defined below) for non-logged-in users."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:389
|
||||
msgid "Document"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:220
|
||||
msgid "Email"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:235
|
||||
msgid "Enable Copy Protection"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:139
|
||||
#: lelms-copyright.php:255
|
||||
msgid "Enable Custom Watermark"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:225
|
||||
msgid "Enable DevTools Protection"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:144
|
||||
#: lelms-copyright.php:240
|
||||
msgid "Enable for Guests"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:230
|
||||
msgid "Enable Print Protection"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:242
|
||||
msgid ""
|
||||
"Enable protection features for non-logged-in users. Additional options will "
|
||||
"appear when checked."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:245
|
||||
msgid "Enable Protection Only for Guests"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:262
|
||||
msgid ""
|
||||
"Enter custom watermark text (applies if \"Enable Custom Watermark\" or "
|
||||
"\"Show Custom Watermark for Guests\" is checked). If empty, \"Custom "
|
||||
"Watermark\" will be used."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:285
|
||||
msgid "Excluded Post Types"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:291
|
||||
msgid "Excluded User Roles"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:509
|
||||
msgid "Failed to reset settings."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:417
|
||||
msgid "For support, visit"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:331
|
||||
msgid "Guest (Not Logged In)"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:414
|
||||
msgid ""
|
||||
"Guest Mode: Enable protection and/or custom watermark for non-logged-in "
|
||||
"users."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:396
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:409
|
||||
msgid "How to Use LeLMS Copyright"
|
||||
msgstr ""
|
||||
|
||||
#. Author URI of the plugin
|
||||
msgid "https://lelms.com"
|
||||
msgstr ""
|
||||
|
@ -70,7 +182,7 @@ msgstr ""
|
|||
msgid "LeLMS Copyright"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:52 lelms-copyright.php:207
|
||||
#: lelms-copyright.php:65
|
||||
msgid "LeLMS Copyright Settings"
|
||||
msgstr ""
|
||||
|
||||
|
@ -78,56 +190,126 @@ msgstr ""
|
|||
msgid "LeLMS.com"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:141
|
||||
#: lelms-copyright.php:219
|
||||
msgid "Nickname"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:227
|
||||
msgid ""
|
||||
"Prevent users from opening browser developer tools (e.g., F12 or "
|
||||
"Ctrl+Shift+I)."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:212
|
||||
#: lelms-copyright.php:413
|
||||
msgid ""
|
||||
"Protection Features: Enable options to block DevTools, printing, and copying."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:421
|
||||
msgid "Reset to Defaults"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:420
|
||||
msgid "Save Changes"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:126
|
||||
#: lelms-copyright.php:287
|
||||
msgid "Select post types where watermark and protection should not apply."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:293
|
||||
msgid "Select user roles exempt from watermark and protection."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:201
|
||||
msgid "Set the distance between each watermark in pixels."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:136
|
||||
#: lelms-copyright.php:211
|
||||
msgid ""
|
||||
"Set the rotation angle of the watermark text in degrees (e.g., -45 for "
|
||||
"diagonal)."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:116
|
||||
#: lelms-copyright.php:191
|
||||
msgid ""
|
||||
"Set the transparency of the watermark (0 = fully transparent, 1 = fully "
|
||||
"opaque)."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:228
|
||||
#: lelms-copyright.php:394
|
||||
msgid "Settings"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:506
|
||||
msgid ""
|
||||
"Settings have been reset to defaults. Please refresh the page to see the "
|
||||
"changes."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:250
|
||||
msgid "Show Custom Watermark for Guests"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:390
|
||||
msgid "Support"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:576
|
||||
msgid "This action is disabled on this site."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:134
|
||||
#: lelms-copyright.php:410
|
||||
msgid ""
|
||||
"This plugin adds a watermark and protection features to your WordPress site. "
|
||||
"Here’s how to configure it:"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:221
|
||||
msgid "Timestamp"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:257
|
||||
msgid "Use a custom watermark text instead of the selected watermark type."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:218
|
||||
msgid "Username"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:388
|
||||
#, php-format
|
||||
msgid "Version: %s"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:209
|
||||
msgid "Watermark Angle"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:129
|
||||
#: lelms-copyright.php:204
|
||||
msgid "Watermark Color"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:113
|
||||
#: lelms-copyright.php:188
|
||||
msgid "Watermark Opacity"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:65
|
||||
#: lelms-copyright.php:78
|
||||
msgid "Watermark Settings"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:119
|
||||
#: lelms-copyright.php:412
|
||||
msgid "Watermark Settings: Adjust opacity, size, spacing, color, and angle."
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:194
|
||||
msgid "Watermark Size (px)"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:124
|
||||
#: lelms-copyright.php:199
|
||||
msgid "Watermark Spacing (px)"
|
||||
msgstr ""
|
||||
|
||||
#: lelms-copyright.php:214
|
||||
msgid "Watermark Type"
|
||||
msgstr ""
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Plugin Name: LeLMS Copyright
|
||||
* Plugin URI: https://wenpai.org/plugins/lelms-copyright
|
||||
* Description: Adds watermark with username and prevents unauthorized screenshots
|
||||
* Version: 1.1.1
|
||||
* Version: 1.1.5
|
||||
* Author: LeLMS.com
|
||||
* Author URI: https://lelms.com
|
||||
* License: GPL v2 or later
|
||||
|
@ -14,11 +14,15 @@
|
|||
* Domain Path: /languages
|
||||
*/
|
||||
|
||||
// Prevent direct access
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
define('LELMS_COPYRIGHT_VERSION', '1.1.5');
|
||||
define('LELMS_COPYRIGHT_DIR_URL', plugin_dir_url(__FILE__));
|
||||
define('LELMS_COPYRIGHT_DIR_PATH', plugin_dir_path(__FILE__));
|
||||
define('LELMS_COPYRIGHT_BASENAME', plugin_basename(__FILE__));
|
||||
|
||||
class LELMS_Copyright {
|
||||
private $options;
|
||||
|
||||
|
@ -33,7 +37,15 @@ class LELMS_Copyright {
|
|||
'watermark_angle' => -45,
|
||||
'enable_devtools_protection' => 'yes',
|
||||
'enable_print_protection' => 'yes',
|
||||
'enable_copy_protection' => 'yes'
|
||||
'enable_copy_protection' => 'yes',
|
||||
'enable_for_guests' => 'no',
|
||||
'enable_guest_protection_only' => 'no',
|
||||
'enable_guest_custom_watermark' => 'no',
|
||||
'enable_custom_watermark' => 'no',
|
||||
'custom_watermark_text' => '',
|
||||
'watermark_type' => 'username',
|
||||
'excluded_post_types' => array(),
|
||||
'excluded_roles' => array(),
|
||||
);
|
||||
$this->options = wp_parse_args(get_option('lelms_copyright_options', array()), $defaults);
|
||||
|
||||
|
@ -45,6 +57,7 @@ class LELMS_Copyright {
|
|||
}
|
||||
add_action('admin_menu', array($this, 'add_admin_menu'));
|
||||
add_action('admin_init', array($this, 'register_settings'));
|
||||
add_action('wp_ajax_lelms_reset_options', array($this, 'reset_options'));
|
||||
}
|
||||
|
||||
public function add_admin_menu() {
|
||||
|
@ -67,6 +80,13 @@ class LELMS_Copyright {
|
|||
'lelms-copyright'
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
'lelms_copyright_advanced_section',
|
||||
__('Advanced Settings', 'lelms-copyright'),
|
||||
array($this, 'advanced_section_description'),
|
||||
'lelms-copyright-advanced'
|
||||
);
|
||||
|
||||
$this->add_settings_fields();
|
||||
}
|
||||
|
||||
|
@ -76,6 +96,12 @@ class LELMS_Copyright {
|
|||
echo '</p>';
|
||||
}
|
||||
|
||||
public function advanced_section_description() {
|
||||
echo '<p>';
|
||||
esc_html_e('Configure advanced options to exclude specific post types or user roles from watermark and protection.', 'lelms-copyright');
|
||||
echo '</p>';
|
||||
}
|
||||
|
||||
public function sanitize_options($input) {
|
||||
$sanitized = array();
|
||||
$defaults = array(
|
||||
|
@ -86,7 +112,15 @@ class LELMS_Copyright {
|
|||
'watermark_angle' => -45,
|
||||
'enable_devtools_protection' => 'yes',
|
||||
'enable_print_protection' => 'yes',
|
||||
'enable_copy_protection' => 'yes'
|
||||
'enable_copy_protection' => 'yes',
|
||||
'enable_for_guests' => 'no',
|
||||
'enable_guest_protection_only' => 'no',
|
||||
'enable_guest_custom_watermark' => 'no',
|
||||
'enable_custom_watermark' => 'no',
|
||||
'custom_watermark_text' => '',
|
||||
'watermark_type' => 'username',
|
||||
'excluded_post_types' => array(),
|
||||
'excluded_roles' => array(),
|
||||
);
|
||||
|
||||
$sanitized['watermark_opacity'] = min(max(floatval($input['watermark_opacity']), 0), 1);
|
||||
|
@ -97,12 +131,53 @@ class LELMS_Copyright {
|
|||
$sanitized['enable_devtools_protection'] = isset($input['enable_devtools_protection']) ? 'yes' : 'no';
|
||||
$sanitized['enable_print_protection'] = isset($input['enable_print_protection']) ? 'yes' : 'no';
|
||||
$sanitized['enable_copy_protection'] = isset($input['enable_copy_protection']) ? 'yes' : 'no';
|
||||
$sanitized['enable_for_guests'] = isset($input['enable_for_guests']) ? 'yes' : 'no';
|
||||
$sanitized['enable_guest_protection_only'] = isset($input['enable_guest_protection_only']) ? 'yes' : 'no';
|
||||
$sanitized['enable_guest_custom_watermark'] = isset($input['enable_guest_custom_watermark']) ? 'yes' : 'no';
|
||||
$sanitized['enable_custom_watermark'] = isset($input['enable_custom_watermark']) ? 'yes' : 'no';
|
||||
$sanitized['custom_watermark_text'] = sanitize_text_field($input['custom_watermark_text']);
|
||||
$sanitized['watermark_type'] = in_array($input['watermark_type'], ['username', 'nickname', 'email', 'timestamp']) ? $input['watermark_type'] : 'username';
|
||||
$sanitized['excluded_post_types'] = array_map('sanitize_key', (array) $input['excluded_post_types']);
|
||||
$sanitized['excluded_roles'] = array_map('sanitize_key', (array) $input['excluded_roles']);
|
||||
|
||||
return wp_parse_args($sanitized, $defaults);
|
||||
}
|
||||
|
||||
public function should_apply_protection() {
|
||||
$enable_for_guests = $this->options['enable_for_guests'] === 'yes';
|
||||
if (!is_user_logged_in() && !$enable_for_guests) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$user = wp_get_current_user();
|
||||
$user_roles = $user && $user->roles ? $user->roles : array('guest');
|
||||
if (array_intersect($user_roles, (array) $this->options['excluded_roles'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$post_type = get_post_type() ?: 'page';
|
||||
if (in_array($post_type, (array) $this->options['excluded_post_types'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function should_apply_watermark() {
|
||||
if (!$this->should_apply_protection()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$is_guest = !is_user_logged_in();
|
||||
if ($is_guest) {
|
||||
return $this->options['enable_for_guests'] === 'yes' && $this->options['enable_guest_custom_watermark'] === 'yes';
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public function add_watermark_container() {
|
||||
if (is_user_logged_in()) {
|
||||
if ($this->should_apply_watermark()) {
|
||||
echo '<div id="lelms-watermark"></div>';
|
||||
}
|
||||
}
|
||||
|
@ -135,6 +210,17 @@ class LELMS_Copyright {
|
|||
'type' => 'number',
|
||||
'description' => __('Set the rotation angle of the watermark text in degrees (e.g., -45 for diagonal).', 'lelms-copyright')
|
||||
),
|
||||
'watermark_type' => array(
|
||||
'title' => __('Watermark Type', 'lelms-copyright'),
|
||||
'type' => 'select',
|
||||
'description' => __('Choose the type of watermark to display for logged-in users (overridden by custom watermark if enabled).', 'lelms-copyright'),
|
||||
'options' => array(
|
||||
'username' => __('Username', 'lelms-copyright'),
|
||||
'nickname' => __('Nickname', 'lelms-copyright'),
|
||||
'email' => __('Email', 'lelms-copyright'),
|
||||
'timestamp' => __('Timestamp', 'lelms-copyright'),
|
||||
),
|
||||
),
|
||||
'enable_devtools_protection' => array(
|
||||
'title' => __('Enable DevTools Protection', 'lelms-copyright'),
|
||||
'type' => 'checkbox',
|
||||
|
@ -149,7 +235,32 @@ class LELMS_Copyright {
|
|||
'title' => __('Enable Copy Protection', 'lelms-copyright'),
|
||||
'type' => 'checkbox',
|
||||
'description' => __('Disable copying of text and right-click menus outside of form fields.', 'lelms-copyright')
|
||||
)
|
||||
),
|
||||
'enable_for_guests' => array(
|
||||
'title' => __('Enable Guest Mode', 'lelms-copyright'),
|
||||
'type' => 'checkbox',
|
||||
'description' => __('Enable protection features for non-logged-in users. Additional options will appear when checked.', 'lelms-copyright')
|
||||
),
|
||||
'enable_guest_protection_only' => array(
|
||||
'title' => __('Enable Protection Only for Guests', 'lelms-copyright'),
|
||||
'type' => 'checkbox',
|
||||
'description' => __('Apply only protection features (no watermark) to non-logged-in users.', 'lelms-copyright')
|
||||
),
|
||||
'enable_guest_custom_watermark' => array(
|
||||
'title' => __('Show Custom Watermark for Guests', 'lelms-copyright'),
|
||||
'type' => 'checkbox',
|
||||
'description' => __('Display the custom watermark text (defined below) for non-logged-in users.', 'lelms-copyright')
|
||||
),
|
||||
'enable_custom_watermark' => array(
|
||||
'title' => __('Enable Custom Watermark', 'lelms-copyright'),
|
||||
'type' => 'checkbox',
|
||||
'description' => __('Use a custom watermark text instead of the selected watermark type.', 'lelms-copyright')
|
||||
),
|
||||
'custom_watermark_text' => array(
|
||||
'title' => __('Custom Watermark Text', 'lelms-copyright'),
|
||||
'type' => 'text',
|
||||
'description' => __('Enter custom watermark text (applies if "Enable Custom Watermark" or "Show Custom Watermark for Guests" is checked). If empty, "LeLMS Copyright" will be used.', 'lelms-copyright')
|
||||
),
|
||||
);
|
||||
|
||||
foreach ($fields as $key => $field) {
|
||||
|
@ -163,18 +274,71 @@ class LELMS_Copyright {
|
|||
'key' => $key,
|
||||
'type' => $field['type'],
|
||||
'attrs' => isset($field['attrs']) ? $field['attrs'] : '',
|
||||
'description' => $field['description'] // Pass the description to the callback
|
||||
'description' => $field['description'],
|
||||
'options' => isset($field['options']) ? $field['options'] : array(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$advanced_fields = array(
|
||||
'excluded_post_types' => array(
|
||||
'title' => __('Excluded Post Types', 'lelms-copyright'),
|
||||
'type' => 'checkbox_group',
|
||||
'description' => __('Select post types where watermark and protection should not apply.', 'lelms-copyright'),
|
||||
'options' => $this->get_public_post_types(),
|
||||
),
|
||||
'excluded_roles' => array(
|
||||
'title' => __('Excluded User Roles', 'lelms-copyright'),
|
||||
'type' => 'checkbox_group',
|
||||
'description' => __('Select user roles exempt from watermark and protection.', 'lelms-copyright'),
|
||||
'options' => $this->get_user_roles(),
|
||||
),
|
||||
);
|
||||
|
||||
foreach ($advanced_fields as $key => $field) {
|
||||
add_settings_field(
|
||||
$key,
|
||||
$field['title'],
|
||||
array($this, 'render_field'),
|
||||
'lelms-copyright-advanced',
|
||||
'lelms_copyright_advanced_section',
|
||||
array(
|
||||
'key' => $key,
|
||||
'type' => $field['type'],
|
||||
'description' => $field['description'],
|
||||
'options' => $field['options'],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private function get_public_post_types() {
|
||||
$post_types = get_post_types(array('public' => true), 'objects');
|
||||
$options = array();
|
||||
foreach ($post_types as $post_type) {
|
||||
$options[$post_type->name] = $post_type->label;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
private function get_user_roles() {
|
||||
global $wp_roles;
|
||||
$roles = $wp_roles->roles;
|
||||
$options = array();
|
||||
foreach ($roles as $role => $details) {
|
||||
$options[$role] = $details['name'];
|
||||
}
|
||||
$options['guest'] = __('Guest (Not Logged In)', 'lelms-copyright');
|
||||
return $options;
|
||||
}
|
||||
|
||||
public function render_field($args) {
|
||||
$key = $args['key'];
|
||||
$type = $args['type'];
|
||||
$value = isset($this->options[$key]) ? $this->options[$key] : '';
|
||||
$value = $this->options[$key];
|
||||
$attrs = isset($args['attrs']) ? $args['attrs'] : '';
|
||||
$description = isset($args['description']) ? $args['description'] : '';
|
||||
$options = isset($args['options']) ? $args['options'] : array();
|
||||
|
||||
if ($type === 'checkbox') {
|
||||
printf(
|
||||
|
@ -183,6 +347,23 @@ class LELMS_Copyright {
|
|||
$attrs,
|
||||
checked($value, 'yes', false)
|
||||
);
|
||||
} elseif ($type === 'select') {
|
||||
printf('<select name="lelms_copyright_options[%s]" %s>', esc_attr($key), $attrs);
|
||||
foreach ($options as $opt_value => $opt_label) {
|
||||
printf('<option value="%s" %s>%s</option>', esc_attr($opt_value), selected($value, $opt_value, false), esc_html($opt_label));
|
||||
}
|
||||
echo '</select>';
|
||||
} elseif ($type === 'checkbox_group') {
|
||||
$value = (array) $value;
|
||||
foreach ($options as $opt_value => $opt_label) {
|
||||
printf(
|
||||
'<label><input type="checkbox" name="lelms_copyright_options[%s][]" value="%s" %s> %s</label><br>',
|
||||
esc_attr($key),
|
||||
esc_attr($opt_value),
|
||||
checked(in_array($opt_value, $value), true, false),
|
||||
esc_html($opt_label)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
printf(
|
||||
'<input type="%s" name="lelms_copyright_options[%s]" value="%s" %s>',
|
||||
|
@ -193,10 +374,9 @@ class LELMS_Copyright {
|
|||
);
|
||||
}
|
||||
|
||||
// Output the description below the field
|
||||
if ($description) {
|
||||
echo '<p class="description">';
|
||||
echo esc_html($description); // Use esc_html to safely output the translated description
|
||||
echo esc_html($description);
|
||||
echo '</p>';
|
||||
}
|
||||
}
|
||||
|
@ -204,36 +384,240 @@ class LELMS_Copyright {
|
|||
public function options_page() {
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h1><?php esc_html_e('LeLMS Copyright Settings', 'lelms-copyright'); ?></h1>
|
||||
<h1><?php echo esc_html(get_admin_page_title()); ?>
|
||||
<span style="font-size: 13px; padding-left: 10px;"><?php printf(esc_html__('Version: %s', 'lelms-copyright'), esc_html(LELMS_COPYRIGHT_VERSION)); ?></span>
|
||||
<a href="https://sharecms.com/document/lelms-copyright" target="_blank" class="button button-secondary" style="margin-left: 10px;"><?php esc_html_e('Document', 'lelms-copyright'); ?></a>
|
||||
<a href="https://sharecms.com/forums/" target="_blank" class="button button-secondary"><?php esc_html_e('Support', 'lelms-copyright'); ?></a>
|
||||
</h1>
|
||||
<div class="card">
|
||||
<h2 class="nav-tab-wrapper">
|
||||
<a href="#settings" class="nav-tab nav-tab-active"><?php esc_html_e('Watermark Settings', 'lelms-copyright'); ?></a>
|
||||
<a href="#advanced" class="nav-tab"><?php esc_html_e('Advanced Settings', 'lelms-copyright'); ?></a>
|
||||
<a href="#about" class="nav-tab"><?php esc_html_e('About', 'lelms-copyright'); ?></a>
|
||||
</h2>
|
||||
|
||||
<form method="post" action="options.php">
|
||||
<?php
|
||||
settings_fields('lelms_copyright');
|
||||
do_settings_sections('lelms-copyright');
|
||||
submit_button(__('Save Changes', 'lelms-copyright'));
|
||||
?>
|
||||
</form>
|
||||
<?php settings_fields('lelms_copyright'); ?>
|
||||
<div id="lelms-tabs-content">
|
||||
<div id="settings-tab" class="lelms-tab-content">
|
||||
<?php do_settings_sections('lelms-copyright'); ?>
|
||||
</div>
|
||||
<div id="advanced-tab" class="lelms-tab-content" style="display: none;">
|
||||
<?php do_settings_sections('lelms-copyright-advanced'); ?>
|
||||
</div>
|
||||
<div id="about-tab" class="lelms-tab-content" style="display: none;">
|
||||
<h3><?php esc_html_e('How to Use LeLMS Copyright', 'lelms-copyright'); ?></h3>
|
||||
<p><?php esc_html_e('This plugin adds a watermark and protection features to your WordPress site. Here’s how to configure it:', 'lelms-copyright'); ?></p>
|
||||
<ul style="list-style: decimal; padding-left: 2em;">
|
||||
<li><?php esc_html_e('Watermark Settings: Adjust opacity, size, spacing, color, and angle.', 'lelms-copyright'); ?></li>
|
||||
<li><?php esc_html_e('Protection Features: Enable options to block DevTools, printing, and copying.', 'lelms-copyright'); ?></li>
|
||||
<li><?php esc_html_e('Guest Mode: Enable protection and/or custom watermark for non-logged-in users.', 'lelms-copyright'); ?></li>
|
||||
<li><?php esc_html_e('Custom Watermark: Enable and set a custom text.', 'lelms-copyright'); ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="submit-group">
|
||||
<?php submit_button(__('Save Changes', 'lelms-copyright'), 'primary'); ?>
|
||||
<button type="button" id="lelms-reset-defaults" class="button"><?php esc_html_e('Reset to Defaults', 'lelms-copyright'); ?></button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<style type="text/css">
|
||||
.nav-tab {
|
||||
border: 0px solid #c3c4c7;
|
||||
background: #ffffff;
|
||||
}
|
||||
.nav-tab.nav-tab-active {
|
||||
border-bottom: 2px solid #007cba;
|
||||
font-weight: 600;
|
||||
background: #f0f0f1;
|
||||
}
|
||||
.nav-tab:hover:not(.active) {
|
||||
background: #f0f0f1;
|
||||
border-bottom-color: #dcdcde;
|
||||
}
|
||||
.card {
|
||||
background: #fff;
|
||||
border: 1px solid #ccd0d4;
|
||||
border-radius: 4px;
|
||||
max-width: unset;
|
||||
margin-top: 20px;
|
||||
padding: 20px;
|
||||
}
|
||||
.submit-group {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
p.submit {
|
||||
padding-top: 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function($) {
|
||||
$(document).ready(function() {
|
||||
$('.nav-tab').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
var target = $(this).attr('href').substring(1);
|
||||
$('.nav-tab').removeClass('nav-tab-active');
|
||||
$(this).addClass('nav-tab-active');
|
||||
$('.lelms-tab-content').hide();
|
||||
$('#' + target + '-tab').show();
|
||||
});
|
||||
|
||||
var $enableForGuests = $('input[name="lelms_copyright_options[enable_for_guests]"]');
|
||||
var $guestProtectionOnly = $('input[name="lelms_copyright_options[enable_guest_protection_only]"]').closest('tr');
|
||||
var $guestCustomWatermark = $('input[name="lelms_copyright_options[enable_guest_custom_watermark]"]').closest('tr');
|
||||
var $enableCustomWatermark = $('input[name="lelms_copyright_options[enable_custom_watermark]"]');
|
||||
var $customTextField = $('input[name="lelms_copyright_options[custom_watermark_text]"]').closest('tr');
|
||||
|
||||
function updateGuestFieldsVisibility() {
|
||||
if ($enableForGuests.is(':checked')) {
|
||||
$guestProtectionOnly.show();
|
||||
$guestCustomWatermark.show();
|
||||
} else {
|
||||
$guestProtectionOnly.hide();
|
||||
$guestCustomWatermark.hide();
|
||||
}
|
||||
}
|
||||
|
||||
function updateCustomTextVisibility() {
|
||||
if ($enableCustomWatermark.is(':checked') || ($enableForGuests.is(':checked') && $('input[name="lelms_copyright_options[enable_guest_custom_watermark]"]').is(':checked'))) {
|
||||
$customTextField.show();
|
||||
} else {
|
||||
$customTextField.hide();
|
||||
}
|
||||
}
|
||||
|
||||
$enableForGuests.on('change', function() {
|
||||
updateGuestFieldsVisibility();
|
||||
updateCustomTextVisibility();
|
||||
});
|
||||
$enableCustomWatermark.on('change', updateCustomTextVisibility);
|
||||
$('input[name="lelms_copyright_options[enable_guest_custom_watermark]"]').on('change', updateCustomTextVisibility);
|
||||
|
||||
updateGuestFieldsVisibility();
|
||||
updateCustomTextVisibility();
|
||||
|
||||
$('#lelms-reset-defaults').on('click', function() {
|
||||
if (confirm('<?php esc_html_e('Are you sure you want to reset all settings to defaults?', 'lelms-copyright'); ?>')) {
|
||||
$.ajax({
|
||||
url: '<?php echo admin_url('admin-ajax.php'); ?>',
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'lelms_reset_options',
|
||||
nonce: '<?php echo wp_create_nonce('lelms_reset_nonce'); ?>'
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
alert('<?php esc_html_e('Settings have been reset to defaults. Please refresh the page to see the changes.', 'lelms-copyright'); ?>');
|
||||
location.reload();
|
||||
} else {
|
||||
alert('<?php esc_html_e('Failed to reset settings.', 'lelms-copyright'); ?>');
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
alert('<?php esc_html_e('An error occurred while resetting settings.', 'lelms-copyright'); ?>');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
public function enqueue_scripts() {
|
||||
if (is_user_logged_in()) {
|
||||
wp_enqueue_style('lelms-copyright', plugins_url('css/style.css', __FILE__), array(), '1.1.1');
|
||||
wp_enqueue_script('lelms-copyright', plugins_url('js/watermark.js', __FILE__), array('jquery'), '1.1.1', true);
|
||||
if ($this->should_apply_protection()) {
|
||||
$style_url = plugins_url('css/style.css', __FILE__);
|
||||
$script_url = plugins_url('js/watermark.js', __FILE__);
|
||||
|
||||
if (!file_exists(plugin_dir_path(__FILE__) . 'css/style.css')) {
|
||||
error_log('LeLMS Copyright: CSS file not found at ' . plugin_dir_path(__FILE__) . 'css/style.css');
|
||||
}
|
||||
if (!file_exists(plugin_dir_path(__FILE__) . 'js/watermark.js')) {
|
||||
error_log('LeLMS Copyright: JS file not found at ' . plugin_dir_path(__FILE__) . 'js/watermark.js');
|
||||
}
|
||||
|
||||
wp_enqueue_style('lelms-copyright', $style_url, array(), '1.1.5');
|
||||
wp_enqueue_script('lelms-copyright', $script_url, array('jquery'), '1.1.5', true);
|
||||
|
||||
$user = is_user_logged_in() ? wp_get_current_user() : null;
|
||||
$watermark_text = '';
|
||||
$is_guest = !is_user_logged_in();
|
||||
|
||||
if ($this->should_apply_watermark()) {
|
||||
if ($is_guest) {
|
||||
$watermark_text = !empty($this->options['custom_watermark_text']) ? $this->options['custom_watermark_text'] : 'LeLMS Copyright';
|
||||
} else {
|
||||
if ($this->options['enable_custom_watermark'] === 'yes') {
|
||||
$watermark_text = !empty($this->options['custom_watermark_text']) ? $this->options['custom_watermark_text'] : 'LeLMS Copyright';
|
||||
} else {
|
||||
switch ($this->options['watermark_type']) {
|
||||
case 'username':
|
||||
$watermark_text = $user ? '@' . $user->user_login : '';
|
||||
break;
|
||||
case 'nickname':
|
||||
$watermark_text = $user ? $user->display_name : '';
|
||||
break;
|
||||
case 'email':
|
||||
$watermark_text = $user ? $user->user_email : '';
|
||||
break;
|
||||
case 'timestamp':
|
||||
$watermark_text = current_time('Y-m-d H:i:s');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$current_user = wp_get_current_user();
|
||||
wp_localize_script('lelms-copyright', 'lelmsData', array(
|
||||
'username' => '@' . $current_user->user_login,
|
||||
'username' => $watermark_text,
|
||||
'options' => $this->options,
|
||||
'warningMessage' => __('This action is disabled on this site.', 'lelms-copyright')
|
||||
'warningMessage' => __('This action is disabled on this site.', 'lelms-copyright'),
|
||||
'isGuest' => $is_guest,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
public function reset_options() {
|
||||
check_ajax_referer('lelms_reset_nonce', 'nonce');
|
||||
if (!current_user_can('manage_options')) {
|
||||
wp_send_json_error('Permission denied');
|
||||
}
|
||||
|
||||
$defaults = array(
|
||||
'watermark_opacity' => 0.1,
|
||||
'watermark_size' => 20,
|
||||
'watermark_spacing' => 150,
|
||||
'watermark_color' => '#000000',
|
||||
'watermark_angle' => -45,
|
||||
'enable_devtools_protection' => 'yes',
|
||||
'enable_print_protection' => 'yes',
|
||||
'enable_copy_protection' => 'yes',
|
||||
'enable_for_guests' => 'no',
|
||||
'enable_guest_protection_only' => 'no',
|
||||
'enable_guest_custom_watermark' => 'no',
|
||||
'enable_custom_watermark' => 'no',
|
||||
'custom_watermark_text' => '',
|
||||
'watermark_type' => 'username',
|
||||
'excluded_post_types' => array(),
|
||||
'excluded_roles' => array(),
|
||||
);
|
||||
|
||||
update_option('lelms_copyright_options', $defaults);
|
||||
wp_send_json_success('Settings reset to defaults');
|
||||
}
|
||||
}
|
||||
|
||||
new LELMS_Copyright();
|
||||
|
||||
// Integrate UpdatePulse Server for updates using PUC v5.3
|
||||
require_once plugin_dir_path(__FILE__) . 'lib/plugin-update-checker/plugin-update-checker.php';
|
||||
use YahnisElsts\PluginUpdateChecker\v5p3\PucFactory;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue