function getfact($which) { // check to see if we should call out facts on the page $callout = isset($_GET['showfacts']) ? true : false; // get record if (is_numeric($which)) { if (!$fact = Fact::findById($which)) return '<span class="fact-broken" title="broken fact"'.($callout ? ' style="background:#FFCFCF;" ' : '' ).'>[fact id('.$which.') not found]</span>'; } else { if (!$fact = Fact::findByName($which)) return '<span class="fact-broken" title="broken fact"'.($callout ? ' style="background:#FFCFCF;" ' : '' ).'>[fact "'.$which.'" not found]</span>'; } // return fact return '<span class="fact" title="Fact #'.$fact->id.' | '.$fact->name.'"'.($callout ? ' style="background:#A1DFC1;" ' : '' ).'>'.$fact->data.'</span>'.(!empty($fact->url) ? '<sup><a class="fact-link" href="/fact-supporting-info/'.$fact->id.'" target="_blank" rel="nofollow">**</a></sup>' : ''); }
public function actionIndex() { $this->render('layouts/header'); $this->render('general/index', array('general' => $this->getGeneral(), 'messages' => $this->getMessages()), true); $this->render('pokemon/index', array('pokemon' => Pokemon::getPartyPokemon(), 'owned' => $this->getGeneral()->pokedex_owned, 'seen' => $this->getGeneral()->pokedex_seen), true); $this->render('badge/index', array('badges' => Badge::getBadges(null, 'LIMIT 0, 8')), true); $this->render('pokemon_box/index', array('pokemon' => Pokemon::getBoxPokemon()), true); $this->render('pokemon_daycare/index', array('pokemon' => Pokemon::getDaycarePokemon()), true); $this->render('item/index', array('items' => Item::getAllItems()), true); $this->render('pokemon_history/index', array('pokemon' => Pokemon::getHistoryPokemon()), true); $this->render('milestone/index', array('milestones' => Milestone::getMilestones()), true); $this->render('fact/index', array('facts' => Fact::getFacts()), true); $this->render('credit/index', array('credits' => Credit::getCredits()), true); $this->render('layouts/footer'); }
/** * @param KnowledgeBase $knowledgeBase */ public function load(KnowledgeBase $knowledgeBase) { foreach ($this->data['facts'] as $name => $value) { $knowledgeBase->add(Fact::factory($name, $value)); } foreach ($this->data['rules'] as $condition => $data) { if (is_string($data)) { $action = $data; $priority = 0; } else { $action = $data['action']; $priority = isset($data['priority']) ? $data['priority'] : 0; } $knowledgeBase->add(Rule::factory($condition, $condition, $action, $priority)); } }
public function create() { // make sure user has rights to create self::__checkPermission('facts_new'); // get the validated input $input = $this->__validate($_POST); // set the created date $input['created'] = date('Y-m-d H:i:s'); $input['updated'] = date('Y-m-d H:i:s'); // save the new record $fact = new Fact($input); if (!$fact->save()) { $this->__log(__('error encountered creating new fact'),self::LOG_ERROR); Flash::set('error',__('Could not save record in database!')); redirect(get_url('plugin/facts/new')); } // pat on the back and send back to the list $this->__log(__('created new fact').' "'.$fact->name.'"'); Flash::set('success',__('Record saved!')); redirect(get_url('plugin/facts')); }//*/
<?php require_once __DIR__ . '/../lib/include.php'; // This probably could be derived from the request URI. define('UR_DOMAIN', 'palowfacts.com'); $fact = new Fact($_GET['id']); ?> <html> <head> <link rel="cpalow.jpg" href="thumbnail_image" /> <meta property="og:title" content="Palow Fact #<?php echo $fact->getFact(); ?> " /> <meta property="og:site_name" content="Palow Facts" /> <meta property="og:image" content="http://palowfacts.com/cpalow.jpg" /> <meta property="fb:admins" content="213359" /> <title>Palow Facts</title> <style> body { background-color:#d4c3b6; font-family:helvetica,arial,sans-serif; } #topSpacer { height:15%; } #name { font-size:70pt; margin-left:5%;
/** * Overwrite conflicts on some fact types * * @param string $field * @param mixed $oldval * @param mixed $newval * @return boolean */ protected function disc_is_conflict($field, $oldval, $newval) { $isconfl = parent::disc_is_conflict($field, $oldval, $newval); // overwrite some fact conflicts if ($isconfl && in_array($this->_disc_fact_ident, self::$_DISC_OVERWRITE_FACTS)) { $this->{$field} = $newval; return false; } // birth year sanity check if ($isconfl && $this->_disc_fact_ident == 'birth_year') { $curr_sane = Fact::birth_year_is_sane($this->{$field}); $tank_sane = Fact::birth_year_is_sane($newval); if ($curr_sane && !$tank_sane) { return false; } if (!$curr_sane && $tank_sane) { $this->{$field} = $newval; return false; } } // return normal value return $isconfl; }