Completed
Push — master ( e21aca...50b935 )
by
unknown
13:22
created
includes/modules/wps_cart/templates/frontend/cart/button-add-to-cart.php 2 patches
Braces   +7 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,10 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
2
- if ( !defined( 'ABSPATH' ) ) exit; ?>
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
4
+ if ( !defined( 'ABSPATH' ) ) {
5
+ 	exit;
6
+ }
7
+ ?>
3 8
 
4 9
 <div class="wps-product-section">
5 10
 	<label><?php _e('Quantity', 'wpshop'); ?></label>
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
2
- if ( !defined( 'ABSPATH' ) ) exit; ?>
1
+<?php if (!defined('ABSPATH')) exit;
2
+ if (!defined('ABSPATH')) exit; ?>
3 3
 
4 4
 <div class="wps-product-section">
5 5
 	<label><?php _e('Quantity', 'wpshop'); ?></label>
6 6
 	<div class="wps-productQtyForm">
7
-		<?php if ( $use_button ): ?>
8
-			<a class="wps-bton-icon-minus-small wps-cart-reduce-product-qty" data-nonce="<?php echo wp_create_nonce( 'ajax_wpshop_set_qty_for_product_into_cart' ); ?>" href=""></a>
7
+		<?php if ($use_button): ?>
8
+			<a class="wps-bton-icon-minus-small wps-cart-reduce-product-qty" data-nonce="<?php echo wp_create_nonce('ajax_wpshop_set_qty_for_product_into_cart'); ?>" href=""></a>
9 9
 		<?php endif; ?>
10 10
 		<span class="wps-form"><input id="wps-cart-product-qty-<?php echo $args['pid']; ?>" class="wpshop_product_qty_input" type="text" value="1" /></span>
11
-		<?php if ( $use_button): ?>
12
-			<a class="wps-bton-icon-plus-small wps-cart-add-product-qty" data-nonce="<?php echo wp_create_nonce( 'ajax_wpshop_set_qty_for_product_into_cart' ); ?>" href=""></a>
11
+		<?php if ($use_button): ?>
12
+			<a class="wps-bton-icon-plus-small wps-cart-add-product-qty" data-nonce="<?php echo wp_create_nonce('ajax_wpshop_set_qty_for_product_into_cart'); ?>" href=""></a>
13 13
 		<?php endif; ?>
14 14
 	</div>
15 15
 </div>
16 16
 
17
-<button itemprop="availability" content="in_stock" id="wpshop_add_to_cart_<?php echo $args['pid']; ?>" data-nonce="<?php echo wp_create_nonce( 'ajax_pos_product_variation_selection' ); ?>" class="wpshop_add_to_cart_button wps-bton-first-mini-rounded"><i class="wps-icon-basket"></i><?php echo $button_text; ?></button>
17
+<button itemprop="availability" content="in_stock" id="wpshop_add_to_cart_<?php echo $args['pid']; ?>" data-nonce="<?php echo wp_create_nonce('ajax_pos_product_variation_selection'); ?>" class="wpshop_add_to_cart_button wps-bton-first-mini-rounded"><i class="wps-icon-basket"></i><?php echo $button_text; ?></button>
Please login to merge, or discard this patch.
includes/modules/wps_cart/wps_cart.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 
3 3
 /**
4 4
  * WpShop Cart bootstrap file
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 
12 12
 /** Template Global vars **/
13 13
 DEFINE('WPS_CART_DIR', basename(dirname(__FILE__)));
14
-DEFINE('WPS_CART_PATH', str_replace( "\\", "/", str_replace( WPS_CART_DIR, "", dirname( __FILE__ ) ) ) );
15
-DEFINE('WPS_CART_URL', str_replace( str_replace( "\\", "/", ABSPATH), site_url() . '/', WPS_CART_PATH ) );
14
+DEFINE('WPS_CART_PATH', str_replace("\\", "/", str_replace(WPS_CART_DIR, "", dirname(__FILE__))));
15
+DEFINE('WPS_CART_URL', str_replace(str_replace("\\", "/", ABSPATH), site_url() . '/', WPS_CART_PATH));
16 16
 
17
-DEFINE('WPS_CART_TPL_DIR', WPS_CART_PATH . WPS_CART_DIR . "/templates/" );
17
+DEFINE('WPS_CART_TPL_DIR', WPS_CART_PATH . WPS_CART_DIR . "/templates/");
18 18
 
