public function publishToPage(Page $c, $data, $controls)
 {
     if (!is_array($data)) {
         $data = [];
     }
     $data += ['name' => null];
     $slug = array_filter($controls, function ($item) {
         if ($item instanceof UrlSlugCorePageProperty) {
             return true;
         }
         return false;
     });
     $this->addPageTypeComposerControlRequestValue('cName', $data['name']);
     if (!count($slug) && $c->isPageDraft()) {
         $txt = new Text();
         $this->addPageTypeComposerControlRequestValue('cHandle', $txt->urlify($data['name'], \Config::get('concrete.seo.segment_max_length')));
     }
     parent::publishToPage($c, $data, $controls);
 }
Example #2
0
 /**
  * Checks the request based on the key passed.
  * If $key denotes an array (eg akID[34]['value']) we'll turn the key into arrays if the key has text versions of [ and ] in it
  * If the result is a string, it'll be escaped (with htmlspecialchars).
  *
  * @param string $key The name of the field to be checked.
  * @param string $type 'post' to check in POST data, other values to check in GET data.
  *
  * @return false|array|string Returns an array if $key denotes an array and we received that data, a string if $key is the name of a received data, false if $key is not found in the received data.
  */
 protected function processRequestValue($key, $type = 'post')
 {
     $arr = $type == 'post' ? $_POST : $_GET;
     if (strpos($key, '[') !== false) {
         $key = str_replace(']', '', $key);
         $key = explode('[', trim($key, '['));
         $v2 = $this->ah->get($arr, $key);
         if (isset($v2)) {
             if (is_string($v2)) {
                 return $this->th->specialchars($v2);
             } else {
                 return $v2;
             }
         }
     } elseif (isset($arr[$key]) && is_string($arr[$key])) {
         return $this->th->specialchars($arr[$key]);
     }
     return false;
 }
Example #3
0
 public function getReadableHandle()
 {
     $textHelper = new TextHelper();
     return $textHelper->unhandle($this->osHandle);
 }
Example #4
0
 public static function add($osHandle, $osName = null, $osInformSite = 1, $osInformCustomer = 1, $osIsStartingStatus = 0)
 {
     $db = \Database::connection();
     $em = $db->getEntityManager();
     if (is_null($osName)) {
         $textHelper = new TextHelper();
         $osName = $textHelper->unhandle($osHandle);
     }
     if ($osIsStartingStatus) {
         $existingStartingStatus = $em->getRepository(get_class())->findOneBy(array('osIsStartingStatus' => 1));
         if (is_object($existingStartingStatus)) {
             $existingStartingStatus->setIsStartingStatus(false);
             $existingStartingStatus->save();
         }
     }
     $orderStatus = new self();
     $orderStatus->setHandle($osHandle);
     $orderStatus->setName($osName);
     $orderStatus->setInformSite($osInformSite ? 1 : 0);
     $orderStatus->setInformCustomer($osInformCustomer ? 1 : 0);
     $orderStatus->setIsStartingStatus($osIsStartingStatus ? 1 : 0);
     $orderStatus->save();
 }