Plugin Directory

Changeset 2028426


Ignore:
Timestamp:
02/11/2019 11:28:20 AM (7 years ago)
Author:
Nitay
Message:

fixed function name conflict

Location:
sponsors-carousel/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sponsors-carousel/trunk/class-sponsors-carousel.php

    r2027712 r2028426  
    6161            }
    6262        }
    63     }
    64 
    65     public function empty() {
    66         return empty($this->images);
    6763    }
    6864
  • sponsors-carousel/trunk/readme.txt

    r2027712 r2028426  
    7171* 4.00: Introduced Gutenberg editor block
    7272* 4.01: Added WP image size chooser to set scale/crop images and carousel copy button.
     73* 4.02: fixed function name conflict, thanks @merchtemeaglesadmin
  • sponsors-carousel/trunk/sponsors-carousel.php

    r2027713 r2028426  
    44 * Plugin URI: http://wordpress.org/extend/plugins/sponsors-carousel
    55 * Description: Sponsors logos on javascript carousel.
    6  * Version: 4.01
     6 * Version: 4.02
    77 * Author: Sergey Panasenko <[email protected]>
    88 * Text Domain: sponsors-carousel
     
    4242
    4343add_action( 'wp_enqueue_scripts',  function () {
    44     wp_enqueue_script( 'jcarousel', plugins_url( '/js/jquery.jcarousel.min.js', __FILE__ ), ['jquery'], SPONSORS_CAROUSEL_VERSION);
    45     wp_enqueue_script( 'jcarousel-autoscroll', plugins_url( '/js/jquery.jcarousel-autoscroll.min.js', __FILE__ ), ['jquery','jcarousel'], SPONSORS_CAROUSEL_VERSION );
    46     wp_enqueue_script( 'sponsors-carousel', plugins_url( '/js/sponsors-carousel.js', __FILE__ ), ['jquery','jcarousel','jcarousel-autoscroll'], SPONSORS_CAROUSEL_VERSION );
     44    wp_enqueue_script( 'jcarousel',
     45            plugins_url( '/js/jquery.jcarousel.min.js', __FILE__ ),
     46            ['jquery'], SPONSORS_CAROUSEL_VERSION);
     47    wp_enqueue_script( 'jcarousel-autoscroll',
     48            plugins_url( '/js/jquery.jcarousel-autoscroll.min.js', __FILE__ ),
     49            ['jquery','jcarousel'], SPONSORS_CAROUSEL_VERSION );
     50    wp_enqueue_script( 'sponsors-carousel',
     51            plugins_url( '/js/sponsors-carousel.js', __FILE__ ),
     52            ['jquery','jcarousel','jcarousel-autoscroll'],
     53            SPONSORS_CAROUSEL_VERSION );
    4754} );
    4855
    4956add_action('wp_print_styles',  function () {
    5057    wp_enqueue_style( 'dashicons' );
    51     wp_enqueue_style( 'sponsors-carousel', plugins_url( '/css/sponsors-carousel.css', __FILE__ ) );
     58    wp_enqueue_style( 'sponsors-carousel',
     59            plugins_url( '/css/sponsors-carousel.css', __FILE__ ) );
    5260} );
    5361
    5462add_action('admin_init', function () {
    55     wp_register_script( 'sponsors-carousel-admin', plugins_url( '/js/sponsors-carousel-admin.js', __FILE__ ),['jquery', 'jquery-ui-core', 'jquery-ui-sortable'], SPONSORS_CAROUSEL_VERSION );
    56     wp_register_style( 'sponsors-carousel-admin', plugins_url( '/css/sponsors-carousel-admin.css', __FILE__ ), [], SPONSORS_CAROUSEL_VERSION );
    57     add_action( 'wp_ajax_sponsors_carousel_change_link', 'scwp_wp_ajax_sponsors_carousel_change_link');
     63    wp_register_script( 'sponsors-carousel-admin',
     64            plugins_url( '/js/sponsors-carousel-admin.js', __FILE__ ),
     65            ['jquery', 'jquery-ui-core', 'jquery-ui-sortable'],
     66            SPONSORS_CAROUSEL_VERSION );
     67    wp_register_style( 'sponsors-carousel-admin',
     68            plugins_url( '/css/sponsors-carousel-admin.css', __FILE__ ),
     69            [], SPONSORS_CAROUSEL_VERSION );
     70    add_action( 'wp_ajax_sponsors_carousel_change_link',
     71            'scwp_wp_ajax_sponsors_carousel_change_link');
    5872});
    5973
     
    7791    if ($file == plugin_basename(__FILE__)) {
    7892        $link = admin_url('admin.php?page=sponsors_carousel');
    79         $dashboard_link = "<a href=\"{$link}\">" . __( 'Settings', 'sponsors-carousel' ) . "</a>";
     93        $dashboard_link = "<a href=\"{$link}\">";
     94        $dashboard_link .= __( 'Settings', 'sponsors-carousel' ) . "</a>";
    8095        array_unshift($links, $dashboard_link);
    8196    }
     
    98113function scwp_options_page() {
    99114
    100     if ( isset( $_POST['save'] ) ) { // Update options
     115    // Update options
     116    if ( isset( $_POST['save'] ) ) {
    101117        $sponsors_carousel = new SponsorsCarousel();
    102118        if ( $sponsors_carousel->update( $_POST ) ) {
    103             echo "<div class='updated fade'><p><strong>" . __( 'Options updated', 'sponsors-carousel' ) . "</strong></p></div>";
     119            echo "<div class='updated fade'><p><strong>";
     120            echo __( 'Options updated', 'sponsors-carousel' );
     121            echo "</strong></p></div>";
    104122        }
    105123    }
    106124
    107     if ( isset( $_GET['copy'] ) ) { // Update options
     125    // Copy carousel
     126    if ( isset( $_GET['copy'] ) ) {
    108127        $sponsors_carousel = new SponsorsCarousel($_GET['id']);
    109128        echo $sponsors_carousel->copy($_GET['copy']);
    110129    }
    111130
    112     if ( isset( $_GET['delete'] ) && isset( $_GET['id'] ) && intval( $_GET['id'] ) == intval( $_GET['delete'] ) ) { // Delete carousel
     131    // Delete carousel
     132    if ( isset( $_GET['delete'] ) && isset( $_GET['id'] ) &&
     133            intval( $_GET['id'] ) == intval( $_GET['delete'] ) ) {
    113134        echo SponsorsCarousel::delete( intval( $_GET['delete'] ) );
    114135        die();
    115136    }
    116137
     138    // Show admin page
    117139    global $scwp_plugin_name;
    118     echo '<h2>' . sprintf( __( '%s Settings', 'sponsors-carousel' ), $scwp_plugin_name ) . '</h2>';
     140    echo '<h2>' . sprintf( __( '%s Settings', 'sponsors-carousel' ),
     141            $scwp_plugin_name ) . '</h2>';
    119142    $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
    120143    $sponsors_carousel = new SponsorsCarousel( $id );
     
    132155        $list = get_option( 'sponsors-carousels', '0' );
    133156        $ids = explode( ',', $list );
    134         $list = array( array( 'value' => 0, 'label' => __( 'main', 'sponsors-carousel' )));
     157        $list = array( array( 'value' => 0,
     158                'label' => __( 'main', 'sponsors-carousel' )));
    135159        foreach ( $ids as $id ) {
    136160            if ( $id > 0 ) {
     
    144168            array( 'wp-blocks', 'wp-element', 'wp-components', 'wp-editor' )
    145169        );
    146         wp_enqueue_style( 'sponsors-carousel', plugins_url( '/css/sponsors-carousel.css', __FILE__ ) );
     170        wp_enqueue_style( 'sponsors-carousel',
     171                plugins_url( '/css/sponsors-carousel.css', __FILE__ ) );
    147172
    148173        register_block_type( 'sponsors-carousel/block', array(
     
    170195function sponsors_carousel_block_render( $attributes ) {
    171196    $sc = sponsors_carousel( isset( $attributes['id'] ) ? $attributes['id'] : 0 );
    172     return empty( $sc ) ? ( '<p>' . __( 'Please add images on <b>Sponsors carousel</b> plugin page', 'sponsors-carousel' ) . '</p>' ) : $sc;
    173 }
     197    $message = __( 'Please add images on <b>Sponsors carousel</b> plugin page',
     198            'sponsors-carousel' );
     199    return empty( $sc ) ? ( '<p>' . $message . '</p>' ) : $sc;
     200}
Note: See TracChangeset for help on using the changeset viewer.