diff --git a/src/ParsedContent.php b/src/ParsedContent.php
index 2d3fcd3..6632535 100644
--- a/src/ParsedContent.php
+++ b/src/ParsedContent.php
@@ -31,6 +31,8 @@ class ParsedContent
'translated_summary',
'translated_description',
'translated_return',
+ 'translated_deprecated',
+ 'translated_sinces',
];
/**
@@ -178,9 +180,13 @@ public function addParsedMetaBox($post) {
$excerpt = $post->post_excerpt;
$params = self::getParams($post->ID);
$return = self::getReturn($post->ID);
+ $deprecated = self::getDeprecated($post->ID);
+ $sinces = self::getSinces($post->ID);
$translated_summary = (string)get_post_meta($post->ID, 'translated_summary', true);
$translated_description = (string)get_post_meta($post->ID, 'translated_description', true);
$translated_return = (string)get_post_meta($post->ID, 'translated_return', true);
+ $translated_deprecated = (string)get_post_meta($post->ID, 'translated_deprecated', true);
+ $translated_sinces = (array)get_post_meta($post->ID, 'translated_sinces', true);
wp_nonce_field('phpdoc-parsed-content', 'phpdoc-parsed-content-nonce');
?>
@@ -266,9 +272,9 @@ public function addParsedMetaBox($post) {
ID, $translated_key, true);
+ $clean_name = str_replace('$', '', $name);
+ $translated_key = "translated_{$clean_name}";
+ $translated_key_val = (string)get_post_meta($post->ID, $translated_key, true);
?>
@@ -330,6 +336,90 @@ public function addParsedMetaBox($post) {
|
+
+
+
+
+ |
+
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+ |
+
+
+ false,
+ 'tinymce' => false,
+ 'quicktags' => false,
+ 'textarea_rows' => 2,
+ ]);
+ ?>
+
+ |
+
+
+
+
+
+
+
+ |
+
+ $since) : ?>
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+ |
+
+
+ false,
+ 'tinymce' => false,
+ 'quicktags' => false,
+ 'textarea_rows' => 2,
+ ]);
+ ?>
+
+ |
+
+
+
+
'deprecated']);
+
+ if (empty($deprecated)) {
+ return [
+ 'content' => '',
+ 'description' => '',
+ ];
+ }
+
+ $deprecated = array_shift($deprecated);
+
+ if (!isset($deprecated['content'])) {
+ return [
+ 'content' => '',
+ 'description' => '',
+ ];
+ }
+
+ return [
+ 'content' => htmlspecialchars($deprecated['content']),
+ 'description' => htmlspecialchars(isset($deprecated['description']) ? $deprecated['description'] : ''),
+ ];
+ }
+
+ /**
+ * Retrieve sinces as a key value array
+ *
+ * @param int $post_id
+ * @return array
+ */
+ public static function getSinces($post_id = null) {
+ if (empty($post_id)) {
+ $post_id = get_the_ID();
+ }
+
+ $sinces = [];
+ $tags = get_post_meta($post_id, '_wp-parser_tags', true);
+ if (!$tags) {
+ return $sinces;
+ }
+
+ foreach ($tags as $tag) {
+ if (!empty($tag['name']) && 'since' == $tag['name'] && isset($tag['content'])) {
+ $sinces[] = [
+ 'content' => htmlspecialchars($tag['content']),
+ 'description' => htmlspecialchars(isset($tag['description']) ? $tag['description'] : ''),
+ ];
+ }
+ }
+
+ return $sinces;
+ }
+
/**
* Returns indexed array of parameter post meta keys
*