/** * Executes the match against a needle (second comparison subject). * * @param mixed $needle * Value to compare with. * * @access public * @uses JaxpString * @return bool True if both values match, false otherwise. * @since 1.1 */ function MatchAgainst($needle) { # Convert the needle value to a JaxpString object, # in case the required comparison type involves text # operations. $text_needle = new JaxpString($needle); switch ($this->ComparisonType) { case JAXP_MYSQL_MATCH_CONTAINS: $result = $text_needle->Contains($this->Value); break; case JAXP_MYSQL_MATCH_STARTS_WITH: $result = $text_needle->StartsWith($this->Value); break; case JAXP_MYSQL_MATCH_ENDS_WITH: $result = $text_needle->EndsWith($this->Value); break; case JAXP_MYSQL_MATCH_DISTINCT: case JAXP_MYSQL_MATCH_EQUAL: case JAXP_MYSQL_MATCH_GREATER_OR_EQUAL_THAN: case JAXP_MYSQL_MATCH_GREATER_THAN: case JAXP_MYSQL_MATCH_LESS_OR_EQUAL_THAN: case JAXP_MYSQL_MATCH_LESS_THAN: $match_template = "\$" . "result = \$" . "needle %s %s;"; $code = sprintf($match_template, $this->ComparisonTypeToLogicOperator(), $this->Column->HasQuotes() ? "'" . $this->Value . "'" : $this->Value); eval($code); break; } return $result; }
/** * Returns a friendly-URL encoded version of the note's title. * * @uses JaxpString * * @access public * @return string The encoded title. * @since 1.2.1 */ function GetTitleAsFriendlyUrl() { # Convert the title to a string object. $str = new JaxpString($this->Title); # Return the encoded text. return $str->ToFriendlyUrlText(); }