updated core to 7.58 (right after the site was hacked)

This commit is contained in:
2018-04-20 23:48:40 +02:00
parent 18f4aba146
commit 9344a61b61
711 changed files with 99690 additions and 480 deletions

View File

@@ -0,0 +1,59 @@
<?php
/**
* @file
* Template file for js_example module.
*/
?>
<div class="demo">
<h2><?php print $title; ?></h2>
<div id="accordion">
<h3><a href="#">Section 1</a></h3>
<div>
<p>
Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
</p>
</div>
<h3><a href="#">Section 2</a></h3>
<div>
<p>
Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
suscipit faucibus urna.
</p>
</div>
<h3><a href="#">Section 3</a></h3>
<div>
<p>
Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
</p>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
<h3><a href="#">Section 4</a></h3>
<div>
<p>
Cras dictum. Pellentesque habitant morbi tristique senectus et netus
et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
mauris vel est.
</p>
<p>
Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
inceptos himenaeos.
</p>
</div>
</div>
</div><!-- End demo -->

View File

@@ -0,0 +1,5 @@
div#js-weights div {
font-size: 20px;
font-weight: bold;
}

View File

@@ -0,0 +1,9 @@
(function ($) {
Drupal.behaviors.jsWeightsBlack = {
attach: function (context, settings) {
var weight = settings.jsWeights.black;
var newDiv = $('<div />').css('color', 'black').html('I have a weight of ' + weight);
$('#js-weights').append(newDiv);
}
};
})(jQuery);

View File

@@ -0,0 +1,9 @@
(function ($) {
Drupal.behaviors.jsWeightsBlue = {
attach: function (context, settings) {
var weight = settings.jsWeights.blue;
var newDiv = $('<div />').css('color', 'blue').html('I have a weight of ' + weight);
$('#js-weights').append(newDiv);
}
};
})(jQuery);

View File

@@ -0,0 +1,9 @@
(function ($) {
Drupal.behaviors.jsWeightsBrown = {
attach: function (context, settings) {
var weight = settings.jsWeights.brown;
var newDiv = $('<div />').css('color', 'brown').html('I have a weight of ' + weight);
$('#js-weights').append(newDiv);
}
};
})(jQuery);

View File

@@ -0,0 +1,9 @@
(function ($) {
Drupal.behaviors.jsWeightsGreen = {
attach: function (context, settings) {
var weight = settings.jsWeights.green;
var newDiv = $('<div></div>').css('color', 'green').html('I have a weight of ' + weight);
$('#js-weights').append(newDiv);
}
};
})(jQuery);

View File

@@ -0,0 +1,9 @@
(function ($) {
Drupal.behaviors.jsWeightsPurple = {
attach: function (context, settings) {
var weight = settings.jsWeights.purple;
var newDiv = $('<div />').css('color', 'purple').html('I have a weight of ' + weight);
$('#js-weights').append(newDiv);
}
};
})(jQuery);

View File

@@ -0,0 +1,9 @@
(function ($) {
Drupal.behaviors.jsWeightsRed = {
attach: function (context, settings) {
var weight = settings.jsWeights.red;
var newDiv = $('<div />').css('color', 'red').html('I have a weight of ' + weight);
$('#js-weights').append(newDiv);
}
};
})(jQuery);

View File

@@ -0,0 +1,12 @@
name = JS Example
description = An example module showing how to use some of the new JavaScript features in Drupal 7
package = Example modules
core = 7.x
files[] = js_example.test
; Information added by Drupal.org packaging script on 2017-01-10
version = "7.x-1.x-dev"
core = "7.x"
project = "examples"
datestamp = "1484076787"

View File

@@ -0,0 +1,122 @@
<?php
/**
* @file
* Examples showing how to use some of the new JavaScript features in Drupal 7.
*/
/**
* @defgroup js_example Example: JavaScript
* @ingroup examples
* @{
* Examples using Drupal 7's built-in JavaScript.
*/
/**
* Implements hook_theme().
*/
function js_example_theme() {
return array(
'my_accordion' => array(
'template' => 'accordion',
'variables' => array('title' => NULL),
),
);
}
/**
* Implements hook_menu().
*/
function js_example_menu() {
$items = array();
$items['js_example/weights'] = array(
'title' => 'JS Example: see weighting in action',
'page callback' => 'js_example_js_weights',
'access callback' => TRUE,
);
$items['js_example/accordion'] = array(
'title' => 'JS Example: jQuery UI accordion',
'page callback' => 'js_example_accordion',
'access callback' => TRUE,
);
return $items;
}
/**
* Weights demonstration.
*
* Here we demonstrate attaching a number of scripts to the render array.
* These scripts generate content according to 'weight' and color.
*
* On the Drupal side, we do three main things:
* - Create a container DIV, with an ID all the scripts can recognize.
* - Attach some scripts which generate color-coded content. We use the
* 'weight' attribute to set the order in which the scripts are included.
* - Add the color->weight array to the settings variable in each *color*.js
* file. This is where Drupal passes data out to JavaScript.
*
* Each of the color scripts (red.js, blue.js, etc) uses jQuery to find our
* DIV, and then add some content to it. The order in which the color scripts
* execute will end up being the order of the content.
*
* The 'weight' form atttribute determines the order in which a script is
* output to the page. To see this in action:
* - Uncheck the 'Aggregate Javascript files' setting at:
* admin/config/development/performance.
* - Load the page: js_example/weights. Examine the page source.
* You will see that the color js scripts have been added in the <head>
* element in weight order.
*
* To test further, change a weight in the $weights array below, then save
* this file and reload js_example/weights. Examine the new source to see the
* reordering.
*
* @return array
* A renderable array.
*/
function js_example_js_weights() {
// Add some css to show which line is output by which script.
drupal_add_css(drupal_get_path('module', 'js_example') . '/css/jsweights.css');
// Create an array of items with random-ish weight values.
$weights = array(
'red' => 100,
'blue' => 23,
'green' => 3,
'brown' => 45,
'black' => 5,
'purple' => 60,
);
// Attach the weights array to our JavaScript settings. This allows the
// color scripts to discover their weight values, by accessing
// settings.jsWeights.*color*. The color scripts only use this information for
// display to the user.
drupal_add_js(array('jsWeights' => $weights), array('type' => 'setting'));
// Add our individual scripts. We add them in an arbitrary order, but the
// 'weight' attribute will cause Drupal to render (and thus load and execute)
// them in the weighted order.
drupal_add_js(drupal_get_path('module', 'js_example') . '/js/red.js', array('weight' => $weights['red']));
drupal_add_js(drupal_get_path('module', 'js_example') . '/js/blue.js', array('weight' => $weights['blue']));
drupal_add_js(drupal_get_path('module', 'js_example') . '/js/green.js', array('weight' => $weights['green']));
drupal_add_js(drupal_get_path('module', 'js_example') . '/js/brown.js', array('weight' => $weights['brown']));
drupal_add_js(drupal_get_path('module', 'js_example') . '/js/black.js', array('weight' => $weights['black']));
drupal_add_js(drupal_get_path('module', 'js_example') . '/js/purple.js', array('weight' => $weights['purple']));
// Main container DIV. We give it a unique ID so that the JavaScript can
// find it using jQuery.
$output = '<div id="js-weights"></div>';
return $output;
}
/**
* Demonstrate accordion effect.
*/
function js_example_accordion() {
$title = t('Click sections to expand or collapse:');
$build['myelement'] = array(
'#theme' => 'my_accordion',
'#title' => $title,
);
$build['myelement']['#attached']['library'][] = array('system', 'ui.accordion');
$build['myelement']['#attached']['js'][] = array('data' => '(function($){$(function() { $("#accordion").accordion(); })})(jQuery);', 'type' => 'inline');
$output = drupal_render($build);
return $output;
}

View File

@@ -0,0 +1,46 @@
<?php
/**
* @file
* Test file for js_example module.
*/
/**
* Default test case for the js_example module.
*
* @ingroup js_example
*/
class JsExampleTestCase extends DrupalWebTestCase {
/**
* {@inheritdoc}
*/
public static function getInfo() {
return array(
'name' => 'JavaScript Example',
'description' => 'Functional tests for the JavaScript Example module.' ,
'group' => 'Examples',
);
}
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp('js_example');
}
/**
* Tests the menu paths defined in js_example module.
*/
public function testJsExampleMenus() {
$paths = array(
'js_example/weights',
'js_example/accordion',
);
foreach ($paths as $path) {
$this->drupalGet($path);
$this->assertResponse(200, '200 response for path: ' . $path);
}
}
}