@param $slug

@return mixed|null
14151
public function getApplicationComponentBySlug($slug)
    {
        $applicationComponents = $this->getApplicationComponents();
        foreach ($applicationComponents as $applicationComponent) {
            if ($applicationComponent->slug == $slug) {
                return $applicationComponent;
            }
        }

        return null;
    }
746385
public function getLog($slug)
    {
        foreach ($this->logs as $log) {
            if ($log->getSlug() == $slug) {
                return $log;
            }
        }
    }
56767
public function fetchBySlug($slug) {
        $select = $this->select()->where('slug = ?', $slug);
        return $this->fetchRow($select);
    }
772679
public function findOneBySlug($slug)
    {
        return $this->_em->createQueryBuilder()
            ->select('p, t, c, co')
            ->from('VeonikBlogBundle:AbstractPost', 'p')
            ->leftJoin('p.tags', 't')
            ->leftJoin('p.categories', 'c')
            ->leftJoin('p.comments', 'co')
            ->where('p.slug = :slug')
            ->andWhere('p.active = true')
            ->setParameter('slug', $slug)
            ->getQuery()
            ->getOneOrNullResult();
    }
869919
public function view($slug = null)
    {
        //Data can be passed as query string, from a widget
        if ($this->request->getQuery('q')) {
            return $this->redirect([$this->request->getQuery('q')]);
        }

        $slug = Text::slug($slug, ['replacement' => ' ']);

        $tag = $this->PostsTags->Tags->findActiveByTag($slug)
            ->cache((sprintf('tag_%s', md5($slug))), $this->PostsTags->getCacheName())
            ->firstOrFail();

        $page = $this->request->getQuery('page', 1);

        //Sets the cache name
        $cache = sprintf('tag_%s_limit_%s_page_%s', md5($slug), $this->paginate['limit'], $page);

        //Tries to get data from the cache
        list($posts, $paging) = array_values(Cache::readMany(
            [$cache, sprintf('%s_paging', $cache)],
            $this->PostsTags->getCacheName()
        ));

        //If the data are not available from the cache
        if (empty($posts) || empty($paging)) {
            $query = $this->PostsTags->Posts->find('active')
                ->find('forIndex')
                ->matching($this->PostsTags->Tags->getAlias(), function (Query $q) use ($slug) {
                    return $q->where(['tag' => $slug]);
                });
            $posts = $this->paginate($query);

            //Writes on cache
            Cache::writeMany([
                $cache => $posts,
                sprintf('%s_paging', $cache) => $this->request->getParam('paging'),
            ], $this->PostsTags->getCacheName());
        //Else, sets the paging parameter
        } else {
            $this->request = $this->request->withParam('paging', $paging);
        }

        $this->set(compact('posts', 'tag'));
    }
1265499
public function getBySlug($slug)
    {
        $image = $this->adapter->get(sprintf('%s/images/%s', $this->endpoint, $slug));

        $image = json_decode($image);

        return new ImageEntity($image->image);
    }
1021420
public static function findBySlug($slug, $locale = null)
    {
        /** @var \Dimsav\Translatable\Translatable $model */
        $model = (new static);

        /** @var SluggableTrait $translationModel */
        $translationModel = $model->getTranslationModelName();
        $parentKey        = $model->getRelationKey();

        $translationInstance = $translationModel::findBySlug($slug, $locale);

        if (empty($translationInstance)) return null;

        return static::find($translationInstance->{$parentKey});
    }
496989
public static function get($slug = null)
    {
        $licenses = self::getLicenseFile();
        $data = (array)$licenses->content();
        $licenses->free();
        $slug = strtolower($slug);

        if (!$slug) {
            return $data['licenses'] ?? [];
        }

        return $data['licenses'][$slug] ?? '';
    }
49039
public static function getPluginFile( $slug ) {

		// Load plugin.php if not already included by core.
		if ( ! function_exists( 'get_plugins' ) ) {
			require ABSPATH . '/wp-admin/includes/plugin.php';
		}

		$plugins = get_plugins();

		foreach ( $plugins as $file => $info ) {

			// Get the basename of the plugin.
			$basename = dirname( plugin_basename( $file ) );
			if ( $basename === $slug ) {
				return $file;
			}
		}

		return null;
	}