19 19
 // Include Controller
20
-include( plugin_dir_path( __FILE__ ).'controller/wps_cart_ctr.php' );
20
+include(plugin_dir_path(__FILE__) . 'controller/wps_cart_ctr.php');
21 21
 
22 22
 // Init Controller
23 23
 $wps_cart = new wps_cart();
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 
3 5
 /**
4 6
  * WpShop Cart bootstrap file
Please login to merge, or discard this patch.
includes/modules/wps_help/wps_help.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 
3 3
 /**
4 4
  * WpShop Help bootstrap file
@@ -8,17 +8,17 @@  discard block
 block discarded – undo
8 8
  * @subpackage modules
9 9
  *
10 10
  */
11
-DEFINE( 'WPS_HELP_VERSION', '1.0.1' );
12
-DEFINE( 'WPS_HELP_DIR', basename(dirname(__FILE__)));
13
-DEFINE( 'WPS_HELP_PATH', dirname( __FILE__ ) );
14
-DEFINE( 'WPS_HELP_URL', str_replace( str_replace( "\\", "/", ABSPATH), site_url() . '/', str_replace( "\\", "/", WPS_HELP_PATH ) ) );
11
+DEFINE('WPS_HELP_VERSION', '1.0.1');
12
+DEFINE('WPS_HELP_DIR', basename(dirname(__FILE__)));
13
+DEFINE('WPS_HELP_PATH', dirname(__FILE__));
14
+DEFINE('WPS_HELP_URL', str_replace(str_replace("\\", "/", ABSPATH), site_url() . '/', str_replace("\\", "/", WPS_HELP_PATH)));
15 15
 
16 16
 /**	Define the templates directories	*/
17
-DEFINE( 'WPS_HELP_TEMPLATES_MAIN_DIR', WPS_HELP_PATH . '/templates/');
17
+DEFINE('WPS_HELP_TEMPLATES_MAIN_DIR', WPS_HELP_PATH . '/templates/');
18 18
 
19
-require_once( WPS_HELP_PATH . '/controller/wps_help_menus_ctr.php' );
20
-require_once( WPS_HELP_PATH . '/controller/wps_help_bubble_ctr.php' );
21
-require_once( WPS_HELP_PATH . '/controller/wps_help_tabs_ctr.php' );
19
+require_once(WPS_HELP_PATH . '/controller/wps_help_menus_ctr.php');
20
+require_once(WPS_HELP_PATH . '/controller/wps_help_bubble_ctr.php');
21
+require_once(WPS_HELP_PATH . '/controller/wps_help_tabs_ctr.php');
22 22
 
23 23
 /**	Instanciate task management*/
24 24
 global $wps_help_menu;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 
