Compare commits
No commits in common. "vendor-prefix" and "master" have entirely different histories.
vendor-pre
...
master
|
@ -3,6 +3,7 @@
|
|||
Plugin Name: Freifunk Hamburg Firmware List Shortcode
|
||||
Plugin URI: http://mschuette.name/
|
||||
Description: Defines shortcodes to display Freifunk Hamburg Firmware versions
|
||||
Version: 0.5dev
|
||||
Author: Martin Schuette
|
||||
Author URI: http://mschuette.name/
|
||||
Licence: 2-clause BSD
|
||||
|
@ -90,11 +91,11 @@ if ( ! shortcode_exists( 'ff_hh_versions' ) ) {
|
|||
}
|
||||
// Example:
|
||||
// [ff_hh_versions]
|
||||
// [ff_hh_versions domain="ffhh-sued" branch="experimental" prefix="ubiquiti"]
|
||||
// [ff_hh_versions domain="ffhh-sued" branch="experimental" grep="ubiquiti"]
|
||||
function ff_hh_shortcode_versions( $atts, $content, $name ) {
|
||||
$domain = 'ffhh';
|
||||
$branch = 'stable';
|
||||
$prefix = false;
|
||||
$grep = false;
|
||||
$filter = false;
|
||||
if ( is_array( $atts ) ) {
|
||||
if ( array_key_exists( 'domain', $atts ) && ! empty( $atts['domain'] ) ) {
|
||||
|
@ -103,8 +104,8 @@ function ff_hh_shortcode_versions( $atts, $content, $name ) {
|
|||
if ( array_key_exists( 'branch', $atts ) && ! empty( $atts['branch'] ) ) {
|
||||
$branch = $atts['branch'];
|
||||
}
|
||||
if ( array_key_exists( 'prefix', $atts ) && ! empty( $atts['prefix'] ) ) {
|
||||
$prefix = explode ( ',', $atts['prefix'] );
|
||||
if ( array_key_exists( 'grep', $atts ) && ! empty( $atts['grep'] ) ) {
|
||||
$grep = $atts['grep'];
|
||||
}
|
||||
if ( array_key_exists( 'filter', $atts ) && ! empty( $atts['filter'] ) ) {
|
||||
$filter = explode ( ',', $atts['filter'] );
|
||||
|
@ -121,17 +122,8 @@ function ff_hh_shortcode_versions( $atts, $content, $name ) {
|
|||
ksort($manifest);
|
||||
foreach ( $manifest as $hw => $versions ) {
|
||||
// select some models
|
||||
if ( $prefix ) {
|
||||
$matched = false;
|
||||
foreach ( $prefix as $pfx ) {
|
||||
if ( strpos ( $hw, $pfx ) === 0 ) {
|
||||
$matched = $pfx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( $matched === false ) {
|
||||
continue;
|
||||
}
|
||||
if ( $grep && ( false === strpos( $hw, $grep ) ) ) {
|
||||
continue;
|
||||
}
|
||||
// filter others
|
||||
if ( $filter ) {
|
||||
|
@ -147,7 +139,7 @@ function ff_hh_shortcode_versions( $atts, $content, $name ) {
|
|||
}
|
||||
}
|
||||
|
||||
$hw = ff_hh_beautify_hw_name( $hw, $matched );
|
||||
$hw = ff_hh_beautify_hw_name( $hw, $grep );
|
||||
$outstr .= sprintf( "\n<tr><td>%s</td>", $hw );
|
||||
|
||||
// factory versions
|
||||
|
|
Loading…
Reference in a new issue