This file contains hidden or 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 | |
protected function getValidationErrorResponse() | |
{ | |
$request = $this->getRequest(); | |
if ($request->isAjax()) { | |
$validationErrors = []; | |
foreach ($this->validator->getErrors() as $error) { |
This file contains hidden or 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
// Remove entity-encoded U+FFFD replacement character. It signifies non-displayable characters, | |
// and shows up as an encoding error in browsers. | |
$result->Excerpt = DBField::create_field( | |
'HTMLText', | |
str_replace( | |
'�', | |
'', | |
implode(' ... ', $combinedHighlights) | |
) |
This file contains hidden or 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 | |
/** | |
* Extension to disable the preview on pages that don't need it. | |
* To hide the preview on a page, add this to the class: | |
* | |
* private static $hide_preview_panel = true; | |
*/ | |
class CMSMainExtension extends Extension | |
{ |
This file contains hidden or 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
$fields = FieldList::create(TabSet::create('Root')); |
This file contains hidden or 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
xvfb-run -a -s "-screen 0 640x480x16" wkhtmltopdf "$@" |
This file contains hidden or 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 CustomValidator extends RequiredFields | |
{ | |
public function php($data) | |
{ | |
if ($data['Type'] == 'Video') { | |
$this->addRequiredField('VideoImage'); | |
} |
This file contains hidden or 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 | |
public function onBeforeWrite() | |
{ | |
/** ========================================= | |
* @var URLSegmentFilter $filter | |
* ========================================*/ | |
if ($this->isChanged('Title') || !$this->getField('Slug')) { | |
$filter = singleton('URLSegmentFilter'); |
This file contains hidden or 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://stackoverflow.com/a/5965940/2 | |
* | |
* @param array $data | |
* @param \SimpleXMLElement $xml_data | |
*/ | |
protected function array_to_xml($data, &$xml_data) | |
{ | |
foreach ($data as $key => $value) { |
This file contains hidden or 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 MyTask extends BuildTask | |
{ | |
protected $title = 'My Task'; | |
protected $description = 'My task description'; | |
protected $br; | |
protected $hr; | |
public function __construct() |
This file contains hidden or 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
phpize | |
CFLAGS=-m32 CPPFLAGS=-m32 CCASFLAGS=-m32 ./configure | |
make | |
sudo make install |
NewerOlder