delete( "post_attributes", array("name" => "rights_title") ); $sql->delete( "post_attributes", array("name" => "rights_holder") ); $sql->delete( "post_attributes", array("name" => "rights_licence") ); } } public function post_options($fields, $post = null): array { $licences = array( array( "name" => __("All rights reserved", "rights"), "value" => "All rights reserved", "selected" => isset($post) ? ($post->rights_licence == "All rights reserved") : true ), array( "name" => __("Creative Commons BY", "rights"), "value" => "Creative Commons BY", "selected" => isset($post) ? ($post->rights_licence == "Creative Commons BY") : false ), array( "name" => __("Creative Commons BY-ND", "rights"), "value" => "Creative Commons BY-ND", "selected" => isset($post) ? ($post->rights_licence == "Creative Commons BY-ND") : false ), array( "name" => __("Creative Commons BY-SA", "rights"), "value" => "Creative Commons BY-SA", "selected" => isset($post) ? ($post->rights_licence == "Creative Commons BY-SA") : false ), array( "name" => __("Creative Commons BY-NC", "rights"), "value" => "Creative Commons BY-NC", "selected" => isset($post) ? ($post->rights_licence == "Creative Commons BY-NC") : false ), array( "name" => __("Creative Commons BY-NC-ND", "rights"), "value" => "Creative Commons BY-NC-ND", "selected" => isset($post) ? ($post->rights_licence == "Creative Commons BY-NC-ND") : false ), array( "name" => __("Creative Commons BY-NC-SA", "rights"), "value" => "Creative Commons BY-NC-SA", "selected" => isset($post) ? ($post->rights_licence == "Creative Commons BY-NC-SA") : false ), array( "name" => __("Creative Commons CC0", "rights"), "value" => "Creative Commons CC0", "selected" => isset($post) ? ($post->rights_licence == "Creative Commons CC0") : false ), array( "name" => __("Orphan Work", "rights"), "value" => "Orphan Work", "selected" => isset($post) ? ($post->rights_licence == "Orphan Work") : false ), array( "name" => __("Public Domain", "rights"), "value" => "Public Domain", "selected" => isset($post) ? ($post->rights_licence == "Public Domain") : false ), array( "name" => __("Crown Copyright", "rights"), "value" => "Crown Copyright", "selected" => isset($post) ? ($post->rights_licence == "Crown Copyright") : false ) ); $fields[] = array( "attr" => "option[rights_title]", "label" => __("Original Work", "rights"), "type" => "text", "value" => isset($post->rights_title) ? $post->rights_title : "" ); $fields[] = array( "attr" => "option[rights_holder]", "label" => __("Rights Holder", "rights"), "type" => "text", "value" => isset($post->rights_holder) ? $post->rights_holder : "" ); $fields[] = array( "attr" => "option[rights_licence]", "label" => __("License", "rights"), "help" => "choosing_a_licence", "type" => "select", "options" => $licences ); return $fields; } public function feed_item($post, $feed): void { if (!empty($post->rights_licence)) $feed->rights($post->rights_licence); } public function post_licence_link_attr($attr, $post): string { switch ($post->rights_licence) { case "Creative Commons BY": $mark = ''. __("Creative Commons BY", "rights"). ''; break; case "Creative Commons BY-ND": $mark = ''. __("Creative Commons BY-ND", "rights"). ''; break; case "Creative Commons BY-SA": $mark = ''. __("Creative Commons BY-SA", "rights"). ''; break; case "Creative Commons BY-NC": $mark = ''. __("Creative Commons BY-NC", "rights"). ''; break; case "Creative Commons BY-NC-ND": $mark = ''. __("Creative Commons BY-NC-ND", "rights"). ''; break; case "Creative Commons BY-NC-SA": $mark = ''. __("Creative Commons BY-NC-SA", "rights"). ''; break; case "Creative Commons CC0": $mark = ''. __("Creative Commons CC0", "rights"). ''; break; case "Public Domain": $mark = ''. __("Public Domain", "rights"). ''; break; default: $mark = __("All rights reserved", "rights"); } return $mark; } }