| 12 | | /* private $itunesCategory = array( |
| 13 | | 'Arts' => array( 'Design', 'Fashion & Beauty', 'Food', 'Literature', 'Performing Arts', 'Visual Arts' ), |
| 14 | | 'Business' => array( 'Business News', 'Careers', 'Investing', 'Management & Marketing', 'Shopping' ), |
| 15 | | 'Comedy', |
| 16 | | 'Education' => array( 'Education Technology', 'Higher Education', 'K-12', 'Language Courses', 'Training' ), |
| 17 | | 'Games & Hobbies' => array( 'Automotive', 'Aviation', 'Hobbies', 'Other Games', 'Video Games' ), |
| 18 | | 'Government & Organizations' => array( 'Local', 'National', 'Non-Profit', 'Regional' ), |
| 19 | | 'Health' => array( 'Alternative Health', 'Fitness & Nutrition', 'Self-Help', 'Sexuality' ), |
| 20 | | 'Kids & Family', |
| 21 | | 'Music', |
| 22 | | 'News & Politics', |
| 23 | | 'Religion & Spirituality' => array( 'Buddhism', 'Christianity', 'Hinduism', 'Islam', 'Judaism', 'Other', 'Spirituality' ), |
| 24 | | 'Science & Medicine' => array( 'Medicine', 'Natural Sciences', 'Social Sciences' ), |
| 25 | | 'Society & Culture' => array( 'History', 'Personal Journals', 'Philosophy', 'Places & Travel' ), |
| 26 | | 'Sports & Recreation' => array( 'Amateur', 'College & High School', 'Outdoor', 'Professional' ), |
| 27 | | 'Technology' => array( 'Gadgets', 'Tech News', 'Podcasting', 'Software How-To' ), |
| 28 | | 'TV & Film', |
| | 12 | const PODCAST_ITUNES = 0; |
| | 13 | |
| | 14 | /* |
| | 15 | private $itunes_categories = array( |
| | 16 | '0 => '', |
| | 17 | 1 => 'Arts' => array( 'Design', 'Fashion & Beauty', 'Food', 'Literature', 'Performing Arts', 'Visual Arts' ), |
| | 18 | 2 => 'Business' => array( 'Business News', 'Careers', 'Investing', 'Management & Marketing', 'Shopping' ), |
| | 19 | 3 => 'Comedy', |
| | 20 | 4 => 'Education' => array( 'Education Technology', 'Higher Education', 'K-12', 'Language Courses', 'Training' ), |
| | 21 | 5 => 'Games & Hobbies' => array( 'Automotive', 'Aviation', 'Hobbies', 'Other Games', 'Video Games' ), |
| | 22 | 6 => 'Government & Organizations' => array( 'Local', 'National', 'Non-Profit', 'Regional' ), |
| | 23 | 7 => 'Health' => array( 'Alternative Health', 'Fitness & Nutrition', 'Self-Help', 'Sexuality' ), |
| | 24 | 8 => 'Kids & Family', |
| | 25 | 9 => 'Music', |
| | 26 | 10 => 'News & Politics', |
| | 27 | 11 => 'Religion & Spirituality' => array( 'Buddhism', 'Christianity', 'Hinduism', 'Islam', 'Judaism', 'Other', 'Spirituality' ), |
| | 28 | 12 => 'Science & Medicine' => array( 'Medicine', 'Natural Sciences', 'Social Sciences' ), |
| | 29 | 13 => 'Society & Culture' => array( 'History', 'Personal Journals', 'Philosophy', 'Places & Travel' ), |
| | 30 | 14 => 'Sports & Recreation' => array( 'Amateur', 'College & High School', 'Outdoor', 'Professional' ), |
| | 31 | 15 => 'Technology' => array( 'Gadgets', 'Tech News', 'Podcasting', 'Software How-To' ), |
| | 32 | 16 => 'TV & Film', |
| | 35 | private $itunes_categories = array( |
| | 36 | 0 => '', |
| | 37 | 1 => 'Arts', |
| | 38 | 2 => 'Business', |
| | 39 | 3 => 'Comedy', |
| | 40 | 4 => 'Education', |
| | 41 | 5 => 'Games & Hobbies', |
| | 42 | 6 => 'Government & Organizations', |
| | 43 | 7 => 'Health', |
| | 44 | 8 => 'Kids & Family', |
| | 45 | 9 => 'Music', |
| | 46 | 10 => 'News & Politics', |
| | 47 | 11 => 'Religion & Spirituality', |
| | 48 | 12 => 'Science & Medicine', |
| | 49 | 13 => 'Society & Culture', |
| | 50 | 14 => 'Sports & Recreation', |
| | 51 | 15 => 'Technology', |
| | 52 | 16 => 'TV & Film', |
| | 53 | ); |
| | 54 | |
| | 55 | private $itunes_subcategories = array( |
| | 56 | 'Arts' => array( 'Design', 'Fashion & Beauty', 'Food', 'Literature', 'Performing Arts', 'Visual Arts' ), |
| | 57 | 'Business' => array( 'Business News', 'Careers', 'Investing', 'Management & Marketing', 'Shopping' ), |
| | 58 | 'Education' => array( 'Education Technology', 'Higher Education', 'K-12', 'Language Courses', 'Training' ), |
| | 59 | 'Games & Hobbies' => array( 'Automotive', 'Aviation', 'Hobbies', 'Other Games', 'Video Games' ), |
| | 60 | 'Government & Organizations' => array( 'Local', 'National', 'Non-Profit', 'Regional' ), |
| | 61 | 'Health' => array( 'Alternative Health', 'Fitness & Nutrition', 'Self-Help', 'Sexuality' ), |
| | 62 | 'Religion & Spirituality' => array( 'Buddhism', 'Christianity', 'Hinduism', 'Islam', 'Judaism', 'Other', 'Spirituality' ), |
| | 63 | 'Science & Medicine' => array( 'Medicine', 'Natural Sciences', 'Social Sciences' ), |
| | 64 | 'Society & Culture' => array( 'History', 'Personal Journals', 'Philosophy', 'Places & Travel' ), |
| | 65 | 'Sports & Recreation' => array( 'Amateur', 'College & High School', 'Outdoor', 'Professional' ), |
| | 66 | 'Technology' => array( 'Gadgets', 'Tech News', 'Podcasting', 'Software How-To' ), |
| | 67 | ); |
| | 68 | |
| | 69 | private $itunes_explicit = array( |
| | 70 | 0 => 'Clean', |
| | 71 | 1 => 'No', |
| | 72 | 2 => 'Yes', |
| | 73 | ); |
| | 74 | |
| 333 | | $category = $item->addChild( 'Category', '' ); |
| 334 | | |
| 335 | | $itunes_author = $item->addChild( 'xmlns:itunes:author', $post->author->displayname ); |
| 336 | | $itunes_explicit = $item->addChild( 'xmlns:itunes:explicit', 'Clean' ); |
| 337 | | $itunes_subtitle = $item->addChild( 'xmlns:itunes:subtitle', '' ); |
| 338 | | $itunes_summary = $item->addChild( 'xmlns:itunes:summary', '' ); |
| 339 | | $itunes_duration = $item->addChild( 'xmlns:itunes:duration', '' ); |
| 340 | | $itunes_keywords = $item->addChild( 'xmlns:itunes:keywords', '' ); |
| | 381 | |
| | 382 | $itunes_author = $item->addChild( 'xmlns:itunes:author', htmlspecialchars( $post->author->displayname, ENT_COMPAT, 'UTF-8' ) ); |
| | 383 | $itunes_explicit = $item->addChild( 'xmlns:itunes:explicit', $explicit ); |
| | 384 | $itunes_subtitle = $item->addChild( 'xmlns:itunes:subtitle', htmlspecialchars( $subtitle, ENT_COMPAT, 'UTF-8' ) ); |
| | 385 | $itunes_summary = $item->addChild( 'xmlns:itunes:summary', htmlspecialchars( $summary, ENT_COMPAT, 'UTF-8' ) ); |
| | 386 | $itunes_duration = $item->addChild( 'xmlns:itunes:duration', $duration ); |
| | 387 | $itunes_keywords = $item->addChild( 'xmlns:itunes:keywords', htmlspecialchars( $keywords, ENT_COMPAT, 'UTF-8' ) ); |
| | 388 | $itunes_block = $item->addChild( 'xmlns:itunes:block', $block ); |
| | 408 | protected function itunes_form( $form, $post, $feed ) |
| | 409 | { |
| | 410 | $postfields = $form->publish_controls->enclosures; |
| | 411 | if( isset( $post->info->$feed ) ) { |
| | 412 | list($url, $size, $duration, $explicit, $subtitle, $keywords, $summary, $block ) = $post->info->$feed; |
| | 413 | } |
| | 414 | $control_id = md5($feed); |
| | 415 | $fieldname = "{$control_id}_settings"; |
| | 416 | $feed_fields = $postfields->append( 'fieldset', $fieldname, _t( 'Settings for ' ) . $feed ); |
| | 417 | $feed_fields->class = 'podcast-settings'; |
| | 418 | |
| | 419 | $fieldname = "enclosure_{$control_id}"; |
| | 420 | $customfield = $feed_fields->append('text', $fieldname, 'null:null', _t( 'Podcast file:' ), 'tabcontrol_text' ); |
| | 421 | $customfield->value = isset( $url ) ? $url : ''; |
| | 422 | |
| | 423 | $fieldname = "explicit_{$control_id}"; |
| | 424 | $customfield = $feed_fields->append( 'select', $fieldname, 'null:null', _t( 'Explicit:' ) ); |
| | 425 | $customfield->template = 'tabcontrol_select'; |
| | 426 | $customfield->options = $this->itunes_explicit; |
| | 427 | if( isset( $explicit ) ) $customfield->value = $explicit; |
| | 428 | |
| | 429 | /* $fieldname = "category_{$control_id}"; |
| | 430 | $customfield = $feed_fields->append( 'select', $fieldname, 'null:null', _t( 'Category:' ) ); |
| | 431 | $customfield->template = 'tabcontrol_select'; |
| | 432 | $customfield->options = $this->itunes_categories; |
| | 433 | $customfield->value = isset( $category ) ? $category : $this->itunes_categories[0]; |
| | 434 | */ |
| | 435 | |
| | 436 | $fieldname = "subtitle_{$control_id}"; |
| | 437 | $customfield = $feed_fields->append( 'text', $fieldname, 'null:null', _t( 'Subtitle:' ), 'tabcontrol_text' ); |
| | 438 | $customfield->value = isset( $subtitle ) ? $subtitle : ''; |
| | 439 | |
| | 440 | $fieldname = "keywords_{$control_id}"; |
| | 441 | $customfield = $feed_fields->append( 'text', $fieldname, 'null:null', _t( 'Keywords:' ), 'tabcontrol_text' ); |
| | 442 | $customfield->value = isset( $keywords ) ? $keywords : ''; |
| | 443 | |
| | 444 | $fieldname = "summary_{$control_id}"; |
| | 445 | $customfield = $feed_fields->append( 'textarea', $fieldname, 'null:null', _t( 'Summary:' ), 'tabcontrol_textarea' ); |
| | 446 | $customfield->value = isset( $summary ) ? $summary : ''; |
| | 447 | |
| | 448 | $fieldname = "block_{$control_id}"; |
| | 449 | $customfield = $feed_fields->append( 'checkbox', $fieldname, 'null:null', _t( 'Summary:' ), 'tabcontrol_checkbox' ); |
| | 450 | $customfield->value = isset( $block ) ? $block : ''; |
| | 451 | } |
| | 452 | |
| | 453 | protected function get_itunes_settings( $form, $post, $feed ) |
| | 454 | { |
| | 455 | $control_id = md5($feed); |
| | 456 | |
| | 457 | $fieldname = "enclosure_{$control_id}"; |
| | 458 | $url = $form->$fieldname->value; |
| | 459 | |
| | 460 | $fieldname = "explicit_{$control_id}"; |
| | 461 | $explicit = $form->$fieldname->value; |
| | 462 | |
| | 463 | $fieldname = "subtitle_{$control_id}"; |
| | 464 | $subtitle = $form->$fieldname->value; |
| | 465 | |
| | 466 | $fieldname = "keywords_{$control_id}"; |
| | 467 | $keywords = $form->$fieldname->value; |
| | 468 | |
| | 469 | $fieldname = "summary_{$control_id}"; |
| | 470 | $summary = $form->$fieldname->value; |
| | 471 | |
| | 472 | $size = strlen( file_get_contents( $url ) ); |
| | 473 | |
| | 474 | $duration = ''; |
| | 475 | |
| | 476 | $fieldname = "block_{$control_id}"; |
| | 477 | $block = $form->$fieldname->value; |
| | 478 | |
| | 479 | $post->info->$feed = array( $url, $size, $duration, $explicit, $subtitle, $keywords, $summary, $block ); |
| | 480 | } |