878928
public function getPlugin($slug)
    {
        $this->plugins->rewind();
        while ($this->plugins->valid()) {
            if ($this->plugins->current()->getSlug() == $slug) {
                return $this->plugins->current();
            }
            $this->plugins->next();
        }

        return false;
    }
837332
public function transform($slug)
    {
        if (null === $slug) {
            return;
        }

        // If the slug ends with a slash, return just a slash
        // so the item is used as the index page of that directory
        if (substr($slug, -1) == '/') {
            return '/';
        }

        $array = explode('/', $slug);
        $slug = end($array);

        return $slug;
    }
1083341
public function createSlug($slug = null)
    {
        if (! is_null($slug) && $this->getOriginal('slug') === $slug) {
            $this->setAttribute('slug', $slug);

            return;
        }

        if (is_null($slug)) {
            $entityObject = $this->getEntityObject();
            if (property_exists($entityObject, 'slugFields')) {
                $content = $this->getAttribute('content');
                $slug = head($content)[$entityObject->slugFields] ?? '';
            }
        }

        $this->setAttribute('slug', SlugService::createSlug(
            Dashboard::modelClass(self::class),
            'slug',
            $slug, [
            'includeTrashed' => true,
        ]));
    }
1275139
public function getPost( $slug ) {

		// Supported post names (ie. slugs)
		$supported = array_keys( $this->supported );
		if ( ! in_array( $slug, $supported, true ) ) {
			return false;
		}

		$args = [
			'name' => $slug,
			'post_type' => 'custom-style',
			'posts_per_page' => 1,
			'post_status' => 'publish',
			'orderby' => 'modified',
			'no_found_rows' => true,
			'cache_results' => true,
		];

		$q = new \WP_Query();
		$results = $q->query( $args );

		if ( empty( $results ) ) {
			return false;
		}

		return $results[0];
	}
1003660
public function actionAll( $slug = null ) {

            Url::remember( Yii::$app->request->getUrl(), $this->commentUrl );

            $model			= null;
            $dataProvider	= null;
            $mCommentTable	= CoreTables::TABLE_MODEL_COMMENT;

            if( isset( $slug ) ) {

                $model          = $this->parentService->getBySlug( $slug, true );
                $dataProvider	= $this->modelService->getPageByParent( $model->id, $this->parentType, [ 'conditions' => [ "$mCommentTable.type" => $this->commentType ] ] );
            }
            else {

                $dataProvider	= $this->modelService->getPageByParentType( $this->parentType, [ 'conditions' => [ "$mCommentTable.type" => $this->commentType ] ] );
            }

            $parent	= isset( $pid ) ? true : false;

            return $this->render( 'all', [
                     'dataProvider' => $dataProvider,
                     'model' => $model,
                     'parent' => $parent
            ]);
	}
734750
public static function removeDate($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;
    }
666720
public function getBySlug($slug)
    {
        if (empty($slug))
            throw new Exception("Cannot retrieve object [".get_class($this->getModel())."] without slug");

        $results = $this->multiGetBySlug((array)$slug);
        if (isset($results[$slug]))
            return $results[$slug];

        throw new Exception(get_class($this->getModel()).' not found for slug: '.$slug);

    }
256451
private function checkUpdatingSlug($slug)
    {
        if ($this->id >= 1) {

            $found = false;
            foreach ($this->uniqueModels() as $class) {

                // find entries matching slug, exclude updating entry
                $builder = $this->eloqent($class)->where('slug', $slug);

                // same model - exlude check
                if ($class == self::class) {
                    $builder = $builder->where('id', '!=', $this->id);
                }

                // found same slug - break, need new slug
                if ($found = $builder->first()) {
                    break;
                }
            }

            // save to use current slug for update
            if ($found == false || $found == null) {
                return $slug;
            }
        }

        // new unique slug needed
        return false;
    }