Skip to content

Commit

Permalink
keep formats unique (tomato) #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny Gershman committed Aug 3, 2018
1 parent e7a153f commit 445a5c9
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion bmlt-meeting-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,10 @@ function bmlt_meeting_list($atts = null, $content = null) {
}
$this->sortBySubkey($this->formats_used, 'key_string');
$this->sortBySubkey($this->formats_all, 'key_string');

$this->uniqueFormat($this->formats_used, 'key_string');
$this->uniqueFormat($this->formats_all, 'key_string');

$this->meeting_count = count($result_meetings);
$unique_areas = $this->get_areas();
$unique_states = array();
Expand Down Expand Up @@ -2026,7 +2030,19 @@ function save_admin_options(){
update_option($this->optionsName, $this->options);
return;
}
} //End Class bread

public function uniqueFormat(&$array_of_formats, $subkey) {
$lastFormat = "";
for ( $i = 0; $i < count( $array_of_formats ); $i++ ) {
if ( strtoupper($lastFormat) == strtoupper($array_of_formats[$i][$subkey]) ) {
array_splice($array_of_formats, $i, 1);
$i--;
} else {
$lastFormat = $array_of_formats[$i][$subkey];
}
}
}
} //End Class bread
} // end if
//instantiate the class
if (class_exists("Bread")) {
Expand Down

0 comments on commit 445a5c9

Please sign in to comment.