├── README.md
├── assets
├── block.css
├── block.min.css
├── editor.css
├── editor.min.css
├── embed.css
├── embed.min.css
├── folder.svg
├── front.css
├── front.min.css
├── ui.css
├── ui.min.css
├── uploader.css
└── uploader.min.css
├── inc
├── avatars.php
├── classes
│ ├── class-mediatheque-admin.php
│ ├── class-mediatheque-rest-controller.php
│ └── class-mediatheque-settings.php
├── functions.php
├── hooks.php
├── media.php
├── options.php
├── settings.php
├── templates.php
├── upgrade.php
└── users.php
├── js
├── block.js
├── block.min.js
├── display.js
├── display.min.js
├── manage.js
├── manage.min.js
├── script.js
├── script.min.js
├── uploader.js
├── uploader.min.js
├── views.js
└── views.min.js
├── languages
├── mediatheque-en_US.mo
├── mediatheque-en_US.po
└── mediatheque.pot
├── mediatheque.php
└── templates
├── dirmaker.html
├── display.php
├── embed-user_media.php
├── feedback.html
├── field-item.html
├── progress.html
├── toolbar-item.html
├── uploader.html
├── user-media-trail.html
├── user-media.html
└── user.html
/README.md:
--------------------------------------------------------------------------------
1 | # MediaThèque
2 |
3 | This WP Plugin is no more supported and this repository is now archived.
4 |
--------------------------------------------------------------------------------
/assets/block.css:
--------------------------------------------------------------------------------
1 | /* Inside the Gutenberg block */
2 | div.editor-block-list__block[data-type='mediatheque/usermedia'] .editor-block-list__block-edit [data-block] {
3 | clear: both;
4 | overflow: hidden;
5 | }
6 |
7 | div.editor-block-list__block[data-type='mediatheque/usermedia'] .editor-block-list__block-edit [data-block] img,
8 | div.editor-block-list__block[data-type='mediatheque/usermedia'] .editor-block-list__block-edit [data-block] .wp-video-shortcode {
9 | display: block;
10 | }
11 |
12 | div.editor-block-list__block[data-type='mediatheque/usermedia'] .editor-block-list__block-edit [data-block] img.aligncenter,
13 | div.editor-block-list__block[data-type='mediatheque/usermedia'] .editor-block-list__block-edit [data-block] .wp-video-shortcode.aligncenter {
14 | margin: 0 auto;
15 | }
16 |
17 | div.editor-block-list__block[data-type='mediatheque/usermedia'] .editor-block-list__block-edit [data-block] .mediatheque-file-link img {
18 | margin-right: 1.5em;
19 | }
20 |
21 | div.editor-block-list__block[data-type='mediatheque/usermedia'] .editor-block-list__block-edit [data-block] dl {
22 | margin-top: 0;
23 | }
24 |
25 | div.editor-block-list__block[data-type='mediatheque/usermedia'] .editor-block-list__block-edit [data-block] .wp-video {
26 | width: 100%!important;
27 | }
28 |
29 | div.editor-block-list__block[data-type='mediatheque/usermedia'] .wp-block-embed.is-loading {
30 | background: none;
31 | }
32 |
--------------------------------------------------------------------------------
/assets/block.min.css:
--------------------------------------------------------------------------------
1 | div.editor-block-list__block[data-type='mediatheque/usermedia'] .editor-block-list__block-edit [data-block]{clear:both;overflow:hidden}div.editor-block-list__block[data-type='mediatheque/usermedia'] .editor-block-list__block-edit [data-block] .wp-video-shortcode,div.editor-block-list__block[data-type='mediatheque/usermedia'] .editor-block-list__block-edit [data-block] img{display:block}div.editor-block-list__block[data-type='mediatheque/usermedia'] .editor-block-list__block-edit [data-block] .wp-video-shortcode.aligncenter,div.editor-block-list__block[data-type='mediatheque/usermedia'] .editor-block-list__block-edit [data-block] img.aligncenter{margin:0 auto}div.editor-block-list__block[data-type='mediatheque/usermedia'] .editor-block-list__block-edit [data-block] .mediatheque-file-link img{margin-right:1.5em}div.editor-block-list__block[data-type='mediatheque/usermedia'] .editor-block-list__block-edit [data-block] dl{margin-top:0}div.editor-block-list__block[data-type='mediatheque/usermedia'] .editor-block-list__block-edit [data-block] .wp-video{width:100%!important}div.editor-block-list__block[data-type='mediatheque/usermedia'] .wp-block-embed.is-loading{background:0 0}
--------------------------------------------------------------------------------
/assets/editor.css:
--------------------------------------------------------------------------------
1 | /* Inside the WP Media Editor */
2 | .media-frame-content #mediatheque-container .wp-filter {
3 | margin-top: 0;
4 | border-top: none;
5 | border-left: none;
6 | border-right: none;
7 | width: 98%;
8 | }
9 |
10 | .media-frame-content #mediatheque-container #forms,
11 | .media-frame-content #mediatheque-container #media,
12 | .media-frame-content #mediatheque-container #trail {
13 | width: 95%;
14 | margin-right: auto;
15 | margin-left: auto;
16 | }
17 |
18 | .media-frame-content #mediatheque-container #media ul li.user-media {
19 | box-shadow: inset 0 0 15px rgba( 0, 0, 0, 0.1 ), inset 0 0 0 1px rgba( 0, 0, 0, 0.05 );
20 | background-color: #eee;
21 | background-image: none;
22 | cursor: pointer;
23 | }
24 |
25 | .media-frame-content #mediatheque-container #media ul li.user-media.dir .user-media-content {
26 | background-image: url( 'folder.svg' );
27 | background-size: 50%;
28 | background-repeat: no-repeat;
29 | background-position: center center;
30 | }
31 |
32 | .media-frame-content #mediatheque-container #media ul li.user-media div.user-media-content {
33 | min-height: 200px;
34 | }
35 |
36 | .media-frame-content #mediatheque-container #media ul li.user-media.selected {
37 | border: 8px inset #0073aa;
38 | outline: none;
39 | max-height: 184px;
40 | }
41 |
42 | .media-frame-content #mediatheque-container #media ul li.user-media.selected .user-media-content {
43 | min-width: 184px;
44 | min-height: 184px;
45 | }
46 |
47 | .media-frame.mediatheque-hide-menu .media-frame-title,
48 | .media-frame.mediatheque-hide-menu .media-frame-router,
49 | .media-frame.mediatheque-hide-menu .media-frame-toolbar,
50 | .media-frame.mediatheque-hide-menu .media-frame-content {
51 | left: 0;
52 | }
53 |
54 | .media-frame.mediatheque-hide-menu .media-frame-menu {
55 | display: none;
56 | }
57 |
58 | .media-frame .user-media-preferences .embed-media-settings {
59 | top: 0;
60 | }
61 |
62 | .media-frame .user-media-preferences .embed-media-settings .column-image,
63 | .media-frame .user-media-preferences .embed-media-settings .wp-video-holder,
64 | .media-frame .user-media-preferences .embed-audio-settings audio {
65 | float: right;
66 | margin-right: 1em;
67 | width: 48%;
68 | }
69 |
70 | .media-frame .user-media-preferences .embed-audio-settings audio,
71 | .media-frame #mediatheque-file-preferences .embed-media-settings {
72 | margin-top: 2em;
73 | }
74 |
75 | .media-frame .user-media-preferences .embed-media-settings .column-settings,
76 | .media-frame .user-media-preferences .embed-video-settings .setting-group,
77 | .media-frame .user-media-preferences .embed-video-settings .setting.align,
78 | .media-frame .user-media-preferences .embed-audio-settings .setting {
79 | float: left;
80 | margin-left: 1em;
81 | overflow: hidden;
82 | width: 48%;
83 | }
84 |
85 | .media-frame .user-media-preferences .embed-video-settings .setting.preload,
86 | .media-frame .user-media-preferences .embed-audio-settings .setting.preload {
87 | overflow: visible;
88 | }
89 |
90 | .media-frame .user-media-preferences .embed-media-settings .column-settings label,
91 | .media-modal .media-frame .user-media-preferences .embed-media-settings .column-settings .legend-inline {
92 | display: block;
93 | position: static;
94 | transform: inherit;
95 | margin: 0;
96 | line-height: 1.84615384;
97 | }
98 |
99 | .media-frame .user-media-preferences .embed-media-settings .column-image {
100 | margin-top: 2em;
101 | }
102 |
103 | .media-frame .user-media-preferences .media-embed .embed-video-settings .setting,
104 | .media-frame .user-media-preferences .media-embed .embed-video-settings .setting-group,
105 | .media-frame .user-media-preferences .media-embed .embed-audio-settings .setting {
106 | clear: none;
107 | }
108 |
109 | .user-media-preferences .embed-video-settings fieldset:first-of-type,
110 | .user-media-preferences .embed-audio-settings fieldset:first-of-type {
111 | display: none;
112 | }
113 |
114 | .user-media-preferences .embed-video-settings .media-embed .setting span {
115 | margin-left: 1em;
116 | }
117 |
118 | .user-media-preferences .media-embed .embed-video-settings .checkbox-setting,
119 | .user-media-preferences .media-embed .embed-audio-settings .checkbox-setting {
120 | float: none;
121 | display: block;
122 | }
123 |
124 | .media-frame #mediatheque-container #media ul li.user-media div.user-media-content h4 {
125 | background: none;
126 | }
127 |
128 | .media-frame-content #mediatheque-container #media li.notice {
129 | margin: 1em 0;
130 | }
131 |
--------------------------------------------------------------------------------
/assets/editor.min.css:
--------------------------------------------------------------------------------
1 | .media-frame-content #mediatheque-container .wp-filter{margin-top:0;border-top:none;border-left:none;border-right:none;width:98%}.media-frame-content #mediatheque-container #forms,.media-frame-content #mediatheque-container #media,.media-frame-content #mediatheque-container #trail{width:95%;margin-right:auto;margin-left:auto}.media-frame-content #mediatheque-container #media ul li.user-media{box-shadow:inset 0 0 15px rgba(0,0,0,.1),inset 0 0 0 1px rgba(0,0,0,.05);background-color:#eee;background-image:none;cursor:pointer}.media-frame-content #mediatheque-container #media ul li.user-media.dir .user-media-content{background-image:url('folder.svg');background-size:50%;background-repeat:no-repeat;background-position:center center}.media-frame-content #mediatheque-container #media ul li.user-media div.user-media-content{min-height:200px}.media-frame-content #mediatheque-container #media ul li.user-media.selected{border:8px inset #0073aa;outline:0;max-height:184px}.media-frame-content #mediatheque-container #media ul li.user-media.selected .user-media-content{min-width:184px;min-height:184px}.media-frame.mediatheque-hide-menu .media-frame-content,.media-frame.mediatheque-hide-menu .media-frame-router,.media-frame.mediatheque-hide-menu .media-frame-title,.media-frame.mediatheque-hide-menu .media-frame-toolbar{left:0}.media-frame.mediatheque-hide-menu .media-frame-menu{display:none}.media-frame .user-media-preferences .embed-media-settings{top:0}.media-frame .user-media-preferences .embed-audio-settings audio,.media-frame .user-media-preferences .embed-media-settings .column-image,.media-frame .user-media-preferences .embed-media-settings .wp-video-holder{float:right;margin-right:1em;width:48%}.media-frame #mediatheque-file-preferences .embed-media-settings,.media-frame .user-media-preferences .embed-audio-settings audio{margin-top:2em}.media-frame .user-media-preferences .embed-audio-settings .setting,.media-frame .user-media-preferences .embed-media-settings .column-settings,.media-frame .user-media-preferences .embed-video-settings .setting-group,.media-frame .user-media-preferences .embed-video-settings .setting.align{float:left;margin-left:1em;overflow:hidden;width:48%}.media-frame .user-media-preferences .embed-audio-settings .setting.preload,.media-frame .user-media-preferences .embed-video-settings .setting.preload{overflow:visible}.media-frame .user-media-preferences .embed-media-settings .column-settings label,.media-modal .media-frame .user-media-preferences .embed-media-settings .column-settings .legend-inline{display:block;position:static;transform:inherit;margin:0;line-height:1.84615384}.media-frame .user-media-preferences .embed-media-settings .column-image{margin-top:2em}.media-frame .user-media-preferences .media-embed .embed-audio-settings .setting,.media-frame .user-media-preferences .media-embed .embed-video-settings .setting,.media-frame .user-media-preferences .media-embed .embed-video-settings .setting-group{clear:none}.user-media-preferences .embed-audio-settings fieldset:first-of-type,.user-media-preferences .embed-video-settings fieldset:first-of-type{display:none}.user-media-preferences .embed-video-settings .media-embed .setting span{margin-left:1em}.user-media-preferences .media-embed .embed-audio-settings .checkbox-setting,.user-media-preferences .media-embed .embed-video-settings .checkbox-setting{float:none;display:block}.media-frame #mediatheque-container #media ul li.user-media div.user-media-content h4{background:0 0}.media-frame-content #mediatheque-container #media li.notice{margin:1em 0}
--------------------------------------------------------------------------------
/assets/embed.css:
--------------------------------------------------------------------------------
1 | .wp-embed-download, .wp-embed-files {
2 | display: inline;
3 | }
4 |
5 | .dashicons-download {
6 | background-image: url("data:image/svg+xml;charset=utf8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%27%2382878c%27%3E%3Cpath%20d%3D%22M14.010%204v6h2v-8h-12.010v8h2.010v-6h8zM12.010%206v6h3l-5%206-5-6h3v-6h4z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E" );
7 | }
8 |
9 | .wp-embed-download a:hover .dashicons-download {
10 | background-image: url("data:image/svg+xml;charset=utf8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%27%230073aa%27%3E%3Cpath%20d%3D%22M14.010%204v6h2v-8h-12.010v8h2.010v-6h8zM12.010%206v6h3l-5%206-5-6h3v-6h4z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E" );
11 | }
12 |
13 | .dashicons-files {
14 | background-image: url("data:image/svg+xml;charset=utf8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3C%21DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%27%2382878c%27%3E%3Cpath%20d%3D%22M13%2011v-7c0-0.55-0.45-1-1-1h-1.67l-1.33-2h-4l-1.33%202h-1.67c-0.55%200-1%200.45-1%201v7c0%200.55%200.45%201%201%201h10c0.55%200%201-0.45%201-1zM7%204.5c1.38%200%202.5%201.12%202.5%202.5s-1.12%202.5-2.5%202.5-2.5-1.12-2.5-2.5%201.12-2.5%202.5-2.5zM14%206h5v10.5c0%201.38-1.12%202.5-2.5%202.5s-2.5-1.12-2.5-2.5%201.12-2.5%202.5-2.5c0.17%200%200.34%200.020%200.5%200.050v-5.050h-3v-3zM10%2014.050v-1.050h2v3.5c0%201.38-1.12%202.5-2.5%202.5s-2.5-1.12-2.5-2.5%201.12-2.5%202.5-2.5c0.17%200%200.34%200.020%200.5%200.050z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E");
15 | }
16 |
17 | .wp-embed-files a:hover .dashicons-files {
18 | background-image: url("data:image/svg+xml;charset=utf8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3C%21DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%27%2382878c%27%3E%3Cpath%20d%3D%22M13%2011v-7c0-0.55-0.45-1-1-1h-1.67l-1.33-2h-4l-1.33%202h-1.67c-0.55%200-1%200.45-1%201v7c0%200.55%200.45%201%201%201h10c0.55%200%201-0.45%201-1zM7%204.5c1.38%200%202.5%201.12%202.5%202.5s-1.12%202.5-2.5%202.5-2.5-1.12-2.5-2.5%201.12-2.5%202.5-2.5zM14%206h5v10.5c0%201.38-1.12%202.5-2.5%202.5s-2.5-1.12-2.5-2.5%201.12-2.5%202.5-2.5c0.17%200%200.34%200.020%200.5%200.050v-5.050h-3v-3zM10%2014.050v-1.050h2v3.5c0%201.38-1.12%202.5-2.5%202.5s-2.5-1.12-2.5-2.5%201.12-2.5%202.5-2.5c0.17%200%200.34%200.020%200.5%200.050z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E");
19 | }
20 |
--------------------------------------------------------------------------------
/assets/embed.min.css:
--------------------------------------------------------------------------------
1 | .wp-embed-download,.wp-embed-files{display:inline}.dashicons-download{background-image:url("data:image/svg+xml;charset=utf8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%27%2382878c%27%3E%3Cpath%20d%3D%22M14.010%204v6h2v-8h-12.010v8h2.010v-6h8zM12.010%206v6h3l-5%206-5-6h3v-6h4z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E")}.wp-embed-download a:hover .dashicons-download{background-image:url("data:image/svg+xml;charset=utf8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%27%230073aa%27%3E%3Cpath%20d%3D%22M14.010%204v6h2v-8h-12.010v8h2.010v-6h8zM12.010%206v6h3l-5%206-5-6h3v-6h4z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E")}.dashicons-files{background-image:url("data:image/svg+xml;charset=utf8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3C%21DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%27%2382878c%27%3E%3Cpath%20d%3D%22M13%2011v-7c0-0.55-0.45-1-1-1h-1.67l-1.33-2h-4l-1.33%202h-1.67c-0.55%200-1%200.45-1%201v7c0%200.55%200.45%201%201%201h10c0.55%200%201-0.45%201-1zM7%204.5c1.38%200%202.5%201.12%202.5%202.5s-1.12%202.5-2.5%202.5-2.5-1.12-2.5-2.5%201.12-2.5%202.5-2.5zM14%206h5v10.5c0%201.38-1.12%202.5-2.5%202.5s-2.5-1.12-2.5-2.5%201.12-2.5%202.5-2.5c0.17%200%200.34%200.020%200.5%200.050v-5.050h-3v-3zM10%2014.050v-1.050h2v3.5c0%201.38-1.12%202.5-2.5%202.5s-2.5-1.12-2.5-2.5%201.12-2.5%202.5-2.5c0.17%200%200.34%200.020%200.5%200.050z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E")}.wp-embed-files a:hover .dashicons-files{background-image:url("data:image/svg+xml;charset=utf8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3C%21DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%27%2382878c%27%3E%3Cpath%20d%3D%22M13%2011v-7c0-0.55-0.45-1-1-1h-1.67l-1.33-2h-4l-1.33%202h-1.67c-0.55%200-1%200.45-1%201v7c0%200.55%200.45%201%201%201h10c0.55%200%201-0.45%201-1zM7%204.5c1.38%200%202.5%201.12%202.5%202.5s-1.12%202.5-2.5%202.5-2.5-1.12-2.5-2.5%201.12-2.5%202.5-2.5zM14%206h5v10.5c0%201.38-1.12%202.5-2.5%202.5s-2.5-1.12-2.5-2.5%201.12-2.5%202.5-2.5c0.17%200%200.34%200.020%200.5%200.050v-5.050h-3v-3zM10%2014.050v-1.050h2v3.5c0%201.38-1.12%202.5-2.5%202.5s-2.5-1.12-2.5-2.5%201.12-2.5%202.5-2.5c0.17%200%200.34%200.020%200.5%200.050z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E")}
--------------------------------------------------------------------------------
/assets/folder.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/assets/front.css:
--------------------------------------------------------------------------------
1 | body:not( .wp-admin ) .media-modal #mediatheque-container {
2 | background-color: #fff;
3 | }
4 |
5 | #mediatheque-container .postbox {
6 | position: relative;
7 | min-width: 255px;
8 | border: 1px solid #e5e5e5;
9 | -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
10 | box-shadow: 0 1px 1px rgba(0,0,0,0.04);
11 | background: #fff;
12 | }
13 |
14 | #mediatheque-container .postbox button.dashicons-no,
15 | #mediatheque-container .mediatheque-uploader-box button.dashicons-no {
16 | color: #555;
17 | padding: 0;
18 | }
19 |
20 | #mediatheque-container .notice,
21 | #mediatheque-container div.updated,
22 | #mediatheque-container div.error {
23 | background: #fff;
24 | border-left: 4px solid #fff;
25 | -webkit-box-shadow: 0 1px 1px 0 rgba( 0, 0, 0, 0.1 );
26 | box-shadow: 0 1px 1px 0 rgba( 0, 0, 0, 0.1 );
27 | margin: 5px 15px 2px;
28 | padding: 1px 12px;
29 | }
30 |
31 | #mediatheque-container .notice p,
32 | #mediatheque-container .notice-title,
33 | #mediatheque-container div.updated p,
34 | #mediatheque-container div.error p,
35 | #mediatheque-container .form-table td .notice p {
36 | margin: 0.5em 0;
37 | padding: 2px;
38 | }
39 |
40 | #mediatheque-container .error a {
41 | text-decoration: underline;
42 | }
43 |
44 | #mediatheque-container .updated a {
45 | padding-bottom: 2px;
46 | }
47 |
48 | #mediatheque-container .notice-alt {
49 | -webkit-box-shadow: none;
50 | box-shadow: none;
51 | }
52 |
53 | #mediatheque-container .notice-large {
54 | padding: 10px 20px;
55 | }
56 |
57 | #mediatheque-container .notice-title {
58 | display: inline-block;
59 | color: #23282d;
60 | font-size: 18px;
61 | }
62 |
63 | .wp-core-ui #mediatheque-container .notice.is-dismissible {
64 | padding-right: 38px;
65 | position: relative;
66 | }
67 |
68 | #mediatheque-container .notice-dismiss {
69 | position: absolute;
70 | top: 0;
71 | right: 1px;
72 | border: none;
73 | margin: 0;
74 | padding: 9px;
75 | background: none;
76 | color: #72777c;
77 | cursor: pointer;
78 | }
79 |
80 | #mediatheque-container .notice-dismiss:hover:before,
81 | #mediatheque-container .notice-dismiss:active:before,
82 | #mediatheque-container .notice-dismiss:focus:before {
83 | color: #c00;
84 | }
85 |
86 | #mediatheque-container .notice-dismiss:focus {
87 | outline: none;
88 | -webkit-box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, .8);
89 | box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, .8);
90 | }
91 |
92 | .ie8 #mediatheque-container .notice-dismiss:focus {
93 | outline: 1px solid #5b9dd9;
94 | }
95 |
96 | #mediatheque-container .notice-success,
97 | #mediatheque-container div.updated {
98 | border-left-color: #46b450;
99 | }
100 |
101 | #mediatheque-container .notice-success.notice-alt {
102 | background-color: #ecf7ed;
103 | }
104 |
105 | #mediatheque-container .notice-warning {
106 | border-left-color: #ffb900;
107 | }
108 |
109 | #mediatheque-container .notice-warning.notice-alt {
110 | background-color: #fff8e5;
111 | }
112 |
113 | #mediatheque-container .notice-error,
114 | #mediatheque-container div.error {
115 | border-left-color: #dc3232;
116 | }
117 |
118 | #mediatheque-container .notice-error.notice-alt {
119 | background-color: #fbeaea;
120 | }
121 |
122 | #mediatheque-container .notice-info {
123 | border-left-color: #00a0d2;
124 | }
125 |
126 | #mediatheque-container .notice-info.notice-alt {
127 | background-color: #e5f5fa;
128 | }
129 |
130 | /* Filter bar */
131 | #mediatheque-container .wp-filter {
132 | display: inline-block;
133 | position: relative;
134 | -webkit-box-sizing: border-box;
135 | -moz-box-sizing: border-box;
136 | box-sizing: border-box;
137 | margin: 12px 0 25px;
138 | padding: 0 10px;
139 | width: 100%;
140 | -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
141 | box-shadow: 0 1px 1px rgba(0,0,0,0.04);
142 | border: 1px solid #e5e5e5;
143 | background: #fff;
144 | color: #555;
145 | font-size: 13px;
146 | }
147 |
148 | #mediatheque-container .wp-filter a {
149 | text-decoration: none;
150 | }
151 |
152 | #mediatheque-container .filter-count {
153 | display: inline-block;
154 | vertical-align: middle;
155 | min-width: 4em;
156 | }
157 |
158 | #mediatheque-container .filter-items {
159 | float: left;
160 | }
161 |
162 | #mediatheque-container .filter-links {
163 | display: inline-block;
164 | margin: 0;
165 | }
166 |
167 | #mediatheque-container .filter-links li {
168 | display: inline-block;
169 | margin: 0;
170 | }
171 |
172 | #mediatheque-container .filter-links li > a {
173 | display: inline-block;
174 | margin: 0 10px;
175 | padding: 15px 0;
176 | border-bottom: 4px solid #fff;
177 | color: #666;
178 | cursor: pointer;
179 | }
180 |
181 | #mediatheque-container .filter-links .current {
182 | -webkit-box-shadow: none;
183 | box-shadow: none;
184 | border-bottom: 4px solid #666;
185 | color: #23282d;
186 | }
187 |
188 | #mediatheque-container .filter-links li > a:hover,
189 | #mediatheque-container .filter-links li > a:focus,
190 | #mediatheque-container .show-filters .filter-links a.current:hover,
191 | #mediatheque-container .show-filters .filter-links a.current:focus {
192 | color: #00a0d2;
193 | }
194 |
--------------------------------------------------------------------------------
/assets/front.min.css:
--------------------------------------------------------------------------------
1 | body:not( .wp-admin ) .media-modal #mediatheque-container{background-color:#fff}#mediatheque-container .postbox{position:relative;min-width:255px;border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.04);box-shadow:0 1px 1px rgba(0,0,0,.04);background:#fff}#mediatheque-container .mediatheque-uploader-box button.dashicons-no,#mediatheque-container .postbox button.dashicons-no{color:#555;padding:0}#mediatheque-container .notice,#mediatheque-container div.error,#mediatheque-container div.updated{background:#fff;border-left:4px solid #fff;-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 15px 2px;padding:1px 12px}#mediatheque-container .form-table td .notice p,#mediatheque-container .notice p,#mediatheque-container .notice-title,#mediatheque-container div.error p,#mediatheque-container div.updated p{margin:.5em 0;padding:2px}#mediatheque-container .error a{text-decoration:underline}#mediatheque-container .updated a{padding-bottom:2px}#mediatheque-container .notice-alt{-webkit-box-shadow:none;box-shadow:none}#mediatheque-container .notice-large{padding:10px 20px}#mediatheque-container .notice-title{display:inline-block;color:#23282d;font-size:18px}.wp-core-ui #mediatheque-container .notice.is-dismissible{padding-right:38px;position:relative}#mediatheque-container .notice-dismiss{position:absolute;top:0;right:1px;border:none;margin:0;padding:9px;background:0 0;color:#72777c;cursor:pointer}#mediatheque-container .notice-dismiss:active:before,#mediatheque-container .notice-dismiss:focus:before,#mediatheque-container .notice-dismiss:hover:before{color:#c00}#mediatheque-container .notice-dismiss:focus{outline:0;-webkit-box-shadow:0 0 0 1px #5b9dd9,0 0 2px 1px rgba(30,140,190,.8);box-shadow:0 0 0 1px #5b9dd9,0 0 2px 1px rgba(30,140,190,.8)}.ie8 #mediatheque-container .notice-dismiss:focus{outline:1px solid #5b9dd9}#mediatheque-container .notice-success,#mediatheque-container div.updated{border-left-color:#46b450}#mediatheque-container .notice-success.notice-alt{background-color:#ecf7ed}#mediatheque-container .notice-warning{border-left-color:#ffb900}#mediatheque-container .notice-warning.notice-alt{background-color:#fff8e5}#mediatheque-container .notice-error,#mediatheque-container div.error{border-left-color:#dc3232}#mediatheque-container .notice-error.notice-alt{background-color:#fbeaea}#mediatheque-container .notice-info{border-left-color:#00a0d2}#mediatheque-container .notice-info.notice-alt{background-color:#e5f5fa}#mediatheque-container .wp-filter{display:inline-block;position:relative;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;margin:12px 0 25px;padding:0 10px;width:100%;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.04);box-shadow:0 1px 1px rgba(0,0,0,.04);border:1px solid #e5e5e5;background:#fff;color:#555;font-size:13px}#mediatheque-container .wp-filter a{text-decoration:none}#mediatheque-container .filter-count{display:inline-block;vertical-align:middle;min-width:4em}#mediatheque-container .filter-items{float:left}#mediatheque-container .filter-links{display:inline-block;margin:0}#mediatheque-container .filter-links li{display:inline-block;margin:0}#mediatheque-container .filter-links li>a{display:inline-block;margin:0 10px;padding:15px 0;border-bottom:4px solid #fff;color:#666;cursor:pointer}#mediatheque-container .filter-links .current{-webkit-box-shadow:none;box-shadow:none;border-bottom:4px solid #666;color:#23282d}#mediatheque-container .filter-links li>a:focus,#mediatheque-container .filter-links li>a:hover,#mediatheque-container .show-filters .filter-links a.current:focus,#mediatheque-container .show-filters .filter-links a.current:hover{color:#00a0d2}
--------------------------------------------------------------------------------
/assets/ui.css:
--------------------------------------------------------------------------------
1 | #mediatheque-upload-status .mediatheque-status {
2 | overflow: hidden;
3 | margin: 1em 0;
4 | }
5 |
6 | #mediatheque-upload-status .mediatheque-progress,
7 | #mediatheque-container #media ul li.user-media .mediatheque-progress {
8 | background: none;
9 | border: 1px solid #d1d1d1;
10 | float: right;
11 | height: 22px;
12 | line-height: 2em;
13 | margin: 6px 10px 0 0;
14 | margin-bottom: 2px;
15 | padding: 0;
16 | overflow: hidden;
17 | width: 200px;
18 | }
19 |
20 | #mediatheque-container #media ul li.user-media .mediatheque-progress {
21 | float: left;
22 | margin: 45% 2% 45% 2%;
23 | width: 95%;
24 | }
25 |
26 | #mediatheque-upload-status .mediatheque-bar,
27 | #mediatheque-container #media ul li.user-media .mediatheque-bar {
28 | background-color: #0073aa;
29 | width: 0;
30 | height: 100%;
31 | z-index: 9;
32 | }
33 |
34 | #toolbar button {
35 | vertical-align: inherit;
36 | margin: 0 0.5em;
37 | }
38 |
39 | #toolbar button:not( .button-primary ):not( .button-secondary ) {
40 | border: none;
41 | border-radius: 0;
42 | background: none!important;
43 | box-shadow: none!important;
44 | }
45 |
46 | #toolbar li {
47 | margin: 0 10px;
48 | padding: 15px 0;
49 | }
50 |
51 | #directory-form {
52 | width: 50%;
53 | margin: 0 auto;
54 | }
55 |
56 | #directory-form form {
57 | padding: 1em;
58 | overflow: hidden;
59 | }
60 |
61 | #directory-form form .close {
62 | background-color: transparent;
63 | border: 0;
64 | cursor: pointer;
65 | height: 48px;
66 | position: absolute;
67 | right: 0;
68 | text-align: center;
69 | top: 0;
70 | width: 50px;
71 | z-index: 1;
72 | }
73 |
74 | #directory-form form label {
75 | margin-top: 2em;
76 | display:block;
77 | font-weight: bold;
78 | }
79 |
80 | #directory-form form input[type=text] {
81 | width: 85%;
82 | line-height: 26px;
83 | height: 28px;
84 | padding: 0 10px 1px;
85 | box-shadow: 0 1px 0 #ccc;
86 | }
87 |
88 | #mediatheque-container #users ul.users,
89 | #mediatheque-container #media ul.user-media {
90 | overflow: hidden;
91 | list-style: none;
92 | }
93 |
94 | #mediatheque-container #users ul li.user,
95 | #mediatheque-container #media ul li.user-media {
96 | float: left;
97 | width: 200px;
98 | min-height: 200px;
99 | -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
100 | box-shadow: 0 1px 1px rgba(0,0,0,0.04);
101 | text-align: center;
102 | margin: 0 0.5em 1.5em 0.5em;
103 | -webkit-box-sizing: border-box;
104 | -moz-box-sizing: border-box;
105 | box-sizing: border-box;
106 | }
107 |
108 | #mediatheque-container #media ul li.user-media:not( .dir ) {
109 | background-color: #fff;
110 | }
111 |
112 | #mediatheque-container #users ul li.user,
113 | #mediatheque-container #media ul li.user-media.dir {
114 | background-image: url( 'folder.svg' );
115 | background-size: cover;
116 | background-repeat: no-repeat;
117 | }
118 |
119 | #mediatheque-container #users ul li.user a {
120 | border: none;
121 | margin-top: 45px;
122 | display: block;
123 | width: 100%;
124 | }
125 |
126 | #mediatheque-container #users ul li.user .stats {
127 | margin-bottom: 0.5em;
128 | }
129 |
130 | #mediatheque-container #media ul li.user-media div.user-media-content {
131 | width: 100%;
132 | min-height: 175px;
133 | position: relative;
134 | }
135 |
136 | #mediatheque-container #media ul li.user-media.dir div.user-media-content {
137 | cursor: pointer;
138 | }
139 |
140 | #mediatheque-container #media ul li.user-media:not( .dir ) div.user-media-content {
141 | background-size: cover;
142 | background-repeat: no-repeat;
143 | }
144 |
145 | #mediatheque-container #media ul li.user-media div.user-media-content h4 {
146 | position: absolute;
147 | bottom: 0;
148 | width: 100%;
149 | font-size: 13px;
150 | font-weight: 600;
151 | background: #fff;
152 | }
153 |
154 | #mediatheque-container #media ul li.user-media div.user-media-content div.bg-img {
155 | position: absolute;
156 | bottom: 20px;
157 | top: 0;
158 | left: 0;
159 | right: 0;
160 | margin: auto;
161 | width: 48px;
162 | height: 64px;
163 | }
164 |
165 | #mediatheque-container #media ul li.user-media div.user-media-actions {
166 | margin: 0.5em 0;
167 | overflow: hidden;
168 | text-align: center;
169 | vertical-align: middle;
170 | height: 100%;
171 | }
172 |
173 | #mediatheque-container #media ul li.user-media div.user-media-actions a {
174 | display: inline-block;
175 | margin: 0 0.5em;
176 | text-decoration: none;
177 | border: none;
178 | box-shadow: none;
179 | -webkit-box-shadow: none;
180 | }
181 |
182 | #mediatheque-container #media ul li.user-media.editing {
183 | width: 83%;
184 | z-index: 160000;
185 | position: fixed;
186 | margin: auto auto;
187 | }
188 |
189 | #mediatheque-container #media ul li.user-media.editing div.user-media-content {
190 | float: left;
191 | width: 200px;
192 | }
193 |
194 | #mediatheque-container #media ul li.user-media.dir.editing {
195 | background: #fff;
196 | background-image: 'none';
197 | }
198 |
199 | #mediatheque-container #media ul li.user-media.dir.editing div.user-media-content {
200 | background-image: url( 'folder.svg' );
201 | background-size: cover;
202 | background-repeat: no-repeat;
203 | background-color: #ddd;
204 | }
205 |
206 | #mediatheque-container #media ul li.user-media.editing div.user-media-actions {
207 | display: none;
208 | }
209 |
210 | #mediatheque-container #media ul li.user-media.editing form.user-media-edit-container .media-edit {
211 | text-align: left;
212 | margin: 1em;
213 | margin-left: 210px;
214 | overflow: hidden;
215 | cursor: auto;
216 | }
217 |
218 | #mediatheque-container #media ul li.user-media.editing form.user-media-edit-container label {
219 | display: block;
220 | margin-bottom: 1em;
221 | cursor: auto;
222 | }
223 |
224 | #mediatheque-container #media ul li.user-media.editing form.user-media-edit-container table a {
225 | text-decoration: none;
226 | border: none;
227 | }
228 |
229 | #mediatheque-container #media ul li.user-media.editing form.user-media-edit-container label.submit,
230 | #mediatheque-container #media ul li.user-media.editing form.user-media-edit-container label.reset {
231 | padding: 0;
232 | margin: 0 0.5em;
233 | display: inline-block;
234 | float: right;
235 | }
236 |
237 | #mediatheque-container #media ul li.user-media.editing form.user-media-edit-container label span {
238 | font-weight: bold;
239 | }
240 |
241 | #mediatheque-container #media ul li.user-media.editing form.user-media-edit-container label input[type="text"],
242 | #mediatheque-container #media ul li.user-media.editing form.user-media-edit-container label textarea {
243 | width: 98%;
244 | }
245 |
246 | #mediatheque-container #media ul li.user-media.editing form.user-media-edit-container [data-setting="description"] {
247 | min-height: 3em;
248 | border: 1px solid #ddd;
249 | margin: 1px;
250 | padding: 3px 5px;
251 | box-sizing: border-box;
252 | -webkit-box-shadow: inset 0 1px 2px rgba( 0, 0, 0, 0.07 );
253 | box-shadow: inset 0 1px 2px rgba( 0, 0, 0, 0.07 );
254 | background-color: #fff;
255 | color: #32373c;
256 | outline: none;
257 | width: 98%;
258 | }
259 |
260 | #mediatheque-container #media ul li.user-media.editing form.user-media-edit-container [data-setting="description"]:focus {
261 | border-color: #5b9dd9;
262 | -webkit-box-shadow: 0 0 2px rgba( 30, 140, 190, 0.8 );
263 | box-shadow: 0 0 2px rgba( 30, 140, 190, 0.8 );
264 | }
265 |
266 | #mediatheque-container #media ul li.user-media.editing form.user-media-edit-container [data-setting="description"] p {
267 | margin: auto;
268 | padding: auto;
269 | }
270 |
271 | #mediatheque-backdrop {
272 | display:none;
273 | position: fixed;
274 | top: 0;
275 | left: 0;
276 | right: 0;
277 | bottom: 0;
278 | min-height: 360px;
279 | background: #000;
280 | opacity: 0.7;
281 | z-index: 159900;
282 | }
283 |
284 | #mediatheque-backdrop.editing {
285 | display: block;
286 | }
287 |
288 | #mediatheque-container #media ul li.user-media.editing:after {
289 | clear:both;
290 | }
291 |
292 | #mediatheque-container #trail ul {
293 | list-style: none;
294 | overflow: hidden;
295 | margin-top: 0;
296 | }
297 |
298 | #mediatheque-container #trail ul li {
299 | float: left;
300 | margin-right: 0.5em;
301 | }
302 |
303 | #mediatheque-container #trail ul li img.avatar {
304 | vertical-align: top;
305 | }
306 |
307 | [draggable="true"] {
308 | -moz-user-select: none;
309 | -khtml-user-select: none;
310 | -webkit-user-select: none;
311 | user-select: none;
312 | /* Required to make elements draggable in old WebKit */
313 | -khtml-user-drag: element;
314 | -webkit-user-drag: element;
315 | cursor:move;
316 | }
317 |
318 | [contenteditable] {
319 | -webkit-user-select: text;
320 | user-select: text;
321 | }
322 |
323 | #mediatheque-container #media ul.loading,
324 | #mediatheque-container #trail ul.loading {
325 | -webkit-filter: grayscale(1);
326 | filter: grayscale(1);
327 | }
328 |
329 | #mediatheque-container #media ul li.drag-over,
330 | #mediatheque-container #trail ul li.drag-over {
331 | border: 0.2em dashed #0073aa;
332 | }
333 |
334 | #mediatheque-container #media ul li.drag-over {
335 | margin-bottom: 1.1em;
336 | }
337 |
338 | #mediatheque-container #trail ul li.drag-over {
339 | display: block;
340 | width: 250px;
341 | }
342 |
343 | /* Front-end only */
344 | body:not( .wp-admin ) #mediatheque-container {
345 | background-color: #f1f1f1;
346 | overflow-y: scroll;
347 | padding: 1em;
348 | }
349 |
350 | body:not( .wp-admin ) #mediatheque-container #media {
351 | width: 100%;
352 | margin: 0 auto;
353 | }
354 |
355 | body:not( .wp-admin ) #mediatheque-container #media .selectable .user-media-content:hover {
356 | cursor: pointer;
357 | }
358 |
--------------------------------------------------------------------------------
/assets/ui.min.css:
--------------------------------------------------------------------------------
1 | #mediatheque-upload-status .mediatheque-status{overflow:hidden;margin:1em 0}#mediatheque-container #media ul li.user-media .mediatheque-progress,#mediatheque-upload-status .mediatheque-progress{background:0 0;border:1px solid #d1d1d1;float:right;height:22px;line-height:2em;margin:6px 10px 0 0;margin-bottom:2px;padding:0;overflow:hidden;width:200px}#mediatheque-container #media ul li.user-media .mediatheque-progress{float:left;margin:45% 2% 45% 2%;width:95%}#mediatheque-container #media ul li.user-media .mediatheque-bar,#mediatheque-upload-status .mediatheque-bar{background-color:#0073aa;width:0;height:100%;z-index:9}#toolbar button{vertical-align:inherit;margin:0 .5em}#toolbar button:not( .button-primary ):not( .button-secondary ){border:none;border-radius:0;background:0 0!important;box-shadow:none!important}#toolbar li{margin:0 10px;padding:15px 0}#directory-form{width:50%;margin:0 auto}#directory-form form{padding:1em;overflow:hidden}#directory-form form .close{background-color:transparent;border:0;cursor:pointer;height:48px;position:absolute;right:0;text-align:center;top:0;width:50px;z-index:1}#directory-form form label{margin-top:2em;display:block;font-weight:700}#directory-form form input[type=text]{width:85%;line-height:26px;height:28px;padding:0 10px 1px;box-shadow:0 1px 0 #ccc}#mediatheque-container #media ul.user-media,#mediatheque-container #users ul.users{overflow:hidden;list-style:none}#mediatheque-container #media ul li.user-media,#mediatheque-container #users ul li.user{float:left;width:200px;min-height:200px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.04);box-shadow:0 1px 1px rgba(0,0,0,.04);text-align:center;margin:0 .5em 1.5em .5em;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#mediatheque-container #media ul li.user-media:not( .dir ){background-color:#fff}#mediatheque-container #media ul li.user-media.dir,#mediatheque-container #users ul li.user{background-image:url('folder.svg');background-size:cover;background-repeat:no-repeat}#mediatheque-container #users ul li.user a{border:none;margin-top:45px;display:block;width:100%}#mediatheque-container #users ul li.user .stats{margin-bottom:.5em}#mediatheque-container #media ul li.user-media div.user-media-content{width:100%;min-height:175px;position:relative}#mediatheque-container #media ul li.user-media.dir div.user-media-content{cursor:pointer}#mediatheque-container #media ul li.user-media:not( .dir ) div.user-media-content{background-size:cover;background-repeat:no-repeat}#mediatheque-container #media ul li.user-media div.user-media-content h4{position:absolute;bottom:0;width:100%;font-size:13px;font-weight:600;background:#fff}#mediatheque-container #media ul li.user-media div.user-media-content div.bg-img{position:absolute;bottom:20px;top:0;left:0;right:0;margin:auto;width:48px;height:64px}#mediatheque-container #media ul li.user-media div.user-media-actions{margin:.5em 0;overflow:hidden;text-align:center;vertical-align:middle;height:100%}#mediatheque-container #media ul li.user-media div.user-media-actions a{display:inline-block;margin:0 .5em;text-decoration:none;border:none;box-shadow:none;-webkit-box-shadow:none}#mediatheque-container #media ul li.user-media.editing{width:83%;z-index:160000;position:fixed;margin:auto auto}#mediatheque-container #media ul li.user-media.editing div.user-media-content{float:left;width:200px}#mediatheque-container #media ul li.user-media.dir.editing{background:#fff;background-image:'none'}#mediatheque-container #media ul li.user-media.dir.editing div.user-media-content{background-image:url('folder.svg');background-size:cover;background-repeat:no-repeat;background-color:#ddd}#mediatheque-container #media ul li.user-media.editing div.user-media-actions{display:none}#mediatheque-container #media ul li.user-media.editing form.user-media-edit-container .media-edit{text-align:left;margin:1em;margin-left:210px;overflow:hidden;cursor:auto}#mediatheque-container #media ul li.user-media.editing form.user-media-edit-container label{display:block;margin-bottom:1em;cursor:auto}#mediatheque-container #media ul li.user-media.editing form.user-media-edit-container table a{text-decoration:none;border:none}#mediatheque-container #media ul li.user-media.editing form.user-media-edit-container label.reset,#mediatheque-container #media ul li.user-media.editing form.user-media-edit-container label.submit{padding:0;margin:0 .5em;display:inline-block;float:right}#mediatheque-container #media ul li.user-media.editing form.user-media-edit-container label span{font-weight:700}#mediatheque-container #media ul li.user-media.editing form.user-media-edit-container label input[type=text],#mediatheque-container #media ul li.user-media.editing form.user-media-edit-container label textarea{width:98%}#mediatheque-container #media ul li.user-media.editing form.user-media-edit-container [data-setting=description]{min-height:3em;border:1px solid #ddd;margin:1px;padding:3px 5px;box-sizing:border-box;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.07);box-shadow:inset 0 1px 2px rgba(0,0,0,.07);background-color:#fff;color:#32373c;outline:0;width:98%}#mediatheque-container #media ul li.user-media.editing form.user-media-edit-container [data-setting=description]:focus{border-color:#5b9dd9;-webkit-box-shadow:0 0 2px rgba(30,140,190,.8);box-shadow:0 0 2px rgba(30,140,190,.8)}#mediatheque-container #media ul li.user-media.editing form.user-media-edit-container [data-setting=description] p{margin:auto;padding:auto}#mediatheque-backdrop{display:none;position:fixed;top:0;left:0;right:0;bottom:0;min-height:360px;background:#000;opacity:.7;z-index:159900}#mediatheque-backdrop.editing{display:block}#mediatheque-container #media ul li.user-media.editing:after{clear:both}#mediatheque-container #trail ul{list-style:none;overflow:hidden;margin-top:0}#mediatheque-container #trail ul li{float:left;margin-right:.5em}#mediatheque-container #trail ul li img.avatar{vertical-align:top}[draggable=true]{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;user-select:none;-khtml-user-drag:element;-webkit-user-drag:element;cursor:move}[contenteditable]{-webkit-user-select:text;user-select:text}#mediatheque-container #media ul.loading,#mediatheque-container #trail ul.loading{-webkit-filter:grayscale(1);filter:grayscale(1)}#mediatheque-container #media ul li.drag-over,#mediatheque-container #trail ul li.drag-over{border:.2em dashed #0073aa}#mediatheque-container #media ul li.drag-over{margin-bottom:1.1em}#mediatheque-container #trail ul li.drag-over{display:block;width:250px}body:not( .wp-admin ) #mediatheque-container{background-color:#f1f1f1;overflow-y:scroll;padding:1em}body:not( .wp-admin ) #mediatheque-container #media{width:100%;margin:0 auto}body:not( .wp-admin ) #mediatheque-container #media .selectable .user-media-content:hover{cursor:pointer}
--------------------------------------------------------------------------------
/assets/uploader.css:
--------------------------------------------------------------------------------
1 | #drag-drop-area.supports-drag-drop {
2 | position: relative;
3 | top: auto;
4 | right: auto;
5 | left: auto;
6 | bottom: auto;
7 | padding-top: 0;
8 | margin-top: 0;
9 | border: 4px dashed #b4b9be;
10 | margin-bottom: 1em;
11 | }
12 |
13 | #drag-drop-area.supports-drag-drop.drag-over {
14 | border: 4px dashed #0073aa;
15 | }
16 |
17 | #drag-drop-area .close {
18 | background-color: transparent;
19 | border: 0;
20 | cursor: pointer;
21 | height: 48px;
22 | position: absolute;
23 | right: 0;
24 | text-align: center;
25 | top: 0;
26 | width: 50px;
27 | z-index: 1;
28 | }
29 |
30 | .drag-drop-inside {
31 | margin: 2em 0;
32 | }
33 |
34 | #drag-drop-area .drag-drop-inside p.drag-drop-info {
35 | display: none;
36 | }
37 |
38 | #drag-drop-area.supports-drag-drop .drag-drop-inside p.drag-drop-info {
39 | display: block;
40 | font-size: 12px;
41 | margin: 0.5em 0;
42 | text-align: center;
43 | }
44 |
45 | p.drag-drop-buttons {
46 | text-align: center;
47 | }
48 |
49 | p.drag-drop-buttons input[type="button"] {
50 | display: inline-block !important;
51 | }
52 |
53 | #drag-drop-area h2.drag-drop-info {
54 | display: none;
55 | }
56 |
57 | #drag-drop-area.supports-drag-drop h2.drag-drop-info {
58 | display: block;
59 | font-size: 20px;
60 | line-height: 28px;
61 | font-weight: 400;
62 | margin: 0;
63 | text-align: center;
64 | }
65 |
66 | #drag-drop-area:not( .supports-drag-drop ) {
67 | position: relative;
68 | width: 50%;
69 | margin: 0 auto;
70 | border: 1px solid #e5e5e5;
71 | box-shadow: 0 1px 1px rgba(0,0,0,0.04);
72 | background: #fff;
73 | }
74 |
--------------------------------------------------------------------------------
/assets/uploader.min.css:
--------------------------------------------------------------------------------
1 | #drag-drop-area.supports-drag-drop{position:relative;top:auto;right:auto;left:auto;bottom:auto;padding-top:0;margin-top:0;border:4px dashed #b4b9be;margin-bottom:1em}#drag-drop-area.supports-drag-drop.drag-over{border:4px dashed #0073aa}#drag-drop-area .close{background-color:transparent;border:0;cursor:pointer;height:48px;position:absolute;right:0;text-align:center;top:0;width:50px;z-index:1}.drag-drop-inside{margin:2em 0}#drag-drop-area .drag-drop-inside p.drag-drop-info{display:none}#drag-drop-area.supports-drag-drop .drag-drop-inside p.drag-drop-info{display:block;font-size:12px;margin:.5em 0;text-align:center}p.drag-drop-buttons{text-align:center}p.drag-drop-buttons input[type=button]{display:inline-block!important}#drag-drop-area h2.drag-drop-info{display:none}#drag-drop-area.supports-drag-drop h2.drag-drop-info{display:block;font-size:20px;line-height:28px;font-weight:400;margin:0;text-align:center}#drag-drop-area:not( .supports-drag-drop ){position:relative;width:50%;margin:0 auto;border:1px solid #e5e5e5;box-shadow:0 1px 1px rgba(0,0,0,.04);background:#fff}
--------------------------------------------------------------------------------
/inc/avatars.php:
--------------------------------------------------------------------------------
1 | personal_avatars[ $user_media_id ][ $size ] ) ) {
40 | $personal_avatar = $mediatheque->personal_avatars[ $user_media_id ][ $size ];
41 | } else {
42 | $mediatheque->personal_avatars[ $user_media_id ][ $size ] = mediatheque_image_get_intermediate_size( $user_media_id, array( $size, $size ) );
43 | $personal_avatar = $mediatheque->personal_avatars[ $user_media_id ][ $size ];
44 | }
45 |
46 | if ( empty( $personal_avatar['url'] ) ) {
47 | return false;
48 | }
49 |
50 | return $personal_avatar['url'];
51 | }
52 |
53 | /**
54 | * Use the personal avatar url when available.
55 | *
56 | * @since 1.0.0
57 | *
58 | * @param array $args Default data.
59 | * @param mixed $id_or_email A user ID, email, a User, a Post or a Comment object.
60 | * @return array Avatar data.
61 | */
62 | function mediatheque_get_avatar_data( $args = array(), $id_or_email = null ) {
63 | if ( empty( $id_or_email ) ) {
64 | return $args;
65 | }
66 |
67 | if ( is_numeric( $id_or_email ) ) {
68 | $user = get_user_by( 'id', (int) $id_or_email );
69 | } else if ( is_a( $id_or_email, 'WP_User' ) ) {
70 | $user = $id_or_email;
71 | } else if ( is_a( $id_or_email, 'WP_Post' ) ) {
72 | $user = get_user_by( 'id', (int) $id_or_email->post_author );
73 | } else if ( is_a( $id_or_email, 'WP_Comment' ) ) {
74 | $user = get_user_by( 'id', (int) $id_or_email->user_id );
75 | } else if ( is_email( $id_or_email ) ) {
76 | $user = get_user_by( 'email', $id_or_email );
77 | }
78 |
79 | if ( empty( $user->ID ) ) {
80 | return $args;
81 | }
82 |
83 | $personal_avatar_id = $user->personal_avatar;
84 |
85 | if ( ! $personal_avatar_id ) {
86 | return $args;
87 | }
88 |
89 | $personal_avatar_url = mediatheque_get_personal_avatar( $personal_avatar_id, $args['size'] );
90 |
91 | if ( ! $personal_avatar_url ) {
92 | return $args;
93 | }
94 |
95 | return array_merge( $args, array( 'url' => $personal_avatar_url ) );
96 | }
97 | add_filter( 'pre_get_avatar_data', 'mediatheque_get_avatar_data', 10, 2 );
98 |
99 | /**
100 | * Restrict the User Media Status to Publish for Avatar selection.
101 | *
102 | * @since 1.0.0
103 | *
104 | * @param array $statuses The list of available User Media statuses.
105 | * @return array The list of available User Media statuses for the Avatar UI.
106 | */
107 | function mediatheque_avatar_user_media_statuses( $statuses = array() ) {
108 | return array_intersect_key( $statuses, array( 'publish' => true ) );
109 | }
110 |
111 | /**
112 | * Output a button on User's dashboard profile to select one of his User Media
113 | * and set it as his personal avatar.
114 | *
115 | * @since 1.0.0
116 | *
117 | * @param WP_User $user The current User object.
118 | * @return string HTML Output.
119 | */
120 | function mediatheque_profile_personal_avatar( $user = null ) {
121 | $message = '';
122 |
123 | if ( ! current_user_can( 'publish_user_uploads' ) ) {
124 | return;
125 | }
126 |
127 | if ( $user->personal_avatar ) {
128 | $message = sprintf(
129 | __( 'Pour supprimer votre avatar local, vous pouvez %s.', 'mediatheque' ),
130 | sprintf( '%s', __( 'cliquer ici', 'mediatheque' ) )
131 | );
132 | }
133 |
134 | add_filter( 'mediatheque_media_statuses', 'mediatheque_avatar_user_media_statuses', 10, 1 );
135 | ?>
136 |
137 |
'personal_avatar',
141 | 'editor_btn_classes' => array( 'mediabrary-insert' ),
142 | 'editor_btn_text' => __( 'MediaThèque', 'mediatheque' ),
143 | 'editor_btn_dashicon' => false,
144 | 'echo' => false,
145 | 'media_type' => 'image',
146 | ) ),
147 | '' . $message . ''
148 | ); ?>
149 |
150 |
151 | settings ) {
76 | $this->settings = new MediaTheque_Settings();
77 | }
78 |
79 | $this->settings_page = 'options-general.php';
80 | $this->capability = 'manage_options';
81 | $this->menu_hook = 'admin_menu';
82 |
83 | if ( is_multisite() ) {
84 | $this->settings_page = 'settings.php';
85 | $this->capability = 'manage_network_options';
86 | $this->menu_hook = 'network_admin_menu';
87 | }
88 |
89 | $this->hooks();
90 | }
91 |
92 | /**
93 | * Starts the Admin class
94 | *
95 | * @since 1.0.0
96 | */
97 | public static function start() {
98 | if ( ! is_admin() ) {
99 | return;
100 | }
101 |
102 | $mediatheque = mediatheque();
103 |
104 | if ( empty( $mediatheque->admin ) ) {
105 | $mediatheque->admin = new self;
106 | }
107 |
108 | return $mediatheque->admin;
109 | }
110 |
111 | /**
112 | * Setups hooks
113 | *
114 | * @since 1.0.0
115 | */
116 | private function hooks() {
117 | add_action( 'admin_menu', array( $this, 'menus' ) );
118 | add_action( 'network_admin_menu', array( $this, 'menus' ) );
119 | add_action( 'user_admin_menu', array( $this, 'menus' ) );
120 | add_action( 'init', array( $this, 'globals' ), 14 );
121 |
122 | /** Settings *********************************************************/
123 | add_action( 'admin_enqueue_scripts', array( $this, 'inline_scripts' ) );
124 |
125 | if ( ! is_multisite() ) {
126 | add_action( 'admin_head', array( $this, 'admin_head' ) );
127 | add_action( 'admin_head-settings_page_user-media-options', array( $this, 'settings_menu_highlight' ) );
128 | }
129 | }
130 |
131 | /**
132 | * Setups globals
133 | *
134 | * @since 1.0.0
135 | */
136 | public function globals() {
137 | $this->post_type_object = get_post_type_object( 'user_media' );
138 | $this->title = $this->post_type_object->labels->menu_name;
139 |
140 | if ( is_super_admin() ) {
141 | $this->title = __( 'MediaThèque Utilisateurs', 'mediatheque' );
142 | }
143 | }
144 |
145 | /**
146 | * Add a navigation to the Media options
147 | *
148 | * @since 1.0.0
149 | */
150 | public function inline_scripts() {
151 | $screen = get_current_screen();
152 |
153 | if ( ! isset( $screen->id ) ) {
154 | return;
155 | }
156 |
157 | $inline_scripts = array();
158 |
159 | if ( ! is_multisite() ) {
160 | if ( 'options-media' === $screen->id || 'settings_page_user-media-options' === $screen->id ) {
161 | $links = array(
162 | sprintf( '%3$s',
163 | esc_url( admin_url( 'options-media.php' ) ),
164 | 'options-media' === $screen->id ? ' class="current"' : '',
165 | esc_html__( 'Bibliothèque partagée', 'mediatheque' )
166 | ),
167 | sprintf( '%3$s',
168 | esc_url( add_query_arg( 'page', 'user-media-options', admin_url( 'options-general.php' ) ) ),
169 | 'settings_page_user-media-options' === $screen->id ? ' class="current"' : '',
170 | esc_html( $this->title )
171 | ),
172 | );
173 |
174 | $inline_scripts['media-tabs'] = sprintf( '
175 | $( \'.wrap h1\' ).first().after( $( \'\' )
176 | .addClass( \'wp-filter\')
177 | .html(
178 | $( \'\' )
179 | .addClass( \'filter-links\')
180 | .html(
181 | %s
182 | )
183 | )
184 | );', '\'' . join( '', $links ) . '\'' );
185 | }
186 | }
187 |
188 | if ( 0 === strpos( $screen->id, 'settings_page_user-media-options' ) ) {
189 | $inline_scripts['select-unselect-all'] = '
190 | $( \'.mediatheque-selectall\' ).on( \'click\', function( e ) {
191 | $.each( $( \'[data-mime-type="\' + $( e.currentTarget ).data( \'mime-type\') + \'"]\' ), function( i, cb ) {
192 | if ( 0 === i ) {
193 | return;
194 | }
195 |
196 | $( cb ).prop( \'checked\', $( e.currentTarget ).prop( \'checked\' ) );
197 | } );
198 | } );
199 | ';
200 | }
201 |
202 | $pointer = '';
203 | $pointer_placeholders = '
204 | $( document ).ready( function( $ ) {
205 | $( \'#%1$s\' ).pointer( {
206 | content: \'%2$s
%3$s
\',
207 | position: {
208 | edge: \'%5$s\',
209 | align: \'center\',
210 | offset: \'-25 0\'
211 | },
212 | close: function() {
213 | setUserSetting( \'%4$s\', 1 );
214 | }
215 | } ).pointer( \'open\' );
216 | } );
217 | ';
218 |
219 | $pointers = mediatheque_get_pointers();
220 |
221 | if ( $pointers ) {
222 | $can_manage_options = current_user_can( $this->capability );
223 |
224 | if ( ! is_multisite() ) {
225 | $permalink_structure = get_option( 'permalink_structure' );
226 | }
227 |
228 | foreach ( $pointers as $key => $p ) {
229 | $selector_id = $key;
230 | $setting = sanitize_key( $key );
231 |
232 | if ( 'toplevel_page_user-media' !== $key && ! $can_manage_options ) {
233 | continue;
234 |
235 | // Permalink is specific
236 | } elseif ( ! isset( $permalink_structure ) && 'user-media-permalinks' === $key ) {
237 | continue;
238 | } elseif ( 'user-media-permalinks' === $key && $can_manage_options ) {
239 | if ( ! $permalink_structure ) {
240 | $selector_id = 'menu-settings';
241 | } else {
242 | continue;
243 | }
244 | } elseif ( 'menu-settings' === $key && ! mediatheque_is_main_site() ) {
245 | continue;
246 | }
247 |
248 | $cookie_setting = preg_replace( '/[^A-Za-z0-9=&_]/', '', $setting );
249 |
250 | if ( ! get_user_setting( $cookie_setting ) ) {
251 | $pointer = sprintf(
252 | $pointer_placeholders,
253 | $selector_id,
254 | $p['title'],
255 | $p['content'],
256 | $cookie_setting,
257 | $p['position']
258 | );
259 | break;
260 | }
261 | }
262 | }
263 |
264 | if ( $pointer ) {
265 | array_push( $inline_scripts, $pointer );
266 | wp_enqueue_style( 'wp-pointer' );
267 | wp_enqueue_script( 'wp-pointer' );
268 | wp_enqueue_script( 'utils' );
269 | }
270 |
271 | if ( $inline_scripts ) {
272 | $inline_scripts = sprintf( '( function($) {%1$s%2$s%1$s} )( jQuery );', "\n", join( "\n", $inline_scripts ) );
273 |
274 | wp_add_inline_script( 'common', $inline_scripts );
275 | }
276 | }
277 |
278 | /**
279 | * Add a sub menu to the Media Library
280 | *
281 | * @since 1.0.0
282 | */
283 | public function menus() {
284 | $menu_title = $this->title;
285 |
286 | // Regular user
287 | if ( ( is_user_logged_in() && ! current_user_can( 'upload_files' ) ) || is_network_admin() ) {
288 | add_menu_page(
289 | $this->title,
290 | $this->title,
291 | 'create_user_uploads',
292 | 'user-media',
293 | array( $this, 'media_grid' ),
294 | mediatheque_get_svg_icon(),
295 | 20 // Before comments
296 | );
297 |
298 | // Contributors and Up.
299 | } else {
300 | add_media_page(
301 | $this->title,
302 | $this->title,
303 | 'upload_files',
304 | 'user-media',
305 | array( $this, 'media_grid' )
306 | );
307 | }
308 |
309 | // User Media options
310 | $screen_id = add_submenu_page(
311 | $this->settings_page,
312 | $this->title,
313 | $this->title,
314 | $this->capability,
315 | 'user-media-options',
316 | array( $this, 'do_settings' )
317 | );
318 |
319 | if ( ! is_network_admin() && ! is_user_admin() ) {
320 | $this->vanished_logs = get_option( '_mediatheque_vanished_media', array() );
321 | $count_vanished = count( $this->vanished_logs );
322 |
323 | if ( $count_vanished > 0 ) {
324 | add_management_page(
325 | $this->title,
326 | $this->title,
327 | 'manage_options',
328 | 'user-media-tools',
329 | array( $this, 'do_tools' )
330 | );
331 |
332 | add_action( 'tool_box', array( $this, 'tools_card' ), 100 );
333 | }
334 |
335 | // Save MediaThèque settings on specific page load
336 | } else {
337 | add_action( "load-{$screen_id}", array( $this, 'load_mediatheque_settings' ) );
338 | }
339 | }
340 |
341 | /**
342 | * Remove the subnav as User Media options is a subtab of shared media.
343 | *
344 | * @since 1.0.0
345 | */
346 | public function admin_head() {
347 | remove_submenu_page( 'options-general.php', 'user-media-options' );
348 | }
349 |
350 | /**
351 | * Make sure the highlighted submenu is the Media Options for User Media Options.
352 | *
353 | * @since 1.0.0
354 | */
355 | public function settings_menu_highlight() {
356 | $GLOBALS['submenu_file'] = 'options-media.php';
357 | }
358 |
359 | /**
360 | * Include options head file to enjoy WordPress settings feedback
361 | * in multisite configs.
362 | *
363 | * @since 1.0.0
364 | */
365 | public function restore_settings_feedback() {
366 | require( ABSPATH . 'wp-admin/options-head.php' );
367 | }
368 |
369 | /**
370 | * Handle settings changes for multisite configs.
371 | *
372 | * @since 1.0.0
373 | */
374 | public function load_mediatheque_settings() {
375 | add_action( 'all_admin_notices', array( $this, 'restore_settings_feedback' ) );
376 |
377 | if ( ! empty( $_POST['mediatheque_settings'] ) && ! empty( $_POST['option_page'] ) ) {
378 | $option_page = $_POST['option_page'];
379 |
380 | check_admin_referer( $option_page . '-options' );
381 |
382 | $options = apply_filters( 'whitelist_options', array() );
383 |
384 | if ( isset( $options[ $option_page ] ) ) {
385 |
386 | foreach ( $options[$option_page] as $option ) {
387 |
388 | $option = trim( $option );
389 | $value = null;
390 |
391 | if ( isset( $_POST[ $option ] ) ) {
392 | $value = $_POST[ $option ];
393 |
394 | if ( ! is_array( $value ) ) {
395 | $value = trim( $value );
396 | }
397 |
398 | $value = wp_unslash( $value );
399 | }
400 |
401 | update_network_option( 0, $option, $value );
402 | }
403 | }
404 |
405 | wp_redirect( add_query_arg( 'updated', 'true', wp_get_referer() ) );
406 | exit;
407 | }
408 | }
409 |
410 | /**
411 | * Media options' form
412 | *
413 | * @since 1.0.0
414 | */
415 | function do_settings() {
416 | $form_url = self_admin_url( 'options.php' );
417 | if ( is_multisite() ) {
418 | $form_url = add_query_arg( 'page', 'user-media-options', self_admin_url( 'settings.php' ) );
419 | }
420 |
421 | $setting_section = str_replace( '-network', '', get_current_screen()->id );
422 | ?>
423 |
424 |
425 |
426 |
436 |
437 |
438 |
439 |
440 |
458 |
459 |
460 |
461 |
479 |
480 |
481 | %2$s
482 |
483 | ', esc_html( $this->title ), mediatheque_print_containers( false ) );
484 |
485 | mediatheque_print_template_parts();
486 | }
487 |
488 | /**
489 | * Adds a card to the tools screen to describe the Vanished media logs tool.
490 | *
491 | * @since 1.0.0
492 | */
493 | public function tools_card() {
494 | $page = add_query_arg( 'page', 'user-media-tools', self_admin_url( 'tools.php' ) );
495 | ?>
496 |
497 |
498 |
outil.', 'mediatheque' ), esc_url( $page ) ); ?>
499 |
500 | 'user-media-tools',
511 | 'reset' => 1,
512 | ) , self_admin_url( 'tools.php' ) );
513 |
514 | if ( ! empty( $_GET['reset'] ) ) {
515 | delete_option( '_mediatheque_vanished_media' );
516 | $this->vanished_logs = array();
517 | }
518 | ?>
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
554 |
555 |
558 |
559 | settings_sections = apply_filters( 'mediatheque_get_settings_sections', array(
40 | 'settings_page_user-media-options' => array(
41 | 'title' => __( 'Options disponibles', 'mediatheque' ),
42 | 'callback' => 'mediatheque_settings_section_callback',
43 | ),
44 | ) );
45 |
46 | $this->settings_fields = apply_filters( 'mediatheque_get_settings_fields', array(
47 | 'settings_page_user-media-options' => array(
48 | 'mediatheque_capability' => array(
49 | 'title' => __( 'Capacités requises.', 'mediatheque' ),
50 | 'callback' => 'mediatheque_settings_field_capability',
51 | 'sanitize_callback' => 'mediatheque_sanitize_capability',
52 | ),
53 | 'mediatheque_mime_types' => array(
54 | 'title' => __( 'Types de fichier autorisés.', 'mediatheque' ),
55 | 'callback' => 'mediatheque_settings_field_mime_types',
56 | 'sanitize_callback' => 'mediatheque_sanitize_mime_types',
57 | ),
58 | 'mediatheque_personal_avatar' => array(
59 | 'title' => __( 'Images de profil.', 'mediatheque' ),
60 | 'callback' => 'mediatheque_settings_field_avatars',
61 | 'sanitize_callback' => 'absint',
62 | ),
63 | 'mediatheque_disable_on_front_end' => array(
64 | 'title' => __( 'Bouton MediaThèque en frontal.', 'mediatheque' ),
65 | 'callback' => 'mediatheque_settings_field_front_end_button',
66 | 'sanitize_callback' => 'absint',
67 | ),
68 | ),
69 | ) );
70 |
71 | // Register the settings once the Administration is inited.
72 | add_action( 'admin_init', array( $this, 'register_settings' ) );
73 | }
74 |
75 | /**
76 | * Register the MediaThèque settings.
77 | *
78 | * @since 1.0.0
79 | */
80 | public function register_settings() {
81 | // Add settings sections.
82 | foreach ( (array) $this->settings_sections as $ks => $section ) {
83 | if ( empty( $section['title'] ) || empty( $section['callback'] ) ) {
84 | continue;
85 | }
86 |
87 | // Add the section.
88 | add_settings_section( $ks, $section['title'], $section['callback'], $ks );
89 | }
90 |
91 | // Add settings fields
92 | foreach ( (array) $this->settings_fields as $section_id => $fields ) {
93 | // Check the section exists.
94 | if ( ! isset( $this->settings_sections[ $section_id ] ) ) {
95 | continue;
96 | }
97 |
98 | foreach ( $fields as $option => $field ) {
99 | if ( empty( $field['title'] ) || empty( $field['callback'] ) || empty( $field['sanitize_callback'] ) ) {
100 | continue;
101 | }
102 |
103 | if ( empty( $field['args'] ) ) {
104 | $field['args'] = array();
105 | }
106 |
107 | // Add the field
108 | add_settings_field( $option, $field['title'], $field['callback'], $section_id, $section_id, $field['args'] );
109 |
110 | // Register the setting
111 | register_setting( $section_id, $option, $field['sanitize_callback'] );
112 | }
113 | }
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/inc/hooks.php:
--------------------------------------------------------------------------------
1 | 'exist',
121 | 'mediatheque_mime_types' => mediatheque_get_default_mime_types(),
122 | 'mediatheque_personal_avatar' => 1,
123 | 'mediatheque_disable_on_front_end' => 0,
124 | ) );
125 | }
126 |
--------------------------------------------------------------------------------
/inc/settings.php:
--------------------------------------------------------------------------------
1 | role_names;
27 | $setting = mediatheque_get_required_cap();
28 |
29 | $caps = array(
30 | 'exist' => __( 'Utilisateur connecté', 'mediatheque' ),
31 | );
32 |
33 | if ( isset( $role_names['subscriber'] ) ) {
34 | $caps['read'] = translate_user_role( $role_names['subscriber'] );
35 | }
36 |
37 | if ( isset( $role_names['contributor'] ) ) {
38 | $caps['edit_posts'] = translate_user_role( $role_names['contributor'] );
39 | }
40 | ?>
41 |
50 |
51 | $translated_type ) {
83 | if ( 'code' === $k_type ) {
84 | continue;
85 | }
86 | ?>
87 |
113 |
142 | />
143 |
144 |
151 | />
152 |
153 |
96 |
97 |
98 |
99 |
100 |
101 | ';
102 |
103 | if ( true === $editor ) {
104 | printf( '', $base_layout );
105 | mediatheque_print_template_parts();
106 | }
107 |
108 | return $base_layout;
109 | }
110 |
111 | /**
112 | * Outputs the Mediatheque button & UI.
113 | *
114 | * @since 1.0.0
115 | *
116 | * @param array $args {
117 | * An array of arguments.
118 | * @type string $editor_id Optional. The WordPress Editor css ID.
119 | * @type array $editor_btn_classes Optional. The list of CSS classes for the button.
120 | * @type string $editor_btn_text Optional. The caption for the button.
121 | * @type string $editor_btn_dashicon Optional. The dashicon to use for the button.
122 | * @type boolean $echo Optional. True to output, false to return.
123 | * @type string $media_type Optional. The file types to filter the User Media query with.
124 | * {@see mediatheque_get_i18n_media_type() for available keys}}
125 | * }
126 | */
127 | function mediatheque_button( $args = array() ) {
128 | static $instance = 0;
129 | $instance++;
130 |
131 | $r = wp_parse_args( $args, array(
132 | 'editor_id' => 'content',
133 | 'editor_btn_classes' => array( 'mediatheque-insert' ),
134 | 'editor_btn_text' => __( 'Ajouter un media', 'mediatheque' ),
135 | 'editor_btn_dashicon' => 'mediatheque-icon',
136 | 'echo' => true,
137 | 'media_type' => '',
138 | ) );
139 |
140 | $post = get_post();
141 | if ( ! $post && ! empty( $GLOBALS['post_ID'] ) ) {
142 | $post = $GLOBALS['post_ID'];
143 | }
144 |
145 | wp_enqueue_media( array(
146 | 'post' => $post
147 | ) );
148 |
149 | if ( ! empty( $r['media_type'] ) ) {
150 | wp_add_inline_script( 'mediatheque-views', sprintf( '
151 | var mediaThequeCustoms = %s;
152 | ',
153 | json_encode( array( 'mediaType' => $r['media_type'] ) )
154 | ) );
155 | }
156 |
157 | if ( ! is_admin() ) {
158 | wp_enqueue_style( 'mediatheque-front' );
159 | mediatheque_load_mce_views();
160 | }
161 |
162 | $img = '';
163 | $output = '%s';
164 |
165 | if ( false !== $r['editor_btn_dashicon'] ) {
166 | if ( 'mediatheque-icon' === $r['editor_btn_dashicon'] ) {
167 | $img = sprintf( ' ', mediatheque_get_svg_icon( '#555d66', '#fafafa' ) );
168 | } else {
169 | $img = ' ';
170 | }
171 |
172 | $output = '';
173 | }
174 |
175 | $id_attribute = $instance === 1 ? ' id="insert-mediabrary-item"' : '';
176 |
177 | if ( true === $r['echo' ] ) {
178 | printf( $output,
179 | $id_attribute,
180 | join( ' ', array_map( 'sanitize_html_class', $r['editor_btn_classes'] ) ),
181 | esc_attr( $r['editor_id'] ),
182 | $img . $r['editor_btn_text']
183 | );
184 | }
185 |
186 | return sprintf( $output,
187 | $id_attribute,
188 | join( ' ', array_map( 'sanitize_html_class', $r['editor_btn_classes'] ) ),
189 | esc_attr( $r['editor_id'] ),
190 | $img . $r['editor_btn_text']
191 | );
192 | }
193 |
194 | /**
195 | * Adds a button to open a light WP Media Editor for users without the 'upload_files' capability.
196 | *
197 | * @since 1.0.0
198 | *
199 | * @param string $editor The editor HTML Output.
200 | * @return string $editor The editor HTML Output.
201 | */
202 | function mediatheque_the_editor( $editor = '' ) {
203 | $mediatheque = mediatheque();
204 |
205 | if ( empty( $mediatheque->editor_id ) || ! current_user_can( 'publish_user_uploads' ) ) {
206 | return $editor;
207 | }
208 |
209 | return sprintf( '%2$s
%3$s',
210 | esc_attr( $mediatheque->editor_id ),
211 | mediatheque_button( array(
212 | 'editor_id' => $mediatheque->editor_id,
213 | 'editor_btn_classes' => array( 'mediatheque-insert' ),
214 | 'echo' => false,
215 | ) ),
216 | $editor
217 | );
218 | }
219 |
220 | /**
221 | * Returns the [mediatheque] shortcode output.
222 | *
223 | * @since 1.0.0
224 | * @since 1.2.0 Adds a new `user_id` Shortcode attributes to get
225 | * a specific user's public media files.
226 | *
227 | * @param array $attr Attributes of the [mediatheque] shortcode.
228 | * @return string HTML Output.
229 | */
230 | function mediatheque_get_display_content( $attr ) {
231 | $content = '';
232 |
233 | if ( did_action( 'mediatheque_display_content' ) ) {
234 | return $content;
235 | }
236 |
237 | $is_main_site = mediatheque_is_main_site();
238 |
239 | if ( ! $is_main_site ) {
240 | switch_to_blog( get_current_network_id() );
241 | }
242 |
243 | $atts = shortcode_atts( array(
244 | 'directory' => 0,
245 | 'width' => '100%',
246 | 'height' => '450px',
247 | 'user_id' => 0,
248 | ), $attr, 'mediatheque' );
249 |
250 | // Globalize template tags
251 | mediatheque_set_template_tags( $atts );
252 |
253 | $template = mediatheque_locate_template_part( 'display', 'php' );
254 |
255 | if ( $template ) {
256 | wp_enqueue_script( 'mediatheque-display' );
257 | mediatheque_localize_script( 'mediatheque-views', $atts['user_id'] );
258 |
259 | wp_enqueue_style( 'mediatheque-ui' );
260 |
261 | ob_start();
262 |
263 | load_template( $template, true );
264 |
265 | $content = ob_get_clean();
266 | }
267 |
268 | do_action( 'mediatheque_display_content' );
269 |
270 | if ( ! $is_main_site ) {
271 | restore_current_blog();
272 | }
273 |
274 | return $content;
275 | }
276 | add_shortcode( 'mediatheque', 'mediatheque_get_display_content' );
277 |
278 | /**
279 | * Builds the User Media's Thumbnail Output for the embed template.
280 | *
281 | * @since 1.0.0
282 | *
283 | * @param string $excerpt The embed User Media's excerpt.
284 | * @param WP_Post $user_media The User Media Object.
285 | * @param string $type Whether it's a 'directory' or a 'user-media'.
286 | * @return string HTML Output.
287 | */
288 | function mediatheque_prepend_embed_thumbnail( $excerpt = '', $user_media = null, $type = 'user-media' ) {
289 | $user_media = get_post( $user_media );
290 |
291 | if ( empty( $user_media->ID ) ) {
292 | return $excerpt;
293 | }
294 |
295 | $pattern = '';
296 |
297 | $media_icon = '';
298 | if ( 'directory' === $type ) {
299 | // Set the displayed directory.
300 | mediatheque_set_displayed_directory( $user_media->ID );
301 |
302 | $media_icon = sprintf(
303 | $pattern,
304 | esc_url_raw( mediatheque_assets_url() . 'folder.svg' ),
305 | '50%',
306 | '50%'
307 | );
308 | } else {
309 | $filedata = mediatheque_get_media_info( $user_media, 'all' );
310 |
311 | if ( isset( $filedata['media_type'] ) ) {
312 | if ( 'image' === $filedata['media_type'] ) {
313 | $thumb_data = mediatheque_image_get_intermediate_size( $user_media, 'thumbnail' );
314 |
315 | if ( isset( $thumb_data['url'] ) ) {
316 | $media_icon = sprintf(
317 | '
',
318 | esc_url_raw( $thumb_data['url'] )
319 | );
320 | }
321 |
322 | } else {
323 | $media_icon = sprintf(
324 | $pattern,
325 | esc_url_raw( wp_mime_type_icon( $filedata['media_type'] ) ),
326 | '48px 64px',
327 | '50%'
328 | );
329 | }
330 | }
331 | }
332 |
333 | if ( ! $excerpt && 'user-media' === $type ) {
334 | $media_type = mediatheque_get_i18n_media_type( $filedata['media_type'] );
335 | $media_title = basename( $user_media->guid );
336 | $media_size = mediatheque_format_file_size( $filedata['size'] / 1000 );
337 |
338 | $excerpt = sprintf( '
339 | - %1$s
-
340 |
- %2$s (%3$s)
341 |
',
342 | esc_html( $media_title ),
343 | esc_html( $media_type ),
344 | esc_html( $media_size )
345 | );
346 | }
347 |
348 | $thumbnail = sprintf( '', get_post_permalink( $user_media ), $media_icon );
353 |
354 | return $thumbnail . "\n" . $excerpt;
355 | }
356 |
357 | /**
358 | * Make sure the User Media file is prepended to its description.
359 | *
360 | * @since 1.0.0
361 | *
362 | * @param string $content The User Media description.
363 | * @return string The User Media description.
364 | */
365 | function mediatheque_prepend_user_media( $content = '' ) {
366 | if ( 'user_media' !== get_post_type() || empty( $GLOBALS['post'] ) ) {
367 | return $content;
368 | }
369 |
370 | $mediatheque = mediatheque();
371 | $term_ids = wp_get_object_terms( $GLOBALS['post']->ID, 'user_media_types', array( 'fields' => 'ids' ) );
372 | $directory_id = mediatheque_get_user_media_type_id( 'mediatheque-directory' );
373 |
374 | // Single Directory display
375 | if ( in_array( $directory_id, $term_ids, true ) ) {
376 | if ( ! is_embed() ){
377 | $content .= "\n" . mediatheque_get_display_content( array(
378 | 'directory' => $GLOBALS['post']->ID,
379 | ) );
380 | } else {
381 | $content = mediatheque_prepend_embed_thumbnail( $content, $GLOBALS['post'], 'directory' );
382 | }
383 |
384 | // Single User Media display
385 | } else {
386 | if ( ! is_embed() ) {
387 | /**
388 | * Some themes are first outputing the Attachment image before the content.
389 | *
390 | * eg: Twenty Nineteen, TwentySixteen.
391 | *
392 | * If the image has been output, no need to prepend the content with it.
393 | */
394 | if ( did_action( 'mediatheque_image_downsized' ) ) {
395 | return $content;
396 | }
397 |
398 | $mediatheque->user_media_link = mediatheque_get_download_url( $GLOBALS['post'] );
399 |
400 | // Overrides
401 | $reset_post = clone $GLOBALS['post'];
402 | $GLOBALS['post']->post_type = 'attachment';
403 | wp_cache_set( $reset_post->ID, $GLOBALS['post'], 'posts' );
404 | add_filter( 'wp_get_attachment_link', 'mediatheque_attachment_link', 10, 1 );
405 |
406 | $content = prepend_attachment( $content );
407 |
408 | // Resets
409 | $GLOBALS['post'] = $reset_post;
410 | wp_cache_set( $reset_post->ID, $reset_post, 'posts' );
411 | remove_filter( 'the_content', 'mediatheque_prepend_user_media', 11 );
412 | remove_filter( 'wp_get_attachment_link', 'mediatheque_attachment_link', 10, 1 );
413 |
414 | unset( $mediatheque->user_media_link );
415 | } else {
416 | $content = mediatheque_prepend_embed_thumbnail( $content, $GLOBALS['post'], 'user-media' );
417 | }
418 | }
419 |
420 | $GLOBALS['wp_query']->is_attachment = false;
421 |
422 | return $content;
423 | }
424 |
425 | /**
426 | * Hide the vanished User Media or warn the Administrator of it.
427 | *
428 | * @since 1.0.0
429 | *
430 | * @param string $link The oembed link output.
431 | * @param string $url The requested URL.
432 | * @return string An empty string for regular users, a warning message for Admins
433 | */
434 | function mediatheque_maybe_hide_link( $link = '', $url = '' ) {
435 | if ( empty( $link ) || empty( $url ) ) {
436 | return $link;
437 | }
438 |
439 | $mediatheque_url = mediatheque_oembed_get_url_args( $url );
440 |
441 | if ( empty( $mediatheque_url['attached'] ) ) {
442 | return $link;
443 | }
444 |
445 | if ( ! current_user_can( 'manage_options' ) ) {
446 | $vanished_media_log = get_option( '_mediatheque_vanished_media', array() );
447 | $query_vars = parse_url( $url, PHP_URL_QUERY );
448 | $s = str_replace( '?' . $query_vars, '', $url );
449 |
450 | if ( ! in_array( $s, $vanished_media_log, true ) ) {
451 | update_option( '_mediatheque_vanished_media', array_merge( $vanished_media_log, array( $s ) ) );
452 |
453 | $search_posts = new WP_Query;
454 | $search_results = mediatheque_get_attached_posts( $s );
455 |
456 | if ( ! empty( $search_results ) ) {
457 | $warning = _n(
458 | 'Ci-dessous le titre du contenu dans lequel le media est présent :',
459 | 'Ci-dessous la liste des titres de contenu dans lesquels le media est présent :',
460 | count( $search_results ),
461 | 'mediatheque'
462 | );
463 |
464 | foreach ( $search_results as $p ) {
465 | $post_type_object = get_post_type_object( $p->post_type );
466 |
467 | $link = '';
468 | if ( $post_type_object->_edit_link ) {
469 | $link = ' ( ' . esc_url_raw( admin_url( sprintf( $post_type_object->_edit_link . '&action=edit', $p->ID ) ) ) . ' )';
470 | }
471 |
472 | $warning .= "\n " . sprintf( '- %1$s%2$s', esc_html( $p->post_title ), $link );
473 | }
474 |
475 | wp_mail(
476 | get_option( 'admin_email' ),
477 | "[ " . wp_specialchars_decode( get_option( 'blogname' ) ) . " ] " . __( 'Media disparu', 'mediatheque' ),
478 | $warning
479 | );
480 | }
481 | }
482 |
483 | return '';
484 | }
485 |
486 | return sprintf(
487 | '',
488 | '¯\_(ツ)_/¯',
489 | __( 'Hum hum, il semble que ce media ait mystérieusement disparu.', 'mediatheque' )
490 | );
491 | }
492 |
493 | /**
494 | * Sets and globalizes the displayed directory.
495 | *
496 | * @since 1.0.0
497 | *
498 | * @param integer $id The directory ID.
499 | */
500 | function mediatheque_set_displayed_directory( $id = 0 ) {
501 | mediatheque()->template_tags->directory = $id;
502 | }
503 |
504 | /**
505 | * Sets and globalizes a list of template tags.
506 | *
507 | * @since 1.0.0
508 | *
509 | * @param array $id The list of template tags.
510 | */
511 | function mediatheque_set_template_tags( $tags = array() ) {
512 | if ( empty( $tags ) || ! is_array( $tags ) ) {
513 | return;
514 | }
515 |
516 | $mediatheque = mediatheque();
517 |
518 | foreach ( $tags as $kt => $vt ) {
519 | $mediatheque->template_tags->{$kt} = $vt;
520 | }
521 | }
522 |
523 | /**
524 | * Gets the output for a template tag.
525 | *
526 | * @since 1.0.0
527 | *
528 | * @param string $tag The template tag's key.
529 | * @return mixed The output for the template tag.
530 | */
531 | function mediatheque_get_tag( $tag = '' ) {
532 | $content_tag = 0;
533 |
534 | if ( ! $tag ) {
535 | return $content_tag;
536 | }
537 |
538 | $mediatheque = mediatheque();
539 |
540 | if ( isset( $mediatheque->template_tags->{$tag} ) ) {
541 | $content_tag = $mediatheque->template_tags->{$tag};
542 | }
543 |
544 | /**
545 | * Filter here to edit the $tag output.
546 | *
547 | * @since 1.0.0
548 | *
549 | * @param mixed $content_tag The output for the template tag.
550 | */
551 | return apply_filters( 'mediatheque_get_displayed_' . $tag , $content_tag );
552 | }
553 |
554 | /**
555 | * Gets the displayed directory.
556 | *
557 | * @since 1.0.0
558 | *
559 | * @return integer The displayed directory.
560 | */
561 | function mediatheque_get_displayed_directory() {
562 | return (int) mediatheque_get_tag( 'directory' );
563 | }
564 |
565 | /**
566 | * Print the User Media excerpt for the embed template.
567 | *
568 | * @since 1.0.0
569 | */
570 | function mediatheque_embed_excerpt() {
571 | $excerpt = apply_filters( 'the_excerpt_embed', get_the_excerpt() );
572 | $excerpt = mediatheque_prepend_user_media( $excerpt );
573 |
574 | /**
575 | * Filter here to edit the embed excerpt.
576 | *
577 | * @since 1.0.0
578 | *
579 | * @param string $excerpt The embed excerpt.
580 | */
581 | echo apply_filters( 'mediatheque_embed_excerpt', $excerpt );
582 | }
583 |
584 | /**
585 | * Prints the necessary markup for the embed download button.
586 | *
587 | * @since 1.0.0
588 | */
589 | function mediatheque_embed_download_button() {
590 | if ( 'private' === get_post_status() ) {
591 | return;
592 | }
593 |
594 | if ( mediatheque_get_displayed_directory() ) {
595 | $dashicon = 'files';
596 | $url = get_post_permalink();
597 | $text = __( 'Afficher', 'mediatheque' );
598 | } else {
599 | $dashicon = 'download';
600 | $url = mediatheque_get_download_url();
601 | $text = __( 'Télécharger', 'mediatheque' );
602 | }
603 |
604 | printf(
605 | '',
611 | esc_attr( $dashicon ),
612 | esc_url( $url ),
613 | sprintf(
614 | '%1$s %2$s',
615 | esc_html( $text ),
616 | esc_html( get_the_title() )
617 | )
618 | );
619 | }
620 |
--------------------------------------------------------------------------------
/inc/upgrade.php:
--------------------------------------------------------------------------------
1 | $option_value ) {
64 | add_network_option( 0, $option_name, $option_value );
65 | }
66 |
67 | /**
68 | * Trigger the 'mediatheque_install' action.
69 | *
70 | * @since 1.0.0
71 | */
72 | do_action( 'mediatheque_install' );
73 |
74 | } elseif ( mediatheque_is_upgrade() ) {
75 | /**
76 | * Trigger the 'mediatheque_upgrade' action.
77 | *
78 | * @since 1.0.0
79 | */
80 | do_action( 'mediatheque_upgrade', $db_version );
81 | }
82 |
83 | // Force rewrite rules to be refreshed
84 | if ( get_option( 'permalink_structure' ) ) {
85 | delete_option( 'rewrite_rules' );
86 | }
87 |
88 | if ( ! $is_main_site ) {
89 | restore_current_blog();
90 | }
91 |
92 | // Update the db version.
93 | update_network_option( 0, 'mediatheque_version', $db_version );
94 | }
95 | add_action( 'admin_init', 'mediatheque_upgrade', 999 );
96 |
97 | /**
98 | * Used to guide the user when new features are added.
99 | *
100 | * @since 1.0.0.
101 | */
102 | function mediatheque_get_pointers() {
103 | $pointers = array(
104 | 'user-media-permalinks' => array(
105 | 'title' => __( 'Modifiez la structure de vos permaliens.', 'mediatheque' ),
106 | 'content' => __( 'MediaThèque nécessite que la structure de vos permaliens soit différente que celle définie par défaut.', 'mediatheque' ),
107 | 'position' => 'bottom',
108 | ),
109 | 'menu-settings' => array(
110 | 'title' => __( 'Options des media utilisateurs', 'mediatheque' ),
111 | 'content' => __( 'Personnalisez les options des media utilisateurs depuis les réglages des media.', 'mediatheque' ),
112 | 'position' => 'bottom',
113 | ),
114 | 'menu-media' => array(
115 | 'title' => __( 'Gestion des media utilisateurs', 'mediatheque' ),
116 | 'content' => __( 'Vous pouvez gérer les media utilisateurs depuis le sous-menu de la bibliothèque de media correspondant.', 'mediatheque' ),
117 | 'position' => 'top',
118 | ),
119 | 'toplevel_page_user-media' => array(
120 | 'title' => __( 'Accédez à votre MediaThèque', 'mediatheque' ),
121 | 'content' => __( 'Vous pouvez ajouter, organiser et supprimer vos media utilisateurs depuis ce menu.', 'mediatheque' ),
122 | 'position' => 'top',
123 | ),
124 | );
125 |
126 | if ( is_multisite() ) {
127 | if ( is_super_admin() ) {
128 | $pointers['toplevel_page_user-media']['title'] = $pointers['menu-media']['title'];
129 | $pointers['toplevel_page_user-media']['content'] = __( 'Vous pouvez gérer les media de tous les utilisateurs depuis ce menu.', 'mediatheque' );
130 | unset( $pointers['menu-media'] );
131 | } else {
132 | $pointers['menu-media']['content'] = $pointers['toplevel_page_user-media']['content'];
133 | }
134 | }
135 |
136 | return $pointers;
137 | }
138 |
--------------------------------------------------------------------------------
/inc/users.php:
--------------------------------------------------------------------------------
1 | 'edit_user_upload',
23 | 'read_post' => 'read_user_upload',
24 | 'delete_post' => 'delete_user_upload',
25 | 'edit_posts' => 'edit_user_uploads',
26 | 'edit_others_posts' => 'edit_others_user_uploads',
27 | 'publish_posts' => 'publish_user_uploads',
28 | 'read_private_posts' => 'read_private_user_uploads',
29 | 'read' => 'read_user_upload',
30 | 'delete_posts' => 'delete_user_uploads',
31 | 'delete_private_posts' => 'delete_private_user_uploads',
32 | 'delete_published_posts' => 'delete_published_user_uploads',
33 | 'delete_others_posts' => 'delete_others_user_uploads',
34 | 'edit_private_posts' => 'edit_private_user_uploads',
35 | 'edit_published_posts' => 'edit_published_user_uploads',
36 | 'create_posts' => 'create_user_uploads',
37 | );
38 | }
39 |
40 | /**
41 | * Get the capabilities for the User media types.
42 | *
43 | * @since 1.0.0
44 | *
45 | * @return array The capabilities for the User media types.
46 | */
47 | function mediatheque_types_capabilities() {
48 | return array(
49 | 'manage_terms' => 'manage_upload_types',
50 | 'edit_terms' => 'edit_upload_types',
51 | 'delete_terms' => 'delete_upload_types',
52 | 'assign_terms' => 'assign_upload_types',
53 | );
54 | }
55 |
56 | /**
57 | * Get All capabilities for User Media Objects.
58 | *
59 | * @since 1.0.0
60 | *
61 | * @return array All capabilities for User Media Objects.
62 | */
63 | function mediatheque_get_all_caps() {
64 | return array_merge( mediatheque_capabilities(), mediatheque_types_capabilities() );
65 | }
66 |
67 | /**
68 | * Map capabilities for User Media
69 | *
70 | * @since 1.0.0
71 | *
72 | * @param array $caps Capabilities for meta capability
73 | * @param string $cap Capability name
74 | * @param int $user_id User id
75 | * @param mixed $args Arguments
76 | * @return array Actual capabilities for meta capability
77 | */
78 | function mediatheque_map_meta_caps( $caps = array(), $cap = '', $user_id = 0, $args = array() ) {
79 | if ( in_array( $cap, mediatheque_get_all_caps(), true ) ) {
80 | if ( $user_id ) {
81 | $required_cap = mediatheque_get_required_cap();
82 | $admin_caps = mediatheque_types_capabilities();
83 | unset( $admin_caps['assign_terms'] );
84 | $admin_caps = array_merge( $admin_caps, array(
85 | 'edit_user_uploads',
86 | 'edit_others_user_uploads',
87 | 'delete_user_uploads',
88 | 'delete_private_user_uploads',
89 | 'delete_published_user_uploads',
90 | 'delete_others_user_uploads',
91 | 'edit_private_user_uploads',
92 | 'edit_published_user_uploads',
93 | ) );
94 |
95 | $admin_cap = 'manage_options';
96 | if ( is_multisite() ) {
97 | $admin_cap = 'manage_network_options';
98 | }
99 |
100 | if ( in_array( $cap, $admin_caps, true ) ) {
101 | $caps = array( $admin_cap );
102 | } else {
103 | $caps = array( $required_cap );
104 | $manage_caps = array(
105 | 'edit_user_upload',
106 | 'delete_user_upload',
107 | );
108 |
109 | $author = 0;
110 | if ( ! empty( $args[0] ) ) {
111 | $author = get_post_field( 'post_author', $args[0] );
112 | }
113 |
114 | if ( in_array( $cap, $manage_caps, true ) && ( ! $author || (int) $author !== (int) $user_id ) ) {
115 | $caps = array( $admin_cap );
116 | }
117 | }
118 | }
119 |
120 | // Allow regular users to set the User Media display preference if WP Editor is used from front-end.
121 | } elseif ( wp_doing_ajax() && isset( $_POST['action'] ) && 'parse-embed' === $_POST['action'] ) {
122 | if ( $user_id && ! empty( $_POST['shortcode'] ) ) {
123 | $url = str_replace( array( '[embed]', '[/embed]' ), '', $_POST['shortcode'] );
124 |
125 | if ( 0 === strpos( $url, trailingslashit( network_site_url() ) . mediatheque_get_root_slug() ) ) {
126 | $caps = array( mediatheque_get_required_cap() );
127 | }
128 | }
129 | }
130 |
131 | /**
132 | * Filter here to edit the capabilities map.
133 | *
134 | * @since 1.0.0
135 | *
136 | * @param array $caps Capabilities for meta capability
137 | * @param string $cap Capability name
138 | * @param int $user_id User id
139 | * @param mixed $args Arguments
140 | */
141 | return apply_filters( 'mediatheque_map_meta_caps', $caps, $cap, $user_id, $args );
142 | }
143 |
144 | /**
145 | * Sanitize the disk usage or personal avatar id user meta.
146 | *
147 | * @since 1.0.0
148 | *
149 | * @param int $value The raw value of the disk usage user meta.
150 | * @param string $meta_key The user meta key.
151 | * @return int $value The sanitized disk usage user meta.
152 | */
153 | function mediatheque_meta_sanitize_value( $value = '', $meta_key = '' ) {
154 | if ( '_mediatheque_disk_usage' === $meta_key || 'personal_avatar' === $meta_key ) {
155 | $value = (int) $value;
156 | }
157 |
158 | return $value;
159 | }
160 |
161 | /**
162 | * Auth callback for the Personal avatar usermeta.
163 | *
164 | * @since 1.0.0
165 | *
166 | * @param boolean $auth True to allow edit. False otherwise.
167 | * @param string $meta_key The usermeta key.
168 | * @param integer $object_id The Object Id.
169 | * @param integer $user_id The User ID.
170 | * @return boolean True to allow edit. False otherwise.
171 | */
172 | function mediatheque_meta_auth_personal_avatar( $auth = false, $meta_key = '', $object_id = 0, $user_id = 0 ) {
173 | if ( 'personal_avatar' !== $meta_key ) {
174 | return $auth;
175 | }
176 |
177 | return ! empty( $object_id ) && ( (int) $object_id === (int) $user_id || is_super_admin() );
178 | }
179 |
180 | /**
181 | * Prepare the disk usage user meta for rest requests.
182 | *
183 | * @since 1.0.0
184 | *
185 | * @param mixed $value Meta value to prepare.
186 | * @param WP_REST_Request $request Rest request object.
187 | * @param array $args Options for the field.
188 | * @return string $value The prepared value.
189 | */
190 | function mediatheque_disk_usage_prepare( $value, WP_REST_Request $request, $args ) {
191 | return mediatheque_format_file_size( $value );
192 | }
193 |
194 | /**
195 | * Update a user's disk usage.
196 | *
197 | * @since 1.0.0
198 | *
199 | * @param int $user_id The ID of the user.
200 | * @param int $bytes The number of bytes to add to user's disk usage.
201 | * @return bool True on success, false otherwise.
202 | */
203 | function mediatheque_disk_usage_update( $user_id = 0, $bytes = 0, $remove = false ) {
204 | if ( empty( $user_id ) || empty( $bytes ) ) {
205 | return false;
206 | }
207 |
208 | $kilo_bytes = absint( $bytes / 1000 );
209 |
210 | // Do nothing if the file is less than a kilobyte.
211 | if ( ! $kilo_bytes ) {
212 | return true;
213 | }
214 |
215 | // Get the user's disk usage
216 | $disk_usage = (int) get_user_meta( $user_id, '_mediatheque_disk_usage', true );
217 |
218 | if ( $disk_usage ) {
219 | if ( true === $remove ) {
220 | $disk_usage = $disk_usage - $kilo_bytes;
221 | } else {
222 | $disk_usage = $disk_usage + $kilo_bytes;
223 | }
224 |
225 | } elseif ( true !== $remove ) {
226 | $disk_usage = $kilo_bytes;
227 | }
228 |
229 | // no negative disk usage!
230 | if ( $disk_usage < 0 ) {
231 | delete_user_meta( $user_id, '_mediatheque_disk_usage' );
232 |
233 | // Update user's disk usage.
234 | } else {
235 | update_user_meta( $user_id, '_mediatheque_disk_usage', absint( $disk_usage ) );
236 | }
237 |
238 | return true;
239 | }
240 |
241 | /**
242 | * Add an additionnal rest query params to users.
243 | *
244 | * @since 1.0.0
245 | *
246 | * @param array $query_params The query params for the users collection
247 | * @return array The query params for the users collection.
248 | */
249 | function mediatheque_additionnal_user_rest_param( $query_params = array() ) {
250 | return array_merge( $query_params, array(
251 | 'has_disk_usage' => array(
252 | 'description' => __( 'True pour limiter les résultats aux utilisateurs ayant soumis des fichiers.', 'mediatheque' ),
253 | 'type' => 'boolean',
254 | )
255 | ) );
256 | }
257 |
258 | /**
259 | * Prepare the disk usage user meta for rest requests.
260 | *
261 | * @since 1.0.0
262 | *
263 | * @param array $prepared_args The prepared params for the users collection.
264 | * @param WP_REST_Request $request Rest request object.
265 | * @return array $prepared_args The prepared params for the users collection.
266 | */
267 | function mediatheque_rest_user_query( $prepared_args, WP_REST_Request $request ) {
268 | if ( $request->get_param( 'has_disk_usage' ) ) {
269 | $capacity = 'list_users';
270 |
271 | if ( is_multisite() ) {
272 | $capacity = 'manage_network_users';
273 | }
274 |
275 | $headers = $request->get_headers();
276 | if ( ! empty( $headers['referer'] ) ) {
277 | $referer = array_shift( $headers['referer'] );
278 | $is_network_admin = 0 === strpos( $referer, network_admin_url() );
279 | }
280 |
281 | // Regular users/site admins can't browse or edit other users files.
282 | if ( ! current_user_can( $capacity ) || empty( $is_network_admin ) ) {
283 | return array_merge( $prepared_args, array( 'login' => '0' ) );
284 |
285 | // Authorized users can browse and edit other users files.
286 | } else {
287 | $p_args = array(
288 | 'meta_key' => '_mediatheque_disk_usage',
289 | 'meta_compare' => 'EXISTS',
290 | );
291 |
292 | // Reset the blog ID to 0 to get all network users.
293 | if ( ! empty( $is_network_admin ) ) {
294 | $p_args['blog_id'] = 0;
295 | }
296 |
297 | // We are only listing the users who uploaded at least one file.
298 | $prepared_args = array_merge( $prepared_args, $p_args );
299 |
300 | // Make sure the Admin has the meta set to include him in results.
301 | $user_id = get_current_user_id();
302 |
303 | $disk_usage = get_user_meta( $user_id, '_mediatheque_disk_usage', true );
304 | if ( ! is_numeric( $disk_usage ) ) {
305 | update_user_meta( $user_id, '_mediatheque_disk_usage', 0 );
306 | }
307 | }
308 | }
309 |
310 | return $prepared_args;
311 | }
312 |
313 | /**
314 | * Remove all user's data when removed from the site.
315 | *
316 | * NB: No reassign is performed for now, it would require to move files and directories
317 | * and to regenerate all user media metadata. A hook is available if you want to build
318 | * this reassign.
319 | *
320 | * @since 1.0.0
321 | *
322 | * @param integer $user_id The deleted user's ID.
323 | * @param integer $reassign The reassigned user's ID.
324 | */
325 | function mediatheque_delete_user_data( $user_id = 0, $reassign = 0 ) {
326 | if ( ! $user_id ) {
327 | return;
328 | }
329 |
330 | $is_main_site = mediatheque_is_main_site();
331 |
332 | if ( ! $is_main_site ) {
333 | switch_to_blog( get_current_network_id() );
334 | }
335 |
336 | $mediatheque_statuses = wp_list_pluck( mediatheque_get_post_statuses( 'all' ), 'name' );
337 |
338 | $d_user_media = get_posts( array(
339 | 'post_type' => 'user_media',
340 | 'author' => $user_id,
341 | 'nopaging' => true,
342 | 'no_found_rows' => true,
343 | 'post_status' => $mediatheque_statuses,
344 | ) );
345 |
346 | /**
347 | * Hook here to use your own way of dealing with user deletion.
348 | *
349 | * NB: $d_user_media is passed by reference, setting it to an empty array
350 | * within your function will shortcircuit the rest of the function.
351 | *
352 | * @param integer $user_id The deleted user's ID.
353 | * @param integer $reassign The reassigned user's ID.
354 | * @param array $d_user_media The User Media to delete.
355 | */
356 | do_action_ref_array( 'mediatheque_before_delete_user_data', array( $user_id, $reassign, &$d_user_media ) );
357 |
358 | if ( empty( $d_user_media ) ) {
359 | return;
360 | }
361 |
362 | foreach ( $d_user_media as $user_media ) {
363 | mediatheque_delete_media( $user_media );
364 | }
365 |
366 | $mediatheque_upload_dir = mediatheque_get_upload_dir();
367 |
368 | foreach ( $mediatheque_statuses as $status ) {
369 | $dirpath = $mediatheque_upload_dir['path'] . '/' . $status . '/' . $user_id;
370 |
371 | if ( ! is_dir( $dirpath ) ) {
372 | continue;
373 | }
374 |
375 | // Remove the empty directory
376 | @ rmdir( $dirpath );
377 | }
378 |
379 | if ( ! $is_main_site ) {
380 | restore_current_blog();
381 | }
382 | }
383 |
--------------------------------------------------------------------------------
/js/block.js:
--------------------------------------------------------------------------------
1 | /* global _, mediaThequeSettings, mediaThequeBlock */
2 |
3 | ( function( $, wp ) {
4 | var el = wp.element.createElement,
5 | registerBlockType = wp.blocks.registerBlockType,
6 | InspectorControls = wp.editor.InspectorControls,
7 | BlockControls = wp.editor.BlockControls,
8 | AlignmentToolbar = wp.editor.AlignmentToolbar,
9 | EditToolbar = wp.components.Toolbar,
10 | PanelBody = wp.components.PanelBody,
11 | mediaThequeIcon = el( 'svg', {
12 | key : 'mediatheque-icon',
13 | 'aria-hidden': true,
14 | role : 'img',
15 | className : 'dashicon mediatheque-icon',
16 | focusable : 'false',
17 | width : '20',
18 | height : '20',
19 | viewBox : '0 0 20 20',
20 | xmlns : 'http://www.w3.org/2000/svg'
21 | }, [
22 | el( 'path', {
23 | key: 'camera',
24 | d: 'M 13 11 L 13 4 C 13 3.45 12.55 3 12 3 L 10.33 3 L 9 1 L 5 1 L 3.67 3 L 2 3 C 1.45 3 1 3.45 1 4 L 1 11 C 1 11.55 1.45 12 2 12 L 12 12 C 12.55 12 13 11.55 13 11 Z'
25 | } ),
26 | el( 'path', {
27 | key: 'sound',
28 | d: 'M 14 6 L 19 6 L 19 16.5 C 19 17.88 17.88 19 16.5 19 C 15.12 19 14 17.88 14 16.5 C 14 15.12 15.12 14 16.5 14 C 16.67 14 16.84 14.02 17 14.05 L 17 9 L 14 9 L 14 6 Z'
29 | } ),
30 | el( 'path', {
31 | key: 'user-head',
32 | d: 'M 7 4.5 C 8.38 4.5 9.5 5.62 9.5 7 C 9.5 8.38 8.38 9.5 7 9.5 C 5.62 9.5 4.5 8.38 4.5 7 C 4.5 5.62 5.62 4.5 7 4.5 Z',
33 | style: { fill: 'rgb(255, 255, 255)' }
34 | } ),
35 | el( 'path', {
36 | key: 'user-body',
37 | d: 'M 7.006 11.465 L 9.121 10.05 C 10.979 10.05 12.636 11.861 12.636 13.573 L 12.636 15.508 C 12.636 15.508 9.797 16.386 7.006 16.386 C 4.168 16.386 1.376 15.508 1.376 15.508 L 1.376 13.573 C 1.376 11.823 2.885 10.089 4.852 10.089 Z',
38 | style: { stroke: 'rgb(255, 255, 255)' }
39 | } )
40 | ]
41 | );
42 |
43 | registerBlockType( 'mediatheque/usermedia', {
44 |
45 | // Block Title
46 | title: 'MediaThèque',
47 |
48 | // Block Description
49 | description: mediaThequeBlock.description,
50 |
51 | // Block Icon
52 | icon: function() {
53 | return mediaThequeIcon;
54 | },
55 |
56 | // Block Category
57 | category: 'common',
58 |
59 | // Block Attributes
60 | attributes: {
61 | link: {
62 | type: 'string'
63 | },
64 | title: {
65 | type: 'string'
66 | },
67 | alignment: {
68 | type: 'string'
69 | }
70 | },
71 |
72 | edit: function( props ) {
73 | var alignment = props.attributes.alignment,
74 | focus = props.isSelected;
75 |
76 | var outputUserMedia = function( usermedia ) {
77 | $( '#' + props.clientId ).parent().find( '.notice-error' ).remove();
78 | $( '#' + props.clientId ).parent().removeClass( 'components-placeholder' );
79 | $( '#' + props.clientId ).before( usermedia ).remove();
80 | };
81 |
82 | var requestUserMedia = function( link ) {
83 | wp.ajax.post( 'parse-embed', {
84 | post_ID: wp.media.view.settings.post.id,
85 | type: 'embed',
86 | shortcode: '[embed]' + link + '[/embed]'
87 | } )
88 | .done( function( response ) {
89 | var userMediaFetched = true;
90 |
91 | if ( response.body ) {
92 | if ( 'A' === $( response.body ).prop( 'tagName' ) ) {
93 | userMediaFetched = $( response.body ).html();
94 | } else {
95 | userMediaFetched = response.body;
96 | }
97 |
98 | outputUserMedia( userMediaFetched );
99 | } else {
100 | userMediaFetched = 'error';
101 |
102 | props.setAttributes( {
103 | link: false
104 | } );
105 | }
106 |
107 | // Avoids fetching more than once
108 | props.setAttributes( { userMediaFetched: userMediaFetched } );
109 | } )
110 | .fail( function() {
111 | // Avoids fetching more than once
112 | props.setAttributes( { userMediaFetched: 'error' } );
113 |
114 | props.setAttributes( {
115 | link: false
116 | } );
117 | } );
118 | };
119 |
120 | var selectUserMedia = function( event ) {
121 | event.preventDefault();
122 |
123 | var block = $( event.currentTarget ),
124 | options = {
125 | frame: 'post',
126 | state: 'user-media',
127 | title: wp.media.view.l10n.addMedia,
128 | isUserMediaOnly: true,
129 | gutenbergBlock : true
130 | };
131 |
132 | /**
133 | * Overrides to make sure:
134 | * - only the User Media UI is loaded by disabling the router.
135 | * - the Drag & Drop is disabled to avoid Gutenberg to duplicate User Media
136 | * in regular media.
137 | */
138 | mediaThequeSettings.common.isUserMediaOnly = true;
139 | mediaThequeSettings.params = _.omit( mediaThequeSettings.params, 'dropzone' );
140 |
141 | // Launch the WordPress Media Editor
142 | wp.media.editor.open( '.gutenberg', options );
143 |
144 | $( '.media-frame-uploader' ).css( {
145 | display: 'none'
146 | } );
147 |
148 | wp.media.frame.on( 'select', function() {
149 | if ( block.data( 'link' ) && ! props.attributes.link ) {
150 | var link = block.data( 'link' ), title = block.data( 'title' );
151 |
152 | if ( title ) {
153 | props.setAttributes( {
154 | title: title,
155 | link: link,
156 | userMediaFetched: true
157 | } );
158 | } else {
159 | props.setAttributes( {
160 | link: link,
161 | userMediaFetched: false
162 | } );
163 | }
164 | }
165 | } );
166 | };
167 |
168 | var onChangeAlignment = function( newAlignment ) {
169 | props.setAttributes( { alignment: newAlignment } );
170 | };
171 |
172 | var onClickEdit = function() {
173 | var frame = wp.media.embed.edit( props.attributes.link, true );
174 |
175 | frame.state( 'embed' ).props.on( 'change:url', function( model, url ) {
176 | if ( url && model.get( 'url' ) ) {
177 | frame.state( 'embed' ).metadata = model.toJSON();
178 | }
179 | } );
180 |
181 | frame.state( 'embed' ).on( 'select', function() {
182 | var data = frame.state( 'embed' ).metadata,
183 | placeholder = $( '.editor-block-list__block.is-selected .editor-block-list__block-edit [data-block]' );
184 |
185 | if ( data && data.url !== props.attributes.link ) {
186 | /**
187 | * @todo Check if this can be improved Using the wp.element once.
188 | */
189 | placeholder
190 | .addClass( 'components-placeholder' )
191 | .html( $( '' )
192 | .addClass( 'wp-block-embed is-loading' )
193 | .html( $('' )
194 | .addClass( 'spinner is-active' )
195 | )
196 | .prop( 'id', props.clientId )
197 | );
198 |
199 | props.setAttributes( {
200 | link: data.url,
201 | userMediaFetched: false
202 | } );
203 | }
204 | } );
205 |
206 | frame.on( 'close', function() {
207 | frame.detach();
208 | } );
209 |
210 | frame.open();
211 | };
212 |
213 | // No User Media were inserted yet.
214 | if ( ! props || ! props.attributes.link ) {
215 | return el(
216 | 'div', {
217 | className: 'components-placeholder'
218 | }, [
219 | el(
220 | 'div', {
221 | key: 'block-placeholder',
222 | className: 'components-placeholder__label'
223 | }, [
224 | mediaThequeIcon,
225 | el(
226 | 'label', {
227 | key: 'block-label'
228 | }, 'MediaThèque'
229 | )
230 | ]
231 | ),
232 | el(
233 | 'button', {
234 | key: 'user-media-select-button',
235 | type: 'button',
236 | id: props.clientId,
237 | className: 'mediatheque-block button button-large',
238 | onClick:selectUserMedia
239 | }, mediaThequeBlock.insertBtn
240 | ),
241 | 'error' === props.attributes.userMediaFetched && el(
242 | 'div', {
243 | className: 'notice notice-alt notice-error',
244 | key: 'user-media-error'
245 | }, el( 'p', {
246 | className: null
247 | }, mediaThequeBlock.genericError )
248 | )
249 | ]
250 | );
251 |
252 | // It's a private User Media.
253 | } else if ( props.attributes.title ) {
254 | return [
255 | !! focus && el(
256 | InspectorControls,
257 | { key: 'controls' },
258 | [
259 | el( PanelBody, {
260 | key: 'label',
261 | title: mediaThequeBlock.alignmentLabel
262 | }, el(
263 | AlignmentToolbar,
264 | {
265 | key: 'aligncontrol',
266 | value: alignment,
267 | onChange: onChangeAlignment
268 | }
269 | ) )
270 | ]
271 | ),
272 | el(
273 | 'p', {
274 | key: 'editable',
275 | className: 'mediatheque-private',
276 | focus: focus.toString(),
277 | style: { textAlign: alignment },
278 | onFocus: props.setFocus
279 | }, el(
280 | 'a', {
281 | href: props.attributes.link
282 | },
283 | props.attributes.title
284 | )
285 | )
286 | ];
287 |
288 | // It's a public User Media, fetch the output.
289 | } else if ( ! props.attributes.userMediaFetched ) {
290 | requestUserMedia( props.attributes.link );
291 |
292 | // Wait a few milliseconds before outputting the User Media.
293 | } else if ( 'error' !== props.attributes.userMediaFetched ) {
294 | window.setTimeout( function() {
295 | outputUserMedia( props.attributes.userMediaFetched );
296 | }, 500 );
297 | }
298 |
299 | // Output the public User Media.
300 | return el(
301 | 'div', {
302 | className: 'components-placeholder'
303 | }, [
304 | el(
305 | 'div', {
306 | id: props.clientId,
307 | key: 'loading',
308 | className: 'wp-block-embed is-loading'
309 | }, el( 'span', {
310 | className: 'spinner is-active'
311 | } )
312 | ),
313 | !! focus && el(
314 | BlockControls,
315 | { key: 'controls' },
316 | el(
317 | EditToolbar,
318 | {
319 | controls: [
320 | {
321 | icon: 'edit',
322 | title: mediaThequeBlock.editTitle,
323 | onClick: onClickEdit
324 | }
325 | ]
326 | }
327 | )
328 | )
329 | ]
330 | );
331 | },
332 |
333 | save: function( props ) {
334 | if ( ! props || ! props.attributes.link || 'false' === props.attributes.link ) {
335 | return;
336 | }
337 |
338 | // Content to save for a Private User Media
339 | if ( props.attributes.title ) {
340 | return el(
341 | 'p', {
342 | className: 'mediatheque-private',
343 | style: { textAlign: props.attributes.alignment }
344 | }, el(
345 | 'a', {
346 | href: props.attributes.link
347 | },
348 | props.attributes.title
349 | )
350 | );
351 | }
352 |
353 | // Content to save for a Public User Media
354 | return el( 'p', {}, props.attributes.link );
355 | }
356 | } );
357 |
358 | } )( jQuery, window.wp || {} );
359 |
--------------------------------------------------------------------------------
/js/block.min.js:
--------------------------------------------------------------------------------
1 | /*! mediatheque - v1.4.0-alpha - 2021-09-05 2:16:43 PM UTC - https://imathi.eu/tag/mediatheque */
2 |
3 | !function(s,o){var r=o.element.createElement,e=o.blocks.registerBlockType,l=o.editor.InspectorControls,d=o.editor.BlockControls,c=o.editor.AlignmentToolbar,u=o.components.Toolbar,m=o.components.PanelBody,b=r("svg",{key:"mediatheque-icon","aria-hidden":!0,role:"img",className:"dashicon mediatheque-icon",focusable:"false",width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[r("path",{key:"camera",d:"M 13 11 L 13 4 C 13 3.45 12.55 3 12 3 L 10.33 3 L 9 1 L 5 1 L 3.67 3 L 2 3 C 1.45 3 1 3.45 1 4 L 1 11 C 1 11.55 1.45 12 2 12 L 12 12 C 12.55 12 13 11.55 13 11 Z"}),r("path",{key:"sound",d:"M 14 6 L 19 6 L 19 16.5 C 19 17.88 17.88 19 16.5 19 C 15.12 19 14 17.88 14 16.5 C 14 15.12 15.12 14 16.5 14 C 16.67 14 16.84 14.02 17 14.05 L 17 9 L 14 9 L 14 6 Z"}),r("path",{key:"user-head",d:"M 7 4.5 C 8.38 4.5 9.5 5.62 9.5 7 C 9.5 8.38 8.38 9.5 7 9.5 C 5.62 9.5 4.5 8.38 4.5 7 C 4.5 5.62 5.62 4.5 7 4.5 Z",style:{fill:"rgb(255, 255, 255)"}}),r("path",{key:"user-body",d:"M 7.006 11.465 L 9.121 10.05 C 10.979 10.05 12.636 11.861 12.636 13.573 L 12.636 15.508 C 12.636 15.508 9.797 16.386 7.006 16.386 C 4.168 16.386 1.376 15.508 1.376 15.508 L 1.376 13.573 C 1.376 11.823 2.885 10.089 4.852 10.089 Z",style:{stroke:"rgb(255, 255, 255)"}})]);e("mediatheque/usermedia",{title:"MediaThèque",description:mediaThequeBlock.description,icon:function(){return b},category:"common",attributes:{link:{type:"string"},title:{type:"string"},alignment:{type:"string"}},edit:function(a){function i(e){s("#"+a.clientId).parent().find(".notice-error").remove(),s("#"+a.clientId).parent().removeClass("components-placeholder"),s("#"+a.clientId).before(e).remove()}var e,t=a.attributes.alignment,n=a.isSelected;return a&&a.attributes.link?a.attributes.title?[!!n&&r(l,{key:"controls"},[r(m,{key:"label",title:mediaThequeBlock.alignmentLabel},r(c,{key:"aligncontrol",value:t,onChange:function(e){a.setAttributes({alignment:e})}}))]),r("p",{key:"editable",className:"mediatheque-private",focus:n.toString(),style:{textAlign:t},onFocus:a.setFocus},r("a",{href:a.attributes.link},a.attributes.title))]:(a.attributes.userMediaFetched?"error"!==a.attributes.userMediaFetched&&window.setTimeout(function(){i(a.attributes.userMediaFetched)},500):(e=a.attributes.link,o.ajax.post("parse-embed",{post_ID:o.media.view.settings.post.id,type:"embed",shortcode:"[embed]"+e+"[/embed]"}).done(function(e){var t=!0;e.body?(t="A"===s(e.body).prop("tagName")?s(e.body).html():e.body,i(t)):a.setAttributes({link:!(t="error")}),a.setAttributes({userMediaFetched:t})}).fail(function(){a.setAttributes({userMediaFetched:"error"}),a.setAttributes({link:!1})})),r("div",{className:"components-placeholder"},[r("div",{id:a.clientId,key:"loading",className:"wp-block-embed is-loading"},r("span",{className:"spinner is-active"})),!!n&&r(d,{key:"controls"},r(u,{controls:[{icon:"edit",title:mediaThequeBlock.editTitle,onClick:function(){var i=o.media.embed.edit(a.attributes.link,!0);i.state("embed").props.on("change:url",function(e,t){t&&e.get("url")&&(i.state("embed").metadata=e.toJSON())}),i.state("embed").on("select",function(){var e=i.state("embed").metadata,t=s(".editor-block-list__block.is-selected .editor-block-list__block-edit [data-block]");e&&e.url!==a.attributes.link&&(t.addClass("components-placeholder").html(s("").addClass("wp-block-embed is-loading").html(s("").addClass("spinner is-active")).prop("id",a.clientId)),a.setAttributes({link:e.url,userMediaFetched:!1}))}),i.on("close",function(){i.detach()}),i.open()}}]}))])):r("div",{className:"components-placeholder"},[r("div",{key:"block-placeholder",className:"components-placeholder__label"},[b,r("label",{key:"block-label"},"MediaThèque")]),r("button",{key:"user-media-select-button",type:"button",id:a.clientId,className:"mediatheque-block button button-large",onClick:function(e){e.preventDefault();var i=s(e.currentTarget),e={frame:"post",state:"user-media",title:o.media.view.l10n.addMedia,isUserMediaOnly:!0,gutenbergBlock:!0};mediaThequeSettings.common.isUserMediaOnly=!0,mediaThequeSettings.params=_.omit(mediaThequeSettings.params,"dropzone"),o.media.editor.open(".gutenberg",e),s(".media-frame-uploader").css({display:"none"}),o.media.frame.on("select",function(){var e,t;i.data("link")&&!a.attributes.link&&(e=i.data("link"),(t=i.data("title"))?a.setAttributes({title:t,link:e,userMediaFetched:!0}):a.setAttributes({link:e,userMediaFetched:!1}))})}},mediaThequeBlock.insertBtn),"error"===a.attributes.userMediaFetched&&r("div",{className:"notice notice-alt notice-error",key:"user-media-error"},r("p",{className:null},mediaThequeBlock.genericError))])},save:function(e){if(e&&e.attributes.link&&"false"!==e.attributes.link)return e.attributes.title?r("p",{className:"mediatheque-private",style:{textAlign:e.attributes.alignment}},r("a",{href:e.attributes.link},e.attributes.title)):r("p",{},e.attributes.link)}})}(jQuery,window.wp||{});
--------------------------------------------------------------------------------
/js/display.js:
--------------------------------------------------------------------------------
1 | /* global wp, _, mediaTheque */
2 |
3 | // Make sure the wp object exists.
4 | window.wp = window.wp || {};
5 | window.mediaTheque = window.mediaTheque || _.extend( {}, _.pick( window.wp, 'Backbone', 'template' ) );
6 |
7 | ( function( $ ) {
8 |
9 | mediaTheque.Models = mediaTheque.Models || {};
10 | mediaTheque.Collections = mediaTheque.Collections || {};
11 | mediaTheque.Views = mediaTheque.Views || {};
12 |
13 | mediaTheque.Display = {
14 | init: function() {
15 | this.views = new Backbone.Collection();
16 | this.userMedia = new wp.api.collections.UserMedia();
17 | this.queryVars = new Backbone.Model();
18 |
19 | this.View = new mediaTheque.Views.Display( {
20 | el: $( '#mediatheque-container' ),
21 | media: this.userMedia,
22 | queryVars: this.queryVars
23 | } ).render();
24 | }
25 | };
26 |
27 | wp.api.loadPromise.done( function() {
28 | mediaTheque.Display.init();
29 | } );
30 |
31 | } )( jQuery );
32 |
--------------------------------------------------------------------------------
/js/display.min.js:
--------------------------------------------------------------------------------
1 | /*! mediatheque - v1.4.0-alpha - 2021-09-05 2:16:43 PM UTC - https://imathi.eu/tag/mediatheque */
2 |
3 | window.wp=window.wp||{},window.mediaTheque=window.mediaTheque||_.extend({},_.pick(window.wp,"Backbone","template")),function(e){mediaTheque.Models=mediaTheque.Models||{},mediaTheque.Collections=mediaTheque.Collections||{},mediaTheque.Views=mediaTheque.Views||{},mediaTheque.Display={init:function(){this.views=new Backbone.Collection,this.userMedia=new wp.api.collections.UserMedia,this.queryVars=new Backbone.Model,this.View=new mediaTheque.Views.Display({el:e("#mediatheque-container"),media:this.userMedia,queryVars:this.queryVars}).render()}},wp.api.loadPromise.done(function(){mediaTheque.Display.init()})}(jQuery);
--------------------------------------------------------------------------------
/js/manage.js:
--------------------------------------------------------------------------------
1 | /* global wp, _, mediaTheque, mediaThequeSettings */
2 |
3 | // Make sure the wp object exists.
4 | window.wp = window.wp || {};
5 | window.mediaTheque = window.mediaTheque || _.extend( {}, _.pick( window.wp, 'Backbone', 'template' ) );
6 |
7 | ( function( $ ) {
8 |
9 | mediaTheque.Models = mediaTheque.Models || {};
10 | mediaTheque.Collections = mediaTheque.Collections || {};
11 | mediaTheque.Views = mediaTheque.Views || {};
12 |
13 | mediaTheque.App = {
14 | init: function( restUrl, restNonce ) {
15 | this.views = new Backbone.Collection();
16 | this.users = new wp.api.collections.Users();
17 | this.userMedia = new wp.api.collections.UserMedia();
18 | this.toolbarItems = new Backbone.Collection();
19 | this.queryVars = new Backbone.Model();
20 | this.trailItems = new Backbone.Collection();
21 |
22 | this.overrides = {
23 | url: restUrl,
24 | 'file_data_name': 'mediatheque_upload',
25 | headers: {
26 | 'X-WP-Nonce' : restNonce
27 | }
28 | };
29 |
30 | this.rootView = new mediaTheque.Views.Root( {
31 | el: $( '#mediatheque-container' ),
32 | users: this.users,
33 | media: this.userMedia,
34 | overrides: this.overrides,
35 | toolbarItems: this.toolbarItems,
36 | queryVars: this.queryVars,
37 | trailItems: this.trailItems
38 | } ).render();
39 | }
40 | };
41 |
42 | wp.api.loadPromise.done( function( api ) {
43 | var restUrl, restNonce;
44 |
45 | if ( api.get( 'apiRoot' ) && api.get( 'versionString' ) ) {
46 | restUrl = api.get( 'apiRoot' ) + api.get( 'versionString' ) + 'user-media';
47 | restNonce = api.get( 'nonce' );
48 |
49 | // If Gutenberg is active, we have to set the nonce.
50 | if ( ! restNonce ) {
51 | restNonce = mediaThequeSettings.restNonce;
52 | api.set( 'nonce', restNonce );
53 | }
54 | }
55 |
56 | mediaTheque.App.init( restUrl, restNonce );
57 | } );
58 |
59 | } )( jQuery );
60 |
--------------------------------------------------------------------------------
/js/manage.min.js:
--------------------------------------------------------------------------------
1 | /*! mediatheque - v1.4.0-alpha - 2021-09-05 2:16:43 PM UTC - https://imathi.eu/tag/mediatheque */
2 |
3 | window.wp=window.wp||{},window.mediaTheque=window.mediaTheque||_.extend({},_.pick(window.wp,"Backbone","template")),function(t){mediaTheque.Models=mediaTheque.Models||{},mediaTheque.Collections=mediaTheque.Collections||{},mediaTheque.Views=mediaTheque.Views||{},mediaTheque.App={init:function(e,i){this.views=new Backbone.Collection,this.users=new wp.api.collections.Users,this.userMedia=new wp.api.collections.UserMedia,this.toolbarItems=new Backbone.Collection,this.queryVars=new Backbone.Model,this.trailItems=new Backbone.Collection,this.overrides={url:e,file_data_name:"mediatheque_upload",headers:{"X-WP-Nonce":i}},this.rootView=new mediaTheque.Views.Root({el:t("#mediatheque-container"),users:this.users,media:this.userMedia,overrides:this.overrides,toolbarItems:this.toolbarItems,queryVars:this.queryVars,trailItems:this.trailItems}).render()}},wp.api.loadPromise.done(function(e){var i,t;e.get("apiRoot")&&e.get("versionString")&&(i=e.get("apiRoot")+e.get("versionString")+"user-media",(t=e.get("nonce"))||(t=mediaThequeSettings.restNonce,e.set("nonce",t))),mediaTheque.App.init(i,t)})}(jQuery);
--------------------------------------------------------------------------------
/js/script.min.js:
--------------------------------------------------------------------------------
1 | /*! mediatheque - v1.4.0-alpha - 2021-09-05 2:16:43 PM UTC - https://imathi.eu/tag/mediatheque */
2 |
3 | window.wp=window.wp||{},window.mediaTheque=window.mediaTheque||_.extend({},_.pick(window.wp,"Backbone","template")),function(s){_.extend(mediaTheque,_.pick(window.wp,"media")),mediaTheque.post=mediaTheque.media.view.MediaFrame.Post,mediaTheque.embed=mediaTheque.media.controller.Embed,wp.media.controller.Embed=mediaTheque.embed.extend({initialize:function(e){var i,t=!1;e.metadata&&!_.isUndefined(e.metadata.url)&&(i=e.metadata.url.match(/user-media\/(.*?)\/\?attached=true/),_.isNull(i)||_.isUndefined(i[1])||(t=!0,i=e.metadata||{url:""},_.extend(i,{isMediaTheque:t}),this.props=new Backbone.Model(i))),t||mediaTheque.embed.prototype.initialize.apply(this,arguments)},activate:function(){mediaTheque.embed.prototype.activate.apply(this,arguments),this.props.get("isMediaTheque")&&(this.set({title:mediaThequeSettings.common.embedTitle}),this.frame.$el.addClass("mediatheque-hide-menu"))}}),mediaTheque.media.controller.UserMedia=wp.media.controller.State.extend({defaults:{id:"user-media",title:mediaThequeSettings.common.frameTitle,content:"user-media",menu:"default",toolbar:"main-user-media",priority:220},initialize:function(){this.set("userMediaSelection",new Backbone.Collection)},activate:function(){s(".media-frame-uploader").css({display:"none"}),_.isUndefined(this.frame.uploader.uploader)||(this.dropElement=this.frame.uploader.uploader.uploader.getOption("drop_element"),this.frame.uploader.uploader.uploader.setOption("drop_element",""))},deactivate:function(){s(".media-frame-uploader").css({display:"block"}),_.isUndefined(this.frame.uploader.uploader)||this.frame.uploader.uploader.uploader.setOption("drop_element",this.dropElement)}}),mediaTheque.media.view.Toolbar.UserMedia=mediaTheque.media.view.Toolbar.Select.extend({initialize:function(){_.defaults(this.options,{text:mediaThequeSettings.common.insertBtn,requires:!1}),this.userMediaSelection=this.controller.state().get("userMediaSelection"),this.userMediaSelection.on("add remove reset",this.refresh,this),mediaTheque.media.view.Toolbar.Select.prototype.initialize.apply(this,arguments)},refresh:function(){this.get("select").model.set("disabled",!this.userMediaSelection.length),mediaTheque.media.view.Toolbar.Select.prototype.refresh.apply(this,arguments)}}),mediaTheque.media.view.mainUserMedia=mediaTheque.media.View.extend({className:"user-media-content",template:mediaTheque.template("mediatheque-main"),initialize:function(){this.on("ready",this.loadApp,this)},loadApp:function(){var e=mediaTheque.App;!_.isUndefined(this.views._views[""])&&this.views._views[""].length||this.views.add(new mediaTheque.Views.Root({el:s("#mediatheque-container"),media:e.userMedia,overrides:e.overrides,toolbarItems:e.toolbarItems,queryVars:e.queryVars,trailItems:e.trailItems,uiType:"wp-editor",selection:this.controller.state().get("userMediaSelection")}))}}),mediaTheque.media.view.customizeImage=mediaTheque.media.view.EmbedImage.extend({className:"user-media-preferences",template:mediaTheque.template("image-details"),initialize:function(){var e,i=this.model.get("media"),t=i.get("guid").rendered,a=i.get("media_details");window.imageEdit&&(this.imageEdit=_.clone(window.imageEdit),window.imageEdit=!1),_.extend(a.sizes,{full:{width:a.width,height:a.height,mime_type:i.get("mime_type"),file:a.file}}),this.options.attachment.set({sizes:a.sizes,url:i.get("link")+mediaThequeSettings.common.downloadSlug+"/"},{silent:!0}),a.sizes.medium&&(e=a.file.split("/"),t=t.replace(e[e.length-1],a.sizes.medium.file)),this.model.set({url:t,base_url:i.get("link")},{silent:!0}),this.queryString=_.defaults(_.pick(this.model,["align","size"]),{attached:!0}),mediaTheque.media.view.EmbedImage.prototype.initialize.apply(this,arguments),this.on("ready",this.setFormElements,this)},prepare:function(){var e=!1;return this.options.attachment&&(e=this.options.attachment.toJSON()),_.defaults({model:this.model.toJSON(),attachment:e},this.options)},setFormElements:function(){this.$el.find(".caption, .alt-text, .advanced-toggle, #alt-text-description").css({display:"none"}),this.$el.find("input.link-to-custom").val(this.options.attachment.get("url")),this.$el.find("select.size").val("full"),this.$el.find('select.size option[value="full"]').prop("selected","selected"),this.$el.find('select.size option[value="custom"]').remove(),this.$el.find('.link-to select option[value="custom"]').remove(),this.imageEdit&&(window.imageEdit=_.clone(this.imageEdit),delete this.imageEdit)},updateChanges:function(e){mediaTheque.media.view.EmbedImage.prototype.updateChanges.apply(this,arguments),_.extend(this.queryString,_.pick(e.attributes,["align","link","size"])),this.model.metadata={url:this.model.get("base_url")+"?"+s.param(this.queryString)}}}),mediaTheque.media.view.customizeUserMedia=mediaTheque.media.view.Settings.extend({className:"user-media-preferences",initialize:function(){var e=this.model.get("media"),i={};this.options.query_keys=this.options.query_keys||["align","preload","loop","autoplay"],"video"===e.get("media_type")?(this.template=mediaTheque.template("video-details"),_.extend(i,_.pick(e.get("media_details"),["width","height"]))):"audio"===e.get("media_type")&&(this.template=mediaTheque.template("audio-details")),_.defaults(i,{src:e.get("guid").rendered,base_url:e.get("link")}),this.model.set(i,{silent:!0}),this.queryString=_.defaults(_.pick(this.model.attributes,this.options.query_keys),{attached:!0}),mediaTheque.media.view.Settings.prototype.initialize.apply(this,arguments),-1!==_.indexOf(["video","audio"],e.get("media_type"))&&this.on("ready",this.setFormElements,this)},setFormElements:function(){var e;"video"===this.model.get("media").get("media_type")?(this.$el.find(".wp-video-holder .setting").first().remove(),this.$el.find('[data-setting="content"]').remove(),this.$el.find(".setting").first().remove(),e=_.chain(mediaThequeSettings.common.alignBtns).map(function(e,i){return s("").addClass("button").val(i).html(e)}).value(),this.$el.find(".embed-video-settings").append(s("").addClass("setting align").html(s("").addClass("button-group button-large").attr("data-setting","align").html(_.each(e,function(e){return s(e).html()}))).prepend(s("").html(mediaThequeSettings.common.alignLabel)))):(this.$el.find("audio").css({visibility:"visible"}),this.$el.find(".embed-audio-settings label.setting").first().remove(),this.$el.find(".embed-audio-settings div.setting").first().remove())},updateChanges:function(i){mediaTheque.media.view.Settings.prototype.updateChanges.apply(this,arguments),_.extend(this.queryString,_.pick(i.attributes,this.options.query_keys)),_.each(this.options.query_keys,function(e){i.get(e)||this.$el.find('[data-setting="'+e+'"]').prop("checked",!1)},this),this.model.metadata={url:this.model.get("base_url")+"?"+s.param(this.queryString)}}}),mediaTheque.media.view.customizeFile=mediaTheque.media.view.customizeUserMedia.extend({initialize:function(){var e=this.options||{},t=0,a=e.model.get("media"),e=e.fields||[],s={};this.options.query_keys=[],this.collection=new Backbone.Collection,mediaTheque.media.view.customizeUserMedia.prototype.initialize.apply(this,arguments),this.model.props&&this.model.props.get("url")&&(s=mediaTheque.App.getURLparams(this.model.props.get("url"))),this.views.add(new mediaTheque.View({id:"mediatheque-file-preferences",className:"media-embed media-embed-details"})),this.views.add("#mediatheque-file-preferences",new mediaTheque.View({className:"embed-media-settings"})),_.each(e,function(e,i){t+=1,e.validate&&-1===_.indexOf(e.validate,a.get("mime_type"))||(this.collection.add({id:i,name:e.name,caption:e.caption||"",options:e.options||[],type:e.type||"",position:e.position||t,classes:e.classes||["setting",i],value:!_.isUndefined(s[i])&&JSON.parse(s[i])}),this.options.query_keys.push(i),this.addField(this.collection.get(i)))},this)},addField:function(e){this.views.add(".embed-media-settings",new mediaTheque.Views.Field({model:e},{at:e.position}))}}),wp.media.view.MediaFrame.Post=mediaTheque.post.extend({initialize:function(){_.extend(this.options,_.pick(mediaThequeSettings.common,"isUserMediaOnly")),mediaTheque.post.prototype.initialize.apply(this,arguments)},createStates:function(){var e=this.options,i={priority:20},t=[];e.isUserMediaOnly?e.gutenbergBlock?i.menu=!1:t.push(new wp.media.controller.Embed({metadata:e.metadata})):(i.priority=220,mediaTheque.post.prototype.createStates.apply(this,arguments)),t.unshift(new mediaTheque.media.controller.UserMedia(i)),this.states.add(t)},bindHandlers:function(){mediaTheque.post.prototype.bindHandlers.apply(this,arguments),this.options.isUserMediaOnly||this.on("menu:render:default",this.menuSeparator,this),this.on("toolbar:create:main-user-media",this.mainUserMediaToolbar,this),this.on("content:render:user-media",this.userMediaContent,this),this.state("user-media").on("select",this.insertUserMedia)},menuSeparator:function(e){e.set({"wordpress-separator":new wp.media.View({className:"separator",priority:200})})},mainUserMediaToolbar:function(e){e.view=new mediaTheque.media.view.Toolbar.UserMedia({controller:this})},userMediaContent:function(){this.options.isUserMediaOnly&&!_.isUndefined(this.uploader.uploader)&&this.uploader.uploader.uploader.setOption("drop_element","");var e=new mediaTheque.media.view.mainUserMedia({controller:this,model:this.state()}).render();this.content.set(e)},insertUserMedia:function(){var e,i,t=this.get("userMediaSelection"),a=void 0!==window.tinymce;if(!t.length)return!1;t=(i=_.first(t.models)).get("link"),a="publish"===i.get("status")?(t+="?attached=true",a&&window.tinymce.activeEditor&&!window.tinymce.activeEditor.isHidden()?""+t+"
":"\n\n"+t+"\n\n"):(e=i.get("title").rendered,wp.media.string.link({linkUrl:t,title:e})),this.frame.options.gutenbergBlock?((i=!(i=s(".block-editor-block-list__block.is-selected .mediatheque-block").get(0))&&s(".editor-block-list__block.is-selected .mediatheque-block").length?s(".editor-block-list__block.is-selected .mediatheque-block").get(0):i).dataset.link=t,e&&(i.dataset.title=e)):mediaTheque.media.editor.insert(a)},editMedia:function(e){var i,t=this.state();_.isUndefined(e.models)||1!==e.models.length||(i=_.first(e.models),e=mediaTheque.App.getURLparams(t.props.get("url")),i.set(_.pick(e,["size","align"])),t.set({media:i}),"image"===i.get("media_type")?this.customizeImageDisplay():this.customizeUserMediaDisplay())},customizeImageDisplay:function(){var e=this.state(),e=new mediaTheque.media.view.customizeImage({model:e,attachment:e.get("media"),controller:this,priority:40}).render();this.content.set(e)},customizeUserMediaDisplay:function(){var e=this.state(),i=e.get("media"),e=(-1!==_.indexOf(["video","audio"],i.get("media_type"))?new mediaTheque.media.view.customizeUserMedia({model:e,controller:this,priority:40}):new mediaTheque.media.view.customizeFile({model:e,fields:mediaThequeSettings.fields,controller:this,priority:40})).render();this.content.set(e)},embedContent:function(){var e=this.state();e.props.get("isMediaTheque")?(e=_.first(_.map(e.props.get("url").replace(mediaTheque.App.getRootURL(),"").split("?"),function(e,i){if(0===i)return e.replace("/","")})))&&(new wp.api.collections.UserMedia).fetch({data:{slug:e,user_media_context:"display-preferences"},success:_.bind(this.editMedia,this)}):mediaTheque.post.prototype.embedContent.apply(this,arguments)},mainEmbedToolbar:function(e){var i={controller:this};this.state().props.get("isMediaTheque")&&_.extend(i,{text:mediaThequeSettings.common.embedBtn}),e.view=new mediaTheque.media.view.Toolbar.Embed(i)}}),mediaTheque.media.personalAvatar={updateAvatar:function(e){var i=0;_.isObject(e)&&(i=e.get("id")),(new wp.api.models.UsersMe).save({meta:{personal_avatar:i}},{success:_.bind(this.avatarUpdated,this)})},avatarUpdated:function(e){var i={},e=e.get("avatar_urls")||{};e[96]&&(i={src:e[96]},e[192]?i.srcset=e[192]:i.srcset=e[96],s(".user-profile-picture").find("img").first().prop(i),s("#mediabrary-remove-message").remove())},frame:function(e){return this._frame?wp.media.frame=this._frame:(this._frame=mediaTheque.media({state:"user-media",states:[new mediaTheque.media.controller.UserMedia]}),this.activeEditor=e||"personal_avatar",this._frame.on("toolbar:create:main-user-media",function(e){e.view=new mediaTheque.media.view.Toolbar.UserMedia({controller:this,text:mediaThequeSettings.common.avatarBtn})},this._frame),this._frame.on("content:render:user-media",function(){var e=new mediaTheque.media.view.mainUserMedia({controller:this,model:this.state()}).render();this.content.set(e)},this._frame),this._frame.on("uploader:ready",function(){this.uploader.uploader.uploader.getOption("drop_element")&&(s(".media-frame-uploader").css({display:"none"}),this.uploader.uploader.uploader.setOption("drop_element",""))},this._frame),this._frame.state("user-media").on("select",this.select)),this._frame},select:function(){var e=this.get("userMediaSelection");if(!e.length)return!1;e=_.first(e.models),mediaTheque.media.personalAvatar.updateAvatar(e)},init:function(){s(".user-profile-picture td p.description").after(s("#personal-avatar-editor")),s("#personal-avatar-editor").on("click",".mediabrary-insert",function(e){e.preventDefault(),e.stopPropagation();e=s(e.currentTarget).data("editor");mediaTheque.media.personalAvatar.frame(e).open()}).on("click",".mediabrary-remove",function(){return mediaTheque.media.personalAvatar.updateAvatar(0),!1})}},s(mediaTheque.media.personalAvatar.init),mediaTheque.media.lightEditor={init:function(){var e,i;s(".mediatheque-buttons").length&&(i=s(".mediatheque-buttons").data("editor"),e={},i=s(".mediatheque-buttons").prev("#wp-"+i+"-editor-tools").find(".wp-editor-tabs").first(),s(i).before(s(".mediatheque-buttons:visible")),s(".mediatheque-insert .dashicons").prop("style").cssText&&(e.background=s(".mediatheque-insert .dashicons").prop("style").cssText),s(".mediatheque-insert .dashicons").css(_.extend(e,{display:"inline-block",width:"18px",height:"18px","vertical-align":"text-bottom",margin:"0 2px"}))),s(document.body).on("click",".mediatheque-insert",function(e){var i=s(e.currentTarget).data("editor"),t={frame:"post",state:"user-media",title:wp.media.view.l10n.addMedia,isUserMediaOnly:!0};e.preventDefault(),wp.media.editor.open(i,t),s(".media-frame-uploader").css({display:"none"})})}},s(mediaTheque.media.lightEditor.init),mediaTheque.App={init:function(e,i,t){this.views=new Backbone.Collection,this.userMedia=new wp.api.collections.UserMedia,this.toolbarItems=new Backbone.Collection,this.queryVars=new Backbone.Model,this.trailItems=new Backbone.Collection,this.overrides={url:e,file_data_name:"mediatheque_upload",headers:{"X-WP-Nonce":t}},this.rootUrl=i.replace("wp-json",mediaThequeSettings.common.rootSlug)},getURLparams:function(e,i){e=e?-1!==e.indexOf("?")?"?"+e.split("?")[1]:"":document.location.search;if(!e)return null;e=e.replace(/(^\?)/,"").split("&").map(function(e){return this[(e=e.split("="))[0]]=e[1],this}.bind({}))[0];return i?e[i]:e},getRootURL:function(){return mediaThequeSettings.common.networkRootUrl&&(this.rootUrl=mediaThequeSettings.common.networkRootUrl),this.rootUrl}},wp.api.loadPromise.done(function(e){var i,t,a;e.get("apiRoot")&&e.get("versionString")&&(i=(t=e.get("apiRoot"))+e.get("versionString")+"user-media",(a=e.get("nonce"))||(a=mediaThequeSettings.restNonce,e.set("nonce",a))),mediaTheque.App.init(i,t,a)})}((wp,jQuery));
--------------------------------------------------------------------------------
/js/uploader.js:
--------------------------------------------------------------------------------
1 | /* global wp, _, mediaTheque, plupload, pluploadL10n, JSON */
2 |
3 | // Make sure the wp object exists.
4 | window.wp = window.wp || {};
5 | window.mediaTheque = window.mediaTheque || _.extend( {}, _.pick( window.wp, 'Backbone', 'template' ) );
6 |
7 | ( function( $ ) {
8 |
9 | mediaTheque.Models = mediaTheque.Models || {};
10 | mediaTheque.Collections = mediaTheque.Collections || {};
11 | mediaTheque.Views = mediaTheque.Views || {};
12 |
13 | // {@extends wp.api.WPApiBaseModel}
14 | mediaTheque.Models.File = wp.api.WPApiBaseModel.extend( {
15 | file: {},
16 |
17 | save: function( attrs, options ) {
18 | return Backbone.Model.prototype.save.call( this, attrs, options );
19 | },
20 |
21 | destroy: function( options, attrs, model ) {
22 | if ( _.isUndefined( this.urlRoot ) ) {
23 | this.clear();
24 | this.trigger( 'destroy', this, this.collection, options );
25 | return false;
26 | }
27 |
28 | return Backbone.Model.prototype.destroy.call( this, options, attrs, model );
29 | }
30 | } );
31 |
32 | mediaTheque.Uploader = function( options ) {
33 | var self = this, overrides;
34 |
35 | if ( options.overrides ) {
36 | overrides = options.overrides;
37 | delete options.overrides;
38 | }
39 |
40 | wp.Uploader.call( this, options );
41 |
42 | if ( overrides ) {
43 | _.each( overrides, function( prop, key ) {
44 | self.uploader.settings[ key ] = prop;
45 |
46 | if ( key === 'headers' ) {
47 | delete self.uploader.settings.multipart_params._wpnonce;
48 | _.extend( self.uploader.settings.multipart_params, prop, { action: 'upload_user_media' } );
49 | }
50 | } );
51 | }
52 |
53 | // Mime Type check will happen on the server side for User Media.
54 | if ( ! _.isUndefined( self.uploader.settings.filters.mime_types ) ) {
55 | self.uploader.settings.filters.mime_types = [];
56 | }
57 |
58 | this.filesQueue = new Backbone.Collection();
59 | this.filesUploaded = new Backbone.Collection();
60 | this.filesError = new Backbone.Collection();
61 |
62 | // Unbind all Plupload events from the WP Uploader.
63 | this.uploader.unbind( 'FilesAdded, UploadProgress, FileUploaded, Error' );
64 |
65 | /**
66 | * User feedback callback.
67 | *
68 | * @param {string} message
69 | * @param {object} data
70 | * @param {plupload.File} file File that was uploaded.
71 | */
72 | var error = function( message, data, file ) {
73 | if ( file.userMedia ) {
74 | file.userMedia.destroy();
75 | }
76 |
77 | self.filesError.add( {
78 | feedback: message || pluploadL10n.default_error,
79 | data : data,
80 | file : file
81 | } );
82 |
83 | self.error( message, data, file );
84 | };
85 |
86 | this.uploader.bind( 'FilesAdded', function( uploader, files ) {
87 | _.each( files, function( file ) {
88 | var attributes, image;
89 |
90 | // Ignore failed uploads.
91 | if ( plupload.FAILED === file.status ) {
92 | return;
93 | }
94 |
95 | // Generate attributes for a new `Attachment` model.
96 | attributes = _.extend( {
97 | id: file.id,
98 | file: file,
99 | uploading: true,
100 | date: new Date(),
101 | filename: file.name
102 | }, _.pick( file, 'loaded', 'size', 'percent' ) );
103 |
104 | // Handle early mime type scanning for images.
105 | image = /(?:jpe?g|png|gif)$/i.exec( file.name );
106 |
107 | // For images set the model's type and subtype attributes.
108 | if ( image ) {
109 | attributes.type = 'image';
110 |
111 | // `jpeg`, `png` and `gif` are valid subtypes.
112 | // `jpg` is not, so map it to `jpeg`.
113 | attributes.subtype = ( 'jpg' === image[0] ) ? 'jpeg' : image[0];
114 | }
115 |
116 | // Create a model for the attachment, and add it to the Upload queue collection
117 | // so listeners to the upload queue can track and display upload progress.
118 | file.userMedia = new mediaTheque.Models.File( attributes );
119 | self.filesQueue.add( file.userMedia );
120 |
121 | self.added( file.userMedia );
122 | } );
123 |
124 | uploader.refresh();
125 | uploader.start();
126 | } );
127 |
128 | this.uploader.bind( 'UploadProgress', function( uploader, file ) {
129 | file.userMedia.set( _.pick( file, 'loaded', 'percent' ) );
130 | } );
131 |
132 | this.uploader.bind( 'FileUploaded', function( uploader, file, response ) {
133 | var status;
134 |
135 | try {
136 | status = response.status;
137 | response = JSON.parse( response.response );
138 | } catch ( e ) {
139 | return error( pluploadL10n.default_error, e, file );
140 | }
141 |
142 | if ( ! _.isObject( response ) || _.isUndefined( status ) ) {
143 | return error( pluploadL10n.default_error, null, file );
144 | } else if ( 201 !== status ) {
145 | return error( response.data && response.data.message, response.data, file );
146 | }
147 |
148 | _.each( ['file','loaded','size','percent'], function( key ) {
149 | file.userMedia.unset( key );
150 | } );
151 |
152 | file.userMedia.set( _.extend( response, { uploading: false } ) );
153 |
154 | // Add the file to the Uploaded ones
155 | self.filesUploaded.add( file.userMedia );
156 |
157 | self.success( file.userMedia );
158 | } );
159 |
160 | /**
161 | * Trigger an event to inform a new upload is being processed
162 | *
163 | * @event BeforeUpload
164 | * @param {plupload.Uploader} uploader Uploader instance.
165 | * @param {Array} files Array of file objects that were added to queue by the user.
166 | */
167 | this.uploader.bind( 'BeforeUpload', function( uploader, files ) {
168 | $( self ).trigger( 'mediatheque-new-upload', uploader, files );
169 | } );
170 |
171 | /**
172 | * Reset the filesQueue once the upload is complete
173 | *
174 | * @event BeforeUpload
175 | * @param {plupload.Uploader} uploader Uploader instance.
176 | * @param {Array} files Array of file objects that were added to queue by the user.
177 | */
178 | this.uploader.bind( 'UploadComplete', function( uploader, files ) {
179 | $( self ).trigger( 'mediatheque-upload-complete', uploader, files );
180 | self.filesQueue.reset();
181 | } );
182 |
183 | this.uploader.bind( 'Error', function( uploader, pluploadError ) {
184 | var message = pluploadL10n.default_error,
185 | key;
186 |
187 | // Try to find the User Media errors
188 | if ( ! _.isUndefined( pluploadError.response ) ) {
189 | pluploadError.response = JSON.parse( pluploadError.response );
190 |
191 | if ( ! _.isUndefined( pluploadError.response.message ) ) {
192 | message = pluploadError.response.message;
193 | }
194 |
195 | // Check for plupload errors.
196 | } else {
197 | for ( key in wp.Uploader.errorMap ) {
198 | if ( pluploadError.code === plupload[ key ] ) {
199 | message = wp.Uploader.errorMap[ key ];
200 |
201 | if ( _.isFunction( message ) ) {
202 | message = message( pluploadError.file, pluploadError );
203 | }
204 |
205 | break;
206 | }
207 | }
208 | }
209 |
210 | error( message, pluploadError, pluploadError.file );
211 | $( self ).trigger( 'mediatheque-upload-error', uploader, pluploadError );
212 |
213 | uploader.refresh();
214 | } );
215 | };
216 |
217 | $.extend( mediaTheque.Uploader.prototype, {
218 | init : function() {},
219 | success : function() {},
220 | added : function() {},
221 | progress: function() {},
222 | complete: function() {},
223 | error : function() {},
224 |
225 | refresh: function() {
226 | wp.Uploader.prototype.refresh.apply( this, arguments );
227 | },
228 |
229 | param: function() {
230 | wp.Uploader.prototype.param.apply( this, arguments );
231 | }
232 | } );
233 |
234 | } )( jQuery );
235 |
--------------------------------------------------------------------------------
/js/uploader.min.js:
--------------------------------------------------------------------------------
1 | /*! mediatheque - v1.4.0-alpha - 2021-09-05 2:16:43 PM UTC - https://imathi.eu/tag/mediatheque */
2 |
3 | window.wp=window.wp||{},window.mediaTheque=window.mediaTheque||_.extend({},_.pick(window.wp,"Backbone","template")),function(t){mediaTheque.Models=mediaTheque.Models||{},mediaTheque.Collections=mediaTheque.Collections||{},mediaTheque.Views=mediaTheque.Views||{},mediaTheque.Models.File=wp.api.WPApiBaseModel.extend({file:{},save:function(e,i){return Backbone.Model.prototype.save.call(this,e,i)},destroy:function(e,i,d){return _.isUndefined(this.urlRoot)?(this.clear(),this.trigger("destroy",this,this.collection,e),!1):Backbone.Model.prototype.destroy.call(this,e,i,d)}}),mediaTheque.Uploader=function(e){var i,o=this;e.overrides&&(i=e.overrides,delete e.overrides),wp.Uploader.call(this,e),i&&_.each(i,function(e,i){o.uploader.settings[i]=e,"headers"===i&&(delete o.uploader.settings.multipart_params._wpnonce,_.extend(o.uploader.settings.multipart_params,e,{action:"upload_user_media"}))}),_.isUndefined(o.uploader.settings.filters.mime_types)||(o.uploader.settings.filters.mime_types=[]),this.filesQueue=new Backbone.Collection,this.filesUploaded=new Backbone.Collection,this.filesError=new Backbone.Collection,this.uploader.unbind("FilesAdded, UploadProgress, FileUploaded, Error");function a(e,i,d){d.userMedia&&d.userMedia.destroy(),o.filesError.add({feedback:e||pluploadL10n.default_error,data:i,file:d}),o.error(e,i,d)}this.uploader.bind("FilesAdded",function(e,i){_.each(i,function(e){var i,d;plupload.FAILED!==e.status&&(i=_.extend({id:e.id,file:e,uploading:!0,date:new Date,filename:e.name},_.pick(e,"loaded","size","percent")),(d=/(?:jpe?g|png|gif)$/i.exec(e.name))&&(i.type="image",i.subtype="jpg"===d[0]?"jpeg":d[0]),e.userMedia=new mediaTheque.Models.File(i),o.filesQueue.add(e.userMedia),o.added(e.userMedia))}),e.refresh(),e.start()}),this.uploader.bind("UploadProgress",function(e,i){i.userMedia.set(_.pick(i,"loaded","percent"))}),this.uploader.bind("FileUploaded",function(e,i,d){var r;try{r=d.status,d=JSON.parse(d.response)}catch(e){return a(pluploadL10n.default_error,e,i)}return!_.isObject(d)||_.isUndefined(r)?a(pluploadL10n.default_error,null,i):201!==r?a(d.data&&d.data.message,d.data,i):(_.each(["file","loaded","size","percent"],function(e){i.userMedia.unset(e)}),i.userMedia.set(_.extend(d,{uploading:!1})),o.filesUploaded.add(i.userMedia),void o.success(i.userMedia))}),this.uploader.bind("BeforeUpload",function(e,i){t(o).trigger("mediatheque-new-upload",e,i)}),this.uploader.bind("UploadComplete",function(e,i){t(o).trigger("mediatheque-upload-complete",e,i),o.filesQueue.reset()}),this.uploader.bind("Error",function(e,i){var d,r=pluploadL10n.default_error;if(_.isUndefined(i.response)){for(d in wp.Uploader.errorMap)if(i.code===plupload[d]){r=wp.Uploader.errorMap[d],_.isFunction(r)&&(r=r(i.file,i));break}}else i.response=JSON.parse(i.response),_.isUndefined(i.response.message)||(r=i.response.message);a(r,i,i.file),t(o).trigger("mediatheque-upload-error",e,i),e.refresh()})},t.extend(mediaTheque.Uploader.prototype,{init:function(){},success:function(){},added:function(){},progress:function(){},complete:function(){},error:function(){},refresh:function(){wp.Uploader.prototype.refresh.apply(this,arguments)},param:function(){wp.Uploader.prototype.param.apply(this,arguments)}})}(jQuery);
--------------------------------------------------------------------------------
/languages/mediatheque-en_US.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imath/mediatheque/92459a972aeeef630046d3a666920241def8a22e/languages/mediatheque-en_US.mo
--------------------------------------------------------------------------------
/languages/mediatheque-en_US.po:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2017 imath
2 | # This file is distributed under the GNU/GPL 2.
3 | msgid ""
4 | msgstr ""
5 | "Project-Id-Version: MediaThèque 1.3.2\n"
6 | "Report-Msgid-Bugs-To: https://github.com/imath/mediatheque/issues\n"
7 | "POT-Creation-Date: 2019-09-21 08:07:56+00:00\n"
8 | "PO-Revision-Date: 2019-09-21 10:09+0100\n"
9 | "Last-Translator: imath \n"
10 | "Language-Team: FRENCH \n"
11 | "Language: en_US\n"
12 | "MIME-Version: 1.0\n"
13 | "Content-Type: text/plain; charset=UTF-8\n"
14 | "Content-Transfer-Encoding: 8bit\n"
15 | "X-Generator: Poedit 1.7.4\n"
16 | "Plural-Forms: nplurals=2; plural=(n != 1);\n"
17 |
18 | #: inc/avatars.php:129
19 | msgid "Pour supprimer votre avatar local, vous pouvez %s."
20 | msgstr "To delete your local avatar, you can %s."
21 |
22 | #: inc/avatars.php:130
23 | msgid "cliquer ici"
24 | msgstr "click here"
25 |
26 | #: inc/avatars.php:138
27 | msgid ""
28 | "Vous pouvez également utiliser une des images de votre %1$s comme avatar "
29 | "pour ce site. %2$s"
30 | msgstr ""
31 | "You can also use an image from your %1$s as an avatar for this website. %2$s"
32 |
33 | #. Plugin Name of the plugin/theme
34 | msgid "MediaThèque"
35 | msgstr "MediaThèque"
36 |
37 | #: inc/classes/class-mediatheque-admin.php:141
38 | msgid "MediaThèque Utilisateurs"
39 | msgstr "User MediaThèque"
40 |
41 | #: inc/classes/class-mediatheque-admin.php:165
42 | msgid "Bibliothèque partagée"
43 | msgstr "Shared library"
44 |
45 | #: inc/classes/class-mediatheque-admin.php:424
46 | msgid "Réglages de la MediaThèque"
47 | msgstr "MediaThèque Settings"
48 |
49 | #: inc/classes/class-mediatheque-admin.php:433
50 | msgid "Enregistrer les modifications"
51 | msgstr "Save changes"
52 |
53 | #: inc/classes/class-mediatheque-admin.php:438
54 | msgid "Configuration complémentaire Nginx"
55 | msgstr "Additional Nginx configuration"
56 |
57 | #: inc/classes/class-mediatheque-admin.php:443
58 | msgid "Configuration de votre serveur"
59 | msgstr "Server configuration"
60 |
61 | #: inc/classes/class-mediatheque-admin.php:453
62 | msgid ""
63 | "Vous utilisez Nginx. Si vous souhaitez protéger les media privés partagés "
64 | "par vos utilisateurs, ajoutez le code ci-dessus au fichier de configuration "
65 | "de votre serveur."
66 | msgstr ""
67 | "You are using Nginx. If you wish to protect your users private media, you "
68 | "can use the code below inside your server configuration file."
69 |
70 | #: inc/classes/class-mediatheque-admin.php:497
71 | #: inc/classes/class-mediatheque-admin.php:520
72 | msgid "Outils de la MediaThèque"
73 | msgstr "MediaThèque tools"
74 |
75 | #: inc/classes/class-mediatheque-admin.php:498
76 | msgid ""
77 | "Vous pouvez gérer les media d'utilisateur qui sont attachés à vos contenus "
78 | "et qui ont disparu depuis cet outil."
79 | msgstr ""
80 | "You can manage the vanished User Media from this tool"
81 |
82 | #: inc/classes/class-mediatheque-admin.php:524
83 | msgid ""
84 | "Ci-dessous la liste des media d'utilisateur qui ont tenté de s'afficher pour "
85 | "vos visiteurs. Utilisez leur adresse pour identifier les contenus les "
86 | "intégrant toujours. Utilisez le bouton "Vider" pour supprimer ces "
87 | "adresses une fois vos contenus modifiés."
88 | msgstr ""
89 | "Beneath is the list of User Media the website tried to display to your "
90 | "visitors without success. Use the urls listed to search within your contents "
91 | "and find the ones that are still using the vanished User Media. Use the "
92 | ""Rest" button to clean these urls once your content has been "
93 | "edited."
94 |
95 | #: inc/classes/class-mediatheque-admin.php:529
96 | #: inc/classes/class-mediatheque-admin.php:534
97 | msgid "Ancienne adresse du media"
98 | msgstr "Old url for the User Media"
99 |
100 | #: inc/classes/class-mediatheque-admin.php:541
101 | msgid "Aucun media disparu n'a tenté de s'afficher à vos visiteurs"
102 | msgstr "No vanished user media were displayed to your visitors"
103 |
104 | #: inc/classes/class-mediatheque-admin.php:556
105 | msgid "Vider"
106 | msgstr "Reset"
107 |
108 | #: inc/classes/class-mediatheque-rest-controller.php:142
109 | msgid "Limite les résultats en fonction du répertoire parent."
110 | msgstr "Restricts the number of results according to the parent folder."
111 |
112 | #: inc/classes/class-mediatheque-rest-controller.php:151
113 | msgid "Ordonne la liste en fonction des attributs des Media utilisateurs."
114 | msgstr "Orders the list according to the User Media attributes."
115 |
116 | #: inc/classes/class-mediatheque-rest-controller.php:363
117 | #: inc/classes/class-mediatheque-rest-controller.php:643
118 | msgid "Aucune donnée fournie."
119 | msgstr "No url were provided."
120 |
121 | #: inc/classes/class-mediatheque-rest-controller.php:373
122 | msgid "Le hash md5 pour le fichier ne correspond pas."
123 | msgstr "The md5 hash for the file does not match."
124 |
125 | #: inc/classes/class-mediatheque-rest-controller.php:746
126 | msgid "L'écriture du répertoire de l'utilisateur a échoué."
127 | msgstr "Creating the user directory failed."
128 |
129 | #: inc/classes/class-mediatheque-rest-controller.php:753
130 | msgid "L'écriture du répertoire a échoué."
131 | msgstr "Creating the directory failed."
132 |
133 | #: inc/classes/class-mediatheque-rest-controller.php:850
134 | msgid "Désolé vous n'êtes pas habilité(e) à supprimer ce media utilisateur."
135 | msgstr "Sorry. You can't delete this user media."
136 |
137 | #: inc/classes/class-mediatheque-rest-controller.php:874
138 | msgid "Ce media utilisateur ne peut être supprimé."
139 | msgstr "This User Media cannot be deleted."
140 |
141 | #: inc/classes/class-mediatheque-rest-controller.php:956
142 | msgid "Type invalide."
143 | msgstr "Invalid type."
144 |
145 | #: inc/classes/class-mediatheque-rest-controller.php:974
146 | msgid "Le déplacement du media utilisateur a échoué."
147 | msgstr "Moving the User Media failed."
148 |
149 | #: inc/classes/class-mediatheque-settings.php:41
150 | msgid "Options disponibles"
151 | msgstr "Available options"
152 |
153 | #: inc/classes/class-mediatheque-settings.php:49
154 | msgid "Capacités requises."
155 | msgstr "Required capabilities."
156 |
157 | #: inc/classes/class-mediatheque-settings.php:54
158 | msgid "Types de fichier autorisés."
159 | msgstr "Allowed file types."
160 |
161 | #: inc/classes/class-mediatheque-settings.php:59
162 | msgid "Images de profil."
163 | msgstr "Profile image."
164 |
165 | #: inc/classes/class-mediatheque-settings.php:64
166 | msgid "Bouton MediaThèque en frontal."
167 | msgstr "MediaThèque button on front-end"
168 |
169 | #: inc/functions.php:293
170 | msgid "Paramètres manquants."
171 | msgstr "Missing parameters."
172 |
173 | #: inc/functions.php:366
174 | msgid "Public"
175 | msgstr "Public"
176 |
177 | #: inc/functions.php:475
178 | msgid "Titre"
179 | msgstr "Title"
180 |
181 | #: inc/functions.php:481
182 | msgid "Description"
183 | msgstr "Description"
184 |
185 | #: inc/functions.php:487
186 | msgid "Attaché au(x) Contenu(s) :"
187 | msgstr "Attached to:"
188 |
189 | #: inc/functions.php:493
190 | msgid "Annuler"
191 | msgstr "Cancel"
192 |
193 | #: inc/functions.php:499
194 | msgid "Modifier"
195 | msgstr "Edit"
196 |
197 | #: inc/functions.php:524
198 | msgid "Nouveau(x) fichier(s)"
199 | msgstr "New file(s)"
200 |
201 | #: inc/functions.php:525
202 | msgid "Nouveau répertoire"
203 | msgstr "New directory"
204 |
205 | #: inc/functions.php:530
206 | msgid "Masquer l'icone"
207 | msgstr "Hide icon"
208 |
209 | #: inc/functions.php:536
210 | msgid "Masquer le type de media."
211 | msgstr "Hide media type."
212 |
213 | #: inc/functions.php:542
214 | msgid "Masquer l'extension"
215 | msgstr "Hide file extension"
216 |
217 | #: inc/functions.php:548
218 | msgid "Masquer la taille du media."
219 | msgstr "Hide media size."
220 |
221 | #: inc/functions.php:559
222 | msgid "Incorporer le media."
223 | msgstr "Embed the media."
224 |
225 | #: inc/functions.php:572
226 | msgid "Déposez vos fichiers pour les mettre en ligne"
227 | msgstr "Drop your files here"
228 |
229 | #: inc/functions.php:573
230 | msgid "ou"
231 | msgstr "or"
232 |
233 | #: inc/functions.php:574
234 | msgid "Choisissez des fichiers"
235 | msgstr "Browse files"
236 |
237 | #: inc/functions.php:577
238 | msgid "Choisissez un utilisateur"
239 | msgstr "Select a user"
240 |
241 | #: inc/functions.php:583
242 | msgid "Nom de votre répertoire"
243 | msgstr "Name for your directory"
244 |
245 | #: inc/functions.php:584
246 | msgid "Créer"
247 | msgstr "Create"
248 |
249 | #: inc/functions.php:590
250 | msgid "Fermer"
251 | msgstr "Close"
252 |
253 | #: inc/functions.php:591
254 | msgid "Aucun media utilisateur ne correspond à votre requête."
255 | msgstr "No User Media were found."
256 |
257 | #: inc/functions.php:592
258 | msgid "Rejeter"
259 | msgstr "Reject"
260 |
261 | #: inc/functions.php:596
262 | msgid "Définissez vos préférences d'affichage du media"
263 | msgstr "Display preferences"
264 |
265 | #: inc/functions.php:597
266 | msgid "Définir"
267 | msgstr "Set"
268 |
269 | #: inc/functions.php:598
270 | msgid "Alignement"
271 | msgstr "Alignment"
272 |
273 | #: inc/functions.php:600
274 | msgid "Gauche"
275 | msgstr "Left"
276 |
277 | #: inc/functions.php:601
278 | msgid "Centre"
279 | msgstr "Center"
280 |
281 | #: inc/functions.php:602
282 | msgid "Droite"
283 | msgstr "Right"
284 |
285 | #: inc/functions.php:603
286 | msgid "Aucun"
287 | msgstr "None"
288 |
289 | #: inc/functions.php:713
290 | msgid "Media utilisateurs"
291 | msgstr "User Media"
292 |
293 | #: inc/functions.php:715
294 | msgid "Tous les media utilisateurs"
295 | msgstr "All User Media"
296 |
297 | #: inc/functions.php:716
298 | msgid "Media utilisateur"
299 | msgstr "User Media"
300 |
301 | #: inc/functions.php:717 inc/functions.php:720
302 | msgid "Nouveau media utilisateur"
303 | msgstr "New User Media"
304 |
305 | #: inc/functions.php:718
306 | msgid "Ajouter un media utilisateur"
307 | msgstr "Add a new User Media"
308 |
309 | #: inc/functions.php:719
310 | msgid "Modifier le media utilisateur"
311 | msgstr "Edit the User Media"
312 |
313 | #: inc/functions.php:721
314 | msgid "Afficher le media utilisateur"
315 | msgstr "Show the User Media"
316 |
317 | #: inc/functions.php:722
318 | msgid "Rechercher un media utilisateur"
319 | msgstr "Search for User Media"
320 |
321 | #: inc/functions.php:723
322 | msgid "Media utilisateur introuvable"
323 | msgstr "No User Media were found."
324 |
325 | #: inc/functions.php:724
326 | msgid "Media utilisateur introuvable dans la corbeille"
327 | msgstr "No User Media were found in trash"
328 |
329 | #: inc/functions.php:725
330 | msgid "Insérer dans le contenu"
331 | msgstr "Insert into content"
332 |
333 | #: inc/functions.php:726
334 | msgid "Utiliser comme avatar"
335 | msgstr "Use as your avatar"
336 |
337 | #: inc/functions.php:727
338 | msgid "Attaché à ce contenu"
339 | msgstr "Attached to this content"
340 |
341 | #: inc/functions.php:728
342 | msgid "Filtrer les Media utilisateurs"
343 | msgstr "Filter User Media"
344 |
345 | #: inc/functions.php:729
346 | msgid "Navigation des Media utilisateurs"
347 | msgstr "User Media navigation"
348 |
349 | #: inc/functions.php:730
350 | msgid "Liste des Media utilisateurs"
351 | msgstr "User Media List"
352 |
353 | #: inc/media.php:84
354 | msgid "Image"
355 | msgstr "Image"
356 |
357 | #: inc/media.php:85
358 | msgid "Son"
359 | msgstr "Sound"
360 |
361 | #: inc/media.php:86
362 | msgid "Vidéo"
363 | msgstr "Video"
364 |
365 | #: inc/media.php:87
366 | msgid "Document"
367 | msgstr "Document"
368 |
369 | #: inc/media.php:88
370 | msgid "Tableur"
371 | msgstr "Spreasheet"
372 |
373 | #: inc/media.php:89
374 | msgid "Présentation"
375 | msgstr "Presentation"
376 |
377 | #: inc/media.php:90
378 | msgid "Texte"
379 | msgstr "Text"
380 |
381 | #: inc/media.php:91
382 | msgid "Archive"
383 | msgstr "Archive"
384 |
385 | #: inc/media.php:92
386 | msgid "Code"
387 | msgstr "Code"
388 |
389 | #. translators: do not translate this string, it is used in a if statement
390 | #: inc/media.php:689
391 | msgid "Sorry, this file type is not permitted for security reasons."
392 | msgstr ""
393 |
394 | #: inc/media.php:690
395 | msgid "Désolé, vous n'êtes pas autorisé à télécharger ce type de fichier"
396 | msgstr "Sorry, you cannot upload files having this mime type"
397 |
398 | #: inc/settings.php:30
399 | msgid "Utilisateur connecté"
400 | msgstr "Logged in user"
401 |
402 | #: inc/settings.php:50
403 | msgid ""
404 | "Sélectionner les capacités du rôle qu'il faut à minima détenir pour pouvoir "
405 | "utiliser la MediaThèque."
406 | msgstr ""
407 | "Choose the Role capabilities a user needs to be able to use the MediaThèque."
408 |
409 | #: inc/settings.php:143
410 | msgid ""
411 | "Autoriser les utilisateurs à choisir un de leurs media comme image de profil."
412 | msgstr "Allow users to choose one of their images as profile image."
413 |
414 | #: inc/settings.php:152
415 | msgid "Désactiver son ajout automatique."
416 | msgstr "Deactivate its automatic insertion."
417 |
418 | #: inc/templates.php:134
419 | msgid "Ajouter un media"
420 | msgstr "Add User Media"
421 |
422 | #: inc/templates.php:457
423 | msgid "Ci-dessous le titre du contenu dans lequel le media est présent :"
424 | msgid_plural ""
425 | "Ci-dessous la liste des titres de contenu dans lesquels le media est "
426 | "présent :"
427 | msgstr[0] ""
428 | "Beneath is the title of the content where the User Media is attached to:"
429 | msgstr[1] ""
430 | "Beneath is the list of content titles where the User Media is attached to:"
431 |
432 | #: inc/templates.php:477
433 | msgid "Media disparu"
434 | msgstr "Vanished User Media"
435 |
436 | #: inc/templates.php:489
437 | msgid "Hum hum, il semble que ce media ait mystérieusement disparu."
438 | msgstr "Hum hum, it looks like this media mysteriously vanished."
439 |
440 | #: inc/templates.php:597
441 | msgid "Afficher"
442 | msgstr "Show"
443 |
444 | #: inc/templates.php:601
445 | msgid "Télécharger"
446 | msgstr "Download"
447 |
448 | #: inc/upgrade.php:105
449 | msgid "Modifiez la structure de vos permaliens."
450 | msgstr "Edit your permalink settings."
451 |
452 | #: inc/upgrade.php:106
453 | msgid ""
454 | "MediaThèque nécessite que la structure de vos permaliens soit différente que "
455 | "celle définie par défaut."
456 | msgstr ""
457 | "The MediaThèque needs your permalink structure to be different than the "
458 | "default one."
459 |
460 | #: inc/upgrade.php:110
461 | msgid "Options des media utilisateurs"
462 | msgstr "User Media options"
463 |
464 | #: inc/upgrade.php:111
465 | msgid ""
466 | "Personnalisez les options des media utilisateurs depuis les réglages des "
467 | "media."
468 | msgstr "You can customize the User Media options from the Media Settings."
469 |
470 | #: inc/upgrade.php:115
471 | msgid "Gestion des media utilisateurs"
472 | msgstr "User Media Management"
473 |
474 | #: inc/upgrade.php:116
475 | msgid ""
476 | "Vous pouvez gérer les media utilisateurs depuis le sous-menu de la "
477 | "bibliothèque de media correspondant."
478 | msgstr ""
479 | "You can manage all user media from the corresponding sub menu in the Media "
480 | "library menu."
481 |
482 | #: inc/upgrade.php:120
483 | msgid "Accédez à votre MediaThèque"
484 | msgstr "Go to your MediaThèque"
485 |
486 | #: inc/upgrade.php:121
487 | msgid ""
488 | "Vous pouvez ajouter, organiser et supprimer vos media utilisateurs depuis ce "
489 | "menu."
490 | msgstr "You can add, organize and delete your User Media from this menu."
491 |
492 | #: inc/upgrade.php:129
493 | msgid "Vous pouvez gérer les media de tous les utilisateurs depuis ce menu."
494 | msgstr "You can manage all User Media from this menu."
495 |
496 | #: inc/users.php:252
497 | msgid ""
498 | "True pour limiter les résultats aux utilisateurs ayant soumis des fichiers."
499 | msgstr "True to restrict to users who uploaded at least one User Media."
500 |
501 | #. Plugin URI of the plugin/theme
502 | msgid "https://imathi.eu/tag/mediatheque/"
503 | msgstr "https://imathi.eu/tag/mediatheque/"
504 |
505 | #. Description of the plugin/theme
506 | msgid "Une gestion alternative des media dans WordPress, pour tous."
507 | msgstr "An alternative Media management for all your WordPress users."
508 |
509 | #. Author of the plugin/theme
510 | msgid "imath"
511 | msgstr "imath"
512 |
513 | #. Author URI of the plugin/theme
514 | msgid "https://imathi.eu/"
515 | msgstr "https://imathi.eu/"
516 |
517 | #: inc/functions.php:714
518 | msgctxt "Plugin submenu"
519 | msgid "Ma MediaThèque"
520 | msgstr "My MediaThèque"
521 |
522 | #: inc/functions.php:760
523 | msgctxt "taxonomy general name"
524 | msgid "Types"
525 | msgstr "Types"
526 |
527 | #: inc/functions.php:761
528 | msgctxt "taxonomy singular name"
529 | msgid "Type"
530 | msgstr "Type"
531 |
532 | #: inc/functions.php:873
533 | msgctxt "Gutenberg block"
534 | msgid "Insérer un Media d'utilisateur."
535 | msgstr "Insert a User Media"
536 |
537 | #: inc/functions.php:874
538 | msgctxt "Gutenberg block"
539 | msgid "Alignement du Media d'utilisateur"
540 | msgstr "User Media Alignment"
541 |
542 | #: inc/functions.php:875
543 | msgctxt "Gutenberg block"
544 | msgid "Modifier"
545 | msgstr "Edit"
546 |
547 | #: inc/functions.php:876
548 | msgctxt "Gutenberg block"
549 | msgid "Une erreur est survenue, merci de réessayer."
550 | msgstr "Something went wrong. Please try again later."
551 |
552 | #: inc/functions.php:877
553 | msgctxt "Gutenberg block"
554 | msgid "Un Media de votre MediaThèque personnelle."
555 | msgstr "One of the media of your personal MediaThèque."
556 |
--------------------------------------------------------------------------------
/languages/mediatheque.pot:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2021 imath
2 | # This file is distributed under the GNU/GPL 2.
3 | msgid ""
4 | msgstr ""
5 | "Project-Id-Version: MediaThèque 1.4.0-alpha\n"
6 | "Report-Msgid-Bugs-To: https://github.com/imath/mediatheque/issues\n"
7 | "POT-Creation-Date: 2021-09-05 14:16:42+00:00\n"
8 | "MIME-Version: 1.0\n"
9 | "Content-Type: text/plain; charset=utf-8\n"
10 | "Content-Transfer-Encoding: 8bit\n"
11 | "PO-Revision-Date: 2021-MO-DA HO:MI+ZONE\n"
12 | "Last-Translator: imath \n"
13 | "Language-Team: FRENCH \n"
14 | "X-Generator: grunt-wp-i18n 1.0.3\n"
15 |
16 | #: inc/avatars.php:129
17 | msgid "Pour supprimer votre avatar local, vous pouvez %s."
18 | msgstr ""
19 |
20 | #: inc/avatars.php:130
21 | msgid "cliquer ici"
22 | msgstr ""
23 |
24 | #: inc/avatars.php:138
25 | msgid ""
26 | "Vous pouvez également utiliser une des images de votre %1$s comme avatar "
27 | "pour ce site. %2$s"
28 | msgstr ""
29 |
30 | #. Plugin Name of the plugin/theme
31 | msgid "MediaThèque"
32 | msgstr ""
33 |
34 | #: inc/classes/class-mediatheque-admin.php:141
35 | msgid "MediaThèque Utilisateurs"
36 | msgstr ""
37 |
38 | #: inc/classes/class-mediatheque-admin.php:165
39 | msgid "Bibliothèque partagée"
40 | msgstr ""
41 |
42 | #: inc/classes/class-mediatheque-admin.php:424
43 | msgid "Réglages de la MediaThèque"
44 | msgstr ""
45 |
46 | #: inc/classes/class-mediatheque-admin.php:433
47 | msgid "Enregistrer les modifications"
48 | msgstr ""
49 |
50 | #: inc/classes/class-mediatheque-admin.php:438
51 | msgid "Configuration complémentaire Nginx"
52 | msgstr ""
53 |
54 | #: inc/classes/class-mediatheque-admin.php:443
55 | msgid "Configuration de votre serveur"
56 | msgstr ""
57 |
58 | #: inc/classes/class-mediatheque-admin.php:453
59 | msgid ""
60 | "Vous utilisez Nginx. Si vous souhaitez protéger les media privés partagés "
61 | "par vos utilisateurs, ajoutez le code ci-dessus au fichier de configuration "
62 | "de votre serveur."
63 | msgstr ""
64 |
65 | #: inc/classes/class-mediatheque-admin.php:497
66 | #: inc/classes/class-mediatheque-admin.php:520
67 | msgid "Outils de la MediaThèque"
68 | msgstr ""
69 |
70 | #: inc/classes/class-mediatheque-admin.php:498
71 | msgid ""
72 | "Vous pouvez gérer les media d'utilisateur qui sont attachés à vos contenus "
73 | "et qui ont disparu depuis cet outil."
74 | msgstr ""
75 |
76 | #: inc/classes/class-mediatheque-admin.php:524
77 | msgid ""
78 | "Ci-dessous la liste des media d'utilisateur qui ont tenté de s'afficher "
79 | "pour vos visiteurs. Utilisez leur adresse pour identifier les contenus les "
80 | "intégrant toujours. Utilisez le bouton "Vider" pour supprimer ces "
81 | "adresses une fois vos contenus modifiés."
82 | msgstr ""
83 |
84 | #: inc/classes/class-mediatheque-admin.php:529
85 | #: inc/classes/class-mediatheque-admin.php:534
86 | msgid "Ancienne adresse du media"
87 | msgstr ""
88 |
89 | #: inc/classes/class-mediatheque-admin.php:541
90 | msgid "Aucun media disparu n'a tenté de s'afficher à vos visiteurs"
91 | msgstr ""
92 |
93 | #: inc/classes/class-mediatheque-admin.php:556
94 | msgid "Vider"
95 | msgstr ""
96 |
97 | #: inc/classes/class-mediatheque-rest-controller.php:142
98 | msgid "Limite les résultats en fonction du répertoire parent."
99 | msgstr ""
100 |
101 | #: inc/classes/class-mediatheque-rest-controller.php:151
102 | msgid "Ordonne la liste en fonction des attributs des Media utilisateurs."
103 | msgstr ""
104 |
105 | #: inc/classes/class-mediatheque-rest-controller.php:363
106 | #: inc/classes/class-mediatheque-rest-controller.php:643
107 | msgid "Aucune donnée fournie."
108 | msgstr ""
109 |
110 | #: inc/classes/class-mediatheque-rest-controller.php:373
111 | msgid "Le hash md5 pour le fichier ne correspond pas."
112 | msgstr ""
113 |
114 | #: inc/classes/class-mediatheque-rest-controller.php:746
115 | msgid "L'écriture du répertoire de l'utilisateur a échoué."
116 | msgstr ""
117 |
118 | #: inc/classes/class-mediatheque-rest-controller.php:753
119 | msgid "L'écriture du répertoire a échoué."
120 | msgstr ""
121 |
122 | #: inc/classes/class-mediatheque-rest-controller.php:850
123 | msgid "Désolé vous n'êtes pas habilité(e) à supprimer ce media utilisateur."
124 | msgstr ""
125 |
126 | #: inc/classes/class-mediatheque-rest-controller.php:874
127 | msgid "Ce media utilisateur ne peut être supprimé."
128 | msgstr ""
129 |
130 | #: inc/classes/class-mediatheque-rest-controller.php:956
131 | msgid "Type invalide."
132 | msgstr ""
133 |
134 | #: inc/classes/class-mediatheque-rest-controller.php:974
135 | msgid "Le déplacement du media utilisateur a échoué."
136 | msgstr ""
137 |
138 | #: inc/classes/class-mediatheque-settings.php:41
139 | msgid "Options disponibles"
140 | msgstr ""
141 |
142 | #: inc/classes/class-mediatheque-settings.php:49
143 | msgid "Capacités requises."
144 | msgstr ""
145 |
146 | #: inc/classes/class-mediatheque-settings.php:54
147 | msgid "Types de fichier autorisés."
148 | msgstr ""
149 |
150 | #: inc/classes/class-mediatheque-settings.php:59
151 | msgid "Images de profil."
152 | msgstr ""
153 |
154 | #: inc/classes/class-mediatheque-settings.php:64
155 | msgid "Bouton MediaThèque en frontal."
156 | msgstr ""
157 |
158 | #: inc/functions.php:293
159 | msgid "Paramètres manquants."
160 | msgstr ""
161 |
162 | #: inc/functions.php:366
163 | msgid "Public"
164 | msgstr ""
165 |
166 | #: inc/functions.php:475
167 | msgid "Titre"
168 | msgstr ""
169 |
170 | #: inc/functions.php:481
171 | msgid "Description"
172 | msgstr ""
173 |
174 | #: inc/functions.php:487
175 | msgid "Attaché au(x) Contenu(s) :"
176 | msgstr ""
177 |
178 | #: inc/functions.php:493
179 | msgid "Annuler"
180 | msgstr ""
181 |
182 | #: inc/functions.php:499
183 | msgid "Modifier"
184 | msgstr ""
185 |
186 | #: inc/functions.php:524
187 | msgid "Nouveau(x) fichier(s)"
188 | msgstr ""
189 |
190 | #: inc/functions.php:525
191 | msgid "Nouveau répertoire"
192 | msgstr ""
193 |
194 | #: inc/functions.php:530
195 | msgid "Masquer l'icone"
196 | msgstr ""
197 |
198 | #: inc/functions.php:536
199 | msgid "Masquer le type de media."
200 | msgstr ""
201 |
202 | #: inc/functions.php:542
203 | msgid "Masquer l'extension"
204 | msgstr ""
205 |
206 | #: inc/functions.php:548
207 | msgid "Masquer la taille du media."
208 | msgstr ""
209 |
210 | #: inc/functions.php:559
211 | msgid "Incorporer le media."
212 | msgstr ""
213 |
214 | #: inc/functions.php:572
215 | msgid "Déposez vos fichiers pour les mettre en ligne"
216 | msgstr ""
217 |
218 | #: inc/functions.php:573
219 | msgid "ou"
220 | msgstr ""
221 |
222 | #: inc/functions.php:574
223 | msgid "Choisissez des fichiers"
224 | msgstr ""
225 |
226 | #: inc/functions.php:577
227 | msgid "Choisissez un utilisateur"
228 | msgstr ""
229 |
230 | #: inc/functions.php:583
231 | msgid "Nom de votre répertoire"
232 | msgstr ""
233 |
234 | #: inc/functions.php:584
235 | msgid "Créer"
236 | msgstr ""
237 |
238 | #: inc/functions.php:590
239 | msgid "Fermer"
240 | msgstr ""
241 |
242 | #: inc/functions.php:591
243 | msgid "Aucun media utilisateur ne correspond à votre requête."
244 | msgstr ""
245 |
246 | #: inc/functions.php:592
247 | msgid "Rejeter"
248 | msgstr ""
249 |
250 | #: inc/functions.php:596
251 | msgid "Définissez vos préférences d'affichage du media"
252 | msgstr ""
253 |
254 | #: inc/functions.php:597
255 | msgid "Définir"
256 | msgstr ""
257 |
258 | #: inc/functions.php:598
259 | msgid "Alignement"
260 | msgstr ""
261 |
262 | #: inc/functions.php:600
263 | msgid "Gauche"
264 | msgstr ""
265 |
266 | #: inc/functions.php:601
267 | msgid "Centre"
268 | msgstr ""
269 |
270 | #: inc/functions.php:602
271 | msgid "Droite"
272 | msgstr ""
273 |
274 | #: inc/functions.php:603
275 | msgid "Aucun"
276 | msgstr ""
277 |
278 | #: inc/functions.php:713
279 | msgid "Media utilisateurs"
280 | msgstr ""
281 |
282 | #: inc/functions.php:715
283 | msgid "Tous les media utilisateurs"
284 | msgstr ""
285 |
286 | #: inc/functions.php:716
287 | msgid "Media utilisateur"
288 | msgstr ""
289 |
290 | #: inc/functions.php:717 inc/functions.php:720
291 | msgid "Nouveau media utilisateur"
292 | msgstr ""
293 |
294 | #: inc/functions.php:718
295 | msgid "Ajouter un media utilisateur"
296 | msgstr ""
297 |
298 | #: inc/functions.php:719
299 | msgid "Modifier le media utilisateur"
300 | msgstr ""
301 |
302 | #: inc/functions.php:721
303 | msgid "Afficher le media utilisateur"
304 | msgstr ""
305 |
306 | #: inc/functions.php:722
307 | msgid "Rechercher un media utilisateur"
308 | msgstr ""
309 |
310 | #: inc/functions.php:723
311 | msgid "Media utilisateur introuvable"
312 | msgstr ""
313 |
314 | #: inc/functions.php:724
315 | msgid "Media utilisateur introuvable dans la corbeille"
316 | msgstr ""
317 |
318 | #: inc/functions.php:725
319 | msgid "Insérer dans le contenu"
320 | msgstr ""
321 |
322 | #: inc/functions.php:726
323 | msgid "Utiliser comme avatar"
324 | msgstr ""
325 |
326 | #: inc/functions.php:727
327 | msgid "Attaché à ce contenu"
328 | msgstr ""
329 |
330 | #: inc/functions.php:728
331 | msgid "Filtrer les Media utilisateurs"
332 | msgstr ""
333 |
334 | #: inc/functions.php:729
335 | msgid "Navigation des Media utilisateurs"
336 | msgstr ""
337 |
338 | #: inc/functions.php:730
339 | msgid "Liste des Media utilisateurs"
340 | msgstr ""
341 |
342 | #: inc/media.php:84
343 | msgid "Image"
344 | msgstr ""
345 |
346 | #: inc/media.php:85
347 | msgid "Son"
348 | msgstr ""
349 |
350 | #: inc/media.php:86
351 | msgid "Vidéo"
352 | msgstr ""
353 |
354 | #: inc/media.php:87
355 | msgid "Document"
356 | msgstr ""
357 |
358 | #: inc/media.php:88
359 | msgid "Tableur"
360 | msgstr ""
361 |
362 | #: inc/media.php:89
363 | msgid "Présentation"
364 | msgstr ""
365 |
366 | #: inc/media.php:90
367 | msgid "Texte"
368 | msgstr ""
369 |
370 | #: inc/media.php:91
371 | msgid "Archive"
372 | msgstr ""
373 |
374 | #: inc/media.php:92
375 | msgid "Code"
376 | msgstr ""
377 |
378 | #: inc/media.php:689
379 | #. translators: do not translate this string, it is used in a if statement
380 | msgid "Sorry, this file type is not permitted for security reasons."
381 | msgstr ""
382 |
383 | #: inc/media.php:690
384 | msgid "Désolé, vous n'êtes pas autorisé à télécharger ce type de fichier"
385 | msgstr ""
386 |
387 | #: inc/settings.php:30
388 | msgid "Utilisateur connecté"
389 | msgstr ""
390 |
391 | #: inc/settings.php:50
392 | msgid ""
393 | "Sélectionner les capacités du rôle qu'il faut à minima détenir pour pouvoir "
394 | "utiliser la MediaThèque."
395 | msgstr ""
396 |
397 | #: inc/settings.php:143
398 | msgid ""
399 | "Autoriser les utilisateurs à choisir un de leurs media comme image de "
400 | "profil."
401 | msgstr ""
402 |
403 | #: inc/settings.php:152
404 | msgid "Désactiver son ajout automatique."
405 | msgstr ""
406 |
407 | #: inc/templates.php:134
408 | msgid "Ajouter un media"
409 | msgstr ""
410 |
411 | #: inc/templates.php:457
412 | msgid "Ci-dessous le titre du contenu dans lequel le media est présent :"
413 | msgid_plural ""
414 | "Ci-dessous la liste des titres de contenu dans lesquels le media est "
415 | "présent :"
416 | msgstr[0] ""
417 | msgstr[1] ""
418 |
419 | #: inc/templates.php:477
420 | msgid "Media disparu"
421 | msgstr ""
422 |
423 | #: inc/templates.php:489
424 | msgid "Hum hum, il semble que ce media ait mystérieusement disparu."
425 | msgstr ""
426 |
427 | #: inc/templates.php:597
428 | msgid "Afficher"
429 | msgstr ""
430 |
431 | #: inc/templates.php:601
432 | msgid "Télécharger"
433 | msgstr ""
434 |
435 | #: inc/upgrade.php:105
436 | msgid "Modifiez la structure de vos permaliens."
437 | msgstr ""
438 |
439 | #: inc/upgrade.php:106
440 | msgid ""
441 | "MediaThèque nécessite que la structure de vos permaliens soit différente "
442 | "que celle définie par défaut."
443 | msgstr ""
444 |
445 | #: inc/upgrade.php:110
446 | msgid "Options des media utilisateurs"
447 | msgstr ""
448 |
449 | #: inc/upgrade.php:111
450 | msgid ""
451 | "Personnalisez les options des media utilisateurs depuis les réglages des "
452 | "media."
453 | msgstr ""
454 |
455 | #: inc/upgrade.php:115
456 | msgid "Gestion des media utilisateurs"
457 | msgstr ""
458 |
459 | #: inc/upgrade.php:116
460 | msgid ""
461 | "Vous pouvez gérer les media utilisateurs depuis le sous-menu de la "
462 | "bibliothèque de media correspondant."
463 | msgstr ""
464 |
465 | #: inc/upgrade.php:120
466 | msgid "Accédez à votre MediaThèque"
467 | msgstr ""
468 |
469 | #: inc/upgrade.php:121
470 | msgid ""
471 | "Vous pouvez ajouter, organiser et supprimer vos media utilisateurs depuis "
472 | "ce menu."
473 | msgstr ""
474 |
475 | #: inc/upgrade.php:129
476 | msgid "Vous pouvez gérer les media de tous les utilisateurs depuis ce menu."
477 | msgstr ""
478 |
479 | #: inc/users.php:252
480 | msgid "True pour limiter les résultats aux utilisateurs ayant soumis des fichiers."
481 | msgstr ""
482 |
483 | #. Plugin URI of the plugin/theme
484 | msgid "https://imathi.eu/tag/mediatheque/"
485 | msgstr ""
486 |
487 | #. Description of the plugin/theme
488 | msgid "Une gestion alternative des media dans WordPress, pour tous."
489 | msgstr ""
490 |
491 | #. Author of the plugin/theme
492 | msgid "imath"
493 | msgstr ""
494 |
495 | #. Author URI of the plugin/theme
496 | msgid "https://imathi.eu/"
497 | msgstr ""
498 |
499 | #: inc/functions.php:714
500 | msgctxt "Plugin submenu"
501 | msgid "Ma MediaThèque"
502 | msgstr ""
503 |
504 | #: inc/functions.php:760
505 | msgctxt "taxonomy general name"
506 | msgid "Types"
507 | msgstr ""
508 |
509 | #: inc/functions.php:761
510 | msgctxt "taxonomy singular name"
511 | msgid "Type"
512 | msgstr ""
513 |
514 | #: inc/functions.php:873
515 | msgctxt "Gutenberg block"
516 | msgid "Insérer un Media d'utilisateur."
517 | msgstr ""
518 |
519 | #: inc/functions.php:874
520 | msgctxt "Gutenberg block"
521 | msgid "Alignement du Media d'utilisateur"
522 | msgstr ""
523 |
524 | #: inc/functions.php:875
525 | msgctxt "Gutenberg block"
526 | msgid "Modifier"
527 | msgstr ""
528 |
529 | #: inc/functions.php:876
530 | msgctxt "Gutenberg block"
531 | msgid "Une erreur est survenue, merci de réessayer."
532 | msgstr ""
533 |
534 | #: inc/functions.php:877
535 | msgctxt "Gutenberg block"
536 | msgid "Un Media de votre MediaThèque personnelle."
537 | msgstr ""
--------------------------------------------------------------------------------
/mediatheque.php:
--------------------------------------------------------------------------------
1 | globals();
45 | $this->inc();
46 | }
47 |
48 | /**
49 | * Return an instance of this class.
50 | *
51 | * @since 1.0.0
52 | *
53 | * @return object A single instance of this class.
54 | */
55 | public static function start() {
56 |
57 | // If the single instance hasn't been set, set it now.
58 | if ( null == self::$instance ) {
59 | self::$instance = new self;
60 | }
61 |
62 | return self::$instance;
63 | }
64 |
65 | /**
66 | * Setups plugin's globals
67 | *
68 | * @since 1.0.0
69 | */
70 | private function globals() {
71 | // Version
72 | $this->version = '1.4.0-alpha';
73 |
74 | // Domain
75 | $this->domain = 'mediatheque';
76 |
77 | // Base name
78 | $this->file = __FILE__;
79 | $this->basename = plugin_basename( $this->file );
80 |
81 | // Path and URL
82 | $this->dir = plugin_dir_path( $this->file );
83 | $this->url = plugin_dir_url ( $this->file );
84 | $this->js_url = trailingslashit( $this->url . 'js' );
85 | $this->assets_url = trailingslashit( $this->url . 'assets' );
86 | $this->inc_dir = trailingslashit( $this->dir . 'inc' );
87 | $this->templates = trailingslashit( $this->dir . 'templates' );
88 | $this->personal_avatars = array();
89 | $this->user_media_oembeds = array();
90 | $this->template_tags = new stdClass;
91 | }
92 |
93 | /**
94 | * Includes plugin's needed files
95 | *
96 | * @since 1.0.0
97 | */
98 | private function inc() {
99 | spl_autoload_register( array( $this, 'autoload' ) );
100 |
101 | require( $this->inc_dir . 'options.php' );
102 | require( $this->inc_dir . 'users.php' );
103 | require( $this->inc_dir . 'functions.php' );
104 | require( $this->inc_dir . 'media.php' );
105 | require( $this->inc_dir . 'templates.php' );
106 | require( $this->inc_dir . 'upgrade.php' );
107 |
108 | if ( mediatheque_use_personal_avatar() ) {
109 | require( $this->inc_dir . 'avatars.php' );
110 | }
111 |
112 | if ( is_admin() ) {
113 | require( $this->inc_dir . 'settings.php' );
114 | }
115 |
116 | // Last but not least!
117 | require( $this->inc_dir . 'hooks.php' );
118 | }
119 |
120 | /**
121 | * Class Autoload function
122 | *
123 | * @since 1.0.0
124 | *
125 | * @param string $class The class name.
126 | */
127 | public function autoload( $class ) {
128 | $name = str_replace( '_', '-', strtolower( $class ) );
129 |
130 | if ( false === strpos( $name, $this->domain ) ) {
131 | return;
132 | }
133 |
134 | $path = $this->inc_dir . "classes/class-{$name}.php";
135 |
136 | // Sanity check.
137 | if ( ! file_exists( $path ) ) {
138 | return;
139 | }
140 |
141 | require $path;
142 | }
143 | }
144 |
145 | endif;
146 |
147 | /**
148 | * Boot the plugin.
149 | *
150 | * @since 1.0.0
151 | */
152 | function mediatheque() {
153 | return MediaTheque::start();
154 | }
155 | add_action( 'plugins_loaded', 'mediatheque', 5 );
156 |
--------------------------------------------------------------------------------
/templates/dirmaker.html:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/templates/display.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
8 |
9 |
19 |
--------------------------------------------------------------------------------
/templates/embed-user_media.php:
--------------------------------------------------------------------------------
1 |
16 | >
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
39 |
40 |
41 |
2 | {{data.message}}
3 |
4 | <# if ( data.dismissible ) { #>
5 |
8 | <# } #>
9 |
--------------------------------------------------------------------------------
/templates/field-item.html:
--------------------------------------------------------------------------------
1 | <# if ( 'textarea' === data.type ) { #>
2 | {{ data.name }}
3 |
4 | <# } else if ( 'contenteditable' === data.type ) { #>
5 | {{ data.name }}
6 | <# if ( data.value ) { #>{{{ data.value }}}<# } #>
7 | <# } else if ( 'text' === data.type ) { #>
8 | {{ data.name }}
9 |
10 | <# } else if ( 'checkbox' === data.type ) { #>
11 | <# if ( data.name ) { #>
12 | {{ data.name }}
13 | <# } #>
14 |
15 | checked="checked"<# } #>/>
16 | {{ data.caption }}
17 | <# } else if ( 'list' === data.type && _.isArray( data.value ) && 0 < data.value.length ) { #>
18 | {{ data.name }}
19 |
20 |
21 | <# for ( i in data.value ) { #>
22 |
23 | {{{data.value[i].title}}} |
24 |
25 | <# if ( data.value[i].edit_link ) { #>
26 |
27 | <# } #>
28 | |
29 |
30 | <# } #>
31 |
32 |
33 | <# } else if ( 'submit' === data.type || 'reset' === data.type ) { #>
34 |
37 | <# } #>
38 |
--------------------------------------------------------------------------------
/templates/progress.html:
--------------------------------------------------------------------------------
1 |
2 |
5 |
{{data.filename}}
6 |
7 |
--------------------------------------------------------------------------------
/templates/toolbar-item.html:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/templates/uploader.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
{{data.dropHelp}}
5 |
{{data.dropOr}}
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/templates/user-media-trail.html:
--------------------------------------------------------------------------------
1 | <# if ( data.avatar_urls ) { #>
2 |
3 | <# if ( data.avatar_urls[24] ) { #>
4 |
5 | <# } else { #>
6 | {{data.name}}
7 | <# } #>
8 |
9 | <# } else if ( data.position ) { #>
10 |
11 | <# if ( data.showLink ) { #>
12 | {{data.name}}
13 | <# } else { #>
14 | {{data.name}}
15 | <# } #>
16 |
17 | <# } else if ( data.showLink ) { #>
18 | {{{data.title.rendered}}}
19 | <# } else { #>
20 | {{{data.title.rendered}}}
21 | <# } #>
22 |
--------------------------------------------------------------------------------
/templates/user-media.html:
--------------------------------------------------------------------------------
1 | <# if ( data.uploading ) { #>
2 |
7 | <# } else { #>
8 | style="background-image:url( {{{data.background}}} );"<# } #>>
9 |
10 | <# if ( 'image' !== data.media_type ) { #>
11 | <# if ( data.media_icon ) { #>
12 |
13 | {{data.media_type}}
14 |
15 | <# } #>
16 |
17 |
{{{data.title.rendered}}}
18 | <# } #>
19 |
20 |
21 |
22 | <# if ( 'wp-editor' !== data.uiType ) { #>
23 |
40 | <# } #>
41 |
42 | <# if ( 'admin' === data.uiType ) { #>
43 |
44 | <# } #>
45 | <# } #>
46 |
--------------------------------------------------------------------------------
/templates/user.html:
--------------------------------------------------------------------------------
1 |
2 | <# if ( data.avatar_urls[96] ) { #>
3 |
4 | <# } #>
5 | {{data.name}}
6 |
7 |
8 |
{{data.meta.disk_usage}}
9 |
10 |
--------------------------------------------------------------------------------