nirjharlo /
wp-plugin-framework
| 1 | <?php |
||||||
| 2 | namespace NirjharLo\WP_Plugin_Framework\Src; |
||||||
| 3 | |||||||
| 4 | use WP_WIDGET as WP_WIDGET; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 5 | |||||||
| 6 | if ( ! defined( 'ABSPATH' ) ) exit; |
||||||
| 7 | |||||||
| 8 | /** |
||||||
| 9 | * Widget class |
||||||
| 10 | * |
||||||
| 11 | * @author Nirjhar Lo |
||||||
| 12 | * @package wp-plugin-framework |
||||||
| 13 | */ |
||||||
| 14 | if ( ! class_exists( 'Widget' ) ) { |
||||||
| 15 | |||||||
| 16 | final class Widget extends WP_WIDGET { |
||||||
| 17 | |||||||
| 18 | |||||||
| 19 | /** |
||||||
| 20 | * Add widget |
||||||
| 21 | * |
||||||
| 22 | * @return Void |
||||||
| 23 | */ |
||||||
| 24 | public function __construct() { |
||||||
| 25 | |||||||
| 26 | $widget_ops = array( |
||||||
| 27 | 'classname' => 'plugin_widget', |
||||||
| 28 | 'description' => __( 'Plugin widget', 'textdomain' ), |
||||||
|
0 ignored issues
–
show
The function
__ was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 29 | ); |
||||||
| 30 | parent::__construct( 'my_widget_id', __( 'Plugin widget', 'textdomain' ), $widget_ops ); |
||||||
| 31 | } |
||||||
| 32 | |||||||
| 33 | |||||||
| 34 | /** |
||||||
| 35 | * Outputs the content of the widget for front end |
||||||
| 36 | * |
||||||
| 37 | * @param Array $args |
||||||
| 38 | * @param Array $instance |
||||||
| 39 | * |
||||||
| 40 | * @return Html |
||||||
|
0 ignored issues
–
show
The type
NirjharLo\WP_Plugin_Framework\Src\Html was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 41 | */ |
||||||
| 42 | public function widget( $args, $instance ) { |
||||||
| 43 | |||||||
| 44 | echo $args['before_widget']; |
||||||
| 45 | if ( ! empty( $instance['title'] ) ) { |
||||||
| 46 | echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title']; |
||||||
|
0 ignored issues
–
show
The function
apply_filters was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 47 | } |
||||||
| 48 | echo esc_html__( 'Hello, World!', 'textdomain' ); |
||||||
|
0 ignored issues
–
show
The function
esc_html__ was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 49 | echo $args['after_widget']; |
||||||
| 50 | } |
||||||
| 51 | |||||||
| 52 | |||||||
| 53 | /** |
||||||
| 54 | * Outputs the options form on admin |
||||||
| 55 | * |
||||||
| 56 | * @param Array $instance |
||||||
| 57 | * |
||||||
| 58 | * @return Html |
||||||
| 59 | */ |
||||||
| 60 | public function form( $instance ) { |
||||||
| 61 | |||||||
| 62 | $title = ! empty( $instance['title'] ) ? $instance['title'] : esc_html__( 'Internal Link Master', 'textdomain' ); ?> |
||||||
|
0 ignored issues
–
show
The function
esc_html__ was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 63 | <p> |
||||||
| 64 | <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_attr_e( 'Title:', 'textdomain' ); ?></label> |
||||||
|
0 ignored issues
–
show
The function
esc_attr_e was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
The function
esc_attr was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 65 | <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>"> |
||||||
| 66 | </p> |
||||||
| 67 | <?php |
||||||
| 68 | } |
||||||
| 69 | |||||||
| 70 | |||||||
| 71 | /** |
||||||
| 72 | * Processing widget options on save |
||||||
| 73 | * |
||||||
| 74 | * @param Array $new_instance |
||||||
| 75 | * @param Array $old_instance |
||||||
| 76 | * |
||||||
| 77 | * @return Array |
||||||
| 78 | */ |
||||||
| 79 | public function update( $new_instance, $old_instance ) { |
||||||
| 80 | |||||||
| 81 | $instance = array(); |
||||||
| 82 | $instance['title'] = ( ! empty( $new_instance['title'] ) ? sanitize_text_field( $new_instance['title'] ) : '' ); |
||||||
|
0 ignored issues
–
show
The function
sanitize_text_field was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 83 | return $instance; |
||||||
| 84 | } |
||||||
| 85 | } |
||||||
| 86 | } ?> |
||||||
| 87 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths