Skip to content

Commit

Permalink
Coding standards
Browse files Browse the repository at this point in the history
  • Loading branch information
laryn committed Oct 12, 2021
1 parent b9c81fa commit 88a4ff0
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ jobs:
run: >
vendor/bin/phpcs -n
--standard=vendor/backdrop/coder/coder_sniffer/Backdrop
--ignore="vendor/*"
--ignore="vendor/*,xmlsitemap.xmlsitemap.inc"
--extensions=install,module,php,inc .
2 changes: 1 addition & 1 deletion .github/workflows/functional-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

- name: Setup Apache
run: |
sudo cp -f modules/{{ env.REPO_NAME }}/.github/workflows/apache/default.conf /etc/apache2/sites-available/000-default.conf
sudo cp -f modules/${{ env.REPO_NAME }}/.github/workflows/apache/default.conf /etc/apache2/sites-available/000-default.conf
sudo sed -i -e "s?_PWD?$PWD?g" -e "s/_PHP_V/${{ env.USE_PHP_V }}/g" /etc/apache2/sites-available/000-default.conf
sudo apt-get install libapache2-mod-fcgid
sudo a2enmod rewrite proxy fcgid proxy_fcgi
Expand Down
1 change: 0 additions & 1 deletion xmlsitemap.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* @file
* Miscellaneous functions for the xmlsitemap module.
Expand Down
6 changes: 5 additions & 1 deletion xmlsitemap.install
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function xmlsitemap_requirements($phase) {
'severity' => REQUIREMENT_ERROR,
);
if (!in_array(xmlsitemap_get_chunk_size(), array(50000, 'auto'))) {
$requirements['xmlsitemap_chunk_count']['description'] .= ' ' . t('Please increase the number of links per page.');
$requirements['xmlsitemap_chunk_count']['description'] .= ' ' . $t('Please increase the number of links per page.');
}
}

Expand Down Expand Up @@ -354,7 +354,9 @@ function xmlsitemap_install() {
// @todo Does the sitemap show up on first install or is it a 404 page?

// Create the link process the queue.
// @codingStandardsIgnoreStart
/** @var BackdropReliableQueueInterface $queue */
// @codingStandardsIgnoreEnd
$queue = BackdropQueue::get('xmlsitemap_link_process', TRUE);
$queue->createQueue();
}
Expand All @@ -378,7 +380,9 @@ function xmlsitemap_uninstall() {
xmlsitemap_clear_directory(NULL, TRUE);

// Remove the queue.
// @codingStandardsIgnoreStart
/** @var BackdropReliableQueueInterface $queue */
// @codingStandardsIgnoreEnd
$queue = BackdropQueue::get('xmlsitemap_link_process', TRUE);
$queue->deleteQueue();
}
Expand Down
6 changes: 4 additions & 2 deletions xmlsitemap.module
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ function _xmlsitemap_delete_recursive($path, $delete_root = FALSE) {
// Resolve streamwrapper URI to local path.
$path = backdrop_realpath($path);
if (is_dir($path)) {
$dir = dir($path);
$dir = getdir($path);
while (($entry = $dir->read()) !== FALSE) {
if ($entry == '.' || $entry == '..') {
continue;
Expand Down Expand Up @@ -1497,7 +1497,7 @@ function xmlsitemap_get_changefreq_options() {
*
* @todo Remove when http://drupal.org/node/660736 is fixed in core.
*
* @param string $language
* @param string $langcode
* A language code. If not provided the default language will be returned.
*
* @return object
Expand Down Expand Up @@ -1675,7 +1675,9 @@ function xmlsitemap_link_enqueue($type, $ids) {
$data['type'] = $type;
$data['ids'] = is_array($ids) ? $ids : array($ids);

// @codingStandardsIgnoreStart
/** @var BackdropReliableQueueInterface $queue */
// @codingStandardsIgnoreEnd
$queue = BackdropQueue::get('xmlsitemap_link_process');
$queue->createItem($data);
}
1 change: 1 addition & 0 deletions xmlsitemap.xmlsitemap.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
/**
* @file
*
* XML sitemap integration functions for xmlsitemap.module.
*/

Expand Down
4 changes: 2 additions & 2 deletions xmlsitemap_custom/xmlsitemap_custom.scan.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Code for injecting custom XML sitemap entries for legacy stories.
*/

/**
/**
* Scan directories and keep matching subtrees of the custom XML sitemap.
*
* This will ensure that there are XML sitemap custom links for every file
Expand All @@ -13,7 +13,7 @@
* directory, the scan might remove custom links that point to existing files
* (they just don't match the given $mask).
*
* $param array $directories
* @param array $directories
* An associative array keyed by directory names where the values are
* preg_match() regular expressions of the files to find.
*
Expand Down
4 changes: 2 additions & 2 deletions xmlsitemap_engines/xmlsitemap_engines.admin.inc
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ function xmlsitemap_engines_settings_form() {
'#type' => 'textarea',
'#title' => t('Custom submission URLs'),
'#description' => t('Enter one URL per line. The token [sitemap] will be replaced with the URL to your sitemap. For example: %example-before would become %example-after.', array(
'%example-before' => 'http://example.com/ping?[sitemap]',
'%example-after' => xmlsitemap_engines_prepare_url('http://example.com/ping?[sitemap]', url('sitemap.xml', array(
'%example-before' => 'https://example.com/ping?[sitemap]',
'%example-after' => xmlsitemap_engines_prepare_url('https://example.com/ping?[sitemap]', url('sitemap.xml', array(
'absolute' => TRUE,
))),
)),
Expand Down
6 changes: 4 additions & 2 deletions xmlsitemap_engines/xmlsitemap_engines.api.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
/**
* @file
* Hooks provided by the XML sitemap engines module.
*
* @ingroup xmlsitemap
*/

/**
Expand All @@ -15,7 +17,7 @@
function hook_xmlsitemap_engine_info() {
$engines['example'] = array(
'name' => t('Example search engine'),
'url' => 'http://example.com/ping?sitemap=[sitemap]',
'url' => 'https://example.com/ping?sitemap=[sitemap]',
);
return $engines;
}
Expand All @@ -25,7 +27,7 @@ function hook_xmlsitemap_engine_info() {
*/
function hook_xmlsitemap_engine_info_alter(&$engines) {
$engines['example']['name'] = t('Kitten Search');
$engines['example']['url'] = 'http://kittens.com/ping?sitemap=[sitemap]';
$engines['example']['url'] = 'https://kittens.com/ping?sitemap=[sitemap]';
}

/**
Expand Down
6 changes: 4 additions & 2 deletions xmlsitemap_node/xmlsitemap_node.module
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,10 @@ function xmlsitemap_node_node_update(stdClass $node) {
/**
* Default site map links to not allow access until cron queue runs.
*
* @param array $link The link having access set toro.
* @param array $context The context sent in backdrop_alter().
* @param array $link
* The link having access set toro.
* @param array $context
* The context sent in backdrop_alter().
*/
function xmlsitemap_node_deny_access(array $link, array $context = array()) {
// Force link access to 0.
Expand Down

0 comments on commit 88a4ff0

Please sign in to comment.