Plugin Directory

Changeset 2211789


Ignore:
Timestamp:
12/13/2019 07:10:13 PM (6 years ago)
Author:
wpseed
Message:

bug fixes

Location:
widgetizer
Files:
8 added
4 edited

Legend:

Unmodified
Added
Removed
  • widgetizer/tags/1.0.1/includes/elementor/class-elementor-builder.php

    r2211678 r2211789  
    206206                    'widget_styles'   => array( $provider_name . '-' . $widget_name ),
    207207                    'widget_scripts'  => array( $provider_name . '-' . $widget_name ),
    208                     'template_path'   => WP_CONTENT_DIR . $widget_content['path'],
     208                    'widget_path'     => WP_CONTENT_DIR . $widget_content['path'],
    209209                );
    210210                $this->generate_widget_class( $class_name, $class_properties );
  • widgetizer/tags/1.0.1/includes/elementor/class-elementor-widget.php

    r2211678 r2211789  
    99
    1010use Latte\Engine;
    11 use Nette\Neon\Exception;
    1211use Nette\Neon\Neon;
    1312use Nette\Utils\FileSystem;
    14 use Symfony\Component\Yaml\Yaml;
    1513
    1614/**
     
    3836
    3937    /**
     38     * Widget title
     39     *
     40     * @var $widget_title
     41     */
     42    protected $widget_title;
     43
     44    /**
    4045     * Widget icon
    4146     *
     
    5964
    6065    /**
    61      * Base path of widget template directory
     66     * Base path of widget
    6267     *
    63      * @var string $template_path Template path.
     68     * @var string $widget_path Widget path.
    6469     */
    65     protected $template_path;
     70    protected $widget_path;
    6671
    6772
     
    8186     */
    8287    public function get_name() {
    83         return $this->widget_name;
     88        return $this->widget_provider . '-' . $this->widget_name;
    8489    }
    8590
     
    112117
    113118    /**
    114      * Widget scipts array
     119     * Widget scripts array
    115120     *
    116121     * @return array Array of widget scripts.
     
    124129     */
    125130    protected function _register_controls() { // phpcs:ignore
    126         $value    = FileSystem::read( $this->template_path . '/' . $this->widget_name . '.neon' );
     131        $config_file = $this->widget_path . '/' . $this->widget_name . '.neon';
     132        if ( ! is_readable( $config_file ) ) {
     133            return false;
     134        }
     135        $value    = FileSystem::read( $config_file );
    127136        $neon     = Neon::decode( $value );
    128137        $controls = $neon['content'];
     
    152161            'content' => $this->get_settings_for_display(),
    153162        );
    154         $html       = $latte->renderToString( $this->template_path . '/' . $this->widget_name . '.latte', $parameters );
     163        $html       = $latte->renderToString( $this->widget_path . '/' . $this->widget_name . '.latte', $parameters );
    155164        echo $html; // phpcs:ignore
    156165    }
  • widgetizer/trunk/includes/elementor/class-elementor-builder.php

    r2211678 r2211789  
    206206                    'widget_styles'   => array( $provider_name . '-' . $widget_name ),
    207207                    'widget_scripts'  => array( $provider_name . '-' . $widget_name ),
    208                     'template_path'   => WP_CONTENT_DIR . $widget_content['path'],
     208                    'widget_path'     => WP_CONTENT_DIR . $widget_content['path'],
    209209                );
    210210                $this->generate_widget_class( $class_name, $class_properties );
  • widgetizer/trunk/includes/elementor/class-elementor-widget.php

    r2211678 r2211789  
    99
    1010use Latte\Engine;
    11 use Nette\Neon\Exception;
    1211use Nette\Neon\Neon;
    1312use Nette\Utils\FileSystem;
    14 use Symfony\Component\Yaml\Yaml;
    1513
    1614/**
     
    3836
    3937    /**
     38     * Widget title
     39     *
     40     * @var $widget_title
     41     */
     42    protected $widget_title;
     43
     44    /**
    4045     * Widget icon
    4146     *
     
    5964
    6065    /**
    61      * Base path of widget template directory
     66     * Base path of widget
    6267     *
    63      * @var string $template_path Template path.
     68     * @var string $widget_path Widget path.
    6469     */
    65     protected $template_path;
     70    protected $widget_path;
    6671
    6772
     
    8186     */
    8287    public function get_name() {
    83         return $this->widget_name;
     88        return $this->widget_provider . '-' . $this->widget_name;
    8489    }
    8590
     
    112117
    113118    /**
    114      * Widget scipts array
     119     * Widget scripts array
    115120     *
    116121     * @return array Array of widget scripts.
     
    124129     */
    125130    protected function _register_controls() { // phpcs:ignore
    126         $value    = FileSystem::read( $this->template_path . '/' . $this->widget_name . '.neon' );
     131        $config_file = $this->widget_path . '/' . $this->widget_name . '.neon';
     132        if ( ! is_readable( $config_file ) ) {
     133            return false;
     134        }
     135        $value    = FileSystem::read( $config_file );
    127136        $neon     = Neon::decode( $value );
    128137        $controls = $neon['content'];
     
    152161            'content' => $this->get_settings_for_display(),
    153162        );
    154         $html       = $latte->renderToString( $this->template_path . '/' . $this->widget_name . '.latte', $parameters );
     163        $html       = $latte->renderToString( $this->widget_path . '/' . $this->widget_name . '.latte', $parameters );
    155164        echo $html; // phpcs:ignore
    156165    }
Note: See TracChangeset for help on using the changeset viewer.