class LS_ModuleManager { public $repoURL; public $uploadsDir; public $uploadsURL; public $modulesDir; public $modulesURL; public $moduleHandle; public $moduleDir; public $moduleURL; public $errMessage = ''; public $errCode = ''; public function __construct( $moduleHandle, $moduleProperties = array() ) { if( empty( $moduleHandle ) ) { return false; } $moduleProperties = array_merge(array( 'autoCheck' => true, 'autoDownload' => true, ), $moduleProperties ); $this->moduleHandle = $moduleHandle; $this->repoURL = LS_REPO_BASE_URL.'modules/'; if( ! $this->checkDirectories() ) { return false; } if( $moduleProperties['autoCheck'] ) { if( ! $this->checkModule() && $moduleProperties['autoDownload'] ) { if( ! $this->downloadModule() ) { return false; } } } return true; } public function checkDirectories( ) { $uploadsDir = wp_upload_dir(); $uploadsBaseDir = $uploadsDir['basedir']; $uploadsBaseURL = $uploadsDir['baseurl']; $this->uploadsDir = $uploadsBaseDir . DIRECTORY_SEPARATOR . 'layerslider'; $this->uploadsURL = $uploadsBaseURL.'/layerslider'; $this->modulesDir = $this->uploadsDir . DIRECTORY_SEPARATOR . 'modules'; $this->modulesURL = $this->uploadsURL.'/modules'; $this->moduleDir = $this->modulesDir . DIRECTORY_SEPARATOR . $this->moduleHandle; $this->moduleURL = $this->modulesURL.'/'.$this->moduleHandle; if( ! file_exists( $this->uploadsDir ) ) { if( ! mkdir( $this->uploadsDir, 0755 ) ) { $this->logError('ERR_UPLOADS_DIR_NOT_WRITABLE', sprintf( __('LayerSlider was unable to create the directory for the Image Editor module. Please verify that your uploads folder is writable. See the %sCodex%s for more information.', 'LayerSlider'), '', '' )); return false; } } if( ! file_exists( $this->modulesDir ) ) { if( ! mkdir( $this->modulesDir, 0755 ) ) { $this->logError('ERR_MODULES_DIR_NOT_WRITABLE', sprintf( __('LayerSlider was unable to create the directory for the Image Editor module. Please verify that your uploads folder is writable. See the %sCodex%s for more information.', 'LayerSlider'), '', '' )); return false; } } return true; } public function checkModule( ) { $targetDir = $this->moduleDir; $filesCount = count( glob( "$targetDir/*" ) ); if( ! file_exists( $targetDir ) || $filesCount === 0) { return false; } return true; } public function downloadModule( ) { // Attempt to remove module dir if it already exists. // This helps avoid issues with partial or corrupt downloads. if( file_exists( $this->moduleDir ) ) { @rmdir( $this->moduleDir ); } $targetURL = $this->repoURL . '?module=' . $this->moduleHandle; $zipContent = $GLOBALS['LS_AutoUpdate']->sendApiRequest( $targetURL ); if( ! $zipContent || is_wp_error( $zipContent ) ) { $this->logError('ERR_DOWNLOAD', sprintf( __('LayerSlider was unable to download the Image Editor module. Please check %sLayerSlider → Options → System Status%s for potential issues. The WP Remote functions may be unavailable or your web hosting provider has to allow external connections to our domain.', 'LayerSlider'), '', '' ) ); return false; } $dlFilePath = tempnam( sys_get_temp_dir(), 'ZIP_' ); file_put_contents( $dlFilePath, $zipContent ); $zip = new ZipArchive(); if( $zip->open( $dlFilePath ) === true ) { if( $zip->extractTo( $this->moduleDir ) ) { $zip->close(); unlink( $dlFilePath ); return true; } } $this->logError('ERR_ZIP_EXTRACTION', sprintf( __('LayerSlider was unable to uncompress the Image Editor module. Please check %sLayerSlider → Options → System Status%s for potential issues. The WP Remote functions may be unavailable or your web hosting provider has to allow external connections to our domain.', 'LayerSlider'), '', '' ) ); unlink( $dlFilePath ); return false; } protected function logError( $code = '', $message = '' ) { $this->errCode = $code; $this->errMessage = $message; } } Layerslider - https://iavgdf.org/
// Prevent direct file access defined( 'LS_ROOT_FILE' ) || exit; $slider = array(); // Filter to override the defaults if(has_filter('layerslider_override_defaults')) { $newDefaults = apply_filters('layerslider_override_defaults', $lsDefaults); if(!empty($newDefaults) && is_array($newDefaults)) { $lsDefaults = $newDefaults; unset($newDefaults); } } // Allow overriding slider settings from the embed code like skins. // // This is a generic solution. To keep things simple and flexible, // this takes place before filtering with defaults. // // As such, some keys might still use their legacy form. foreach( $embed as $key => $val ) { if( $key !== 'id' ) { $slides['properties'][ $key ] = $val; } } // Allow accepting a "hero" type slider if( ! empty( $slides['properties']['type'] ) ) { if( $slides['properties']['type'] === 'hero' ) { $slides['properties']['type'] = 'fullsize'; $slides['properties']['fullSizeMode'] = 'hero'; } } // Hook to alter slider data *before* filtering with defaults if(has_filter('layerslider_pre_parse_defaults')) { $result = apply_filters('layerslider_pre_parse_defaults', $slides); if(!empty($result) && is_array($result)) { $slides = $result; } } // Filter slider data with defaults $slides['properties'] = apply_filters('ls_parse_defaults', $lsDefaults['slider'], $slides['properties']); $skin = !empty($slides['properties']['attrs']['skin']) ? $slides['properties']['attrs']['skin'] : $lsDefaults['slider']['skin']['value']; $slides['properties']['attrs']['skinsPath'] = dirname(LS_Sources::urlForSkin($skin)) . '/'; if(isset($slides['properties']['autoPauseSlideshow'])) { switch($slides['properties']['autoPauseSlideshow']) { case 'auto': $slides['properties']['autoPauseSlideshow'] = 'auto'; break; case 'enabled': $slides['properties']['autoPauseSlideshow'] = true; break; case 'disabled': $slides['properties']['autoPauseSlideshow'] = false; break; } } // Get global background image by attachment ID (if any) if( ! empty( $slides['properties']['props']['globalBGImageId'] ) ) { $tempSrc = wp_get_attachment_image_src( $slides['properties']['props']['globalBGImageId'], 'full' ); $tempSrc = apply_filters('layerslider_init_props_image', $tempSrc[0]); $slides['properties']['attrs']['globalBGImage'] = $tempSrc; } // Get YourLogo image by attachment ID (if any) if( ! empty( $slides['properties']['props']['yourlogoId'] ) ) { $tempSrc = wp_get_attachment_image_src( $slides['properties']['props']['yourlogoId'], 'full' ); $tempSrc = apply_filters('layerslider_init_props_image', $tempSrc[0]); $slides['properties']['attrs']['yourLogo'] = $tempSrc; } // Old and without type if( empty($slides['properties']['attrs']['sliderVersion']) && empty($slides['properties']['attrs']['type']) ) { if( !empty($slides['properties']['props']['forceresponsive']) ) { $slides['properties']['attrs']['type'] = 'fullwidth'; } elseif( empty($slides['properties']['props']['responsive']) ) { $slides['properties']['attrs']['type'] = 'fixedsize'; } else { $slides['properties']['attrs']['type'] = 'responsive'; } } // Override firstSlide if it is specified in embed params if( ! empty( $embed['firstslide'] ) ) { $slides['properties']['attrs']['firstSlide'] = '[firstSlide]'; } // Make sure that width & height are set correctly if( empty( $slides['properties']['props']['width'] ) ) { $slides['properties']['props']['width'] = 1280; } if( empty( $slides['properties']['props']['height'] ) ) { $slides['properties']['props']['height'] = 720; } // Slides and layers if(isset($slides['layers']) && is_array($slides['layers'])) { foreach($slides['layers'] as $slidekey => $slide) { // 6.6.1: Fix PHP undef notice $slide['properties'] = ! empty( $slide['properties'] ) ? $slide['properties'] : array(); $slider['slides'][$slidekey] = apply_filters('ls_parse_defaults', $lsDefaults['slides'], $slide['properties']); if(isset($slide['sublayers']) && is_array($slide['sublayers'])) { foreach($slide['sublayers'] as $layerkey => $layer) { // Ensure that magic quotes will not mess with JSON data if(function_exists('get_magic_quotes_gpc') && @get_magic_quotes_gpc()) { $layer['styles'] = stripslashes($layer['styles']); $layer['transition'] = stripslashes($layer['transition']); } if( ! empty( $layer['transition'] ) ) { $layer = array_merge($layer, json_decode(stripslashes($layer['transition']), true)); } if( ! empty( $layer['styles'] ) ) { $layerStyles = json_decode($layer['styles'], true); if( empty( $layerStyles ) ) { $layerStyles = json_decode(stripslashes($layer['styles']), true); } $layer['styles'] = ! empty( $layerStyles ) ? $layerStyles : array(); } if( ! empty( $layer['top'] ) ) { $layer['styles']['top'] = $layer['top']; } if( ! empty( $layer['left'] ) ) { $layer['styles']['left'] = $layer['left']; } if( ! empty($layer['wordwrap']) || ! empty($layer['styles']['wordwrap']) ) { $layer['styles']['white-space'] = 'normal'; } // Marker for Font Awesome if( empty( $lsFonts['font-awesome'] ) && ! empty( $layer['html'] ) ) { if( strpos( $layer['html'], 'fa fa-') !== false ) { $lsFonts['font-awesome'] = 'font-awesome'; } } // v6.5.6: Compatibility mode for media layers that used the // old checkbox based media settings. if( isset( $layer['controls'] ) ) { if( true === $layer['controls'] ) { $layer['controls'] = 'auto'; } elseif( false === $layer['controls'] ) { $layer['controls'] = 'disabled'; } } // Remove unwanted style options $keys = array_keys( $layer['styles'], 'unset', true ); foreach( $keys as $key) { unset( $layer['styles'][$key] ); } if( isset($layer['styles']['opacity']) && $layer['styles']['opacity'] === '1') { unset($layer['styles']['opacity']); } unset($layer['styles']['wordwrap']); $slider['slides'][$slidekey]['layers'][$layerkey] = apply_filters('ls_parse_defaults', $lsDefaults['layers'], $layer); } } } } // Hook to alter slider data *after* filtering with defaults if(has_filter('layerslider_post_parse_defaults')) { $result = apply_filters('layerslider_post_parse_defaults', $slides); if(!empty($result) && is_array($result)) { $slides = $result; } } // Fix circle timer if( empty($slides['properties']['attrs']['sliderVersion']) && empty($slides['properties']['attrs']['showCircleTimer']) ) { $slides['properties']['attrs']['showCircleTimer'] = false; }

Layer Slider

You can display not only one Layerslider but multiple ones on every page. You got all the amazing Layerlsider options for each slider, starting with height, style, transitions etc. The transitions for each element can be set in a fancy drag and drop editor, you got amazing options like mouse parallax effects and a slew of demo sliders to import.