This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | namespace Gwa\Wordpress\Zero\Module; |
||
| 3 | |||
| 4 | use Gwa\Wordpress\WpBridge\Traits\WpBridgeTrait; |
||
| 5 | use Gwa\Wordpress\Zero\Module\AbstractThemeModule; |
||
| 6 | |||
| 7 | class CleanUpModule extends AbstractThemeModule |
||
| 8 | { |
||
| 9 | use WpBridgeTrait; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * The default WordPress head is a mess. Let's clean it up. |
||
| 13 | */ |
||
| 14 | public function wpHeadCleanup() |
||
| 15 | { |
||
| 16 | // index link |
||
| 17 | $this->getWpBridge()->removeAction('wp_head', 'index_rel_link'); |
||
| 18 | // previous link |
||
| 19 | $this->getWpBridge()->removeAction('wp_head', 'parent_post_rel_link', 10, 0); |
||
| 20 | // start link |
||
| 21 | $this->getWpBridge()->removeAction('wp_head', 'start_post_rel_link', 10, 0); |
||
| 22 | // remove WP version from css |
||
| 23 | $this->getWpBridge()->addFilter('style_loader_src', [$this, 'removeWpVerCssJs'], 9999); |
||
| 24 | // remove Wp version from scripts |
||
| 25 | $this->getWpBridge()->addFilter('script_loader_src', [$this, 'removeWpVerCssJs'], 9999); |
||
| 26 | } |
||
| 27 | |||
| 28 | public function removeRssVersion() |
||
| 29 | { |
||
| 30 | return ''; |
||
| 31 | } |
||
| 32 | |||
| 33 | public function removeWpVerCssJs($src) |
||
| 34 | { |
||
| 35 | if (strpos($src, 'ver=')) { |
||
| 36 | $src = $this->getWpBridge()->removeQueryArg('ver', $src); |
||
| 37 | } |
||
| 38 | |||
| 39 | return $src; |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Clean the output of attributes of images in editor. |
||
| 44 | * Courtesy of SitePoint. http://www.sitepoint.com/wordpress-change-img-tag-html/ |
||
| 45 | * |
||
| 46 | * @param string $class |
||
| 47 | * @param string $id |
||
| 48 | * @param string $align |
||
| 49 | * @param string $size |
||
| 50 | * |
||
| 51 | * @return string |
||
| 52 | */ |
||
| 53 | public function imageTagClassClean($class, $id, $align, $size) |
||
|
0 ignored issues
–
show
|
|||
| 54 | { |
||
| 55 | return 'align'.esc_attr($align); |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Remove width and height in editor, for a better responsive world. |
||
| 60 | * |
||
| 61 | * @param string $html |
||
| 62 | * @param string $id |
||
| 63 | * @param string $alt |
||
| 64 | * @param string $title |
||
| 65 | * |
||
| 66 | * @return string |
||
| 67 | */ |
||
| 68 | public function imageEditorRemoveHightAndWidth($html, $id, $alt, $title) |
||
|
0 ignored issues
–
show
|
|||
| 69 | { |
||
| 70 | return preg_replace([ |
||
| 71 | '/\s+width="\d+"/i', |
||
| 72 | '/\s+height="\d+"/i', |
||
| 73 | '/alt=""/i' |
||
| 74 | ], [ |
||
| 75 | '', |
||
| 76 | '', |
||
| 77 | '', |
||
| 78 | 'alt="'.$title.'"' |
||
| 79 | ], $html); |
||
| 80 | } |
||
| 81 | |||
| 82 | /** |
||
| 83 | * Remove image attributes |
||
| 84 | * |
||
| 85 | * @param string $html |
||
| 86 | * |
||
| 87 | * @return string |
||
| 88 | */ |
||
| 89 | public function removeImageAttributes($html) |
||
| 90 | { |
||
| 91 | $html = preg_replace('/(width|height)="\d*"\s/', '', $html); |
||
| 92 | |||
| 93 | return $html; |
||
| 94 | } |
||
| 95 | |||
| 96 | public function shortcodeParagraphFix($content) |
||
| 97 | { |
||
| 98 | // Suchen und Ersetzen Strings festlegen |
||
| 99 | $array = [ |
||
| 100 | '<p>[' => '[', |
||
| 101 | ']</p>' => ']', |
||
| 102 | ']<br />' => ']' |
||
| 103 | ]; |
||
| 104 | |||
| 105 | return strtr($content, $array); |
||
| 106 | } |
||
| 107 | |||
| 108 | 1 | protected function getActionMap() |
|
| 109 | { |
||
| 110 | return [ |
||
| 111 | [ |
||
| 112 | 1 | 'hooks' => 'init', |
|
| 113 | 1 | 'class' => $this, |
|
| 114 | 1 | 'method' => 'wpHeadCleanup', |
|
| 115 | 1 | 'prio' => 10, |
|
| 116 | 1 | 'args' => 1, |
|
| 117 | 1 | ], |
|
| 118 | 1 | ]; |
|
| 119 | } |
||
| 120 | |||
| 121 | /** |
||
| 122 | * Override in concrete subclass. |
||
| 123 | * |
||
| 124 | * @return array |
||
|
0 ignored issues
–
show
|
|||
| 125 | */ |
||
| 126 | 1 | protected function getFilterMap() |
|
| 127 | { |
||
| 128 | return [ |
||
| 129 | [ |
||
| 130 | 1 | 'hooks' => 'the_generator', |
|
| 131 | 1 | 'class' => $this, |
|
| 132 | 1 | 'method' => 'removeRssVersion', |
|
| 133 | 1 | 'prio' => 10, |
|
| 134 | 1 | 'args' => 1, |
|
| 135 | 1 | ], [ |
|
| 136 | 1 | 'hooks' => 'get_image_tag_class', |
|
| 137 | 1 | 'class' => $this, |
|
| 138 | 1 | 'method' => 'imageTagClassClean', |
|
| 139 | 1 | 'prio' => 0, |
|
| 140 | 1 | 'args' => 4, |
|
| 141 | 1 | ], [ |
|
| 142 | 1 | 'hooks' => 'get_image_tag', |
|
| 143 | 1 | 'class' => $this, |
|
| 144 | 1 | 'method' => 'imageEditorRemoveHightAndWidth', |
|
| 145 | 1 | 'prio' => 0, |
|
| 146 | 1 | 'args' => 4, |
|
| 147 | 1 | ], [ |
|
| 148 | 1 | 'hooks' => 'the_content', |
|
| 149 | 1 | 'class' => $this, |
|
| 150 | 1 | 'method' => 'shortcodeParagraphFix', |
|
| 151 | 1 | 'prio' => 10, |
|
| 152 | 1 | 'args' => 1, |
|
| 153 | 1 | ], [ |
|
| 154 | 1 | 'hooks' => ['post_thumbnail_html', 'removeImageAttributes'], |
|
| 155 | 1 | 'class' => $this, |
|
| 156 | 1 | 'method' => 'removeImageAttributes', |
|
| 157 | 1 | 'prio' => 10, |
|
| 158 | 1 | 'args' => 1, |
|
| 159 | 1 | ], |
|
| 160 | 1 | ]; |
|
| 161 | } |
||
| 162 | } |
||
| 163 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.