3 5
 /**
4 6
  * WpShop Help bootstrap file
Please login to merge, or discard this patch.
includes/modules/wps_help/controller/wps_help_tabs_ctr.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@
 block discarded – undo
26 26
 	}
27 27
 
28 28
 	public function help_tab_static()
29
-    {
29
+	{
30 30
 		ob_start();
31
-    	require( wpshop_tools::get_template_part( WPS_HELP_DIR, WPS_HELP_TEMPLATES_MAIN_DIR, "backend", "wps_tabs_static_tpl") );
31
+		require( wpshop_tools::get_template_part( WPS_HELP_DIR, WPS_HELP_TEMPLATES_MAIN_DIR, "backend", "wps_tabs_static_tpl") );
32 32
 		$result .= ob_get_contents();
33 33
 		ob_end_clean();
34 34
 		return $result;
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 class wps_help_tabs_ctr
3 3
 {
4 4
 	private $help_tabs;
5 5
 
6 6
 	public function __construct() {
7
-		add_action( "load-{$GLOBALS['pagenow']}", array( $this, 'create_help_tabs' ), 20 );
7
+		add_action("load-{$GLOBALS['pagenow']}", array($this, 'create_help_tabs'), 20);
8 8
 	}
9 9
 
10 10
 	public function create_help_tabs()
11 11
 	{
12
-		if( is_array( $this->help_tabs ) ) {
12
+		if (is_array($this->help_tabs)) {
13 13
 			$screen = get_current_screen();
14
-			foreach ( $this->help_tabs as $id => $data )
14
+			foreach ($this->help_tabs as $id => $data)
15 15
 			{
16
-				if( is_array($data['pages']) && in_array( $screen->id, $data['pages'] ) ) {
17
-					$screen->add_help_tab( array(
16
+				if (is_array($data['pages']) && in_array($screen->id, $data['pages'])) {
17
+					$screen->add_help_tab(array(
18 18
 						'id'        => $id
19 19
 						,'title'    => $data['title']
20 20
 						,'content'  => $this->help_tab_static()
21
-						,'callback' => array( $this, 'help_tab_content' )
22
-					) );
21
+						,'callback' => array($this, 'help_tab_content')
22
+					));
23 23
 				}
24 24
 			}
25 25
 		}
@@ -28,23 +28,23 @@  discard block
 block discarded – undo
28 28
 	public function help_tab_static()
29 29
     {
30 30
 		ob_start();
31
-    	require( wpshop_tools::get_template_part( WPS_HELP_DIR, WPS_HELP_TEMPLATES_MAIN_DIR, "backend", "wps_tabs_static_tpl") );
31
+    	require(wpshop_tools::get_template_part(WPS_HELP_DIR, WPS_HELP_TEMPLATES_MAIN_DIR, "backend", "wps_tabs_static_tpl"));
32 32
 		$result .= ob_get_contents();
33 33
 		ob_end_clean();
34 34
 		return $result;
35 35
 	}
36 36
 	
37
-	public function help_tab_content( $screen, $tab )
37
+	public function help_tab_content($screen, $tab)
38 38
 	{
39 39
 		$id = $tab['id'];
40
-		$title = $tab['callback'][0]->help_tabs[ $tab['id'] ]['title'];
41
-		$content = $tab['callback'][0]->help_tabs[ $tab['id'] ]['content'];
42
-		$pages = $tab['callback'][0]->help_tabs[ $tab['id'] ]['pages'];
43
-		require( wpshop_tools::get_template_part( WPS_HELP_DIR, WPS_HELP_TEMPLATES_MAIN_DIR, "backend", "wps_tab_content_tpl") );
40
+		$title = $tab['callback'][0]->help_tabs[$tab['id']]['title'];
41
+		$content = $tab['callback'][0]->help_tabs[$tab['id']]['content'];
42
+		$pages = $tab['callback'][0]->help_tabs[$tab['id']]['pages'];
43
+		require(wpshop_tools::get_template_part(WPS_HELP_DIR, WPS_HELP_TEMPLATES_MAIN_DIR, "backend", "wps_tab_content_tpl"));
44 44
 	}
45 45
 	
46
-	public function set_help_tab( $ID, $title, $content, $pages ) {
47
-		$this->help_tabs[$ID] = array( 'title' => $title, 'content' => $content, 'pages' => $pages );
46
+	public function set_help_tab($ID, $title, $content, $pages) {
47
+		$this->help_tabs[$ID] = array('title' => $title, 'content' => $content, 'pages' => $pages);
48 48
 	}
49 49
 	
50 50
 	/**
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 * @return string
53 53
 	 */
54 54
 	public static function display_current_id_page() {
55
-		add_action( "load-{$GLOBALS['pagenow']}", array( 'wps_help_tabs_ctr', 'get_current_id_page' ), 20 );
55
+		add_action("load-{$GLOBALS['pagenow']}", array('wps_help_tabs_ctr', 'get_current_id_page'), 20);
56 56
 	}
