$sw_ver"; return $outstr; } if ( ! shortcode_exists( 'ff_hh_versions' ) ) { add_shortcode( 'ff_hh_versions', 'ff_hh_shortcode_versions'); } // Example: // [ff_hh_versions] // [ff_hh_versions grep="ubiquiti"] function ff_hh_shortcode_versions( $atts, $content, $name ) { $manifest = ff_hh_getmanifest(FF_HH_STABLE_BASEDIR); $outstr = "
"; $outstr .= ''; # optionally filter output by given substring if (is_array($atts) && array_key_exists('grep', $atts) && !empty($atts['grep'])) { $grep = $atts['grep']; } else { $grep = false; } foreach ($manifest as $hw => $versions) { // filter if ($grep && (false === strpos($hw, $grep))) { continue; } // beautify HW model names if (!strncmp($hw, 'tp-link', 7)) { if ($grep) $hw = str_replace($grep, '', $hw); $hw = strtoupper($hw); $hw = str_replace('-', ' ', $hw); $hw = str_replace('TP LINK TL ', 'TP-Link TL-', $hw); } elseif (!strncmp($hw, 'ubiquiti', 8)) { if ($grep) $hw = str_replace($grep, '', $hw); $hw = str_replace('bullet-m', 'bullet-m / nanostation-loco-m', $hw); $hw = str_replace('-m', ' M2', $hw); $hw = str_replace('-', ' ', $hw); $hw = ucwords($hw); } $outstr .= sprintf("\n", $hw); // factory versions $hw_ver_links = array(); foreach ($versions as $hw_ver => $filename) { $filename = str_replace('-sysupgrade', '', $filename); $hw_ver_links[] = sprintf('%s.x', FF_HH_STABLE_BASEDIR.'factory/', $filename, $hw_ver); } $outstr .= ''; // sysupgrade versions $hw_ver_links = array(); foreach ($versions as $hw_ver => $filename) { $hw_ver_links[] = sprintf('%s.x', FF_HH_STABLE_BASEDIR.'sysupgrade/', $filename, $hw_ver); } $outstr .= ''; $outstr .= ''; } $outstr .= '
ModellErstinstallationAktualisierung
%sHardware Version ' . join(', ', $hw_ver_links) . 'Hardware Version ' . join(', ', $hw_ver_links) . '
'; $outstr .= '
'; // $outstr .= '
'.print_r($manifest, true).'
'; return $outstr; }