Repository navigation
Expand file tree
/
Copy pathmodule_transform.inc.php
More file actions
91 lines (71 loc) · 1.84 KB
/
Copy pathmodule_transform.inc.php
File metadata and controls
91 lines (71 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
/**
* module_transform.inc.php
* Module for performing css transformations on objects
*
* Copyright Gottfried Haider, Danja Vasiliev 2010.
* This source code is licensed under the GNU General Public License.
* See the file COPYING for more details.
*/
@require_once('config.inc.php');
require_once('html.inc.php');
require_once('html_parse.inc.php');
require_once('modules.inc.php');
// module glue gets loaded on demand
// module_image.inc.php has more information on what's going on inside modules
// (they can be easier than that one though)
function transform_alter_render_early($args)
{
$elem = &$args['elem'];
$obj = $args['obj'];
if (!elem_has_class($elem, 'object')) {
return false;
}
if (!empty($obj['transform-flip'])) {
elem_css($elem, 'transform', $obj['transform-flip']);
}
return true;
}
function transform_alter_save($args)
{
$elem = $args['elem'];
$obj = &$args['obj'];
if (!elem_has_class($elem, 'object')) {
return false;
}
if (elem_css($elem, 'transform') !== NULL) {
$transform = elem_css($elem, 'transform');
$transform = str_replace("px", "", $transform);
$transform = str_replace("pt", "", $transform);
$obj['transform-flip'] = $transform;
} else {
unset($obj['transform-flip']);
}
return true;
}
function transform_render_object($args)
{
$elem = &$args['elem'];
$obj = &$args['obj'];
if (!elem_has_class($elem, 'object')) {
return false;
}
if (!empty($obj['transform-flip'])) {
elem_css($elem, 'transform', $obj['transform-flip']);
}
}
function transform_render_page_early($args)
{
if ($args['edit']) {
if (USE_MIN_FILES) {
html_add_js(base_url().'modules/transform/transform.min.js');
} else {
html_add_js(base_url().'modules/transform/transform.js');
}
// html_add_css(base_url().'modules/transform/transform.css');
return true;
} else {
return false;
}
}
?>