public function javascript_url($inhead) {
        global $CFG;

        $rev = theme_get_revision();
        $params = array('theme'=>$this->name,'rev'=>$rev);
        $params['type'] = $inhead ? 'head' : 'footer';

        // Return early if there are no files to serve
        if (count($this->javascript_files($params['type'])) === 0) {
            return null;
        }

        if (!empty($CFG->slasharguments) and $rev > 0) {
            $url = new moodle_url("/theme/javascript.php");
            $url->set_slashargument('/'.$this->name.'/'.$rev.'/'.$params['type'], 'noparam', true);
            return $url;
        } else {
            return new moodle_url('/theme/javascript.php', $params);
        }
    }
public function javascript_url($inhead) {
        global $CFG;

        $rev = theme_get_revision();
        $params = array('theme'=>$this->name,'rev'=>$rev);
        $params['type'] = $inhead ? 'head' : 'footer';

        // Return early if there are no files to serve
        if (count($this->javascript_files($params['type'])) === 0) {
            return null;
        }

        if (!empty($CFG->slasharguments) and $rev > 0) {
            $url = new moodle_url("/theme/javascript.php");
            $url->set_slashargument('/'.$this->name.'/'.$rev.'/'.$params['type'], 'noparam', true);
            return $url;
        } else {
            return new moodle_url('/theme/javascript.php', $params);
        }
    }
public function javascript_url ( $ inhead ) { global $ CFG ; $ rev = theme_get_revision ( ) ; $ params = array ( 'theme' => $ this -> name , 'rev' => $ rev ) ; $ params [ 'type' ] = $ inhead ? 'head' : 'footer' ; // Return early if there are no files to serve if ( count ( $ this -> javascript_files ( $ params [ 'type' ] ) ) === 0 ) { return null ; } if ( ! empty ( $ CFG -> slasharguments ) and $ rev > 0 ) { $ url = new moodle_url ( "/theme/javascript.php" ) ; $ url -> set_slashargument ( '/' . $ this -> name . '/' . $ rev . '/' . $ params [ 'type' ] , 'noparam' , true ) ; return $ url ; } else { return new moodle_url ( '/theme/javascript.php' , $ params ) ; } }
Generate a URL to the file that serves theme JavaScript files.

If we determine that the theme has no relevant files, then we return
early with a null value.

@param bool $inhead true means head url, false means footer
@return moodle_url|null
Generate a URL to the file that serves theme JavaScript files .