Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/jetpack/modules/shortcod...
File: presentations.php
<?php //phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
[0] Fix | Delete
/**
[1] Fix | Delete
* Presentations
[2] Fix | Delete
* Presentations plugin based on the work done by <a href="http://darylkoop.com/">Daryl Koopersmith</a>. Powered by jmpress.js
[3] Fix | Delete
*
[4] Fix | Delete
* HOW TO: How the plugin settings are organized and which features are supported.
[5] Fix | Delete
*
[6] Fix | Delete
* The entire presentation should be wrapped with a [presentation] shortcode, and every
[7] Fix | Delete
* individual slide should be wrapped with a [slide] shortcode. Any settings supported
[8] Fix | Delete
* by [slide] can be set into [presentation], which will apply that setting for the entire
[9] Fix | Delete
* presentation unless overridden by individual slides.
[10] Fix | Delete
*
[11] Fix | Delete
* - [presentation] only settings:
[12] Fix | Delete
* - duration: transition durations, default is one second.
[13] Fix | Delete
* - height: content height, default is 400px
[14] Fix | Delete
* - width: content width, default is 550px
[15] Fix | Delete
* - autoplay: delay between transitions in seconds, default 3s
[16] Fix | Delete
* when set the presentation will automatically transition between slides
[17] Fix | Delete
* as long as the presentation remains in focus
[18] Fix | Delete
*
[19] Fix | Delete
* - [slide] settings:
[20] Fix | Delete
* - transition: specifies where the next slide will be placed relative
[21] Fix | Delete
* to the last one before it. Supported values are "up", "down"
[22] Fix | Delete
* "left", "right", or "none". Default value is "down".
[23] Fix | Delete
*
[24] Fix | Delete
* - scale: scales the content relative to other slides, default value is one
[25] Fix | Delete
*
[26] Fix | Delete
* - rotate: rotates the content by the specified degrees, default is zero
[27] Fix | Delete
*
[28] Fix | Delete
* - fade: slides will fade in and out during transition. Values of "on" or
[29] Fix | Delete
* "true" will enable fading, while values of "no" or "false" will
[30] Fix | Delete
* disable it. Default value is "on"
[31] Fix | Delete
*
[32] Fix | Delete
* - bgcolor: specifies a background color for the slides. Any CSS valid value
[33] Fix | Delete
* is permitted. Default color is transparent.
[34] Fix | Delete
*
[35] Fix | Delete
* - bgimg: specifies an image url which will fill the background. Image is
[36] Fix | Delete
* set to fill the background 100% width and height
[37] Fix | Delete
*
[38] Fix | Delete
* - fadebullets: any html <li> tags will start out with an opacity of 0 and any
[39] Fix | Delete
* subsequent slide transitions will show the bullets one by one
[40] Fix | Delete
*
[41] Fix | Delete
* Known issues:
[42] Fix | Delete
*
[43] Fix | Delete
* - IE 7/8 are not supported by jmpress and presentations will not work
[44] Fix | Delete
* - IE 9 will not animate transitions at all, though it's possible to at least
[45] Fix | Delete
* switch between slides.
[46] Fix | Delete
* - Infinite Scroll themes will not load presentations properly unless the post
[47] Fix | Delete
* happens to be on the first loaded page. The permalink page will function
[48] Fix | Delete
* properly, however.
[49] Fix | Delete
* - Exiting fullscreen mode will not properly reset the scroll locations in Safari
[50] Fix | Delete
*
[51] Fix | Delete
* @package automattic/jetpack
[52] Fix | Delete
*/
[53] Fix | Delete
[54] Fix | Delete
use Automattic\Jetpack\Assets;
[55] Fix | Delete
[56] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[57] Fix | Delete
exit( 0 );
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
if ( ! class_exists( 'Presentations' ) ) :
[61] Fix | Delete
/**
[62] Fix | Delete
* Create a shortcode to display Presentations and slides.
[63] Fix | Delete
*/
[64] Fix | Delete
class Presentations {
[65] Fix | Delete
[66] Fix | Delete
/**
[67] Fix | Delete
* Presentation settings.
[68] Fix | Delete
*
[69] Fix | Delete
* @var array
[70] Fix | Delete
*/
[71] Fix | Delete
private $presentation_settings;
[72] Fix | Delete
/**
[73] Fix | Delete
* Do we have a Presentation shortcode to be displayed.
[74] Fix | Delete
*
[75] Fix | Delete
* @var bool
[76] Fix | Delete
*/
[77] Fix | Delete
private $presentation_initialized;
[78] Fix | Delete
/**
[79] Fix | Delete
* Were scripts and styles enqueued already.
[80] Fix | Delete
*
[81] Fix | Delete
* @var bool
[82] Fix | Delete
*/
[83] Fix | Delete
private $scripts_and_style_included;
[84] Fix | Delete
[85] Fix | Delete
/**
[86] Fix | Delete
* Constructor
[87] Fix | Delete
*/
[88] Fix | Delete
public function __construct() {
[89] Fix | Delete
$this->presentation_initialized = false;
[90] Fix | Delete
$this->scripts_and_style_included = false;
[91] Fix | Delete
[92] Fix | Delete
// Registers shortcodes.
[93] Fix | Delete
add_action( 'wp_head', array( $this, 'add_scripts' ), 1 );
[94] Fix | Delete
[95] Fix | Delete
add_shortcode( 'presentation', array( $this, 'presentation_shortcode' ) );
[96] Fix | Delete
add_shortcode( 'slide', array( $this, 'slide_shortcode' ) );
[97] Fix | Delete
}
[98] Fix | Delete
[99] Fix | Delete
/**
[100] Fix | Delete
* Enqueue all scripts and styles.
[101] Fix | Delete
*/
[102] Fix | Delete
public function add_scripts() {
[103] Fix | Delete
$this->scripts_and_style_included = false;
[104] Fix | Delete
[105] Fix | Delete
if ( empty( $GLOBALS['posts'] ) || ! is_array( $GLOBALS['posts'] ) ) {
[106] Fix | Delete
return;
[107] Fix | Delete
}
[108] Fix | Delete
[109] Fix | Delete
foreach ( $GLOBALS['posts'] as $p ) {
[110] Fix | Delete
if ( isset( $p->post_content ) && has_shortcode( $p->post_content, 'presentation' ) ) {
[111] Fix | Delete
$this->scripts_and_style_included = true;
[112] Fix | Delete
break;
[113] Fix | Delete
}
[114] Fix | Delete
}
[115] Fix | Delete
[116] Fix | Delete
if ( ! $this->scripts_and_style_included ) {
[117] Fix | Delete
return;
[118] Fix | Delete
}
[119] Fix | Delete
[120] Fix | Delete
$plugin = plugin_dir_url( __FILE__ );
[121] Fix | Delete
// Add CSS.
[122] Fix | Delete
wp_enqueue_style( 'presentations', $plugin . 'css/style.css', array(), JETPACK__VERSION );
[123] Fix | Delete
// Add JavaScript.
[124] Fix | Delete
wp_enqueue_script( 'jquery' );
[125] Fix | Delete
wp_enqueue_script(
[126] Fix | Delete
'jmpress',
[127] Fix | Delete
Assets::get_file_url_for_environment( '_inc/build/shortcodes/js/jmpress.min.js', 'modules/shortcodes/js/jmpress.js' ),
[128] Fix | Delete
array( 'jquery' ),
[129] Fix | Delete
JETPACK__VERSION,
[130] Fix | Delete
true
[131] Fix | Delete
);
[132] Fix | Delete
wp_enqueue_script(
[133] Fix | Delete
'presentations',
[134] Fix | Delete
Assets::get_file_url_for_environment( '_inc/build/shortcodes/js/main.min.js', 'modules/shortcodes/js/main.js' ),
[135] Fix | Delete
array( 'jquery', 'jmpress' ),
[136] Fix | Delete
JETPACK__VERSION,
[137] Fix | Delete
true
[138] Fix | Delete
);
[139] Fix | Delete
}
[140] Fix | Delete
[141] Fix | Delete
/**
[142] Fix | Delete
* Main Presentation shortcode.
[143] Fix | Delete
*
[144] Fix | Delete
* @param array $atts Shortcode attributes.
[145] Fix | Delete
* @param string $content Post content.
[146] Fix | Delete
*/
[147] Fix | Delete
public function presentation_shortcode( $atts, $content = '' ) {
[148] Fix | Delete
// Mark that we've found a valid [presentation] shortcode.
[149] Fix | Delete
$this->presentation_initialized = true;
[150] Fix | Delete
[151] Fix | Delete
$atts = shortcode_atts(
[152] Fix | Delete
array(
[153] Fix | Delete
'duration' => '',
[154] Fix | Delete
'height' => '',
[155] Fix | Delete
'width' => '',
[156] Fix | Delete
'bgcolor' => '',
[157] Fix | Delete
'bgimg' => '',
[158] Fix | Delete
'autoplay' => '',
[159] Fix | Delete
[160] Fix | Delete
// Settings.
[161] Fix | Delete
'transition' => '',
[162] Fix | Delete
'scale' => '',
[163] Fix | Delete
'rotate' => '',
[164] Fix | Delete
'fade' => '',
[165] Fix | Delete
'fadebullets' => '',
[166] Fix | Delete
),
[167] Fix | Delete
$atts,
[168] Fix | Delete
'presentation'
[169] Fix | Delete
);
[170] Fix | Delete
[171] Fix | Delete
$this->presentation_settings = array(
[172] Fix | Delete
'transition' => 'down',
[173] Fix | Delete
'scale' => 1,
[174] Fix | Delete
'rotate' => 0,
[175] Fix | Delete
'fade' => 'on',
[176] Fix | Delete
'fadebullets' => 0,
[177] Fix | Delete
'last' => array(
[178] Fix | Delete
'x' => 0,
[179] Fix | Delete
'y' => 0,
[180] Fix | Delete
'scale' => 1,
[181] Fix | Delete
'rotate' => 0,
[182] Fix | Delete
),
[183] Fix | Delete
);
[184] Fix | Delete
[185] Fix | Delete
// Set the presentation-wide settings.
[186] Fix | Delete
if ( '' !== trim( $atts['transition'] ) ) {
[187] Fix | Delete
$this->presentation_settings['transition'] = $atts['transition'];
[188] Fix | Delete
}
[189] Fix | Delete
[190] Fix | Delete
if ( '' !== trim( $atts['scale'] ) ) {
[191] Fix | Delete
$this->presentation_settings['scale'] = (float) $atts['scale'];
[192] Fix | Delete
}
[193] Fix | Delete
[194] Fix | Delete
if ( '' !== trim( $atts['rotate'] ) ) {
[195] Fix | Delete
$this->presentation_settings['rotate'] = (float) $atts['rotate'];
[196] Fix | Delete
}
[197] Fix | Delete
[198] Fix | Delete
if ( '' !== trim( $atts['fade'] ) ) {
[199] Fix | Delete
$this->presentation_settings['fade'] = $atts['fade'];
[200] Fix | Delete
}
[201] Fix | Delete
[202] Fix | Delete
if ( '' !== trim( $atts['fadebullets'] ) ) {
[203] Fix | Delete
$this->presentation_settings['fadebullets'] = $atts['fadebullets'];
[204] Fix | Delete
}
[205] Fix | Delete
[206] Fix | Delete
// Set any settings the slides don't care about.
[207] Fix | Delete
if ( '' !== trim( $atts['duration'] ) ) {
[208] Fix | Delete
$duration = (float) $atts['duration'] . 's';
[209] Fix | Delete
} else {
[210] Fix | Delete
$duration = '1s';
[211] Fix | Delete
}
[212] Fix | Delete
[213] Fix | Delete
// Autoplay durations are set in milliseconds.
[214] Fix | Delete
if ( '' !== trim( $atts['autoplay'] ) ) {
[215] Fix | Delete
$autoplay = (float) $atts['autoplay'] * 1000;
[216] Fix | Delete
} else {
[217] Fix | Delete
$autoplay = 0;
[218] Fix | Delete
} // No autoplay
[219] Fix | Delete
[220] Fix | Delete
// Set the presentation size as specified or with some nicely sized dimensions.
[221] Fix | Delete
if ( '' !== trim( $atts['width'] ) ) {
[222] Fix | Delete
$this->presentation_settings['width'] = (int) $atts['width'];
[223] Fix | Delete
} else {
[224] Fix | Delete
$this->presentation_settings['width'] = 480;
[225] Fix | Delete
}
[226] Fix | Delete
[227] Fix | Delete
if ( '' !== trim( $atts['height'] ) ) {
[228] Fix | Delete
$this->presentation_settings['height'] = (int) $atts['height'];
[229] Fix | Delete
} else {
[230] Fix | Delete
$this->presentation_settings['height'] = 370;
[231] Fix | Delete
}
[232] Fix | Delete
[233] Fix | Delete
// Hide the content by default in case the scripts fail.
[234] Fix | Delete
$style = 'display: none; width: ' . $this->presentation_settings['width'] . 'px; height: ' . $this->presentation_settings['height'] . 'px;';
[235] Fix | Delete
[236] Fix | Delete
/*
[237] Fix | Delete
* Check for background color XOR background image
[238] Fix | Delete
* Use a white background if nothing specified
[239] Fix | Delete
*/
[240] Fix | Delete
if ( preg_match( '/https?\:\/\/[^\'"\s]*/', $atts['bgimg'], $matches ) ) {
[241] Fix | Delete
$style .= ' background-image: url("' . esc_url( $matches[0] ) . '");';
[242] Fix | Delete
} elseif ( '' !== trim( $atts['bgcolor'] ) ) {
[243] Fix | Delete
$style .= ' background-color: ' . esc_attr( $atts['bgcolor'] ) . ';';
[244] Fix | Delete
} else {
[245] Fix | Delete
$style .= ' background-color: #fff;';
[246] Fix | Delete
}
[247] Fix | Delete
[248] Fix | Delete
// Not supported message style is inlined incase the style sheet doesn't get included.
[249] Fix | Delete
$out = "<section class='presentation-wrapper'>";
[250] Fix | Delete
$out .= "<p class='not-supported-msg' style='display: inherit; padding: 25%; text-align: center;'>";
[251] Fix | Delete
$out .= __( 'This slideshow could not be started. Try refreshing the page or viewing it in another browser.', 'jetpack' ) . '</p>';
[252] Fix | Delete
[253] Fix | Delete
$out .= sprintf(
[254] Fix | Delete
'<div class="presentation" duration="%s" data-autoplay="%s" style="%s">',
[255] Fix | Delete
esc_attr( $duration ),
[256] Fix | Delete
esc_attr( $autoplay ),
[257] Fix | Delete
esc_attr( $style )
[258] Fix | Delete
);
[259] Fix | Delete
$out .= "<div class='nav-arrow-left'></div>";
[260] Fix | Delete
$out .= "<div class='nav-arrow-right'></div>";
[261] Fix | Delete
$out .= "<div class='nav-fullscreen-button'></div>";
[262] Fix | Delete
[263] Fix | Delete
if ( $autoplay ) {
[264] Fix | Delete
$out .= '<div class="autoplay-overlay" style="display: none;"><p class="overlay-msg">';
[265] Fix | Delete
$out .= __( 'Click to autoplay the presentation!', 'jetpack' );
[266] Fix | Delete
$out .= '</p></div>';
[267] Fix | Delete
}
[268] Fix | Delete
[269] Fix | Delete
$out .= do_shortcode( $content );
[270] Fix | Delete
[271] Fix | Delete
$out .= '</section>';
[272] Fix | Delete
[273] Fix | Delete
$this->presentation_initialized = false;
[274] Fix | Delete
[275] Fix | Delete
return $out;
[276] Fix | Delete
}
[277] Fix | Delete
[278] Fix | Delete
/**
[279] Fix | Delete
* Slide shortcode.
[280] Fix | Delete
*
[281] Fix | Delete
* @param array $atts Shortcode attributes.
[282] Fix | Delete
* @param string $content Post content.
[283] Fix | Delete
*/
[284] Fix | Delete
public function slide_shortcode( $atts, $content = '' ) {
[285] Fix | Delete
// Bail out unless wrapped by a [presentation] shortcode.
[286] Fix | Delete
if ( ! $this->presentation_initialized ) {
[287] Fix | Delete
return $content;
[288] Fix | Delete
}
[289] Fix | Delete
[290] Fix | Delete
$atts = shortcode_atts(
[291] Fix | Delete
array(
[292] Fix | Delete
'transition' => '',
[293] Fix | Delete
'scale' => '',
[294] Fix | Delete
'rotate' => '',
[295] Fix | Delete
'fade' => '',
[296] Fix | Delete
'fadebullets' => '',
[297] Fix | Delete
'bgcolor' => '',
[298] Fix | Delete
'bgimg' => '',
[299] Fix | Delete
),
[300] Fix | Delete
$atts,
[301] Fix | Delete
'slide'
[302] Fix | Delete
);
[303] Fix | Delete
[304] Fix | Delete
// Determine positioning based on transition.
[305] Fix | Delete
if ( '' === trim( $atts['transition'] ) ) {
[306] Fix | Delete
$atts['transition'] = $this->presentation_settings['transition'];
[307] Fix | Delete
}
[308] Fix | Delete
[309] Fix | Delete
// Setting the content scale.
[310] Fix | Delete
if ( '' === trim( $atts['scale'] ) ) {
[311] Fix | Delete
$atts['scale'] = $this->presentation_settings['scale'];
[312] Fix | Delete
}
[313] Fix | Delete
[314] Fix | Delete
if ( '' === trim( $atts['scale'] ) ) {
[315] Fix | Delete
$scale = 1;
[316] Fix | Delete
} else {
[317] Fix | Delete
$scale = (float) $atts['scale'];
[318] Fix | Delete
}
[319] Fix | Delete
[320] Fix | Delete
if ( $scale < 0 ) {
[321] Fix | Delete
$scale *= -1;
[322] Fix | Delete
}
[323] Fix | Delete
[324] Fix | Delete
// Setting the content rotation.
[325] Fix | Delete
if ( '' === trim( $atts['rotate'] ) ) {
[326] Fix | Delete
$atts['rotate'] = $this->presentation_settings['rotate'];
[327] Fix | Delete
}
[328] Fix | Delete
[329] Fix | Delete
if ( '' === trim( $atts['rotate'] ) ) {
[330] Fix | Delete
$rotate = 0;
[331] Fix | Delete
} else {
[332] Fix | Delete
$rotate = (float) $atts['rotate'];
[333] Fix | Delete
}
[334] Fix | Delete
[335] Fix | Delete
// Setting if the content should fade.
[336] Fix | Delete
if ( '' === trim( $atts['fade'] ) ) {
[337] Fix | Delete
$atts['fade'] = $this->presentation_settings['fade'];
[338] Fix | Delete
}
[339] Fix | Delete
[340] Fix | Delete
if ( 'on' === $atts['fade'] || 'true' === $atts['fade'] ) {
[341] Fix | Delete
$fade = 'fade';
[342] Fix | Delete
} else {
[343] Fix | Delete
$fade = '';
[344] Fix | Delete
}
[345] Fix | Delete
[346] Fix | Delete
// Setting if bullets should fade on step changes.
[347] Fix | Delete
if ( '' === trim( $atts['fadebullets'] ) ) {
[348] Fix | Delete
$atts['fadebullets'] = $this->presentation_settings['fadebullets'];
[349] Fix | Delete
}
[350] Fix | Delete
[351] Fix | Delete
if ( 'on' === $atts['fadebullets'] || 'true' === $atts['fadebullets'] ) {
[352] Fix | Delete
$fadebullets = 'fadebullets';
[353] Fix | Delete
} else {
[354] Fix | Delete
$fadebullets = '';
[355] Fix | Delete
}
[356] Fix | Delete
[357] Fix | Delete
$coords = $this->get_coords(
[358] Fix | Delete
array(
[359] Fix | Delete
'transition' => $atts['transition'],
[360] Fix | Delete
'scale' => $scale,
[361] Fix | Delete
'rotate' => $rotate,
[362] Fix | Delete
)
[363] Fix | Delete
);
[364] Fix | Delete
[365] Fix | Delete
$x = $coords['x'];
[366] Fix | Delete
$y = $coords['y'];
[367] Fix | Delete
[368] Fix | Delete
/*
[369] Fix | Delete
* Check for background color XOR background image
[370] Fix | Delete
* Use a white background if nothing specified
[371] Fix | Delete
*/
[372] Fix | Delete
if ( preg_match( '/https?\:\/\/[^\'"\s]*/', $atts['bgimg'], $matches ) ) {
[373] Fix | Delete
$style = 'background-image: url("' . esc_url( $matches[0] ) . '");';
[374] Fix | Delete
} elseif ( '' !== trim( $atts['bgcolor'] ) ) {
[375] Fix | Delete
$style = 'background-color: ' . esc_attr( $atts['bgcolor'] ) . ';';
[376] Fix | Delete
} else {
[377] Fix | Delete
$style = '';
[378] Fix | Delete
}
[379] Fix | Delete
[380] Fix | Delete
// Put everything together and let jmpress do the magic!
[381] Fix | Delete
$out = sprintf(
[382] Fix | Delete
'<div class="step %s %s" data-x="%s" data-y="%s" data-scale="%s" data-rotate="%s" style="%s">',
[383] Fix | Delete
esc_attr( $fade ),
[384] Fix | Delete
esc_attr( $fadebullets ),
[385] Fix | Delete
esc_attr( $x ),
[386] Fix | Delete
esc_attr( $y ),
[387] Fix | Delete
esc_attr( $scale ),
[388] Fix | Delete
esc_attr( $rotate ),
[389] Fix | Delete
esc_attr( $style )
[390] Fix | Delete
);
[391] Fix | Delete
[392] Fix | Delete
$out .= '<div class="slide-content">';
[393] Fix | Delete
$out .= do_shortcode( $content );
[394] Fix | Delete
$out .= '</div></div>';
[395] Fix | Delete
[396] Fix | Delete
return $out;
[397] Fix | Delete
}
[398] Fix | Delete
[399] Fix | Delete
/**
[400] Fix | Delete
* Determines the position of the next slide based on the position and scaling of the previous slide.
[401] Fix | Delete
*
[402] Fix | Delete
* @param array $args {
[403] Fix | Delete
* Array of key-value pairs.
[404] Fix | Delete
*
[405] Fix | Delete
* @type string $transition: the transition name, "up", "down", "left", or "right".
[406] Fix | Delete
* @type float $scale: the scale of the next slide (used to determine the position of the slide after that).
[407] Fix | Delete
* }
[408] Fix | Delete
*
[409] Fix | Delete
* @return array with the 'x' and 'y' coordinates of the slide.
[410] Fix | Delete
*/
[411] Fix | Delete
private function get_coords( $args ) {
[412] Fix | Delete
if ( 0 === $args['scale'] ) {
[413] Fix | Delete
$args['scale'] = 1;
[414] Fix | Delete
}
[415] Fix | Delete
[416] Fix | Delete
$width = $this->presentation_settings['width'];
[417] Fix | Delete
$height = $this->presentation_settings['height'];
[418] Fix | Delete
$last = $this->presentation_settings['last'];
[419] Fix | Delete
$scale = $last['scale'];
[420] Fix | Delete
[421] Fix | Delete
$next = array(
[422] Fix | Delete
'x' => $last['x'],
[423] Fix | Delete
'y' => $last['y'],
[424] Fix | Delete
'scale' => $args['scale'],
[425] Fix | Delete
'rotate' => $args['rotate'],
[426] Fix | Delete
);
[427] Fix | Delete
[428] Fix | Delete
// All angles are measured from the vertical axis, so everything is backwards!
[429] Fix | Delete
$diag_angle = atan2( $width, $height );
[430] Fix | Delete
$diagonal = sqrt( pow( $width, 2 ) + pow( $height, 2 ) );
[431] Fix | Delete
[432] Fix | Delete
/*
[433] Fix | Delete
* We offset the angles by the angle formed by the diagonal so that
[434] Fix | Delete
* we can multiply the sines directly against the diagonal length
[435] Fix | Delete
*/
[436] Fix | Delete
$theta = deg2rad( $last['rotate'] ) - $diag_angle;
[437] Fix | Delete
$phi = deg2rad( $next['rotate'] ) - $diag_angle;
[438] Fix | Delete
[439] Fix | Delete
// We start by displacing by the slide dimensions.
[440] Fix | Delete
$total_horiz_disp = $width * $scale;
[441] Fix | Delete
$total_vert_disp = $height * $scale;
[442] Fix | Delete
[443] Fix | Delete
/*
[444] Fix | Delete
* If the previous slide was rotated, we add the incremental offset from the rotation
[445] Fix | Delete
* Namely the difference between the regular dimension (no rotation) and the component
[446] Fix | Delete
* of the diagonal for that angle
[447] Fix | Delete
*/
[448] Fix | Delete
$total_horiz_disp += ( ( ( abs( sin( $theta ) ) * $diagonal ) - $width ) / 2 ) * $scale;
[449] Fix | Delete
$total_vert_disp += ( ( ( abs( cos( $theta ) ) * $diagonal ) - $height ) / 2 ) * $scale;
[450] Fix | Delete
[451] Fix | Delete
/*
[452] Fix | Delete
* Similarly, we check if the current slide has been rotated and add whatever additional
[453] Fix | Delete
* offset has been added. This is so that two rotated corners don't clash with each other.
[454] Fix | Delete
* Note: we are checking the raw angle relative to the vertical axis, NOT the diagonal angle.
[455] Fix | Delete
*/
[456] Fix | Delete
if ( 0 !== $next['rotate'] % 180 ) {
[457] Fix | Delete
$total_horiz_disp += ( abs( ( sin( $phi ) * $diagonal ) - $width ) / 2 ) * $next['scale'];
[458] Fix | Delete
$total_vert_disp += ( abs( ( cos( $phi ) * $diagonal ) - $height ) / 2 ) * $next['scale'];
[459] Fix | Delete
}
[460] Fix | Delete
[461] Fix | Delete
switch ( trim( $args['transition'] ) ) {
[462] Fix | Delete
case 'none':
[463] Fix | Delete
break;
[464] Fix | Delete
[465] Fix | Delete
case 'left':
[466] Fix | Delete
$next['x'] -= $total_horiz_disp;
[467] Fix | Delete
break;
[468] Fix | Delete
[469] Fix | Delete
case 'right':
[470] Fix | Delete
$next['x'] += $total_horiz_disp;
[471] Fix | Delete
break;
[472] Fix | Delete
[473] Fix | Delete
case 'up':
[474] Fix | Delete
$next['y'] -= $total_vert_disp;
[475] Fix | Delete
break;
[476] Fix | Delete
[477] Fix | Delete
case 'down':
[478] Fix | Delete
default:
[479] Fix | Delete
$next['y'] += $total_vert_disp;
[480] Fix | Delete
break;
[481] Fix | Delete
}
[482] Fix | Delete
[483] Fix | Delete
$this->presentation_settings['last'] = $next;
[484] Fix | Delete
[485] Fix | Delete
return $next;
[486] Fix | Delete
}
[487] Fix | Delete
}
[488] Fix | Delete
[489] Fix | Delete
$GLOBALS['presentations'] = new Presentations();
[490] Fix | Delete
endif;
[491] Fix | Delete
[492] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function