diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/CategoryCid.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/CategoryCid.php index 28c9d0e..fb55a40 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/CategoryCid.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/CategoryCid.php @@ -30,25 +30,6 @@ class CategoryCid extends Numeric { protected $database; /** - * Creates an instance of the plugin. - * - * @param \Symfony\Component\DependencyInjection\ContainerInterface $container - * The DI Container. - * @param array $configuration - * A configuration array containing information about the plugin instance. - * @param string $plugin_id - * The plugin ID for the plugin instance. - * @param array $plugin_definition - * The plugin implementation definition. - * - * @return static - * Returns an instance of this plugin. - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) { - return new static($configuration, $plugin_id, $plugin_definition, $container->get('database')); - } - - /** * Constructs a Drupal\Component\Plugin\PluginBase object. * * @param array $configuration @@ -68,6 +49,13 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi /** * {@inheritdoc} */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) { + return new static($configuration, $plugin_id, $plugin_definition, $container->get('database')); + } + + /** + * {@inheritdoc} + */ function titleQuery() { $titles = $this->database->query("SELECT title FROM {aggregator_category} where cid IN (:cid)", array(':cid' => $this->value))->fetchCol(); diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/Fid.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/Fid.php index a7b69d4..f77fb02 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/Fid.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/Fid.php @@ -30,25 +30,6 @@ class Fid extends Numeric { protected $entityManager; /** - * Creates an instance of the plugin. - * - * @param \Symfony\Component\DependencyInjection\ContainerInterface $container - * The DI Container. - * @param array $configuration - * A configuration array containing information about the plugin instance. - * @param string $plugin_id - * The plugin ID for the plugin instance. - * @param array $plugin_definition - * The plugin implementation definition. - * - * @return static - * Returns an instance of this plugin. - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) { - return new static($configuration, $plugin_id, $plugin_definition, $container->get('plugin.manager.entity')); - } - - /** * Constructs a Drupal\Component\Plugin\PluginBase object. * * @param array $configuration @@ -68,6 +49,13 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi /** * {@inheritdoc} */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) { + return new static($configuration, $plugin_id, $plugin_definition, $container->get('plugin.manager.entity')); + } + + /** + * {@inheritdoc} + */ function titleQuery() { $titles = array(); diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/Iid.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/Iid.php index 433196a..1ce1864 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/Iid.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/argument/Iid.php @@ -30,25 +30,6 @@ class Iid extends Numeric { protected $entityManager; /** - * Creates an instance of the plugin. - * - * @param \Symfony\Component\DependencyInjection\ContainerInterface $container - * The DI Container. - * @param array $configuration - * A configuration array containing information about the plugin instance. - * @param string $plugin_id - * The plugin ID for the plugin instance. - * @param array $plugin_definition - * The plugin implementation definition. - * - * @return static - * Returns an instance of this plugin. - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) { - return new static($configuration, $plugin_id, $plugin_definition, $container->get('plugin.manager.entity')); - } - - /** * Constructs a Drupal\Component\Plugin\PluginBase object. * * @param array $configuration @@ -68,6 +49,13 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi /** * {@inheritdoc} */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) { + return new static($configuration, $plugin_id, $plugin_definition, $container->get('plugin.manager.entity')); + } + + /** + * {@inheritdoc} + */ function titleQuery() { $titles = array(); diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/Category.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/Category.php index 0232d43..8291422 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/Category.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/Category.php @@ -56,10 +56,16 @@ public function buildOptionsForm(&$form, &$form_state) { /** * Render whatever the data is as a link to the category. * - * Data should be made XSS safe prior to calling this function. + * @param string $data + * The XSS safe string for the link text. + * @param object $values + * The values retrieved from the database. + * + * @return data + * Returns string for the link text. */ protected function render_link($data, $values) { - $cid = $this->get_value($values, 'cid'); + $cid = $this->getValue($values, 'cid'); if (!empty($this->options['link_to_category']) && !empty($cid) && $data !== NULL && $data !== '') { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = "aggregator/categories/$cid"; @@ -71,7 +77,7 @@ protected function render_link($data, $values) { * {@inheritdoc} */ public function render($values) { - $value = $this->get_value($values); + $value = $this->getValue($values); return $this->render_link($this->sanitizeValue($value), $values); } diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/TitleLink.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/TitleLink.php index f208b65..a4c1e5e 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/TitleLink.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/field/TitleLink.php @@ -65,7 +65,13 @@ function render($values) { /** * Renders aggregator item's title as link. * - * Data should be made XSS safe prior to calling this function. + * @param string $data + * The XSS safe string for the link text. + * @param object $values + * The values retrieved from the database. + * + * @return data + * Returns string for the link text. */ protected function render_link($data, $values) { $link = $this->getValue($values, 'link'); diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/filter/CategoryCid.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/filter/CategoryCid.php index ea8f1a6..bb5f705 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/filter/CategoryCid.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/filter/CategoryCid.php @@ -20,6 +20,37 @@ class CategoryCid extends InOperator { /** + * Database Service Object. + * + * @var \Drupal\Core\Database\Connection + */ + protected $database; + + /** + * Constructs a Drupal\Component\Plugin\PluginBase object. + * + * @param array $configuration + * A configuration array containing information about the plugin instance. + * @param string $plugin_id + * The plugin_id for the plugin instance. + * @param array $plugin_definition + * The plugin implementation definition. + * @param \Drupal\Core\Database\Connection $database + * Database Service Object. + */ + public function __construct(array $configuration, $plugin_id, array $plugin_definition, Connection $database) { + parent::__construct($configuration, $plugin_id, $plugin_definition); + $this->database = $database; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) { + return new static($configuration, $plugin_id, $plugin_definition, $container->get('database')); + } + + /** * {@inheritdoc} */ function getValueOptions() { @@ -28,7 +59,7 @@ function getValueOptions() { } $this->value_options = array(); - $this->value_options = db_query('SELECT cid, title FROM {aggregator_category} ORDER BY title')->fetchAllKeyed(); + $this->value_options = $this->database->query('SELECT cid, title FROM {aggregator_category} ORDER BY title')->fetchAllKeyed(); } } diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/row/Rss.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/row/Rss.php index ad6c933..7e55034 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/row/Rss.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/views/row/Rss.php @@ -76,20 +76,24 @@ function render($row) { $item = new \stdClass(); foreach ($entity->getProperties() as $name => $value) { + // views_view_row_rss takes care about the escaping. $item->{$name} = $value->value; } $item->elements = array( array( 'key' => 'pubDate', + // views_view_row_rss takes care about the escaping. 'value' => gmdate('r', $entity->timestamp->value), ), array( 'key' => 'dc:creator', + // views_view_row_rss takes care about the escaping. 'value' => $entity->author->value, ), array( 'key' => 'guid', + // views_view_row_rss takes care about the escaping. 'value' => $entity->guid->value, 'attributes' => array('isPermaLink' => 'false'), ),