function validation() { // Valid sources $this->object->validates_presence_of('source'); // Valid display type? $this->object->validates_presence_of('display_type'); if ($display_type = $this->object->get_display_type()) { $display_type->settings = $this->object->display_settings; if (!$display_type->validate()) { foreach ($display_type->get_errors() as $property => $errors) { foreach ($errors as $error) { $this->object->add_error($error, $property); } } } // Is the display type compatible with the source? E.g., if we're // using a display type that expects images, we can't be feeding it // galleries and albums if ($source = $this->object->get_source()) { if (!$display_type->is_compatible_with_source($source)) { $this->object->add_error(_('Source not compatible with selected display type'), 'display_type'); } } // If no maximum_entity_count has been given, then set a maximum if (!isset($this->object->maximum_entity_count)) { $this->object->maximum_entity_count = C_Photocrati_Global_Settings_Manager::get('maximum_entity_count', 500); } } else { $this->object->add_error('Invalid display type', 'display_type'); } return $this->object->is_valid(); }
static function get_instance() { if (is_multisite()) { return C_Photocrati_Global_Settings_Manager::get_instance(); } else { return C_Photocrati_Settings_Manager::get_instance(); } }
function get($key, $default = NULL) { $retval = parent::get($key, NULL); if (is_null($retval)) { $retval = C_Photocrati_Global_Settings_Manager::get_instance()->get($key, $default); } return $retval; }
function _load_non_pope() { // Load caching component include_once 'non_pope/class.photocrati_cache.php'; C_Photocrati_Cache::get_instance(); C_Photocrati_Cache::get_instance('displayed_galleries'); C_Photocrati_Cache::get_instance('displayed_gallery_rendering'); C_Photocrati_Cache::$enabled = PHOTOCRATI_CACHE; if (isset($_REQUEST['ngg_flush'])) { C_Photocrati_Cache::flush('all'); die("Flushed all caches"); } elseif (isset($_REQUEST['ngg_force_update'])) { C_Photocrati_Cache::$do_not_lookup = TRUE; C_Photocrati_Cache::$force_update = TRUE; $_SERVER['QUERY_STRING'] = str_replace('ngg_force_update=1', '', $_SERVER['QUERY_STRING']); } elseif (isset($_REQUEST['ngg_flush_expired'])) { C_Photocrati_Cache::flush('all', TRUE); die("Flushed all expired items from the cache"); } // Load Settings Manager include_once 'non_pope/class.photocrati_settings_manager.php'; include_once 'non_pope/class.nextgen_settings.php'; C_Photocrati_Global_Settings_Manager::$option_name = $this->_settings_option_name; C_Photocrati_Settings_Manager::$option_name = $this->_settings_option_name; // Load the installer include_once 'non_pope/class.photocrati_installer.php'; // Load the resource manager include_once 'non_pope/class.photocrati_resource_manager.php'; C_Photocrati_Resource_Manager::init(); // Load the style manager include_once 'non_pope/class.nextgen_style_manager.php'; // Load the shortcode manager include_once 'non_pope/class.nextgen_shortcode_manager.php'; }
function select_random_variation() { $retval = FALSE; $source_obj = $this->object->get_source(); if ($source_obj && $source_obj->has_variations) { $max = 0; if (!defined('NGG_MAX_VARIATIONS')) { $settings = C_Photocrati_Global_Settings_Manager::get_instance(); $max = $settings->get('max_variations', 5); define('NGG_MAX_VARIATIONS', $max); } else { $max = NGG_MAX_VARIATIONS; } $this->object->variation = floor(rand(1, $max)); $retval = $this->object->variation; } return $retval; }
function _load_non_pope() { // Load caching component include_once 'non_pope/class.photocrati_transient_manager.php'; if (isset($_REQUEST['ngg_flush']) or isset($_REQUEST['ngg_flush_expired'])) { C_Photocrati_Transient_Manager::flush(); die("Flushed all caches"); } // Load Settings Manager include_once 'non_pope/class.photocrati_settings_manager.php'; include_once 'non_pope/class.nextgen_settings.php'; C_Photocrati_Global_Settings_Manager::$option_name = $this->_settings_option_name; C_Photocrati_Settings_Manager::$option_name = $this->_settings_option_name; // Load the installer include_once 'non_pope/class.photocrati_installer.php'; // Load the resource manager include_once 'non_pope/class.photocrati_resource_manager.php'; C_Photocrati_Resource_Manager::init(); // Load the style manager include_once 'non_pope/class.nextgen_style_manager.php'; // Load the shortcode manager include_once 'non_pope/class.nextgen_shortcode_manager.php'; }
function _load_non_pope() { // Load WordPress pluggables for plugin compatibility include_once path_join(ABSPATH, 'wp-includes/pluggable.php'); // Load caching component include_once 'non_pope/class.photocrati_cache.php'; C_Photocrati_Cache::$enabled = TRUE; if (isset($_REQUEST['ngg_flush'])) { C_Photocrati_Cache::flush('all'); $_SERVER['QUERY_STRING'] = str_replace('ngg_flush=1', '', $_SERVER['QUERY_STRING']); } elseif (isset($_REQUEST['ngg_force_update'])) { C_Photocrati_Cache::$do_not_lookup = TRUE; C_Photocrati_Cache::$force_update = TRUE; $_SERVER['QUERY_STRING'] = str_replace('ngg_force_update=1', '', $_SERVER['QUERY_STRING']); } // Load Settings Manager include_once 'non_pope/class.photocrati_settings_manager.php'; include_once 'non_pope/class.nextgen_settings.php'; C_Photocrati_Global_Settings_Manager::$option_name = $this->_settings_option_name; C_Photocrati_Settings_Manager::$option_name = $this->_settings_option_name; // Load the installer include_once 'non_pope/class.photocrati_installer.php'; // Load the resource manager include_once 'non_pope/class.photocrati_resource_manager.php'; C_Photocrati_Resource_Manager::init(); // Load the style manager include_once 'non_pope/class.nextgen_style_manager.php'; // Load the shortcode manager include_once 'non_pope/class.nextgen_shortcode_manager.php'; }