@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | /** |
11 | 11 | * @return array |
12 | 12 | */ |
13 | - public function filterEditorSettings(array $settings) |
|
13 | + public function filterEditorSettings( array $settings ) |
|
14 | 14 | { |
15 | - if ($this->isReviewEditable()) { |
|
15 | + if( $this->isReviewEditable() ) { |
|
16 | 16 | $settings = [ |
17 | 17 | 'media_buttons' => false, |
18 | 18 | 'quicktags' => false, |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | * @param string $html |
28 | 28 | * @return string |
29 | 29 | */ |
30 | - public function filterEditorTextarea($html) |
|
30 | + public function filterEditorTextarea( $html ) |
|
31 | 31 | { |
32 | - if ($this->isReviewEditable()) { |
|
33 | - $html = str_replace('<textarea', '<div id="ed_toolbar"></div><textarea', $html); |
|
32 | + if( $this->isReviewEditable() ) { |
|
33 | + $html = str_replace( '<textarea', '<div id="ed_toolbar"></div><textarea', $html ); |
|
34 | 34 | } |
35 | 35 | return $html; |
36 | 36 | } |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function removeAutosave() |
42 | 42 | { |
43 | - if (!$this->isReviewEditor() || $this->isReviewEditable()) { |
|
43 | + if( !$this->isReviewEditor() || $this->isReviewEditable() ) { |
|
44 | 44 | return; |
45 | 45 | } |
46 | - wp_deregister_script('autosave'); |
|
46 | + wp_deregister_script( 'autosave' ); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function removeMetaBoxes() |
53 | 53 | { |
54 | - remove_meta_box('slugdiv', Application::POST_TYPE, 'advanced'); |
|
54 | + remove_meta_box( 'slugdiv', Application::POST_TYPE, 'advanced' ); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function removePostTypeSupport() |
61 | 61 | { |
62 | - if (!$this->isReviewEditor() || $this->isReviewEditable()) { |
|
62 | + if( !$this->isReviewEditor() || $this->isReviewEditable() ) { |
|
63 | 63 | return; |
64 | 64 | } |
65 | - remove_post_type_support(Application::POST_TYPE, 'title'); |
|
66 | - remove_post_type_support(Application::POST_TYPE, 'editor'); |
|
65 | + remove_post_type_support( Application::POST_TYPE, 'title' ); |
|
66 | + remove_post_type_support( Application::POST_TYPE, 'editor' ); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | */ |
72 | 72 | protected function isReviewEditable() |
73 | 73 | { |
74 | - $postId = intval(filter_input(INPUT_GET, 'post')); |
|
74 | + $postId = intval( filter_input( INPUT_GET, 'post' ) ); |
|
75 | 75 | return $postId > 0 |
76 | - && 'local' == glsr(Database::class)->get($postId, 'review_type') |
|
76 | + && 'local' == glsr( Database::class )->get( $postId, 'review_type' ) |
|
77 | 77 | && $this->isReviewEditor(); |
78 | 78 | } |
79 | 79 |
@@ -8,12 +8,12 @@ |
||
8 | 8 | * @param int|string $postId |
9 | 9 | * @return \WP_Post|void|null |
10 | 10 | */ |
11 | - public function getPost($postId); |
|
11 | + public function getPost( $postId ); |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @return array |
15 | 15 | */ |
16 | - public function getPostIds(array $postIds); |
|
16 | + public function getPostIds( array $postIds ); |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @return bool |
@@ -13,44 +13,44 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * {@inheritdoc} |
15 | 15 | */ |
16 | - public function getPost($postId) |
|
16 | + public function getPost( $postId ) |
|
17 | 17 | { |
18 | - $postId = trim($postId); |
|
19 | - if (!is_numeric($postId)) { |
|
18 | + $postId = trim( $postId ); |
|
19 | + if( !is_numeric( $postId ) ) { |
|
20 | 20 | return; |
21 | 21 | } |
22 | - if ($this->isEnabled()) { |
|
23 | - $postId = apply_filters('wpml_object_id', $postId, 'any', true); |
|
22 | + if( $this->isEnabled() ) { |
|
23 | + $postId = apply_filters( 'wpml_object_id', $postId, 'any', true ); |
|
24 | 24 | } |
25 | - return get_post(intval($postId)); |
|
25 | + return get_post( intval( $postId ) ); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
29 | 29 | * {@inheritdoc} |
30 | 30 | */ |
31 | - public function getPostIds(array $postIds) |
|
31 | + public function getPostIds( array $postIds ) |
|
32 | 32 | { |
33 | - if (!$this->isEnabled()) { |
|
33 | + if( !$this->isEnabled() ) { |
|
34 | 34 | return $postIds; |
35 | 35 | } |
36 | 36 | $newPostIds = []; |
37 | - foreach ($this->cleanIds($postIds) as $postId) { |
|
38 | - $postType = get_post_type($postId); |
|
39 | - if (!$postType) { |
|
37 | + foreach( $this->cleanIds( $postIds ) as $postId ) { |
|
38 | + $postType = get_post_type( $postId ); |
|
39 | + if( !$postType ) { |
|
40 | 40 | continue; |
41 | 41 | } |
42 | 42 | $elementType = 'post_'.$postType; |
43 | - $trid = apply_filters('wpml_element_trid', null, $postId, $elementType); |
|
44 | - $translations = apply_filters('wpml_get_element_translations', null, $trid, $elementType); |
|
45 | - if (!is_array($translations)) { |
|
43 | + $trid = apply_filters( 'wpml_element_trid', null, $postId, $elementType ); |
|
44 | + $translations = apply_filters( 'wpml_get_element_translations', null, $trid, $elementType ); |
|
45 | + if( !is_array( $translations ) ) { |
|
46 | 46 | $translations = []; |
47 | 47 | } |
48 | 48 | $newPostIds = array_merge( |
49 | 49 | $newPostIds, |
50 | - array_column($translations, 'element_id') |
|
50 | + array_column( $translations, 'element_id' ) |
|
51 | 51 | ); |
52 | 52 | } |
53 | - return $this->cleanIds($newPostIds); |
|
53 | + return $this->cleanIds( $newPostIds ); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function isActive() |
60 | 60 | { |
61 | - return defined('ICL_SITEPRESS_VERSION'); |
|
61 | + return defined( 'ICL_SITEPRESS_VERSION' ); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | public function isEnabled() |
68 | 68 | { |
69 | 69 | return $this->isActive() |
70 | - && 'wpml' == glsr(OptionManager::class)->get('settings.general.multilingual'); |
|
70 | + && 'wpml' == glsr( OptionManager::class )->get( 'settings.general.multilingual' ); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | public function isSupported() |
77 | 77 | { |
78 | 78 | return $this->isActive() |
79 | - && version_compare(ICL_SITEPRESS_VERSION, static::SUPPORTED_VERSION, '>='); |
|
79 | + && version_compare( ICL_SITEPRESS_VERSION, static::SUPPORTED_VERSION, '>=' ); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
83 | 83 | * @return array |
84 | 84 | */ |
85 | - protected function cleanIds(array $postIds) |
|
85 | + protected function cleanIds( array $postIds ) |
|
86 | 86 | { |
87 | - return array_filter(array_unique($postIds)); |
|
87 | + return array_filter( array_unique( $postIds ) ); |
|
88 | 88 | } |
89 | 89 | } |
@@ -13,37 +13,37 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * {@inheritdoc} |
15 | 15 | */ |
16 | - public function getPost($postId) |
|
16 | + public function getPost( $postId ) |
|
17 | 17 | { |
18 | - $postId = trim($postId); |
|
19 | - if (!is_numeric($postId)) { |
|
18 | + $postId = trim( $postId ); |
|
19 | + if( !is_numeric( $postId ) ) { |
|
20 | 20 | return; |
21 | 21 | } |
22 | - if ($this->isEnabled()) { |
|
23 | - $polylangPostId = pll_get_post($postId, pll_get_post_language(get_the_ID())); |
|
22 | + if( $this->isEnabled() ) { |
|
23 | + $polylangPostId = pll_get_post( $postId, pll_get_post_language( get_the_ID() ) ); |
|
24 | 24 | } |
25 | - if (!empty($polylangPostId)) { |
|
25 | + if( !empty($polylangPostId) ) { |
|
26 | 26 | $postId = $polylangPostId; |
27 | 27 | } |
28 | - return get_post(intval($postId)); |
|
28 | + return get_post( intval( $postId ) ); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
32 | 32 | * {@inheritdoc} |
33 | 33 | */ |
34 | - public function getPostIds(array $postIds) |
|
34 | + public function getPostIds( array $postIds ) |
|
35 | 35 | { |
36 | - if (!$this->isEnabled()) { |
|
36 | + if( !$this->isEnabled() ) { |
|
37 | 37 | return $postIds; |
38 | 38 | } |
39 | 39 | $newPostIds = []; |
40 | - foreach ($this->cleanIds($postIds) as $postId) { |
|
40 | + foreach( $this->cleanIds( $postIds ) as $postId ) { |
|
41 | 41 | $newPostIds = array_merge( |
42 | 42 | $newPostIds, |
43 | - array_values(pll_get_post_translations($postId)) |
|
43 | + array_values( pll_get_post_translations( $postId ) ) |
|
44 | 44 | ); |
45 | 45 | } |
46 | - return $this->cleanIds($newPostIds); |
|
46 | + return $this->cleanIds( $newPostIds ); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function isActive() |
53 | 53 | { |
54 | - return function_exists('PLL') |
|
55 | - && function_exists('pll_get_post') |
|
56 | - && function_exists('pll_get_post_language') |
|
57 | - && function_exists('pll_get_post_translations'); |
|
54 | + return function_exists( 'PLL' ) |
|
55 | + && function_exists( 'pll_get_post' ) |
|
56 | + && function_exists( 'pll_get_post_language' ) |
|
57 | + && function_exists( 'pll_get_post_translations' ); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | public function isEnabled() |
64 | 64 | { |
65 | 65 | return $this->isActive() |
66 | - && 'polylang' == glsr(OptionManager::class)->get('settings.general.multilingual'); |
|
66 | + && 'polylang' == glsr( OptionManager::class )->get( 'settings.general.multilingual' ); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function isSupported() |
73 | 73 | { |
74 | - return defined('POLYLANG_VERSION') |
|
75 | - && version_compare(POLYLANG_VERSION, static::SUPPORTED_VERSION, '>='); |
|
74 | + return defined( 'POLYLANG_VERSION' ) |
|
75 | + && version_compare( POLYLANG_VERSION, static::SUPPORTED_VERSION, '>=' ); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
79 | 79 | * @return array |
80 | 80 | */ |
81 | - protected function cleanIds(array $postIds) |
|
81 | + protected function cleanIds( array $postIds ) |
|
82 | 82 | { |
83 | - return array_filter(array_unique($postIds)); |
|
83 | + return array_filter( array_unique( $postIds ) ); |
|
84 | 84 | } |
85 | 85 | } |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | * @param int $roundBy |
46 | 46 | * @return float |
47 | 47 | */ |
48 | - public function getAverage(array $ratingCounts, $roundBy = 1) |
|
48 | + public function getAverage( array $ratingCounts, $roundBy = 1 ) |
|
49 | 49 | { |
50 | - $average = array_sum($ratingCounts); |
|
51 | - if ($average > 0) { |
|
52 | - $average = round($this->getTotalSum($ratingCounts) / $average, intval($roundBy)); |
|
50 | + $average = array_sum( $ratingCounts ); |
|
51 | + if( $average > 0 ) { |
|
52 | + $average = round( $this->getTotalSum( $ratingCounts ) / $average, intval( $roundBy ) ); |
|
53 | 53 | } |
54 | - return floatval(apply_filters('site-reviews/rating/average', $average, $ratingCounts)); |
|
54 | + return floatval( apply_filters( 'site-reviews/rating/average', $average, $ratingCounts ) ); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -64,50 +64,50 @@ discard block |
||
64 | 64 | * @param int $confidencePercentage |
65 | 65 | * @return int|float |
66 | 66 | */ |
67 | - public function getLowerBound(array $upDownCounts = [0, 0], $confidencePercentage = 95) |
|
67 | + public function getLowerBound( array $upDownCounts = [0, 0], $confidencePercentage = 95 ) |
|
68 | 68 | { |
69 | - $numRatings = array_sum($upDownCounts); |
|
70 | - if ($numRatings < 1) { |
|
69 | + $numRatings = array_sum( $upDownCounts ); |
|
70 | + if( $numRatings < 1 ) { |
|
71 | 71 | return 0; |
72 | 72 | } |
73 | 73 | $z = static::CONFIDENCE_LEVEL_Z_SCORES[$confidencePercentage]; |
74 | 74 | $phat = 1 * $upDownCounts[1] / $numRatings; |
75 | - return ($phat + $z * $z / (2 * $numRatings) - $z * sqrt(($phat * (1 - $phat) + $z * $z / (4 * $numRatings)) / $numRatings)) / (1 + $z * $z / $numRatings); |
|
75 | + return ($phat + $z * $z / (2 * $numRatings) - $z * sqrt( ($phat * (1 - $phat) + $z * $z / (4 * $numRatings)) / $numRatings )) / (1 + $z * $z / $numRatings); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
79 | 79 | * @return int|float |
80 | 80 | */ |
81 | - public function getOverallPercentage(array $ratingCounts) |
|
81 | + public function getOverallPercentage( array $ratingCounts ) |
|
82 | 82 | { |
83 | - return round($this->getAverage($ratingCounts) * 100 / glsr()->constant('MAX_RATING', __CLASS__), 2); |
|
83 | + return round( $this->getAverage( $ratingCounts ) * 100 / glsr()->constant( 'MAX_RATING', __CLASS__ ), 2 ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
87 | 87 | * @return array |
88 | 88 | */ |
89 | - public function getPercentages(array $ratingCounts) |
|
89 | + public function getPercentages( array $ratingCounts ) |
|
90 | 90 | { |
91 | - $total = array_sum($ratingCounts); |
|
92 | - foreach ($ratingCounts as $index => $count) { |
|
93 | - if (empty($count)) { |
|
91 | + $total = array_sum( $ratingCounts ); |
|
92 | + foreach( $ratingCounts as $index => $count ) { |
|
93 | + if( empty($count) ) { |
|
94 | 94 | continue; |
95 | 95 | } |
96 | 96 | $ratingCounts[$index] = $count / $total * 100; |
97 | 97 | } |
98 | - return $this->getRoundedPercentages($ratingCounts); |
|
98 | + return $this->getRoundedPercentages( $ratingCounts ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
102 | 102 | * @return float |
103 | 103 | */ |
104 | - public function getRanking(array $ratingCounts) |
|
104 | + public function getRanking( array $ratingCounts ) |
|
105 | 105 | { |
106 | - return floatval(apply_filters('site-reviews/rating/ranking', |
|
107 | - $this->getRankingUsingImdb($ratingCounts), |
|
106 | + return floatval( apply_filters( 'site-reviews/rating/ranking', |
|
107 | + $this->getRankingUsingImdb( $ratingCounts ), |
|
108 | 108 | $ratingCounts, |
109 | 109 | $this |
110 | - )); |
|
110 | + ) ); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -120,15 +120,15 @@ discard block |
||
120 | 120 | * @param int $confidencePercentage |
121 | 121 | * @return int|float |
122 | 122 | */ |
123 | - public function getRankingUsingImdb(array $ratingCounts, $confidencePercentage = 70) |
|
123 | + public function getRankingUsingImdb( array $ratingCounts, $confidencePercentage = 70 ) |
|
124 | 124 | { |
125 | - $avgRating = $this->getAverage($ratingCounts); |
|
125 | + $avgRating = $this->getAverage( $ratingCounts ); |
|
126 | 126 | // Represents a prior (your prior opinion without data) for the average star rating. A higher prior also means a higher margin for error. |
127 | 127 | // This could also be the average score of all items instead of a fixed value. |
128 | - $bayesMean = ($confidencePercentage / 100) * glsr()->constant('MAX_RATING', __CLASS__); // prior, 70% = 3.5 |
|
128 | + $bayesMean = ($confidencePercentage / 100) * glsr()->constant( 'MAX_RATING', __CLASS__ ); // prior, 70% = 3.5 |
|
129 | 129 | // Represents the number of ratings expected to begin observing a pattern that would put confidence in the prior. |
130 | 130 | $bayesMinimal = 10; // confidence |
131 | - $numOfReviews = array_sum($ratingCounts); |
|
131 | + $numOfReviews = array_sum( $ratingCounts ); |
|
132 | 132 | return $avgRating > 0 |
133 | 133 | ? (($bayesMinimal * $bayesMean) + ($avgRating * $numOfReviews)) / ($bayesMinimal + $numOfReviews) |
134 | 134 | : 0; |
@@ -144,48 +144,48 @@ discard block |
||
144 | 144 | * @param int $confidencePercentage |
145 | 145 | * @return float |
146 | 146 | */ |
147 | - public function getRankingUsingZScores(array $ratingCounts, $confidencePercentage = 90) |
|
147 | + public function getRankingUsingZScores( array $ratingCounts, $confidencePercentage = 90 ) |
|
148 | 148 | { |
149 | - $ratingCountsSum = array_sum($ratingCounts) + glsr()->constant('MAX_RATING', __CLASS__); |
|
150 | - $weight = $this->getWeight($ratingCounts, $ratingCountsSum); |
|
151 | - $weightPow2 = $this->getWeight($ratingCounts, $ratingCountsSum, true); |
|
149 | + $ratingCountsSum = array_sum( $ratingCounts ) + glsr()->constant( 'MAX_RATING', __CLASS__ ); |
|
150 | + $weight = $this->getWeight( $ratingCounts, $ratingCountsSum ); |
|
151 | + $weightPow2 = $this->getWeight( $ratingCounts, $ratingCountsSum, true ); |
|
152 | 152 | $zScore = static::CONFIDENCE_LEVEL_Z_SCORES[$confidencePercentage]; |
153 | - return $weight - $zScore * sqrt(($weightPow2 - pow($weight, 2)) / ($ratingCountsSum + 1)); |
|
153 | + return $weight - $zScore * sqrt( ($weightPow2 - pow( $weight, 2 )) / ($ratingCountsSum + 1) ); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
157 | 157 | * @param int $target |
158 | 158 | * @return array |
159 | 159 | */ |
160 | - protected function getRoundedPercentages(array $percentages, $totalPercent = 100) |
|
160 | + protected function getRoundedPercentages( array $percentages, $totalPercent = 100 ) |
|
161 | 161 | { |
162 | - array_walk($percentages, function (&$percent, $index) { |
|
162 | + array_walk( $percentages, function( &$percent, $index ) { |
|
163 | 163 | $percent = [ |
164 | 164 | 'index' => $index, |
165 | - 'percent' => floor($percent), |
|
166 | - 'remainder' => fmod($percent, 1), |
|
165 | + 'percent' => floor( $percent ), |
|
166 | + 'remainder' => fmod( $percent, 1 ), |
|
167 | 167 | ]; |
168 | 168 | }); |
169 | - $indexes = glsr_array_column($percentages, 'index'); |
|
170 | - $remainders = glsr_array_column($percentages, 'remainder'); |
|
171 | - array_multisort($remainders, SORT_DESC, SORT_STRING, $indexes, SORT_DESC, $percentages); |
|
169 | + $indexes = glsr_array_column( $percentages, 'index' ); |
|
170 | + $remainders = glsr_array_column( $percentages, 'remainder' ); |
|
171 | + array_multisort( $remainders, SORT_DESC, SORT_STRING, $indexes, SORT_DESC, $percentages ); |
|
172 | 172 | $i = 0; |
173 | - if (array_sum(glsr_array_column($percentages, 'percent')) > 0) { |
|
174 | - while (array_sum(glsr_array_column($percentages, 'percent')) < $totalPercent) { |
|
173 | + if( array_sum( glsr_array_column( $percentages, 'percent' ) ) > 0 ) { |
|
174 | + while( array_sum( glsr_array_column( $percentages, 'percent' ) ) < $totalPercent ) { |
|
175 | 175 | ++$percentages[$i]['percent']; |
176 | 176 | ++$i; |
177 | 177 | } |
178 | 178 | } |
179 | - array_multisort($indexes, SORT_DESC, $percentages); |
|
180 | - return array_combine($indexes, glsr_array_column($percentages, 'percent')); |
|
179 | + array_multisort( $indexes, SORT_DESC, $percentages ); |
|
180 | + return array_combine( $indexes, glsr_array_column( $percentages, 'percent' ) ); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
184 | 184 | * @return int |
185 | 185 | */ |
186 | - protected function getTotalSum(array $ratingCounts) |
|
186 | + protected function getTotalSum( array $ratingCounts ) |
|
187 | 187 | { |
188 | - return array_reduce(array_keys($ratingCounts), function ($carry, $index) use ($ratingCounts) { |
|
188 | + return array_reduce( array_keys( $ratingCounts ), function( $carry, $index ) use ($ratingCounts) { |
|
189 | 189 | return $carry + ($index * $ratingCounts[$index]); |
190 | 190 | }); |
191 | 191 | } |
@@ -195,12 +195,12 @@ discard block |
||
195 | 195 | * @param bool $powerOf2 |
196 | 196 | * @return float |
197 | 197 | */ |
198 | - protected function getWeight(array $ratingCounts, $ratingCountsSum, $powerOf2 = false) |
|
198 | + protected function getWeight( array $ratingCounts, $ratingCountsSum, $powerOf2 = false ) |
|
199 | 199 | { |
200 | - return array_reduce(array_keys($ratingCounts), |
|
201 | - function ($count, $rating) use ($ratingCounts, $ratingCountsSum, $powerOf2) { |
|
200 | + return array_reduce( array_keys( $ratingCounts ), |
|
201 | + function( $count, $rating ) use ($ratingCounts, $ratingCountsSum, $powerOf2) { |
|
202 | 202 | $ratingLevel = $powerOf2 |
203 | - ? pow($rating, 2) |
|
203 | + ? pow( $rating, 2 ) |
|
204 | 204 | : $rating; |
205 | 205 | return $count + ($ratingLevel * ($ratingCounts[$rating] + 1)) / $ratingCountsSum; |
206 | 206 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | protected function getFromEmail() |
35 | 35 | { |
36 | - return glsr(OptionManager::class)->getWP('admin_email'); |
|
36 | + return glsr( OptionManager::class )->getWP( 'admin_email' ); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -41,6 +41,6 @@ discard block |
||
41 | 41 | */ |
42 | 42 | protected function getFromName() |
43 | 43 | { |
44 | - return wp_specialchars_decode(glsr(OptionManager::class)->getWP('blogname'), ENT_QUOTES); |
|
44 | + return wp_specialchars_decode( glsr( OptionManager::class )->getWP( 'blogname' ), ENT_QUOTES ); |
|
45 | 45 | } |
46 | 46 | } |
@@ -1,4 +1,4 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <p class="about-description">We think you'll love the changes in this new release!</p> |
4 | 4 | <div class="is-fullwidth"> |
@@ -1,23 +1,23 @@ |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <div class="glsr-welcome wrap about-wrap about-wrap-content"> |
4 | 4 | <h1>Welcome to <?= glsr()->name; ?></h1> |
5 | 5 | <div class="about-text">Site Reviews is a free WordPress review plugin with advanced features that makes it easy to manage reviews on your website. Follow the instructions below to get started!</div> |
6 | 6 | <div class="wp-badge">Version <?= glsr()->version; ?></div> |
7 | 7 | <p class="about-buttons"> |
8 | - <a class="button" href="<?= admin_url('edit.php?post_type=site-review&page=documentation'); ?>">Documentation</a> |
|
8 | + <a class="button" href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation' ); ?>">Documentation</a> |
|
9 | 9 | <a class="button" href="https://wordpress.org/support/plugin/site-reviews/">Support</a> |
10 | 10 | <a target="_blank" class="button" href="https://www.facebook.com/sharer/sharer.php?u=https%3A//geminilabs.io/site-reviews"><span class="dashicons dashicons-facebook-alt"></span> Share</a> |
11 | 11 | <a target="_blank" class="button" href="https://twitter.com/intent/tweet?text=Site Reviews is a fantastic WordPress review plugin with advanced features that makes it easy to manage reviews on your website.&url=https://geminilabs.io/site-reviews&hashtags=WordPress,reviewplugins,"><span class="dashicons dashicons-twitter"></span> Tweet</a> |
12 | 12 | </p> |
13 | 13 | <nav class="glsr-nav-tab-wrapper nav-tab-wrapper"> |
14 | - <?php foreach ($tabs as $id => $title) : ?> |
|
14 | + <?php foreach( $tabs as $id => $title ) : ?> |
|
15 | 15 | <a class="glsr-nav-tab nav-tab" href="#<?= $id; ?>"><?= $title; ?></a> |
16 | 16 | <?php endforeach; ?> |
17 | 17 | </nav> |
18 | - <?php foreach ($tabs as $id => $title) : ?> |
|
18 | + <?php foreach( $tabs as $id => $title ) : ?> |
|
19 | 19 | <div class="glsr-nav-view ui-tabs-hide" id="<?= $id; ?>"> |
20 | - <?php $template->render('pages/welcome/'.$id, $data); ?> |
|
20 | + <?php $template->render( 'pages/welcome/'.$id, $data ); ?> |
|
21 | 21 | </div> |
22 | 22 | <?php endforeach; ?> |
23 | 23 | <input type="hidden" name="_active_tab"> |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php defined('WPINC') || die; ?> |
|
1 | +<?php defined( 'WPINC' ) || die; ?> |
|
2 | 2 | |
3 | 3 | <p>Hooks (also known as <a href="https://developer.wordpress.org/plugins/hooks/index.html">Actions and Filters</a>) are used in your theme's <code>functions.php</code> file to make changes to the plugin.</p> |
4 | 4 | |
@@ -6,13 +6,13 @@ discard block |
||
6 | 6 | <div class="glsr-card-header"> |
7 | 7 | <h3>Customise the order of the fields in the review submission form</h3> |
8 | 8 | <button type="button" class="handlediv" aria-expanded="true"> |
9 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
9 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
10 | 10 | <span class="toggle-indicator" aria-hidden="true"></span> |
11 | 11 | </button> |
12 | 12 | </div> |
13 | 13 | <div class="inside"> |
14 | 14 | <p>Use this hook to customise the order of the fields in the review submission form used by Site Reviews.</p> |
15 | - <p>See the <code><a data-expand="#faq-07" href="<?= admin_url('edit.php?post_type=site-review&page=documentation#!faq'); ?>">FAQ</a></code> for a detailed example of how to use this hook.</p> |
|
15 | + <p>See the <code><a data-expand="#faq-07" href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation#!faq' ); ?>">FAQ</a></code> for a detailed example of how to use this hook.</p> |
|
16 | 16 | <pre><code class="php">/** |
17 | 17 | * Customises the order of the fields used in the Site Reviews submission form. |
18 | 18 | * Paste this in your active theme's functions.php file. |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | <div class="glsr-card-header"> |
31 | 31 | <h3>Customise the star images</h3> |
32 | 32 | <button type="button" class="handlediv" aria-expanded="true"> |
33 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
33 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
34 | 34 | <span class="toggle-indicator" aria-hidden="true"></span> |
35 | 35 | </button> |
36 | 36 | </div> |
37 | 37 | <div class="inside"> |
38 | 38 | <p>Use this hook to customise the star images used by Site Reviews.</p> |
39 | - <p>See the <code><a data-expand="#faq-11" href="<?= admin_url('edit.php?post_type=site-review&page=documentation#!faq'); ?>">FAQ</a></code> for a detailed example of how to use this hook.</p> |
|
39 | + <p>See the <code><a data-expand="#faq-11" href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation#!faq' ); ?>">FAQ</a></code> for a detailed example of how to use this hook.</p> |
|
40 | 40 | <pre><code class="php">/** |
41 | 41 | * Customises the stars used by Site Reviews. |
42 | 42 | * Paste this in your active theme's functions.php file. |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | <div class="glsr-card-header"> |
55 | 55 | <h3>Disable the plugin javascript</h3> |
56 | 56 | <button type="button" class="handlediv" aria-expanded="true"> |
57 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
57 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
58 | 58 | <span class="toggle-indicator" aria-hidden="true"></span> |
59 | 59 | </button> |
60 | 60 | </div> |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | <div class="glsr-card-header"> |
74 | 74 | <h3>Disable the plugin stylesheet</h3> |
75 | 75 | <button type="button" class="handlediv" aria-expanded="true"> |
76 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
76 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
77 | 77 | <span class="toggle-indicator" aria-hidden="true"></span> |
78 | 78 | </button> |
79 | 79 | </div> |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | <div class="glsr-card-header"> |
93 | 93 | <h3>Disable the polyfill.io script</h3> |
94 | 94 | <button type="button" class="handlediv" aria-expanded="true"> |
95 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
95 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
96 | 96 | <span class="toggle-indicator" aria-hidden="true"></span> |
97 | 97 | </button> |
98 | 98 | </div> |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | <div class="glsr-card-header"> |
113 | 113 | <h3>Do something immediately after a review has been submitted</h3> |
114 | 114 | <button type="button" class="handlediv" aria-expanded="true"> |
115 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
115 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
116 | 116 | <span class="toggle-indicator" aria-hidden="true"></span> |
117 | 117 | </button> |
118 | 118 | </div> |
@@ -136,14 +136,14 @@ discard block |
||
136 | 136 | <div class="glsr-card-header"> |
137 | 137 | <h3>Modify the schema</h3> |
138 | 138 | <button type="button" class="handlediv" aria-expanded="true"> |
139 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
139 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
140 | 140 | <span class="toggle-indicator" aria-hidden="true"></span> |
141 | 141 | </button> |
142 | 142 | </div> |
143 | 143 | <div class="inside"> |
144 | 144 | <p>Use this hook if you would like to modify the schema type properties.</p> |
145 | 145 | <p>This hook is specific to the schema type. For example, to modify the schema properties for the LocalBusiness schema type you would use the <code>site-reviews/schema/LocalBusiness</code> hook, but to modify the schema properties for the Product schema type you would use the <code>site-reviews/schema/Product</code> hook.</p> |
146 | - <p>See the <code><a data-expand="#faq-01" href="<?= admin_url('edit.php?post_type=site-review&page=documentation#!faq'); ?>">FAQ</a></code> for a detailed example of how to use this hook.</p> |
|
146 | + <p>See the <code><a data-expand="#faq-01" href="<?= admin_url( 'edit.php?post_type=site-review&page=documentation#!faq' ); ?>">FAQ</a></code> for a detailed example of how to use this hook.</p> |
|
147 | 147 | <p>Make sure to use Google's <a href="https://search.google.com/structured-data/testing-tool">Structured Data Testing Tool</a> to test the schema after any custom modifications have been made.</p> |
148 | 148 | <pre><code class="php">/** |
149 | 149 | * Modifies the properties of the schema created by Site Reviews. |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | <div class="glsr-card-header"> |
164 | 164 | <h3>Modify the submitted review before it is saved</h3> |
165 | 165 | <button type="button" class="handlediv" aria-expanded="true"> |
166 | - <span class="screen-reader-text"><?= __('Toggle documentation panel', 'site-reviews'); ?></span> |
|
166 | + <span class="screen-reader-text"><?= __( 'Toggle documentation panel', 'site-reviews' ); ?></span> |
|
167 | 167 | <span class="toggle-indicator" aria-hidden="true"></span> |
168 | 168 | </button> |
169 | 169 | </div> |