public static function SocialContent::getAllInstances in Social Content 7.2
Utility static function to get all instances.
Parameters
array $global: The global to which the return instances should belong to.
bool $only_enabled: Whether to only retrieve enabled instances.
Return value
array Instances.
6 calls to SocialContent::getAllInstances()
- drush_social_content_list in ./
social_content.drush.inc - Callback function for drush social-content-list command.
- SocialContent::getInstances in ./
social_content.class.inc - Get all instances for the current global.
- social_content_cron in ./
social_content.module - Implements hook_cron().
- social_content_cronapi in ./
social_content.module - Implements hook_cronapi().
- social_content_delete_old_nodes in ./
social_content.module - Deletes old nodes of all configured instances.
File
- ./
social_content.class.inc, line 936 - Social Content class.
Class
- SocialContent
- TODO: Table names should be a property for ease of change Separate this class into smaller classes.
Code
public static function getAllInstances($global = array(), $only_enabled = FALSE) {
$query = db_select('social_content_instances', 'social_content_instances')
->fields('social_content_instances', array());
if ($global) {
$query
->condition('global', $global);
}
if ($only_enabled) {
$query
->condition('enabled', 1);
}
$instances = $query
->execute()
->fetchAllAssoc('id');
foreach ($instances as $id => &$instance) {
$instance->settings = unserialize($instance->settings);
$instance->settings['id'] = $id;
$instance->settings['count'] = self::getImportCount($id);
}
return $instances;
}