本文整理汇总了PHP中JoomdleHelperContent::get_file方法的典型用法代码示例。如果您正苦于以下问题:PHP JoomdleHelperContent::get_file方法的具体用法?PHP JoomdleHelperContent::get_file怎么用?PHP JoomdleHelperContent::get_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JoomdleHelperContent
的用法示例。
在下文中一共展示了JoomdleHelperContent::get_file方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_avatar_cb
static function save_avatar_cb($userid, $pic_url)
{
$pic = JoomdleHelperContent::get_file($pic_url);
if (!$pic) {
return;
}
if ($moodle_version == 19) {
$extension = '.jpg';
// Moodle stores JPG always in 1.9
$type = 'image/jpeg';
} else {
$extension = '.png';
// Moodle stores PNG always in 2.0
$type = 'image/png';
}
$newFileName = uniqid($userid . "_") . '.' . $extension;
file_put_contents(JPATH_SITE . '/images/comprofiler/' . $newFileName, $pic);
$db = JFactory::getDBO();
if ($ueConfig['avatarUploadApproval'] == 1) {
$cbNotification = new cbNotification();
$cbNotification->sendToModerators(_UE_IMAGE_ADMIN_SUB, _UE_IMAGE_ADMIN_MSG);
$db->setQuery("UPDATE #__comprofiler SET avatar=" . $db->Quote($newFileName) . ", avatarapproved=0 WHERE id=" . (int) $userid);
} else {
$db->setQuery("UPDATE #__comprofiler SET avatar=" . $db->Quote($newFileName) . ", avatarapproved=1, lastupdatedate=now() WHERE id=" . (int) $userid);
}
$db->query();
}
示例2: check_joomdle_system
static function check_joomdle_system()
{
$params = JComponentHelper::getParams('com_joomdle');
$joomla_config = new JConfig();
/* PHP XMLRPC extension enabled */
$php_exts = get_loaded_extensions();
$xmlrpc_enabled = in_array('xmlrpc', $php_exts);
$system[2]['description'] = JText::_('COM_JOOMDLE_XMLRPC_PHP_EXTENSION');
$system[2]['value'] = $xmlrpc_enabled;
if ($system[2]['value'] == '0') {
$system[2]['error'] = JText::_('COM_JOOMDLE_XMLRPC_PHP_EXTENSION_ERROR');
} else {
$system[2]['error'] = '';
}
/* Error reporting */
/*
$display_errors = ini_get('display_errors');
$error_reporting = ini_get('error_reporting');
$system[6]['description'] = JText::_ ('COM_JOOMDLE_ERROR_REPORTING');
if (($display_errors) && ($error_reporting & E_DEPRECATED))
{
$system[6]['error'] = JText::_ ('COM_JOOMDLE_DEPRECATED_ERRORS_ON');
$system[6]['value'] = 0;
}
else
{
$system[6]['error'] = '';
$system[6]['value'] = 1;
}
*/
/*
$system[0]['description'] = JText::_ ('COM_JOOMDLE_JOOMLA WEB SERVICES');
$system[0]['value'] = $joomla_config->xmlrpc_server;
if ($joomla_config->xmlrpc_server == '0')
$system[0]['error'] = JText::_ ('COM_JOOMDLE_JOOMLA WEB SERVICES ERROR');
else $system[0]['error'] = '';
*/
/* Mandatory Joomdle plugins enabled */
$system[5]['description'] = JText::_('COM_JOOMDLE_JOOMDLEHOOKS_PLUGIN');
$system[5]['value'] = JPluginHelper::isEnabled('user', 'joomdlehooks');
if (JPluginHelper::isEnabled('user', 'joomdlehooks') != '1') {
$system[5]['error'] = JText::_('COM_JOOMDLE_JOOMDLEHOOKS_PLUGIN_ERROR');
} else {
$system[5]['error'] = '';
}
$comp_params = JComponentHelper::getParams('com_joomdle');
$connection = $comp_params->get('connection_method');
if ($connection == 'fgc') {
/* file_get_contents call. Test to see if allow_url_fopen PHP option is enabled */
$system[1]['description'] = JText::_('COM_JOOMDLE_ALLOW_URL_FOPEN');
$system[1]['value'] = ini_get('allow_url_fopen');
if ($system[1]['value'] != '1') {
$system[1]['error'] = JText::_('COM_JOOMDLE_ALLOW_URL_FOPEN_ERROR');
} else {
$system[1]['error'] = '';
}
} else {
if ($connection == 'curl') {
$system[1]['description'] = JText::_('COM_JOOMDLE_CURL_ENABLED');
$system[1]['value'] = function_exists('curl_version') == "Enabled";
if (!$system[1]['value']) {
$system[1]['error'] = JText::_('COM_JOOMDLE_CURL_ENABLED_ERROR');
} else {
$system[1]['error'] = '';
}
}
}
if ($system[1]['error'] != '' || $system[2]['error'] != '') {
/* If no working connection, no need to continue */
return $system;
}
// Check bare HTTP connection
$moodle_url = $params->get('MOODLE_URL');
$moodle_file_url = $moodle_url . '/auth/joomdle/connection_test.php';
$joomla_file_url = $moodle_url . '/auth/joomdle/connection_test_joomla.php';
// Joomla to Moodle
// $result = file_get_contents ($moodle_file_url);
$result = JoomdleHelperContent::get_file($moodle_file_url);
$system[6]['description'] = JText::_('COM_JOOMDLE_JOOMDLE_JOOMLA_TO_MOODLE_CONNECTION');
if (strncmp($result, 'OK', 2) != 0) {
$system[6]['value'] = 0;
$system[6]['error'] = JText::_('COM_JOOMDLE_JOOMLA_CANNOT_CONNECT_TO_MOODLE');
} else {
$system[6]['value'] = 1;
$system[6]['error'] = '';
}
// Moodle to Joomla
// $result = file_get_contents ($joomla_file_url);
$result = JoomdleHelperContent::get_file($joomla_file_url);
$system[7]['description'] = JText::_('COM_JOOMDLE_JOOMDLE_MOODLE_TO_JOOMLA_CONNECTION');
if (strncmp($result, 'OK', 2) != 0) {
$system[7]['value'] = 0;
$system[7]['error'] = JText::_('COM_JOOMDLE_MOODLE_CANNOT_CONNECT_TO_JOOMLA');
} else {
$system[7]['value'] = 1;
$system[7]['error'] = '';
}
/* Test Moodle Web services in joomdle plugin */
$system[3]['description'] = JText::_('COM_JOOMDLE_JOOMDLE_WEB_SERVICES');
//.........这里部分代码省略.........