<?php
namespace Website\Widgets\Pinterest; use Moto; class Widget extends Moto\System\Widgets\AbstractWidget { protected $_name = 'pinterest'; protected static $_defaultProperties = array( 'url' => '', 'lang' => '', 'img_width' => 92, 'board_height' => 600, 'spacing' => array( 'top' => 'auto', 'right' => 'auto', 'bottom' => 'auto', 'left' => 'auto', ), 'align' => array( 'desktop' => 'left', 'tablet' => '', 'mobile-v' => '', 'mobile-h' => '', ), ); protected $_templateType = 'templates'; protected $_widgetId = true; public function getBoardUrl() { $pinterestUrlPattern = '/^(http[s]?:)?\/\/((www\.)?([a-z]{2,3}\.)?pinterest\..+\/)((?!\bpin\b).+)\/(.+)$/i'; if (preg_match($pinterestUrlPattern, $this->getPropertyValue('url'))) { return $this->getPropertyValue('url'); } else { return ''; } } } 