是否有任何插件可用於joomla 2.5從github存儲庫中嵌入代碼。對於新聞媒體來說,有一個插件可以實現同樣的功能(http://wordpress.org/extend/plugins/github-code-viewer-2/)。我想做的事包括從我的github倉庫到使用的東西我的Joomla/K2的文章像Joomla插件將github代碼顯示爲文章
{github url='https://github.com/jamescarr/spring-integration/blob/master/spring-integration-file/src/main/java/org/springframework/integration/file/filters/AbstractFileListFilter.java'}
代碼通過查看WP插件,我還以爲寫我自己的Joomla插件,但WP插件使用* wp_remote_fopen *的功能,並且我在joomla中找不到相同類型的功能,並使用這種remote_open函數閱讀關於漏洞的一些文章。這裏是WP插件做
function getGitHubFile($url, $ttl = null){
self::__loadCache($url, $ttl);
if (isset(self::$cache[$url])) {
$code = self::$cache[$url];
} else {
$code = wp_remote_fopen($url . '?raw=true');
if ($code == '') {
return 'You need cURL installed to use GitHub_Code_Viewer';
}
$code = str_replace('<', '<', $code);
self::__setCache($url, $code);
}
return $code;
}
WordPress的wp_remote_fopen方法將等同於在Joomla中使用cURL。看看php.net的信息,瞭解如何使用它。如果cURL在服務器上被禁用,請嘗試使用fopen()或file_get_contents(); – Stilero
我們是否有任何joomla api而不是使用php api? – springpress
不是我所知道的。 JFile類僅用於本地文件。 – Stilero