Plugin Directory

Changeset 890024


Ignore:
Timestamp:
04/09/2014 11:44:30 AM (12 years ago)
Author:
pricemesh
Message:

pages integration, woocommerce integration

Location:
pricemesh/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • pricemesh/trunk/admin/pricemesh-admin.php

    r874063 r890024  
    9898     */
    9999    public function enqueue_admin_styles() {
    100 
    101         if($this->is_on_post_screen()){
     100        if($this->is_on_supported_screen()){
    102101            wp_enqueue_style( $this->plugin_slug .'pm-metabox-styles', plugins_url('assets/css/metabox.css', __FILE__ ), array(), PricemeshPublic::VERSION );
    103102        }
     
    123122    public function enqueue_admin_scripts(){
    124123
    125         if($this->is_on_post_screen()){
     124        if($this->is_on_supported_screen()){
    126125            wp_enqueue_script($this->plugin_slug.'pm-handlebars', plugins_url('assets/js/handlebars-v1.3.0.js', __FILE__ ), array('jquery'), PricemeshPublic::VERSION );
    127126            wp_enqueue_script($this->plugin_slug.'pm-metabox', plugins_url('assets/js/metabox.js', __FILE__ ), array('jquery'), PricemeshPublic::VERSION );
     
    322321        $option_name = "WP Robot";
    323322        $option_callback = "settings_3rd_party_wp_robot_callback";
     323        add_settings_field(
     324            $option, __($option_name, $this->plugin_slug), array($this, $option_callback), $this->plugin_slug, $section
     325        );
     326        register_setting($group, $option);
     327
     328        //woocommerce
     329        $option = "pricemesh_option_woocommerce_integration";
     330        $option_name = "WooCommerce";
     331        $option_callback = "settings_3rd_party_woocommerce_callback";
    324332        add_settings_field(
    325333            $option, __($option_name, $this->plugin_slug), array($this, $option_callback), $this->plugin_slug, $section
     
    552560     */
    553561    public function settings_section_3rd_party_callback(){
    554         echo __("Pricemesh kann auf andere Plugins zugreifen und einen Preisvergleich anzeigen, wenn ein Barcode erkannt wird.", $this->plugin_slug);
     562        echo __("Pricemesh kann auf andere Plugins zugreifen und zusätzliche Funktionen freischalten.", $this->plugin_slug);
    555563    }
    556564
     
    563571        $setting = $opts["wp_robot_integration"];
    564572        if($this->is_wp_robot_installed()){
    565             $checked = checked('1', $setting);
    566             echo "<input name='pricemesh_option_wp_robot_integration' type='checkbox' value='1' $checked/>";
     573            $checked = checked('1', $setting, false);
     574
     575            echo "<p class='description'>".
     576                    "<input name='pricemesh_option_wp_robot_integration' type='checkbox' value='1' $checked/>".
     577                    " ".__("Fügt automatisch importierte ASINs zu dem aktuellen Post hinzu.", $this->plugin_slug).
     578                 "</p>";
    567579        }else{
    568580            //echo "<input name='pricemesh_option_wp_robot_integration' type='checkbox' value='1' disabled/>";
    569581            echo "<p class='description'>".__("WPRobot ist nicht installiert", $this->plugin_slug)."</p>";
     582        }
     583    }
     584
     585    /**
     586     * woocommerce callback
     587     * @since    1.3.1
     588     */
     589    public function settings_3rd_party_woocommerce_callback(){
     590        $opts = self::get_pricemesh_settings();
     591        $setting = $opts["woocommerce_integration"];
     592        if($this->is_woocommerce_installed()){
     593            $checked = checked('1', $setting, false);
     594            echo "<p class='description'>".
     595                   "<input name='pricemesh_option_woocommerce_integration' type='checkbox' value='1' $checked/>".
     596                    " ".__("Schaltet die Pricemesh auf Produktseiten frei", $this->plugin_slug).
     597                "</p>";
     598        }else{
     599            //echo "<input name='pricemesh_option_wp_robot_integration' type='checkbox' value='1' disabled/>";
     600            echo "<p class='description'>".__("WooCommerce ist nicht installiert", $this->plugin_slug)."</p>";
    570601        }
    571602    }
     
    604635    function is_on_post_screen(){
    605636        $screen = get_current_screen();
    606 
    607637        if($screen->base == "post"){
     638            return True;
     639        }
     640        return False;
     641    }
     642
     643    /**
     644     * Checks if the current page is one of the supported types: post or page
     645     *
     646     * @since    1.3.1
     647     * @return boolean  true if the current screen is of type post or page
     648     */
     649    function is_on_supported_screen(){
     650        $screen = get_current_screen();
     651        var_dump($screen->base);
     652        if($screen->base == "post" || $screen->base == "page"){
    608653            return True;
    609654        }
     
    614659        // create our custom meta box
    615660        add_meta_box('pricemesh-meta',__('Pricemesh', 'pricemesh-plugin'), array($this, 'meta_box'),'post','normal','high');
     661        add_meta_box('pricemesh-meta',__('Pricemesh', 'pricemesh-plugin'), array($this, 'meta_box'),'page','normal','high');
     662        $opts = self::get_pricemesh_settings();
     663        if($opts["woocommerce_integration"]){
     664            add_meta_box('pricemesh-meta',__('Pricemesh', 'pricemesh-plugin'), array($this, 'meta_box'),'product','normal','high');
     665        }
    616666    }
    617667
     
    668718    }
    669719
     720    /**
     721     * Checks if WooCommerce is installed
     722     * @since    1.0.1
     723     * @return boolean  true if WooCommerce is installed. false otherwise
     724     */
     725    function is_woocommerce_installed(){
     726        /***
     727         * checks if WooCommerce is installed
     728         * Note: only works in the admin area.
     729         */
     730        if(is_plugin_active("woocommerce/woocommerce.php")){
     731            return true;
     732        }
     733        return false;
     734    }
     735
     736
     737
    670738}?>
  • pricemesh/trunk/pricemesh-base.php

    r874063 r890024  
    2929
    3030            "wp_robot_integration" => get_option("pricemesh_option_wp_robot_integration", 0),
     31            "woocommerce_integration" => get_option("pricemesh_option_woocommerce_integration", 0),
    3132        );
    3233    }
  • pricemesh/trunk/pricemesh.php

    r874063 r890024  
    44Plugin URI: https://www.pricemesh.io/plugins/wordpress/
    55Description: Mit diesem Plugin ist es möglich Wordpress um einen eigenen Preisvergleich zu erweitern.
    6 Version: 1.3
     6Version: 1.3.1
    77Author: pricemesh
    88Author URI: https://www.pricemesh.io
  • pricemesh/trunk/public/pricemesh-public.php

    r874063 r890024  
    2222     * @var     string
    2323     */
    24     const VERSION = '1.3';
     24    const VERSION = '1.3.1';
    2525
    2626    /**
     
    285285     */
    286286    public function add_pricemesh($content){
    287         if(is_single() && $this->is_injection_needed()){
     287        if((is_single() || is_page()) && $this->is_injection_needed()){
    288288            $injection_point = $this->get_injection_point();
    289289            if($injection_point == PricemeshRender::IN_CONTENT){
     
    313313     */
    314314    public static function is_injection_needed(){
    315 
    316         if(is_single()){
     315        if(is_single() || is_page()){
    317316            $opts = self::get_pricemesh_settings();
    318317            if(strlen($opts["pids"])>=8 && strlen($opts["token"])>5){
  • pricemesh/trunk/readme.txt

    r874063 r890024  
    33Tags: affiliate, commerce, e-commerce, ecommerce, sales, sell, shop, shopping, widgets, wordpress ecommerce, amazon, preisvergleich, ads, advertising
    44Requires at least: 3.4
    5 Tested up to: 3.8
    6 Stable tag: 1.3
     5Tested up to: 3.8.2
     6Stable tag: 1.3.1
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7373== Changelog ==
    7474
     75= 1.3.1 =
     76* Pricemesh kann nun auf Pages eingesetzt werden
     77* Integration von WooCommerce Produktseiten
     78
    7579= 1.3 =
    7680Es gibt nun zahlreiche Möglichkeiten das Design und das Verhalten des Preisvergleichs anzupassen.
Note: See TracChangeset for help on using the changeset viewer.