protected function validatePageRequest($token) { if (!$this->token->validate($token)) { $this->error->add($this->token->getErrorMessage()); } $ssHandle = $this->request->request->get('ssHandle'); if ($ssHandle) { $service = Service::getByHandle($ssHandle); } $sec = Core::make('helper/security'); $url = $sec->sanitizeURL($this->request->request->get('url')); if (!$url) { $this->error->add(t('You must specify a valid URL.')); } if (!is_object($service)) { $this->error->add(t('You must choose a service.')); } return array($ssHandle, $url); }
public function getDisplayValue() { $html = ''; $services = $this->getValue(); if (count($services) > 0) { $env = Environment::get(); $url = $env->getURL(DIRNAME_ATTRIBUTES . '/social_links/view.css'); $this->addHeaderItem(Loader::helper('html')->css($url)); $html .= '<span class="ccm-social-link-attribute-display">'; foreach ($services as $service => $serviceInfo) { $serviceObject = Service::getByHandle($service); if (is_object($serviceObject)) { $iconHtml = $serviceObject->getServiceIconHTML(); } $html .= '<span class="ccm-social-link-service">'; $html .= '<span class="ccm-social-link-service-icon"><a href="' . filter_var($serviceInfo, FILTER_VALIDATE_URL) . '">' . $iconHtml . '</a></span>'; $html .= '<span class="ccm-social-link-service-info"><a href="' . filter_var($serviceInfo, FILTER_VALIDATE_URL) . '">' . $serviceObject->getName() . '</a></span>'; $html .= '</span>'; } $html .= '</span>'; } return $html; }
><?php echo $s->getDisplayName(); ?> </option> <?php } ?> </select> </div> <div class="form-group"> <span class="ccm-social-link-service-text-wrapper"> <span class="ccm-social-link-service-add-on-wrapper"> <span class="add-on"> <?php if (is_object(Service::getByHandle($data['service'][$i]))) { echo Service::getByHandle($data['service'][$i])->getServiceIconHTML(); } ?> </span> <input name="<?php echo $this->field('serviceInfo'); ?> []" type="text" value="<?php echo $data['serviceInfo'][$i]; ?> " /> <button type="button" class="ccm-social-link-attribute-remove-line btn btn-link"><i class="fa fa-trash-o"></i></button> </span> </span> </div> </div>
public function getServiceObject() { return Service::getByHandle($this->ssHandle); }