Changeset 3246867
- Timestamp:
- 02/26/2025 07:08:06 AM (12 months ago)
- Location:
- podlove-podcasting-plugin-for-wordpress
- Files:
-
- 2 added
- 14 edited
- 1 copied
-
tags/4.2.3 (copied) (copied from podlove-podcasting-plugin-for-wordpress/trunk)
-
tags/4.2.3/includes/api/api.php (modified) (1 diff)
-
tags/4.2.3/includes/api/feeds.php (added)
-
tags/4.2.3/lib/modules/transcripts/transcripts.php (modified) (3 diffs)
-
tags/4.2.3/podlove.php (modified) (1 diff)
-
tags/4.2.3/readme.txt (modified) (2 diffs)
-
tags/4.2.3/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
tags/4.2.3/vendor/composer/autoload_static.php (modified) (1 diff)
-
tags/4.2.3/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/includes/api/api.php (modified) (1 diff)
-
trunk/includes/api/feeds.php (added)
-
trunk/lib/modules/transcripts/transcripts.php (modified) (3 diffs)
-
trunk/podlove.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_static.php (modified) (1 diff)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
podlove-podcasting-plugin-for-wordpress/tags/4.2.3/includes/api/api.php
r3217075 r3246867 14 14 require_once \Podlove\PLUGIN_DIR.'includes/api/episodes/related_episodes.php'; 15 15 require_once \Podlove\PLUGIN_DIR.'includes/api/chapters.php'; 16 require_once \Podlove\PLUGIN_DIR.'includes/api/feeds.php'; 16 17 require_once \Podlove\PLUGIN_DIR.'includes/api/tools.php'; 17 18 require_once \Podlove\PLUGIN_DIR.'includes/api/admin/onboarding.php'; -
podlove-podcasting-plugin-for-wordpress/tags/4.2.3/lib/modules/transcripts/transcripts.php
r3199134 r3246867 22 22 add_action('podlove_module_was_activated_transcripts', [$this, 'was_activated']); 23 23 add_filter('podlove_episode_form_data', [$this, 'extend_episode_form'], 10, 2); 24 add_action('wp_ajax_podlove_transcript_import', [$this, 'ajax_transcript_import']); 25 add_action('wp_ajax_podlove_transcript_asset_import', [$this, 'ajax_transcript_asset_import']); 26 add_action('wp_ajax_podlove_transcript_delete', [$this, 'ajax_transcript_delete']); 27 add_action('wp_ajax_podlove_transcript_get_contributors', [$this, 'ajax_transcript_get_contributors']); 28 add_action('wp_ajax_podlove_transcript_get_voices', [$this, 'ajax_transcript_get_voices']); 29 30 // add_filter('podlove_episode_data_before_save', [$this, 'save_episode_voice_assignments']); 24 31 25 add_filter('mime_types', [$this, 'ensure_vtt_mime_type_is_known'], 20); 32 26 … … 136 130 } 137 131 138 public function ajax_transcript_import()139 {140 if (!isset($_FILES['transcript'])) {141 wp_die();142 }143 144 // allow vtt uploads145 add_filter('mime_types', function ($mimes) {146 $mimes['vtt'] = 'text/vtt';147 $mimes['webvtt'] = 'text/vtt';148 149 return $mimes;150 });151 152 add_filter('upload_mimes', function ($mimes_types) {153 $mimes_types['vtt'] = 'text/vtt';154 $mimes_types['webvtt'] = 'text/vtt';155 156 return $mimes_types;157 }, 99);158 159 add_filter('wp_check_filetype_and_ext', function ($types, $file, $filename, $mimes) {160 $wp_filetype = wp_check_filetype($filename, $mimes);161 $ext = $wp_filetype['ext'];162 $type = $wp_filetype['type'];163 if (in_array($ext, ['vtt', 'webvtt'])) {164 $types['ext'] = $ext;165 $types['type'] = $type;166 }167 168 return $types;169 }, 99, 4);170 171 // todo: I don't really want it permanently uploaded, so ... delete when done172 $file = wp_handle_upload($_FILES['transcript'], ['test_form' => false]);173 174 if (!$file || isset($file['error'])) {175 $error = 'Could not upload transcript file. Reason: '.$file['error'];176 \Podlove\Log::get()->addError($error);177 \Podlove\AJAX\Ajax::respond_with_json(['error' => $error]);178 }179 180 if (stripos($file['type'], 'vtt') === false) {181 $error = 'Transcript file must be webvtt. Is: '.$file['type'];182 \Podlove\Log::get()->addError($error);183 \Podlove\AJAX\Ajax::respond_with_json(['error' => $error]);184 }185 186 $post_id = intval($_POST['post_id'], 10);187 $episode = Model\Episode::find_one_by_post_id($post_id);188 189 if (!$episode) {190 $error = 'Could not find episode for this post object.';191 \Podlove\Log::get()->addError($error);192 \Podlove\AJAX\Ajax::respond_with_json(['error' => $error]);193 }194 195 $content = file_get_contents($file['file']);196 197 self::parse_and_import_webvtt($episode, $content);198 199 wp_die();200 }201 202 public function ajax_transcript_asset_import()203 {204 $post_id = intval($_GET['post_id'], 10);205 $episode = Model\Episode::find_one_by_post_id($post_id);206 207 if (!$episode) {208 $error = 'Could not find episode for this post object.';209 \Podlove\Log::get()->addError($error);210 \Podlove\AJAX\Ajax::respond_with_json(['error' => $error]);211 }212 213 if (($return = $this->transcript_import_from_asset($episode)) !== true) {214 if (is_array($return) && isset($return['error'])) {215 \Podlove\Log::get()->addError($return['error']);216 \Podlove\AJAX\Ajax::respond_with_json($return);217 }218 }219 220 wp_die();221 }222 223 public function ajax_transcript_delete()224 {225 $post_id = intval($_GET['post_id'], 10);226 $episode = Model\Episode::find_one_by_post_id($post_id);227 228 if (!$episode) {229 $error = 'Could not find episode for this post object.';230 \Podlove\Log::get()->addError($error);231 \Podlove\AJAX\Ajax::respond_with_json(['error' => $error]);232 }233 234 Transcript::delete_for_episode($episode->id);235 236 echo 'ok';237 wp_die();238 }239 240 132 /** 241 133 * Import transcript from remote file. … … 335 227 } 336 228 337 public function ajax_transcript_get_contributors()338 {339 $contributors = Contributor::all();340 $contributors = array_map(function ($c) {341 return [342 'id' => $c->id,343 'name' => $c->getName(),344 'identifier' => $c->identifier,345 'avatar' => $c->avatar()->url(),346 ];347 }, $contributors);348 349 \Podlove\AJAX\Ajax::respond_with_json(['contributors' => $contributors]);350 }351 352 public function ajax_transcript_get_voices()353 {354 $post_id = intval($_GET['post_id'], 10);355 $episode = Model\Episode::find_one_by_post_id($post_id);356 $voices = Transcript::get_voices_for_episode_id($episode->id);357 \Podlove\AJAX\Ajax::respond_with_json(['voices' => $voices]);358 }359 360 229 public function serve_transcript_file() 361 230 { -
podlove-podcasting-plugin-for-wordpress/tags/4.2.3/podlove.php
r3240397 r3246867 3 3 * Plugin Name: Podlove Podcast Publisher 4 4 * Plugin URI: https://podlove.org/podlove-podcast-publisher/ 5 * Version: 4.2. 25 * Version: 4.2.3 6 6 * Requires at least: 4.9.6 7 7 * Requires PHP: 8.0 -
podlove-podcasting-plugin-for-wordpress/tags/4.2.3/readme.txt
r3240397 r3246867 4 4 Tags: podlove, podcast, publishing, rss, audio 5 5 Tested up to: 6.7.2 6 Stable tag: 4.2. 26 Stable tag: 4.2.3 7 7 Requires at least: 4.9.6 8 8 Requires PHP: 8.0 … … 115 115 116 116 == Changelog == 117 118 = 4.2.3 = 119 120 - feat: add API route to list public feeds: `GET podlove/v2/feeds` 121 - security: remove unused code (which contained an XSS vulnerability) 117 122 118 123 = 4.2.2 = -
podlove-podcasting-plugin-for-wordpress/tags/4.2.3/vendor/composer/autoload_classmap.php
r3217075 r3246867 480 480 'Podlove\\Api\\Error\\NotFoundEpisode' => $baseDir . '/lib/api/error.php', 481 481 'Podlove\\Api\\Error\\NotSupported' => $baseDir . '/lib/api/error.php', 482 'Podlove\\Api\\Feeds\\WP_REST_PodloveFeed_Controller' => $baseDir . '/includes/api/feeds.php', 482 483 'Podlove\\Api\\Permissons' => $baseDir . '/lib/api/permissions.php', 483 484 'Podlove\\Api\\Podcast\\WP_REST_Podlove_Controller' => $baseDir . '/includes/api/podcast.php', -
podlove-podcasting-plugin-for-wordpress/tags/4.2.3/vendor/composer/autoload_static.php
r3217075 r3246867 625 625 'Podlove\\Api\\Error\\NotFoundEpisode' => __DIR__ . '/../..' . '/lib/api/error.php', 626 626 'Podlove\\Api\\Error\\NotSupported' => __DIR__ . '/../..' . '/lib/api/error.php', 627 'Podlove\\Api\\Feeds\\WP_REST_PodloveFeed_Controller' => __DIR__ . '/../..' . '/includes/api/feeds.php', 627 628 'Podlove\\Api\\Permissons' => __DIR__ . '/../..' . '/lib/api/permissions.php', 628 629 'Podlove\\Api\\Podcast\\WP_REST_Podlove_Controller' => __DIR__ . '/../..' . '/includes/api/podcast.php', -
podlove-podcasting-plugin-for-wordpress/tags/4.2.3/vendor/composer/installed.php
r3240397 r3246867 2 2 'root' => array( 3 3 'name' => 'podlove/podcast-publisher', 4 'pretty_version' => '4.2. 2',5 'version' => '4.2. 2.0',6 'reference' => ' 24877eaa382d293c8ede303e212b76b3c2dd3e75',4 'pretty_version' => '4.2.3', 5 'version' => '4.2.3.0', 6 'reference' => '3f37989e000f406ec7a484490a3d0549bb06ac91', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 144 144 ), 145 145 'podlove/podcast-publisher' => array( 146 'pretty_version' => '4.2. 2',147 'version' => '4.2. 2.0',148 'reference' => ' 24877eaa382d293c8ede303e212b76b3c2dd3e75',146 'pretty_version' => '4.2.3', 147 'version' => '4.2.3.0', 148 'reference' => '3f37989e000f406ec7a484490a3d0549bb06ac91', 149 149 'type' => 'library', 150 150 'install_path' => __DIR__ . '/../../', -
podlove-podcasting-plugin-for-wordpress/trunk/includes/api/api.php
r3217075 r3246867 14 14 require_once \Podlove\PLUGIN_DIR.'includes/api/episodes/related_episodes.php'; 15 15 require_once \Podlove\PLUGIN_DIR.'includes/api/chapters.php'; 16 require_once \Podlove\PLUGIN_DIR.'includes/api/feeds.php'; 16 17 require_once \Podlove\PLUGIN_DIR.'includes/api/tools.php'; 17 18 require_once \Podlove\PLUGIN_DIR.'includes/api/admin/onboarding.php'; -
podlove-podcasting-plugin-for-wordpress/trunk/lib/modules/transcripts/transcripts.php
r3199134 r3246867 22 22 add_action('podlove_module_was_activated_transcripts', [$this, 'was_activated']); 23 23 add_filter('podlove_episode_form_data', [$this, 'extend_episode_form'], 10, 2); 24 add_action('wp_ajax_podlove_transcript_import', [$this, 'ajax_transcript_import']); 25 add_action('wp_ajax_podlove_transcript_asset_import', [$this, 'ajax_transcript_asset_import']); 26 add_action('wp_ajax_podlove_transcript_delete', [$this, 'ajax_transcript_delete']); 27 add_action('wp_ajax_podlove_transcript_get_contributors', [$this, 'ajax_transcript_get_contributors']); 28 add_action('wp_ajax_podlove_transcript_get_voices', [$this, 'ajax_transcript_get_voices']); 29 30 // add_filter('podlove_episode_data_before_save', [$this, 'save_episode_voice_assignments']); 24 31 25 add_filter('mime_types', [$this, 'ensure_vtt_mime_type_is_known'], 20); 32 26 … … 136 130 } 137 131 138 public function ajax_transcript_import()139 {140 if (!isset($_FILES['transcript'])) {141 wp_die();142 }143 144 // allow vtt uploads145 add_filter('mime_types', function ($mimes) {146 $mimes['vtt'] = 'text/vtt';147 $mimes['webvtt'] = 'text/vtt';148 149 return $mimes;150 });151 152 add_filter('upload_mimes', function ($mimes_types) {153 $mimes_types['vtt'] = 'text/vtt';154 $mimes_types['webvtt'] = 'text/vtt';155 156 return $mimes_types;157 }, 99);158 159 add_filter('wp_check_filetype_and_ext', function ($types, $file, $filename, $mimes) {160 $wp_filetype = wp_check_filetype($filename, $mimes);161 $ext = $wp_filetype['ext'];162 $type = $wp_filetype['type'];163 if (in_array($ext, ['vtt', 'webvtt'])) {164 $types['ext'] = $ext;165 $types['type'] = $type;166 }167 168 return $types;169 }, 99, 4);170 171 // todo: I don't really want it permanently uploaded, so ... delete when done172 $file = wp_handle_upload($_FILES['transcript'], ['test_form' => false]);173 174 if (!$file || isset($file['error'])) {175 $error = 'Could not upload transcript file. Reason: '.$file['error'];176 \Podlove\Log::get()->addError($error);177 \Podlove\AJAX\Ajax::respond_with_json(['error' => $error]);178 }179 180 if (stripos($file['type'], 'vtt') === false) {181 $error = 'Transcript file must be webvtt. Is: '.$file['type'];182 \Podlove\Log::get()->addError($error);183 \Podlove\AJAX\Ajax::respond_with_json(['error' => $error]);184 }185 186 $post_id = intval($_POST['post_id'], 10);187 $episode = Model\Episode::find_one_by_post_id($post_id);188 189 if (!$episode) {190 $error = 'Could not find episode for this post object.';191 \Podlove\Log::get()->addError($error);192 \Podlove\AJAX\Ajax::respond_with_json(['error' => $error]);193 }194 195 $content = file_get_contents($file['file']);196 197 self::parse_and_import_webvtt($episode, $content);198 199 wp_die();200 }201 202 public function ajax_transcript_asset_import()203 {204 $post_id = intval($_GET['post_id'], 10);205 $episode = Model\Episode::find_one_by_post_id($post_id);206 207 if (!$episode) {208 $error = 'Could not find episode for this post object.';209 \Podlove\Log::get()->addError($error);210 \Podlove\AJAX\Ajax::respond_with_json(['error' => $error]);211 }212 213 if (($return = $this->transcript_import_from_asset($episode)) !== true) {214 if (is_array($return) && isset($return['error'])) {215 \Podlove\Log::get()->addError($return['error']);216 \Podlove\AJAX\Ajax::respond_with_json($return);217 }218 }219 220 wp_die();221 }222 223 public function ajax_transcript_delete()224 {225 $post_id = intval($_GET['post_id'], 10);226 $episode = Model\Episode::find_one_by_post_id($post_id);227 228 if (!$episode) {229 $error = 'Could not find episode for this post object.';230 \Podlove\Log::get()->addError($error);231 \Podlove\AJAX\Ajax::respond_with_json(['error' => $error]);232 }233 234 Transcript::delete_for_episode($episode->id);235 236 echo 'ok';237 wp_die();238 }239 240 132 /** 241 133 * Import transcript from remote file. … … 335 227 } 336 228 337 public function ajax_transcript_get_contributors()338 {339 $contributors = Contributor::all();340 $contributors = array_map(function ($c) {341 return [342 'id' => $c->id,343 'name' => $c->getName(),344 'identifier' => $c->identifier,345 'avatar' => $c->avatar()->url(),346 ];347 }, $contributors);348 349 \Podlove\AJAX\Ajax::respond_with_json(['contributors' => $contributors]);350 }351 352 public function ajax_transcript_get_voices()353 {354 $post_id = intval($_GET['post_id'], 10);355 $episode = Model\Episode::find_one_by_post_id($post_id);356 $voices = Transcript::get_voices_for_episode_id($episode->id);357 \Podlove\AJAX\Ajax::respond_with_json(['voices' => $voices]);358 }359 360 229 public function serve_transcript_file() 361 230 { -
podlove-podcasting-plugin-for-wordpress/trunk/podlove.php
r3240397 r3246867 3 3 * Plugin Name: Podlove Podcast Publisher 4 4 * Plugin URI: https://podlove.org/podlove-podcast-publisher/ 5 * Version: 4.2. 25 * Version: 4.2.3 6 6 * Requires at least: 4.9.6 7 7 * Requires PHP: 8.0 -
podlove-podcasting-plugin-for-wordpress/trunk/readme.txt
r3240397 r3246867 4 4 Tags: podlove, podcast, publishing, rss, audio 5 5 Tested up to: 6.7.2 6 Stable tag: 4.2. 26 Stable tag: 4.2.3 7 7 Requires at least: 4.9.6 8 8 Requires PHP: 8.0 … … 115 115 116 116 == Changelog == 117 118 = 4.2.3 = 119 120 - feat: add API route to list public feeds: `GET podlove/v2/feeds` 121 - security: remove unused code (which contained an XSS vulnerability) 117 122 118 123 = 4.2.2 = -
podlove-podcasting-plugin-for-wordpress/trunk/vendor/composer/autoload_classmap.php
r3217075 r3246867 480 480 'Podlove\\Api\\Error\\NotFoundEpisode' => $baseDir . '/lib/api/error.php', 481 481 'Podlove\\Api\\Error\\NotSupported' => $baseDir . '/lib/api/error.php', 482 'Podlove\\Api\\Feeds\\WP_REST_PodloveFeed_Controller' => $baseDir . '/includes/api/feeds.php', 482 483 'Podlove\\Api\\Permissons' => $baseDir . '/lib/api/permissions.php', 483 484 'Podlove\\Api\\Podcast\\WP_REST_Podlove_Controller' => $baseDir . '/includes/api/podcast.php', -
podlove-podcasting-plugin-for-wordpress/trunk/vendor/composer/autoload_static.php
r3217075 r3246867 625 625 'Podlove\\Api\\Error\\NotFoundEpisode' => __DIR__ . '/../..' . '/lib/api/error.php', 626 626 'Podlove\\Api\\Error\\NotSupported' => __DIR__ . '/../..' . '/lib/api/error.php', 627 'Podlove\\Api\\Feeds\\WP_REST_PodloveFeed_Controller' => __DIR__ . '/../..' . '/includes/api/feeds.php', 627 628 'Podlove\\Api\\Permissons' => __DIR__ . '/../..' . '/lib/api/permissions.php', 628 629 'Podlove\\Api\\Podcast\\WP_REST_Podlove_Controller' => __DIR__ . '/../..' . '/includes/api/podcast.php', -
podlove-podcasting-plugin-for-wordpress/trunk/vendor/composer/installed.php
r3240397 r3246867 2 2 'root' => array( 3 3 'name' => 'podlove/podcast-publisher', 4 'pretty_version' => '4.2. 2',5 'version' => '4.2. 2.0',6 'reference' => ' 24877eaa382d293c8ede303e212b76b3c2dd3e75',4 'pretty_version' => '4.2.3', 5 'version' => '4.2.3.0', 6 'reference' => '3f37989e000f406ec7a484490a3d0549bb06ac91', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 144 144 ), 145 145 'podlove/podcast-publisher' => array( 146 'pretty_version' => '4.2. 2',147 'version' => '4.2. 2.0',148 'reference' => ' 24877eaa382d293c8ede303e212b76b3c2dd3e75',146 'pretty_version' => '4.2.3', 147 'version' => '4.2.3.0', 148 'reference' => '3f37989e000f406ec7a484490a3d0549bb06ac91', 149 149 'type' => 'library', 150 150 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.