| @@ -106,8 +106,18 @@ | ||
| 106 | 106 | |
| 107 | 107 | // get all shortcodes of any type |
| 108 | 108 | $shortcodes = $this->all(); |
| 109 | 109 | |
| 110 | + /** | |
| 111 | + * Premature filtering of shortcodes not assigned to any page. | |
| 112 | + * | |
| 113 | + * @since 1.8.6 | |
| 114 | + */ | |
| 115 | + $shortcodes = array_values(array_filter($shortcodes, function($shortcode) | |
| 116 | + { | |
| 117 | + return !empty($shortcode->post_id); | |
| 118 | + })); | |
| 119 | + | |
| 110 | 120 | // current language |
| 111 | 121 | $lang = is_null($lang) ? JFactory::getLanguage()->getTag() : $lang; |
| 112 | 122 | |
| 113 | 123 | if (!count($shortcodes)) |
| @@ -125,14 +135,8 @@ | ||
| 125 | 135 | $last_count = 0; |
| 126 | 136 | |
| 127 | 137 | foreach ($shortcodes as $k => $v) |
| 128 | 138 | { |
| 129 | - // ignore shortcodes not linked to a valid page | |
| 130 | - if (empty($v->post_id)) | |
| 131 | - { | |
| 132 | - continue; | |
| 133 | - } | |
| 134 | - | |
| 135 | 139 | // start the score counter |
| 136 | 140 | $count = 0; |
| 137 | 141 | |
| 138 | 142 | if (!strcasecmp($v->type, $reqview)) |