/**
  * @param mixed[] $options New value for gallery branch of DG options array.
  * @param int $blog The blog we're retrieving options for (null => current blog).
  */
 public static function setOptions($options, $blog = null)
 {
     $dg_options = DocumentGallery::getOptions($blog);
     $dg_options['gallery'] = $options;
     DocumentGallery::setOptions($dg_options, $blog);
 }
 /**
  * Runs activation setup for Document Gallery on all blog(s) it is activated on.
  *
  * @param int $blog Blog to update or null if updating current blog.
  */
 private static function _activate($blog)
 {
     $options = DocumentGallery::getOptions($blog);
     // first activation
     if (is_null($options)) {
         DocumentGallery::setOptions(self::getDefaultOptions(), $blog);
     }
 }
示例#3
0
 /**
  * Key: Attachment ID
  * Val: array
  *      + timestamp - When the thumbnail was generated (or generation failed).
  *      + thumb_path - System path to thumbnail image.
  *      + thumb_url - URL pointing to the thumbnail for this document.
  *      + thumber - Generator used to create thumb OR false if failed to gen.
  *
  * @param array $options Thumber options to store in DB
  */
 private static function setOptions($options, $blog = null)
 {
     $dg_options = DocumentGallery::getOptions($blog);
     $dg_options['thumber'] = $options;
     DocumentGallery::setOptions($dg_options, $blog);
 }
 /**
  * Retrieves the supported MIME types from Thumber that are also compatible with WordPress.
  * @return string[] The supported MIME types reported by the Thumber server.
  */
 public function getMimeTypes()
 {
     global $dg_options;
     if (empty($dg_options['thumber-co']['mime_types'])) {
         // avoid values being removed as a result of current user but also include any MIME types
         // that are added outside of the default WP values
         $wp_types = array_merge(wp_get_mime_types(), get_allowed_mime_types());
         $allowed = array_intersect($wp_types, parent::getMimeTypes());
         $dg_options['thumber-co']['mime_types'] = array_keys($allowed);
         DocumentGallery::setOptions($dg_options);
     }
     return $dg_options['thumber-co']['mime_types'];
 }
/**
 * @return int The limit, which may or may not be a member of $limit_options.
 */
function dg_get_limit_param()
{
    global $dg_options;
    $limit = isset($_REQUEST['limit']) ? DG_Util::posint($_REQUEST['limit']) : $dg_options['meta']['items_per_page'];
    if ($limit !== $dg_options['meta']['items_per_page']) {
        $dg_options['meta']['items_per_page'] = $limit;
        DocumentGallery::setOptions($dg_options);
    }
    return $limit;
}