This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$doc = new DOMDocument(); | |
// It's rare you'll have valid XHTML, suppress any errors- it'll do its best. | |
@$doc->loadhtml($string); | |
$xpath = new DOMXPath($doc); | |
// Modify the XPath query to match the content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$this->logSection($this->namespace, 'Getting latest tweets for @'.$user->getUsername()); | |
$web = new sfWebBrowser(); | |
$atom = $web->get('http://search.twitter.com/search.atom?q=from:'.$user->getUsername().'&rpp=5'); | |
try { | |
if(!$atom->responseIsError()) { | |
$feed = new SimpleXMLElement($atom->getResponseText()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function link_to_frontend() { | |
// for BC with 1.1 | |
$arguments = func_get_args(); | |
if (empty($arguments[1]) || is_array($arguments[1]) || '@' == substr($arguments[1], 0, 1) || false !== strpos($arguments[1], '/')) { | |
return call_user_func_array('link_to_frontend1', $arguments); | |
} else { | |
if (!array_key_exists(2, $arguments)) { | |
$arguments[2] = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$response = file_get_contents('http://data.tweetsentiments.com:8080/api/analyze.json?'.http_build_query(array('q' => $_GET['tweet']))); | |
$json = json_decode($response); | |
echo $json->sentiment->name,"\n",$json->sentiment->value,"\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<fieldset id="sf_fieldset_[?php echo preg_replace('/[^a-z0-9_]/', '_', strtolower($fieldset)) ?]"> | |
[?php if ('NONE' != $fieldset): ?] | |
<h2>[?php echo __($fieldset, array(), '<?php echo $this->getI18nCatalogue() ?>') ?]</h2> | |
[?php endif; ?] | |
[?php if (is_readable('<?php echo sfConfig::get('sf_app_module_dir').'/'.$this->getModuleName() ?>/templates/_'.preg_replace('/[^a-z0-9_]/', '_', strtolower($fieldset)).'_help.php')): ?] | |
[?php include_partial('<?php echo $this->getModuleName() ?>/'.preg_replace('/[^a-z0-9_]/', '_', strtolower($fieldset)).'_help') ?] | |
[?php endif ?] | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Constructor(in DOMString url, in optional DOMString protocols)] | |
[Constructor(in DOMString url, in optional DOMString[] protocols)] | |
interface WebSocket { | |
readonly attribute DOMString url; | |
// ready state | |
const unsigned short CONNECTING = 0; | |
const unsigned short OPEN = 1; | |
const unsigned short CLOSING = 2; | |
const unsigned short CLOSED = 3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Source: http://www.carronmedia.com/uk-postal-counties-list | |
array( | |
'England' => array( | |
'Avon', | |
'Bedfordshire', | |
'Berkshire', | |
'Buckinghamshire', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class sfWidgetFormCountyChoice extends sfWidgetFormChoice { | |
/** | |
* Constructor. | |
* | |
* Available options: | |
* | |
* * choices: An array of possible choices (defaults to counties) | |
* * multiple: true if the select tag must allow multiple selections |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Acme\BaseBundle\Routing\Generator; | |
use Symfony\Component\Routing\Generator\UrlGenerator as BaseUrlGenerator; | |
use Doctrine\Common\Util\Inflector; | |
/** | |
* UrlGenerator generates URL based on a set of routes. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Acme\DemoBundle\Twig; | |
use Twig_Extension; | |
use Twig_Filter_Method; | |
class ChunkExtension extends \Twig_Extension | |
{ | |
public function getFilters() |
OlderNewer