public static function normalize($text, $funcs) { $norm = new self($text); if ($norm->invalid) { return $text; } foreach ($funcs as $func) { $norm->{$func}(); } return $norm->serialize(); }
/** * Print a dictionary based on an ID */ static function get_dictionary() { global $wp; $dictionary = new self($wp->query_vars['did']); echo json_encode($dictionary->serialize()); }
/** * Enables serialization to act as a static method call for nice clear one liners * @return string */ public static function __callStatic($method, $args) { if (count($args) < 1) { throw new Exception("invaid arguments"); } if (!isset($args[1]) || empty($args[1])) { $args[1] = array(); } $class = new self($args[0], strtoupper($method), $args[1]); return $class->serialize(); }
public static function encode($_object) { $me = new self(); return $me->serialize($_object); }
public static function get_all_trackings() { $trackings = array(); $id_volunteer = 0; global $wpdb; if (isset($_POST['token'])) { $id_volunteer = Volunteer::get_volunter_id($_POST['token']); } if ($id_volunteer) { $id_trackings = $wpdb->get_col('SELECT id FROM ' . CINDA_TABLE_TRACKINGS_NAME . ' where id_volunteer = ' . $id_volunteer . ' ORDER BY create_date, id ASC'); if (0 < count($id_trackings)) { foreach ($id_trackings as $id) { $tracking = new self($id); $trackings[] = $tracking->serialize(); } } } die(json_encode($trackings)); }
/** * Print contribution based on an ID */ public static function get_contribution() { global $wp; $contribution = new self($wp->query_vars['cid']); die(json_encode($contribution->serialize())); }