Keep the content's disable settings when re-saving after global options have changed. (More consistent and reliable)

redesign-copyrights
Frode Petterson 2015-05-22 15:31:28 +02:00
parent 9db33dd61b
commit d85815b3be
1 changed files with 15 additions and 14 deletions

View File

@ -2351,23 +2351,24 @@ class H5PCore {
* Determine disable state from sources.
*
* @param array $sources
* @param int $current
* @return int
*/
public static function getDisable(&$sources) {
$disable = H5PCore::DISABLE_NONE;
if (!isset($sources['frame']) || !$sources['frame']) {
$disable |= H5PCore::DISABLE_FRAME;
public function getDisable(&$sources, $current) {
foreach (H5PCore::$disable as $bit => $option) {
if ($option === 'download') {
$option = 'export';
}
if (!isset($sources['download']) || !$sources['download']) {
$disable |= H5PCore::DISABLE_DOWNLOAD;
if ($this->h5pF->getOption($option, TRUE) ) {
if (!isset($sources[$option]) || !$sources[$option]) {
$current |= $bit; // Disable
}
if (!isset($sources['copyright']) || !$sources['copyright']) {
$disable |= H5PCore::DISABLE_COPYRIGHT;
else {
$current &= ~$bit; // Enable
}
if (!isset($sources['embed']) || !$sources['embed']) {
$disable |= H5PCore::DISABLE_EMBED;
}
return $disable;
}
return $current;
}
// Cache for getting library ids