Example #1
0
 private static function format($template, $fields)
 {
     $goat = new goat();
     foreach ($fields as $field => $data) {
         if (is_array($data)) {
             $data = call_user_func(__CLASS__ . "::" . $data[1], $data[0]);
         }
         $goat->register_variable($field, $data);
     }
     return $goat->parse($template) . "\n";
 }
Example #2
0
 private static function format($template, $id)
 {
     $goat = new goat();
     $goat->register_variable("id", $id);
     return $goat->parse($template);
 }
Example #3
0
 /**
  * Get the value of a variable
  *
  * Get the value of a variable request passed to the function via a regular
  * expression match from goat.parse()
  *
  * @param array $matches regular expression matching captures
  * @access private
  * @return string
  */
 function handle_variable($matches)
 {
     //if we have too few captures, jump out and report an error
     if (count($matches) < 2) {
         $this->register_error("Unable to handle variable; Too few callback captures.");
         return "";
     }
     $vid = goat::clean_id($matches[GOAT_KEY_CAPTURES_VARIABLE]);
     //number of tabs used
     //default or specified by tab=x
     $tabs = count($matches) > GOAT_KEY_CAPTURES_TABS_VARIABLE ? $matches[GOAT_KEY_CAPTURES_TABS_VARIABLE] : $this->myTabCount;
     if ($this->variable_exists($vid)) {
         $output = $this->get_variable($vid);
         //if we should add tabs, do it
         if ($tabs > 0) {
             $output = $this->indent_output($output, $tabs);
         }
         return $output;
     } else {
         $this->register_error("Could not handle Variable; Variable '{$vid}' doesn't exist");
         return "";
     }
 }
Example #4
0
 * @version 1.2.0 20080317 JJ
 * @version 1.1.0 20080315 JJ
 * @version 1.0.0 20080314 JJ
 *
 */
include_gobe_module('output.multiform');
include_gobe_module('gallery.main');
include_gobe_module('gallery.results');
$countPerPage = isset($_GET['count']) && (int) $_GET['count'] > 0 ? (int) $_GET['count'] : DB_DEFAULT_LIMIT;
$currentPage = isset($_GET['page']) && (int) $_GET['page'] > 1 ? (int) $_GET['page'] : 1;
$startListing = ($currentPage - 1) * $countPerPage;
$sortBy = isset($_GET['sortBy']) ? $_GET['sortBy'] : 'high-low';
$templates = multiform(PATH_TEMPLATES . 'stubs/examples/sidebar.gform.html');
$results = getExamples();
if (!empty($results)) {
    $resultsList = $title = '';
    $goat = new goat();
    $goat->register_variable('title', '');
    $goat->register_variable('url', '');
    $goat->register_variable('alt', '');
    foreach ($results as $listing) {
        $title = stripslashes($listing['title']);
        $goat->mod_variable('title', $title);
        $goat->mod_variable('url', get_path('examples-details', true) . '?id=' . $listing['listing_id']);
        $goat->mod_variable('alt', str_replace('"', "''", $title));
        $resultsList .= $goat->parse($templates['sidebar-list']);
    }
} else {
    $resultsList = $templates['noresults'];
}
add_gobe_variable('sidebar-examples', $resultsList);