public function get($url) { $url = urldecode($url); $styles = new Styles(); $styles->createStyles($url); $colorsResult = $styles->getColorsResult(); $cssResult = $styles->getCSSResult(); return new JsonModel(array('colors' => $colorsResult, 'css' => $cssResult)); }
public function indexAction() { $form = new StylesForm(); $form->get('submit')->setValue('Create CSS'); $colorsResult = null; $cssResult = null; $imageURL = null; $error = null; $request = $this->getRequest(); if ($request->isPost()) { $styles = new Styles(); $form->setInputFilter($styles->getInputFilter()); $form->setData($request->getPost()); if ($form->isValid()) { $styles->createStyles($form->getData()); $colorsResult = $styles->getColorsResult(); $cssResult = $styles->getCSSResult(); $imageURL = $styles->getImageURL(); $error = $styles->getError(); } } return array('form' => $form, 'colorsResult' => $colorsResult, 'imageURL' => $imageURL, 'cssResult' => $cssResult, 'error' => $error); }