| @@ -18,9 +18,8 @@ | ||
| 18 | 18 | // | MA 02110-1301 USA | |
| 19 | 19 | // +----------------------------------------------------------------------+ |
| 20 | 20 | // | Author: Eugene Manuilov <eugene@manuilov.org> | |
| 21 | 21 | // +----------------------------------------------------------------------+ |
| 22 | - | |
| 23 | 22 | /** |
| 24 | 23 | * Frontend module class. |
| 25 | 24 | * |
| 26 | 25 | * @category Visualizer |
| @@ -57,14 +56,14 @@ | ||
| 57 | 56 | $this->_addAction( 'wp_enqueue_scripts', 'enqueueScripts' ); |
| 58 | 57 | $this->_addShortcode( 'visualizer', 'renderChart' ); |
| 59 | 58 | |
| 60 | 59 | // add do_shortocde hook for widget_text filter |
| 61 | - if ( !has_filter( 'widget_text', 'do_shortcode' ) ) { | |
| 60 | + if ( ! has_filter( 'widget_text', 'do_shortcode' ) ) { | |
| 62 | 61 | add_filter( 'widget_text', 'do_shortcode' ); |
| 63 | 62 | } |
| 64 | 63 | |
| 65 | 64 | // add do_shortcode hook for term_description filter |
| 66 | - if ( !has_filter( 'term_description', 'do_shortcode' ) ) { | |
| 65 | + if ( ! has_filter( 'term_description', 'do_shortcode' ) ) { | |
| 67 | 66 | add_filter( 'term_description', 'do_shortcode' ); |
| 68 | 67 | } |
| 69 | 68 | } |
| 70 | 69 | |
| @@ -77,9 +76,9 @@ | ||
| 77 | 76 | * @access public |
| 78 | 77 | */ |
| 79 | 78 | public function enqueueScripts() { |
| 80 | 79 | wp_register_script( 'visualizer-google-jsapi-new', '//www.gstatic.com/charts/loader.js', array(), null, true ); |
| 81 | - wp_register_script( 'visualizer-google-jsapi-old', '//www.google.com/jsapi', array('visualizer-google-jsapi-new'), null, true ); | |
| 80 | + wp_register_script( 'visualizer-google-jsapi-old', '//www.google.com/jsapi', array( 'visualizer-google-jsapi-new' ), null, true ); | |
| 82 | 81 | wp_register_script( 'visualizer-render', VISUALIZER_ABSURL . 'js/render.js', array( 'visualizer-google-jsapi-old', 'jquery' ), Visualizer_Plugin::VERSION, true ); |
| 83 | 82 | } |
| 84 | 83 | |
| 85 | 84 | /** |
| @@ -104,17 +103,17 @@ | ||
| 104 | 103 | 'settings' => false, // data filter hook |
| 105 | 104 | ), $atts ); |
| 106 | 105 | |
| 107 | 106 | // if empty id or chart does not exists, then return empty string |
| 108 | - if ( !$atts['id'] || !( $chart = get_post( $atts['id'] ) ) || $chart->post_type != Visualizer_Plugin::CPT_VISUALIZER ) { | |
| 107 | + if ( ! $atts['id'] || ! ( $chart = get_post( $atts['id'] ) ) || $chart->post_type != Visualizer_Plugin::CPT_VISUALIZER ) { | |
| 109 | 108 | return ''; |
| 110 | 109 | } |
| 111 | 110 | |
| 112 | 111 | $id = 'visualizer-' . $atts['id']; |
| 113 | - $defaultClass = "visualizer-front"; | |
| 112 | + $defaultClass = 'visualizer-front'; | |
| 114 | 113 | $class = apply_filters( Visualizer_Plugin::FILTER_CHART_WRAPPER_CLASS, $atts['class'], $atts['id'] ); |
| 115 | - $class = $defaultClass . " " . $class; | |
| 116 | - $class = !empty( $class ) ? ' class="' . trim($class) . '"' : ''; | |
| 114 | + $class = $defaultClass . ' ' . $class; | |
| 115 | + $class = ! empty( $class ) ? ' class="' . trim( $class ) . '"' : ''; | |
| 117 | 116 | |
| 118 | 117 | $type = get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true ); |
| 119 | 118 | |
| 120 | 119 | // faetch and update settings |
| @@ -124,25 +123,25 @@ | ||
| 124 | 123 | } |
| 125 | 124 | |
| 126 | 125 | // handle series filter hooks |
| 127 | 126 | $series = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_SERIES, get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true ), $chart->ID, $type ); |
| 128 | - if ( !empty( $atts['series'] ) ) { | |
| 127 | + if ( ! empty( $atts['series'] ) ) { | |
| 129 | 128 | $series = apply_filters( $atts['series'], $series, $chart->ID, $type ); |
| 130 | 129 | } |
| 131 | 130 | // handle settings filter hooks |
| 132 | 131 | $settings = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_SETTINGS, $settings, $chart->ID, $type ); |
| 133 | - if ( !empty( $atts['settings'] ) ) { | |
| 132 | + if ( ! empty( $atts['settings'] ) ) { | |
| 134 | 133 | $settings = apply_filters( $atts['settings'], $settings, $chart->ID, $type ); |
| 135 | 134 | } |
| 136 | 135 | |
| 137 | 136 | // handle data filter hooks |
| 138 | 137 | $data = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, unserialize( $chart->post_content ), $chart->ID, $type ); |
| 139 | - if ( !empty( $atts['data'] ) ) { | |
| 138 | + if ( ! empty( $atts['data'] ) ) { | |
| 140 | 139 | $data = apply_filters( $atts['data'], $data, $chart->ID, $type ); |
| 141 | 140 | } |
| 142 | 141 | |
| 143 | 142 | // add chart to the array |
| 144 | - $this->_charts[$id] = array( | |
| 143 | + $this->_charts[ $id ] = array( | |
| 145 | 144 | 'type' => $type, |
| 146 | 145 | 'series' => $series, |
| 147 | 146 | 'settings' => $settings, |
| 148 | 147 | 'data' => $data, |
| @@ -155,5 +154,5 @@ | ||
| 155 | 154 | // return placeholder div |
| 156 | 155 | return '<div id="' . $id . '"' . $class . '></div>'; |
| 157 | 156 | } |
| 158 | 157 | |
| 159 | -} | |
| 158 | +} | |