Esempio n. 1
0
 /**
  * Prepares a container
  * 
  * @param array $input Raw input data
  * @return array
  */
 private function prepareInput(array $input)
 {
     // Empty slug is always taken from a title
     if (empty($input['slug'])) {
         $input['slug'] = $input['name'];
     }
     // Empty title is taken from name
     if (empty($input['title'])) {
         $input['title'] = $input['name'];
     }
     $input['slug'] = $this->webPageManager->sluggify($input['slug']);
     return $input;
 }
Esempio n. 2
0
 /**
  * Prepares an input before sending to the form mapper
  * 
  * @param array $input Raw input data
  * @return array Prepared input
  */
 private function prepareInput(array $input)
 {
     $form =& $input['form'];
     // Empty slug is taken from name
     if (empty($form['slug'])) {
         $form['slug'] = $form['name'];
     }
     if (empty($form['title'])) {
         $form['title'] = $form['name'];
     }
     // Normalize a slug now
     $form['slug'] = $this->webPageManager->sluggify($form['slug']);
     return $input;
 }
Esempio n. 3
0
 /**
  * Prepares input before sending to the mapper
  * 
  * @param array $input Raw input data
  * @return array
  */
 private function prepareInput(array $input)
 {
     $category =& $input['data']['category'];
     // Empty slug is always take from a title
     if (empty($category['slug'])) {
         $category['slug'] = $category['name'];
     }
     // Empty title is taken from the name
     if (empty($category['title'])) {
         $category['title'] = $category['name'];
     }
     $category['slug'] = $this->webPageManager->sluggify($category['slug']);
     return $input;
 }
Esempio n. 4
0
 /**
  * Prepares raw input data before sending to the mapper
  * 
  * @param array $input
  * @return array
  */
 private function prepareInput(array $input)
 {
     // Empty slug is always taken from the name
     if (empty($input['slug'])) {
         $input['slug'] = $input['name'];
     }
     // Take empty title from the name
     if (empty($input['title'])) {
         $input['title'] = $input['name'];
     }
     $input['slug'] = $this->webPageManager->sluggify($input['slug']);
     $input['timestamp'] = strtotime($input['date']);
     return $input;
 }
Esempio n. 5
0
 /**
  * Prepares raw form data before sending to the mapper
  * 
  * @param array $input Raw input data
  * @return array
  */
 private function prepareInput(array $input)
 {
     $category =& $input['category'];
     // By default a slug is taken from a title as well
     if (empty($category['slug'])) {
         $category['slug'] = $category['name'];
     }
     // Use name for empty titles
     if (empty($category['title'])) {
         $category['title'] = $category['name'];
     }
     // Force a string to be slugiffied
     $category['slug'] = $this->webPageManager->sluggify($category['slug']);
     return $input;
 }
Esempio n. 6
0
 /**
  * Prepares raw input, before sending to the mapper
  * 
  * @param array $input Raw input data
  * @return array
  */
 private function prepareInput(array $input)
 {
     $data =& $input['data']['post'];
     $data['timestamp'] = strtotime($data['date']);
     // Take a slug from a name if empty
     if (empty($data['slug'])) {
         $data['slug'] = $data['name'];
     }
     // Take empty name from title
     if (empty($data['title'])) {
         $data['title'] = $data['name'];
     }
     $data['slug'] = $this->webPageManager->sluggify($data['slug']);
     return $input;
 }
Esempio n. 7
0
 /**
  * Prepares raw input data before sending it to the mapper
  * 
  * @param array $input
  * @return array
  */
 private function prepareInput(array $input)
 {
     $form =& $input['data']['album'];
     // When name is empty, then it needs to be taken from a title
     if (empty($form['title'])) {
         $form['title'] = $form['name'];
     }
     // Empty slug is always taken from a name
     if (empty($form['slug'])) {
         $form['slug'] = $form['name'];
     }
     // It's time to make a string look like a slug
     $form['slug'] = $this->webPageManager->sluggify($form['slug']);
     return $input;
 }
Esempio n. 8
0
 /**
  * Prepares data container before sending to the mapper
  * 
  * @param array $input Raw input data
  * @return array
  */
 private function prepareInput(array $input)
 {
     $page =& $input['page'];
     // Generate empty slug from the name
     if (empty($page['slug'])) {
         $page['slug'] = $page['name'];
     }
     // Generate empty title from the name
     if (empty($page['title'])) {
         $page['title'] = $page['name'];
     }
     // Make it look like a a slug now
     $page['slug'] = $this->webPageManager->sluggify($page['slug']);
     return $input;
 }
Esempio n. 9
0
 /**
  * Prepares raw input data before sending to the mapper
  * 
  * @param array $input Raw input data
  * @return array
  */
 private function prepareInput(array $input)
 {
     // Request's data
     $product =& $input['data']['product'];
     $files =& $input['files'];
     if (empty($product['slug'])) {
         $product['slug'] = $product['name'];
     }
     // If a cover has been selected, then we need to override its base name right now
     if (!empty($files['file'])) {
         $this->filterFileInput($files['file']);
         $product['cover'] = $files['file'][0]->getName();
     }
     // Empty title is taken from the name
     if (empty($product['title'])) {
         $product['title'] = $product['name'];
     }
     // Make it now look like a slug
     $product['slug'] = $this->webPageManager->sluggify($product['slug']);
     return $input;
 }