/** * Determine the relevant CSS classes for a media item container * @mvc Model * * @param int $item_id * @param string $author_username * @param array $classes Extra classes to add the defaults * @return array */ public static function get_css_classes($item_id, $author_username, $classes = array()) { array_unshift($classes, get_post_type()); array_unshift($classes, Tagregator::CSS_PREFIX . 'media-item'); $highlighted_accounts = explode(',', strtolower(trim(TGGRSettings::get_instance()->settings[get_called_class()]['highlighted_accounts']))); if (in_array(strtolower($author_username), $highlighted_accounts)) { $classes[] = Tagregator::CSS_PREFIX . 'highlighted-account'; } return implode(' ', apply_filters(Tagregator::PREFIX . 'item_css_classes', $classes, $item_id, $author_username)); }
/** * Updates the _newest_activity_date setting with the timestamp of the most recent * @mvc Model * * @param string $hashtag */ protected static function update_newest_activity_date($hashtag) { $latest_post = self::get_latest_hashtagged_post(self::POST_TYPE_SLUG, $hashtag); if (isset($latest_post->ID)) { $settings = TGGRSettings::get_instance()->settings; $settings[__CLASS__]['_newest_activity_date'] = strtotime($latest_post->post_date_gmt . ' GMT'); TGGRSettings::get_instance()->settings = $settings; } }
<input type="text" id="<?php echo esc_attr($class::SETTINGS_PREFIX . $setting); ?> " name="<?php echo esc_attr(Tagregator::PREFIX); ?> settings[<?php echo esc_attr($class); ?> ][<?php echo esc_attr($setting); ?> ] ); ?>" class="regular-text" value="<?php echo esc_attr(TGGRSettings::get_instance()->settings[$class][$setting]); ?> " />
/** * Updates the _newest_tweet_id setting with the ID of the most recent * @mvc Model * * @param string $hashtag */ protected static function update_newest_tweet_id($hashtag) { $latest_post = self::get_latest_hashtagged_post(self::POST_TYPE_SLUG, $hashtag); if (isset($latest_post->ID)) { $source_id = get_post_meta($latest_post->ID, 'source_id', true); if ($source_id) { $settings = TGGRSettings::get_instance()->settings; $settings[__CLASS__]['_newest_tweet_id'] = $source_id; TGGRSettings::get_instance()->settings = $settings; } } }
/** * Constructor * @mvc Controller */ protected function __construct() { $this->register_hook_callbacks(); $this->modules = apply_filters(self::PREFIX . 'modules', array('TGGRSettings' => TGGRSettings::get_instance(), 'TGGRShortcodeTagregator' => TGGRShortcodeTagregator::get_instance())); $this->media_sources = apply_filters(self::PREFIX . 'media_sources', array('TGGRSourceTwitter' => TGGRSourceTwitter::get_instance(), 'TGGRSourceInstagram' => TGGRSourceInstagram::get_instance(), 'TGGRSourceFlickr' => TGGRSourceFlickr::get_instance(), 'TGGRSourceGoogle' => TGGRSourceGoogle::get_instance())); }