* @link http://wp-dreams.com, http://codecanyon.net/user/anago/portfolio
* @copyright Copyright (c) 2014, Ernest Marcinko
*/
class wpdreamsLabelPosition extends wpdreamsType {
function __construct($name, $label, $width, $height, $data) {
$this->constraints = null;
$this->name = $name;
$this->label = $label;
$this->data = $data;
$this->width = $width;
$this->height = $height;
$this->ratio = 400 / $this->width;
$this->cheight = $this->ratio * $this->height;
self::$_instancenumber++;
$this->direction = "";
$this->duration = "";
$this->getType();
}
function getType() {
parent::getType();
$this->processData();
$inst = self::$_instancenumber;
echo "
";
echo "
";
new wpdreamsSelect("indirection_" . $this->name, "Animation direction", $this->_direction);
new wpdreamsText("induration_" . $this->name, "Animation duration (ms)", $this->duration);
echo "
";
echo "
";
echo "
";
}
function processData() {
// string: 'duration:123;direction:bottom-left;position:123||321;'
$this->data = str_replace("\n", "", $this->data);
preg_match("/duration:(.*?);/", $this->data, $matches);
$this->duration = $matches[1];
if ($this->duration == "")
$this->duration = 500;
preg_match("/direction:(.*?);/", $this->data, $matches);
$this->direction = $matches[1];
if ($this->direction == "")
$this->direction = "top-left";
$this->_direction = "
Top|top;
Bottom|bottom;
Left|left;
Right|right;
Bottom-Left|bottom-left;
Bottom-Right|bottom-right;
Top-Left|top-left;
Top-Right|top-right;
Random|random||
" . $this->direction;
preg_match("/position:(.*?);/", $this->data, $matches);
$this->position = $matches[1];
$_temp = explode("||", $this->position);
$this->top = $_temp[0];
$this->left = $_temp[1];
}
}
}