function getId() { if ($this->id === null) { $a = explode('_', get_class($this)); $this->id = fromCamelCase(array_pop($a), '-'); } return $this->id; }
function getId() { if ($this->id === null) { $a = preg_split('#[\\\\_]#', get_class($this)); $this->id = fromCamelCase(array_pop($a), '-'); } return $this->id; }
function getAvailable() { $result = array(); foreach (get_declared_classes() as $class) { if (is_subclass_of($class, 'Am_Invoice_Tax')) { $result[] = fromCamelCase(str_replace('Am_Invoice_Tax_', '', $class), '-'); } } return $result; }
function getClass() { return fromCamelCase(str_replace('Am_Form_Brick_', '', get_class($this)), '-'); }
public function __call($name, $arguments) { $prefixes = array('findBy', 'findFirstBy', 'deleteBy'); foreach ($prefixes as $prefix) { if (strpos($name, $prefix) !== 0) { continue; } $key = fromCamelCase(substr($name, strlen($prefix))); $arguments[0] = array($key => $arguments[0]); return call_user_func_array(array($this, $prefix), $arguments); } //trigger_error("Method [$name] does not exists in " . get_class($this), E_USER_ERROR); throw new Am_Exception_InternalError("Method [{$name}] does not exists in " . get_class($this)); }
function getId($oldStyle = true) { if (null == $this->id) { $this->id = str_ireplace($this->_idPrefix, '', get_class($this)); } return $oldStyle ? fromCamelCase($this->id, '-') : $this->id; }
/** * Transform PHP class name to CSS class */ static function classToCss($className) { return strtolower(preg_replace('/\\-+/', '-', str_replace('_', '-', fromCamelCase($className)))); }
died($error_message); } $email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type", "bcc:", "to:", "cc:", "href"); return str_replace($bad, "", $string); } function fromCamelCase($camelCaseString) { $re = '/(?<=[a-z])(?=[A-Z])/x'; $a = preg_split($re, $camelCaseString); return join($a, " "); } foreach ($_POST as $k => $v) { $email_message .= "<tr><td style=\"border-bottom:1px solid #666;width:200px;\">" . fromCamelCase($k) . "</td><td style=\"border-bottom:1px solid #666;\">" . clean_string($v) . "</td></tr>\n"; } // create email headers $headers = 'MIME-Version: 1.0' . "\\ r\n" . 'Content-type: text/html; charset=iso-8859-1' . "\\ r\n" . 'From: Health Survey Form<*****@*****.**>' . " \r\n" . 'Reply-To: ' . $email_from . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $message = '<html><body>'; $message .= '<h1 style="color:#f40;">About ' . $first_name . ' ' . $last_name . ',</h1>'; $message .= '<table style="border:1px solid #000;">' . $email_message . '</table>'; $message .= '</body></html>'; @mail($email_to, $email_subject, $message, $headers); ?> <!-- include your own success html here -->