<?php

class Intense_Parallax_Scene_Layer extends Intense_Shortcode {
    function __construct() {
      parent::__construct();

      global $intense_visions_options;

      $this->title = __( 'Parallax Scene Layer', 'intense' );
      $this->category = __( 'Layout', 'intense' );
      $this->show_preview = true;
      $this->hidden = true;
      $this->parent = 'intense_parallax_scene';
      $this->is_container = true;      
    }

    function shortcode( $atts, $content = null ) {
        global $intense_visions_options;
        extract( shortcode_atts( $this->get_shortcode_defaults( null, $atts ), $atts ) );

        $layerclass = '';
        $layerstyle = '';

        if ( isset( $layer_class ) && $layer_class != '' ) {
            $layerclass = $layer_class;
        }

        if ( isset( $layer_lock ) && $layer_lock != '' ) {
          if ( $layer_lock == 'horizontal' ) {
            $layerclass .= ' lockHorizontal';
          } else if ( $layer_lock == 'vertical' ) {
            $layerclass .= ' lockVertical';
          }            
        }

        if ( isset( $layer_opacity ) && $layer_opacity != '' ) {
            $layerstyle = 'style="opacity:' . $layer_opacity / 100 . ';"';
        }

        $output = '<li class="layer ' . $layerclass . '" data-depth="' . $layer_depth . '"' . $layerstyle . '>' . do_shortcode( $content ) . '</li>';

        return $output;
    }
}