public function release($args)
    {
        $json = $this->container->json;
        $markdown = $this->container->markdownParser;
        $responseBody = '';

        // If curl is not installed display alert
        if (!function_exists('curl_init')) {
            $this->setAlert('warning', 'Required PHP cURL not installed');
        } else {
            // https://developer.github.com/v3/repos/releases
            $githubApi = 'https://api.github.com/repos/PitonCMS/Engine/releases';
            $curl = curl_init();
            curl_setopt_array($curl, [
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_URL => $githubApi,
                CURLOPT_USERAGENT => $this->request->getHeaderLine('HTTP_USER_AGENT')
            ]);
            $responseBody = curl_exec($curl);
            $responseStatus = curl_getinfo($curl, CURLINFO_HTTP_CODE);
            curl_close($curl);

            // Verify that we have a response
            if ($responseStatus == '200') {
                $releases = json_decode($responseBody);
                $releases = array_slice($releases, 0, 5, true);

                // Format Markdown
                foreach ($releases as $key => $release) {
                    $releases[$key]->body = $markdown->text($release->body);
                }

                // Check if there is a more current release
                if (array_search($args['release'], array_column($releases, 'tag_name')) > 0) {
                    $message = "The current version is {$releases[0]->tag_name}, you have version {$args['release']}.";
                    $message .= "\nTo upgrade, from your project root run <code>composer update pitoncms/engine</code>";
                    $this->setAlert('info', 'There is a newer version of the PitonCMS Engine', $message);
                }
            } else {
                $releases = [];
                $this->setAlert('warning', "$responseStatus Response From GitHub", $responseBody);
            }
        }

        return $this->render('releaseNotes.html', ['releases' => $releases]);
    }
public function release($args)
    {
        $json = $this->container->json;
        $markdown = $this->container->markdownParser;
        $responseBody = '';

        // If curl is not installed display alert
        if (!function_exists('curl_init')) {
            $this->setAlert('warning', 'Required PHP cURL not installed');
        } else {
            // https://developer.github.com/v3/repos/releases
            $githubApi = 'https://api.github.com/repos/PitonCMS/Engine/releases';
            $curl = curl_init();
            curl_setopt_array($curl, [
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_URL => $githubApi,
                CURLOPT_USERAGENT => $this->request->getHeaderLine('HTTP_USER_AGENT')
            ]);
            $responseBody = curl_exec($curl);
            $responseStatus = curl_getinfo($curl, CURLINFO_HTTP_CODE);
            curl_close($curl);

            // Verify that we have a response
            if ($responseStatus == '200') {
                $releases = json_decode($responseBody);
                $releases = array_slice($releases, 0, 5, true);

                // Format Markdown
                foreach ($releases as $key => $release) {
                    $releases[$key]->body = $markdown->text($release->body);
                }

                // Check if there is a more current release
                if (array_search($args['release'], array_column($releases, 'tag_name')) > 0) {
                    $message = "The current version is {$releases[0]->tag_name}, you have version {$args['release']}.";
                    $message .= "\nTo upgrade, from your project root run <code>composer update pitoncms/engine</code>";
                    $this->setAlert('info', 'There is a newer version of the PitonCMS Engine', $message);
                }
            } else {
                $releases = [];
                $this->setAlert('warning', "$responseStatus Response From GitHub", $responseBody);
            }
        }

        return $this->render('releaseNotes.html', ['releases' => $releases]);
    }
public function release ( $ args ) { $ json = $ this -> container -> json ; $ markdown = $ this -> container -> markdownParser ; $ responseBody = '' ; // If curl is not installed display alert if ( ! function_exists ( 'curl_init' ) ) { $ this -> setAlert ( 'warning' , 'Required PHP cURL not installed' ) ; } else { // https://developer.github.com/v3/repos/releases $ githubApi = 'https://api.github.com/repos/PitonCMS/Engine/releases' ; $ curl = curl_init ( ) ; curl_setopt_array ( $ curl , [ CURLOPT_RETURNTRANSFER => true , CURLOPT_URL => $ githubApi , CURLOPT_USERAGENT => $ this -> request -> getHeaderLine ( 'HTTP_USER_AGENT' ) ] ) ; $ responseBody = curl_exec ( $ curl ) ; $ responseStatus = curl_getinfo ( $ curl , CURLINFO_HTTP_CODE ) ; curl_close ( $ curl ) ; // Verify that we have a response if ( $ responseStatus == '200' ) { $ releases = json_decode ( $ responseBody ) ; $ releases = array_slice ( $ releases , 0 , 5 , true ) ; // Format Markdown foreach ( $ releases as $ key => $ release ) { $ releases [ $ key ] -> body = $ markdown -> text ( $ release -> body ) ; } // Check if there is a more current release if ( array_search ( $ args [ 'release' ] , array_column ( $ releases , 'tag_name' ) ) > 0 ) { $ message = "The current version is {$releases[0]->tag_name}, you have version {$args['release']}." ; $ message .= "\nTo upgrade, from your project root run <code>composer update pitoncms/engine</code>" ; $ this -> setAlert ( 'info' , 'There is a newer version of the PitonCMS Engine' , $ message ) ; } } else { $ releases = [ ] ; $ this -> setAlert ( 'warning' , "$responseStatus Response From GitHub" , $ responseBody ) ; } } return $ this -> render ( 'releaseNotes.html' , [ 'releases' => $ releases ] ) ; }
Show Piton Engine Release Notes

@param array $args GET Segment array
Show Piton Engine Release Notes