main/core/Controller/HomeController.php
public function canGenerateContentAction(Request $request)
    {
        $content = $this->decodeRequest($request);
        if ($content && $content['url'] && $this->manager->isValidUrl($content['url'])) {
            $graph = $this->manager->getGraph($content['url']);

            if (isset($graph['type'])) {
                return $this->render(
                    'ClarolineCoreBundle:home/graph:'.$graph['type'].'.html.twig',
                    ['content' => $graph],
                    true
                );
            }
        }

        return new Response('false'); //in case is not valid URL
    }
public function canGenerateContentAction(Request $request)
    {
        $content = $this->decodeRequest($request);
        if ($content && $content['url'] && $this->manager->isValidUrl($content['url'])) {
            $graph = $this->manager->getGraph($content['url']);

            if (isset($graph['type'])) {
                return $this->render(
                    'ClarolineCoreBundle:home/graph:'.$graph['type'].'.html.twig',
                    ['content' => $graph],
                    true
                );
            }
        }

        return new Response('false'); //in case is not valid URL
    }
public function canGenerateContentAction ( Request $ request ) { $ content = $ this -> decodeRequest ( $ request ) ; if ( $ content && $ content [ 'url' ] && $ this -> manager -> isValidUrl ( $ content [ 'url' ] ) ) { $ graph = $ this -> manager -> getGraph ( $ content [ 'url' ] ) ; if ( isset ( $ graph [ 'type' ] ) ) { return $ this -> render ( 'ClarolineCoreBundle:home/graph:' . $ graph [ 'type' ] . '.html.twig' , [ 'content' => $ graph ] , true ) ; } } return new Response ( 'false' ) ; //in case is not valid URL }
Check if a string is a valid URL.

@Route("/cangeneratecontent", name="claroline_can_generate_content", options={"expose" = true})
@Method("POST")

@param Request $request

@return Response
Check if a string is a valid URL .