Keep the content's disable settings when re-saving after global options have changed. (More consistent and reliable)
parent
9db33dd61b
commit
d85815b3be
|
@ -2351,23 +2351,24 @@ class H5PCore {
|
||||||
* Determine disable state from sources.
|
* Determine disable state from sources.
|
||||||
*
|
*
|
||||||
* @param array $sources
|
* @param array $sources
|
||||||
|
* @param int $current
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public static function getDisable(&$sources) {
|
public function getDisable(&$sources, $current) {
|
||||||
$disable = H5PCore::DISABLE_NONE;
|
foreach (H5PCore::$disable as $bit => $option) {
|
||||||
if (!isset($sources['frame']) || !$sources['frame']) {
|
if ($option === 'download') {
|
||||||
$disable |= H5PCore::DISABLE_FRAME;
|
$option = 'export';
|
||||||
}
|
}
|
||||||
if (!isset($sources['download']) || !$sources['download']) {
|
if ($this->h5pF->getOption($option, TRUE) ) {
|
||||||
$disable |= H5PCore::DISABLE_DOWNLOAD;
|
if (!isset($sources[$option]) || !$sources[$option]) {
|
||||||
|
$current |= $bit; // Disable
|
||||||
}
|
}
|
||||||
if (!isset($sources['copyright']) || !$sources['copyright']) {
|
else {
|
||||||
$disable |= H5PCore::DISABLE_COPYRIGHT;
|
$current &= ~$bit; // Enable
|
||||||
}
|
}
|
||||||
if (!isset($sources['embed']) || !$sources['embed']) {
|
|
||||||
$disable |= H5PCore::DISABLE_EMBED;
|
|
||||||
}
|
}
|
||||||
return $disable;
|
}
|
||||||
|
return $current;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cache for getting library ids
|
// Cache for getting library ids
|
||||||
|
|
Loading…
Reference in New Issue