Removes the date in the format YYYY/mm/dd from the slug if it is found.

The slug passed may or may not contain a date (most times it will)

@param string $slug The slug to have the date removed

@return string A slug without the date
962609
public static function removeDateFromSlug($slug)
    {
        $slug = trim($slug, '/');
        while(preg_match('/^\d{4}\/\d{2}\/\d{2}\/?(\S+)?/', $slug, $m))
            $slug = trim(isset($m[1])?$m[1]:'', '/');
        return $slug;
    }
195893
public static function slugify($slug)
    {
        $slug = preg_replace('/\xE3\x80\x80/', ' ', $slug);
        $slug = str_replace('-', ' ', $slug);
        $slug = preg_replace('#[:\#\*"@+=;!><&\.%()\]\/\'\\\\|\[]#', "\x20", $slug);
        $slug = str_replace('?', '', $slug);
        $slug = trim(mb_strtolower($slug, 'UTF-8'));
        $slug = preg_replace('#\x20+#', '-', $slug);
        return $slug;
    }
1260809
public function display($column, $slug = '", "', $format = '["%s"]')
    {
        return sprintf($format, implode($slug, $this
            ->column($column)
        ));
    }
1280558
protected function _formatDate($date)
    {
        $clearDate = trim($date, '\'" ');
        //brak daty, pusty zwrot
        if (!$clearDate || $clearDate == 'false') {
            return;
        }
        return date($this->getFormat(), strtotime($clearDate));
    }
54062
public function deleteBySlug($slug)
    {
        $album = $this->findBySlug($slug);

        return $this->delete($album->id);
    }
136966
public function deleteImageSetBySlug($slug)
    {
        $imageSet = $this->getImageSet();

        foreach ($imageSet as $key => $set) {
            if ($set->slug == $slug) {
                unset($imageSet[$key]);
            }
        }
        $imageSet = array_values($imageSet);
        $this->repository->imageSet = $imageSet;
        $this->save();
    }
1245963
public function slug($slug = null): self
    {
        if (! empty($slug)) {
            // set this slug to be used in with callback
            $this->slug = $slug;

            // exception to filter on specific slug
            $exception = function ($query) {
                $query->where('slug', '=', $this->slug);
            };

            // load term to filter
            return $this->whereHas('term', $exception);
        }

        return $this;
    }
419485
public static function checkBySlug(string $slug)
    {
        if(Language::all()->where('slug', $slug)->count()) {
            return true;
        }
        return false;
    }
307116
protected function delete($slug)
    {
        if ($this->dao->getBySlug($slug) == false)
            $this->getErrors()->reject('Record not found for slug:' . $slug);
    }
695330
public function findBySlug($slug)
    {
        return $this->plugger
            ->setModel($this)
            ->setAdapter(Post::class)
            ->plugIn(get_page_by_path($slug, OBJECT, $this->getSlug()))
            ->getConnected()
            ->first();
    }
1022949
public function get($slug){
        return empty($this->index[$slug]) ? null : $this->index[$slug];
    }
1114313
public function inGroup($slug)
    {
        return $this->groups->contains(function ($group) use ($slug) {
            return $group->slug === $slug || $group->id === $slug;
        });
    }
1213607
public function bySlug(string $slug = null)
    {
        if (isset($slug)) {
            return $this->apps_by_slug[$slug] ?? null;
        } else {
            return $this->apps_by_slug;
        }
    }
917243
public function checkIfSlugIsUnique($slug)
    {
        $i = 0;
        $this->base_slug = $slug;

        while ($this->post->whereSlug($slug)->get()->count() > 0) {
            $i++;
            $slug = "$this->base_slug-$i";
        }

        return $slug;
    }
290956
public function delete($slug)
    {
        $this->loadModel('Content.ContentTypes');
        $type = $this->ContentTypes->find()
            ->where(['slug' => $slug])
            ->first();

        if (!$type) {
            throw new NotFoundException(__d('content', 'Content type was not found!'));
        }

        if ($this->ContentTypes->delete($type)) {
            $this->Flash->success(__d('content', 'Content was deleted!'));
        } else {
            $$this->Flash->danger(__d('content', 'Content type could not be deleted, please try again.'));
        }

        $this->title(__d('content', 'Delete Content Type'));
        $this->redirect($this->referer());
    }
118325
public function deleteDocumentFolderBySlug($slug)
    {
        $path = '/' . $slug;
        $this->repository->getContentRepository()->deleteDocumentByPath($this->repository, $path);
        $this->repository->getContentRepository()->cleanPublishedDeletedDocuments();
    }
762411
public static function slug($str)
    {
        $str = strtolower($str);
        $str = preg_replace('/[^a-z0-9]/i', '-', $str);
        $str = preg_replace('/-+/', '-', $str);
        $str = preg_replace('/-$|^-/', '', $str);

        return $str;
    }