57 57
 	public static function get_current_id_page() {
58 58
 		$screen = get_current_screen();
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 class wps_help_tabs_ctr
3 5
 {
4 6
 	private $help_tabs;
Please login to merge, or discard this patch.
includes/modules/wps_help/templates/backend/help-container.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 ?>
3 5
 <script type="text/javascript">
4 6
 	//<![CDATA[
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 ?>
3 3
 <script type="text/javascript">
4 4
 	//<![CDATA[
5 5
 	jQuery(document).ready( function($) {
6 6
     	$('<?php echo $help_case['pointer_id']; ?>').pointer({
7
-	        content: '<?php echo str_replace( "'", "&#039;", $pointer_content ); ?>',
7
+	        content: '<?php echo str_replace("'", "&#039;", $pointer_content); ?>',
8 8
 	        position : {
9 9
 		        edge : '<?php echo $help_case['edge']; ?>',
10 10
 				at : '<?php echo $help_case['at']; ?>',
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	        close: function() {
15 15
 	        	var data = {
16 16
 					action: "close_wps_help_window",
17
-					_wpnonce: '<?php echo wp_create_nonce( "wps_ajax_close_wps_help_window" ); ?>',
17
+					_wpnonce: '<?php echo wp_create_nonce("wps_ajax_close_wps_help_window"); ?>',
18 18
 					pointer_id : '<?php echo $help_id; ?>'
19 19
 				};
20 20
 				jQuery.post(ajaxurl, data, function(response) {}, 'json');
Please login to merge, or discard this patch.
includes/modules/wps_help/templates/backend/wps_tabs_static_tpl.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,3 +1,3 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 ?>
3
-<p style="text-align: center;"><i><?php _e( 'Help of plugin WPShop', 'wpshop' )?></i></p>
4 3
\ No newline at end of file
4
+<p style="text-align: center;"><i><?php _e('Help of plugin WPShop', 'wpshop')?></i></p>
5 5
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,3 +1,5 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 ?>
3 5
 <p style="text-align: center;"><i><?php _e( 'Help of plugin WPShop', 'wpshop' )?></i></p>
4 6
\ No newline at end of file
Please login to merge, or discard this patch.
includes/modules/wps_help/templates/backend/wps_tab_content_tpl.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,3 +1,3 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 ?>
3 3
 <p><?php echo $content; ?></p>
4 4
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,3 +1,5 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 ?>
3 5
 <p><?php echo $content; ?></p>
4 6
\ No newline at end of file
Please login to merge, or discard this patch.
includes/modules/wps_help/assets/js/header.js.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 ?>
3 3
 <script type="text/javascript">
4 4
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 ?>
3 5
 <script type="text/javascript">
4 6
 
Please login to merge, or discard this patch.
includes/modules/wps_barcode/librairies/odtphp/Segment.php 3 patches
Indentation   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -19,210 +19,210 @@
 block discarded – undo
19 19
  */
20 20
 class Segment implements IteratorAggregate, Countable
21 21
 {
22
-    protected $xml;
23
-    protected $xmlParsed = '';
24
-    protected $name;
25
-    protected $children = array();
26
-    protected $vars = array();
27
-    public $manif_vars = array();
22
+	protected $xml;
23
+	protected $xmlParsed = '';
24
+	protected $name;
25
+	protected $children = array();
26
+	protected $vars = array();
27
+	public $manif_vars = array();
28 28
 	protected $images = array();
29 29
 	protected $odf;
30 30
 	protected $file;
31
-    /**
32
-     * Constructor
33
-     *
34
-     * @param string $name name of the segment to construct
35
-     * @param string $xml XML tree of the segment
36
-     */
37
-    public function __construct($name, $xml, $odf)
38
-    {
39
-        $this->name = (string) $name;
40
-        $this->xml = (string) $xml;
31
+	/**
32
+	 * Constructor
33
+	 *
34
+	 * @param string $name name of the segment to construct
35
+	 * @param string $xml XML tree of the segment
36
+	 */
37
+	public function __construct($name, $xml, $odf)
38
+	{
39
+		$this->name = (string) $name;
40
+		$this->xml = (string) $xml;
41 41
 		$this->odf = $odf;
42
-        $zipHandler = $this->odf->getConfig('ZIP_PROXY');
43
-        $this->file = new $zipHandler();	
44
-        $this->_analyseChildren($this->xml);
45
-    }
46
-    /**
47
-     * Returns the name of the segment
48
-     *
49
-     * @return string
50
-     */
51
-    public function getName()
52
-    {
53
-        return $this->name;
54
-    }
55
-    /**
56
-     * Does the segment have children ?
57
-     *
58
-     * @return bool
59
-     */
60
-    public function hasChildren()
61
-    {
62
-        return $this->getIterator()->hasChildren();
63
-    }
64
-    /**
65
-     * Countable interface
66
-     *
67
-     * @return int
68
-     */
69
-    public function count()
70
-    {
71
-        return count($this->children);
72
-    }
73
-    /**
74
-     * IteratorAggregate interface
75
-     *
76
-     * @return Iterator
77
-     */
78
-    public function getIterator()
79
-    {
80
-        return new RecursiveIteratorIterator(new SegmentIterator($this->children), 1);
81
-    }
82
-    /**
83
-     * Replace variables of the template in the XML code
84
-     * All the children are also called
85
-     *
86
-     * @return string
87
-     */
88
-    public function merge()
89
-    {
90
-        $this->xmlParsed .= str_replace(array_keys($this->vars), array_values($this->vars), $this->xml);
91
-        if ($this->hasChildren()) {
92
-            foreach ($this->children as $child) {
93
-                $this->xmlParsed = str_replace($child->xml, ($child->xmlParsed=="")?$child->merge():$child->xmlParsed, $this->xmlParsed);
94
-                $child->xmlParsed = '';
95
-                //Store all image names used in child segments in current segment array 
42
+		$zipHandler = $this->odf->getConfig('ZIP_PROXY');
43
+		$this->file = new $zipHandler();	
44
+		$this->_analyseChildren($this->xml);
45
+	}
46
+	/**
47
+	 * Returns the name of the segment
48
+	 *
49
+	 * @return string
50
+	 */
51
+	public function getName()
52
+	{
53
+		return $this->name;
54
+	}
55
+	/**
56
+	 * Does the segment have children ?
57
+	 *
58
+	 * @return bool
59
+	 */
60
+	public function hasChildren()
61
+	{
62
+		return $this->getIterator()->hasChildren();
63
+	}
64
+	/**
65
+	 * Countable interface
66
+	 *
67
+	 * @return int
68
+	 */
69
+	public function count()
70
+	{
71
+		return count($this->children);
72
+	}
73
+	/**
74
+	 * IteratorAggregate interface
75
+	 *
76
+	 * @return Iterator
77
+	 */
78
+	public function getIterator()
79
+	{
80
+		return new RecursiveIteratorIterator(new SegmentIterator($this->children), 1);
81
+	}
82
+	/**
83
+	 * Replace variables of the template in the XML code
84
+	 * All the children are also called
85
+	 *
86
+	 * @return string
87
+	 */
88
+	public function merge()
89
+	{
90
+		$this->xmlParsed .= str_replace(array_keys($this->vars), array_values($this->vars), $this->xml);
91
+		if ($this->hasChildren()) {
92
+			foreach ($this->children as $child) {
93
+				$this->xmlParsed = str_replace($child->xml, ($child->xmlParsed=="")?$child->merge():$child->xmlParsed, $this->xmlParsed);
94
+				$child->xmlParsed = '';
95
+				//Store all image names used in child segments in current segment array 
96 96
 				foreach ($child->manif_vars as $file) 
97
-                $this->manif_vars[] = $file; 
98
-                $child->manif_vars=array();
99
-            }
100
-        }
101
-        $reg = "/\[!--\sBEGIN\s$this->name\s--\](.*)\[!--\sEND\s$this->name\s--\]/smU";
102
-        $this->xmlParsed = preg_replace($reg, '$1', $this->xmlParsed);
103
-        $this->file->open($this->odf->getTmpfile());
104
-        foreach ($this->images as $imageKey => $imageValue) {
97
+				$this->manif_vars[] = $file; 
98
+				$child->manif_vars=array();
99
+			}
100
+		}
101
+		$reg = "/\[!--\sBEGIN\s$this->name\s--\](.*)\[!--\sEND\s$this->name\s--\]/smU";
102
+		$this->xmlParsed = preg_replace($reg, '$1', $this->xmlParsed);
103
+		$this->file->open($this->odf->getTmpfile());
104
+		foreach ($this->images as $imageKey => $imageValue) {
105 105
 			if ($this->file->getFromName('Pictures/' . $imageValue) === false) {
106 106
 				$this->file->addFile($imageKey, 'Pictures/' . $imageValue);
107 107
 			}
108
-        }
108
+		}
109 109
 
110
-        $this->file->close();		
111
-        return $this->xmlParsed;
112
-    }
113
-    /**
114
-     * Analyse the XML code in order to find children
115
-     *
116
-     * @param string $xml
117
-     * @return Segment
118
-     */
119
-    protected function _analyseChildren($xml)
120
-    {
121
-        // $reg2 = "#\[!--\sBEGIN\s([\S]*)\s--\](?:<\/text:p>)?(.*)(?:<text:p\s.*>)?\[!--\sEND\s(\\1)\s--\]#sm";
122
-        $reg2 = "#\[!--\sBEGIN\s([\S]*)\s--\](.*)\[!--\sEND\s(\\1)\s--\]#smU";
123
-        preg_match_all($reg2, $xml, $matches);
124
-        for ($i = 0, $size = count($matches[0]); $i < $size; $i++) {
125
-            if ($matches[1][$i] != $this->name) {
126
-                $this->children[$matches[1][$i]] = new self($matches[1][$i], $matches[0][$i], $this->odf);
127
-            } else {
128
-                $this->_analyseChildren($matches[2][$i]);
129
-            }
130
-        }
131
-        return $this;
132
-    }
133
-    /**
134
-     * Assign a template variable to replace
135
-     *
136
-     * @param string $key
137
-     * @param string $value
138
-     * @throws SegmentException
139
-     * @return Segment
140
-     */
141
-    public function setVars($key, $value, $encode = true, $charset = 'ISO-8859')
142
-    {
143
-        if (strpos($this->xml, $this->odf->getConfig('DELIMITER_LEFT') . $key . $this->odf->getConfig('DELIMITER_RIGHT')) === false) {
144
-            throw new SegmentException("var $key not found in {$this->getName()}");
145
-        }
110
+		$this->file->close();		
111
+		return $this->xmlParsed;
112
+	}
113
+	/**
114
+	 * Analyse the XML code in order to find children
115
+	 *
116
+	 * @param string $xml
117
+	 * @return Segment
118
+	 */
119
+	protected function _analyseChildren($xml)
120
+	{
121
+		// $reg2 = "#\[!--\sBEGIN\s([\S]*)\s--\](?:<\/text:p>)?(.*)(?:<text:p\s.*>)?\[!--\sEND\s(\\1)\s--\]#sm";
122
+		$reg2 = "#\[!--\sBEGIN\s([\S]*)\s--\](.*)\[!--\sEND\s(\\1)\s--\]#smU";
123
+		preg_match_all($reg2, $xml, $matches);
124
+		for ($i = 0, $size = count($matches[0]); $i < $size; $i++) {
125
+			if ($matches[1][$i] != $this->name) {
126
+				$this->children[$matches[1][$i]] = new self($matches[1][$i], $matches[0][$i], $this->odf);
127
+			} else {
128
+				$this->_analyseChildren($matches[2][$i]);
129
+			}
130
+		}
131
+		return $this;
132
+	}
133
+	/**
134
+	 * Assign a template variable to replace
135
+	 *
136
+	 * @param string $key
137
+	 * @param string $value
138
+	 * @throws SegmentException
139
+	 * @return Segment
140
+	 */
141
+	public function setVars($key, $value, $encode = true, $charset = 'ISO-8859')
142
+	{
143
+		if (strpos($this->xml, $this->odf->getConfig('DELIMITER_LEFT') . $key . $this->odf->getConfig('DELIMITER_RIGHT')) === false) {
144
+			throw new SegmentException("var $key not found in {$this->getName()}");
145
+		}
146 146
 		$value = $encode ? htmlspecialchars($value) : $value;
147 147
 		$value = ($charset == 'ISO-8859') ? utf8_encode($value) : $value;
148
-        $this->vars[$this->odf->getConfig('DELIMITER_LEFT') . $key . $this->odf->getConfig('DELIMITER_RIGHT')] = str_replace("\n", "<text:line-break/>", $value);
149
-        return $this;
150
-    }
151
-    /**
152
-     * Assign a template variable as a picture
153
-     *
154
-     * @param string $key name of the variable within the template
155
-     * @param string $value path to the picture
156
-     * @param string $page anchor to page number (or -1 if anchor-type is aschar)
157
-     * @param string $width width of picture (keep original if null)
158
-     * @param string $height height of picture (keep original if null)
159
-     * @param string $offsetX offset by horizontal (not used if $page = -1)
160
-     * @param string $offsetY offset by vertical (not used if $page = -1)
161
-     * @throws OdfException
162
-     * @return Segment
163
-     */
164
-    public function setImage($key, $value, $page=null, $width=null, $height=null, $offsetX=null, $offsetY=null)
165
-    {
166
-        $filename = strtok(strrchr($value, '/'), '/.');
167
-        $file = substr(strrchr($value, '/'), 1);
168
-        $size = @getimagesize($value);
169
-        if ($size === false) {
170
-            throw new OdfException("Invalid image");
171
-        }
172
-        if (!$width && !$height) {
173
-            list ($width, $height) = $size;
174
-            $width *= Odf::PIXEL_TO_CM;
175
-            $height *= Odf::PIXEL_TO_CM;
176
-        }
177
-        $anchor = $page == -1 ? 'text:anchor-type="aschar"' : "text:anchor-type=\"page\" text:anchor-page-number=\"{$page}\" svg:x=\"{$offsetX}cm\" svg:y=\"{$offsetY}cm\"";
178
-        $xml = <<<IMG
148
+		$this->vars[$this->odf->getConfig('DELIMITER_LEFT') . $key . $this->odf->getConfig('DELIMITER_RIGHT')] = str_replace("\n", "<text:line-break/>", $value);
149
+		return $this;
150
+	}
151
+	/**
152
+	 * Assign a template variable as a picture
153
+	 *
154
+	 * @param string $key name of the variable within the template
155
+	 * @param string $value path to the picture
156
+	 * @param string $page anchor to page number (or -1 if anchor-type is aschar)
157
+	 * @param string $width width of picture (keep original if null)
158
+	 * @param string $height height of picture (keep original if null)
159
+	 * @param string $offsetX offset by horizontal (not used if $page = -1)
160
+	 * @param string $offsetY offset by vertical (not used if $page = -1)
161
+	 * @throws OdfException
162
+	 * @return Segment
163
+	 */
164
+	public function setImage($key, $value, $page=null, $width=null, $height=null, $offsetX=null, $offsetY=null)
165
+	{
166
+		$filename = strtok(strrchr($value, '/'), '/.');
167
+		$file = substr(strrchr($value, '/'), 1);
168
+		$size = @getimagesize($value);
169
+		if ($size === false) {
170
+			throw new OdfException("Invalid image");
171
+		}
172
+		if (!$width && !$height) {
173
+			list ($width, $height) = $size;
174
+			$width *= Odf::PIXEL_TO_CM;
175
+			$height *= Odf::PIXEL_TO_CM;
176
+		}
177
+		$anchor = $page == -1 ? 'text:anchor-type="aschar"' : "text:anchor-type=\"page\" text:anchor-page-number=\"{$page}\" svg:x=\"{$offsetX}cm\" svg:y=\"{$offsetY}cm\"";
178
+		$xml = <<<IMG
179 179
 <draw:frame draw:style-name="fr1" draw:name="$filename" {$anchor} svg:width="{$width}cm" svg:height="{$height}cm" draw:z-index="3"><draw:image xlink:href="Pictures/$file" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame>
180 180
 IMG;
181
-        $this->images[$value] = $file;
182
-        $this->manif_vars[] = $file;	//save image name as array element
183
-        $this->setVars($key, $xml, false);
184
-        return $this;
185
-    }	
186
-    /**
187
-     * Shortcut to retrieve a child
188
-     *
189
-     * @param string $prop
190
-     * @return Segment
191
-     * @throws SegmentException
192
-     */
193
-    public function __get($prop)
194
-    {
195
-        if (array_key_exists($prop, $this->children)) {
196
-            return $this->children[$prop];
197
-        } else {
198
-            throw new SegmentException('child ' . $prop . ' does not exist');
199
-        }
200
-    }
201
-    /**
202
-     * Proxy for setVars
203
-     *
204
-     * @param string $meth
205
-     * @param array $args
206
-     * @return Segment
207
-     */
208
-    public function __call($meth, $args)
209
-    {
210
-        try {
211
-            array_unshift($args,$meth);
212
-            return call_user_func_array(array($this,'setVars'),$args);
213
-        } catch (SegmentException $e) {
214
-            throw new SegmentException("method $meth nor var $meth exist");
215
-        }
216
-    }
217
-    /**
218
-     * Returns the parsed XML
219
-     *
220
-     * @return string
221
-     */
222
-    public function getXmlParsed()
223
-    {
224
-        return $this->xmlParsed;
225
-    }
181
+		$this->images[$value] = $file;
182
+		$this->manif_vars[] = $file;	//save image name as array element
183
+		$this->setVars($key, $xml, false);
184
+		return $this;
185
+	}	
186
+	/**
187
+	 * Shortcut to retrieve a child
188
+	 *
189
+	 * @param string $prop
190
+	 * @return Segment
191
+	 * @throws SegmentException
192
+	 */
193
+	public function __get($prop)
194
+	{
195
+		if (array_key_exists($prop, $this->children)) {
196
+			return $this->children[$prop];
197
+		} else {
198
+			throw new SegmentException('child ' . $prop . ' does not exist');
199
+		}
200
+	}
201
+	/**
202
+	 * Proxy for setVars
203
+	 *
204
+	 * @param string $meth
205
+	 * @param array $args
206
+	 * @return Segment
207
+	 */
208
+	public function __call($meth, $args)
209
+	{
210
+		try {
211
+			array_unshift($args,$meth);
212
+			return call_user_func_array(array($this,'setVars'),$args);
213
+		} catch (SegmentException $e) {
214
+			throw new SegmentException("method $meth nor var $meth exist");
215
+		}
216
+	}
217
+	/**
218
+	 * Returns the parsed XML
219
+	 *
220
+	 * @return string
221
+	 */
222
+	public function getXmlParsed()
223
+	{
224
+		return $this->xmlParsed;
225
+	}
226 226
 }
227 227
 
228 228
 ?>
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 require 'SegmentIterator.php';
3 3
 class SegmentException extends Exception
4 4
 {}
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public function __construct($name, $xml, $odf)
38 38
     {
39
-        $this->name = (string) $name;
40
-        $this->xml = (string) $xml;
39
+        $this->name = (string)$name;
40
+        $this->xml = (string)$xml;
41 41
 		$this->odf = $odf;
42 42
         $zipHandler = $this->odf->getConfig('ZIP_PROXY');
43 43
         $this->file = new $zipHandler();	
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
         $this->xmlParsed .= str_replace(array_keys($this->vars), array_values($this->vars), $this->xml);
91 91
         if ($this->hasChildren()) {
92 92
             foreach ($this->children as $child) {
93
-                $this->xmlParsed = str_replace($child->xml, ($child->xmlParsed=="")?$child->merge():$child->xmlParsed, $this->xmlParsed);
93
+                $this->xmlParsed = str_replace($child->xml, ($child->xmlParsed == "") ? $child->merge() : $child->xmlParsed, $this->xmlParsed);
94 94
                 $child->xmlParsed = '';
95 95
                 //Store all image names used in child segments in current segment array 
96 96
 				foreach ($child->manif_vars as $file) 
97 97
                 $this->manif_vars[] = $file; 
98
-                $child->manif_vars=array();
98
+                $child->manif_vars = array();
99 99
             }
100 100
         }
101 101
         $reg = "/\[!--\sBEGIN\s$this->name\s--\](.*)\[!--\sEND\s$this->name\s--\]/smU";
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      * @throws OdfException
162 162
      * @return Segment
163 163
      */
164
-    public function setImage($key, $value, $page=null, $width=null, $height=null, $offsetX=null, $offsetY=null)
164
+    public function setImage($key, $value, $page = null, $width = null, $height = null, $offsetX = null, $offsetY = null)
165 165
     {
166 166
         $filename = strtok(strrchr($value, '/'), '/.');
167 167
         $file = substr(strrchr($value, '/'), 1);
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 <draw:frame draw:style-name="fr1" draw:name="$filename" {$anchor} svg:width="{$width}cm" svg:height="{$height}cm" draw:z-index="3"><draw:image xlink:href="Pictures/$file" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame>
180 180
 IMG;
181 181
         $this->images[$value] = $file;
182
-        $this->manif_vars[] = $file;	//save image name as array element
182
+        $this->manif_vars[] = $file; //save image name as array element
183 183
         $this->setVars($key, $xml, false);
184 184
         return $this;
185 185
     }	
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
     public function __call($meth, $args)
209 209
     {
210 210
         try {
211
-            array_unshift($args,$meth);
212
-            return call_user_func_array(array($this,'setVars'),$args);
211
+            array_unshift($args, $meth);
212
+            return call_user_func_array(array($this, 'setVars'), $args);
213 213
         } catch (SegmentException $e) {
214 214
             throw new SegmentException("method $meth nor var $meth exist");
215 215
         }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 require 'SegmentIterator.php';
3 5
 class SegmentException extends Exception
4 6
 {}
@@ -93,8 +95,9 @@  discard block
 block discarded – undo
93 95
                 $this->xmlParsed = str_replace($child->xml, ($child->xmlParsed=="")?$child->merge():$child->xmlParsed, $this->xmlParsed);
94 96
                 $child->xmlParsed = '';
95 97
                 //Store all image names used in child segments in current segment array 
96
-				foreach ($child->manif_vars as $file) 
97
-                $this->manif_vars[] = $file; 
98
+				foreach ($child->manif_vars as $file) {
99
+				                $this->manif_vars[] = $file;
100
+				}
98 101
                 $child->manif_vars=array();
99 102
             }
100 103
         }
Please login to merge, or discard this patch.