Giter VIP home page Giter VIP logo

Comments (12)

 avatar commented on June 25, 2024

+1 I'm all for this.

Also an extra var/define/constant/whatever to make the class unique would be great. Many times I need to tweet or add something project-specific that doesn't make sense to send in as pull request. It would be very handy in that case to not have conflicts with multiple plugins that use the class.

from wordpress-settings-api-class.

tareq1988 avatar tareq1988 commented on June 25, 2024

Version number added on 96f4373

@daankortenbach I am not sure what you meant, but doesn't the if ( !class_exists( 'WeDevs_Settings_API' ) ) makes it to not conflict?

from wordpress-settings-api-class.

 avatar commented on June 25, 2024

if ( !class_exists( 'WeDevs_Settings_API' ) ) makes it no conflict but if I use a modified version it will nullify the modifications. But renaming the class will solve that. Simple.

from wordpress-settings-api-class.

tareq1988 avatar tareq1988 commented on June 25, 2024

Okay got it. But if you have any idea to make the class unique, let me know :)

from wordpress-settings-api-class.

 avatar commented on June 25, 2024

Haha, you funny guy. Sorry dude, sometimes I have a brainfart that just doesn't make sense ;)

(extend class with basename that calls specific class with version number in classname)

from wordpress-settings-api-class.

roidayan avatar roidayan commented on June 25, 2024

My suggestion is to rename the class per plugin I use it with. this is what I do. this is to avoid any conflicts with other plugins that may use older or newer version. sometimes I also have small modifications in the class so this will also avoid problems to the other plugins in case my plugin loads first.

from wordpress-settings-api-class.

ahansson89 avatar ahansson89 commented on June 25, 2024

Why would you want to load the class multiple times for multiple plugins? The cool thing about a class like this is that it can be loaded once and reused in different plugins. Now what I like to do is to use the latest version of the class no matter which plugins that are using it.

from wordpress-settings-api-class.

roidayan avatar roidayan commented on June 25, 2024

because I know I have changes. you can use 1 name for all your plugins as you can track and update the class for all your plugins but I think it should still be different than the default from whats in the git.
Other people might use this class with their changes or not and there might be a collision or bad behavior, etc.

I try to submit the changes I do but for example I added input type url which if my class won't load there will be a problem and a bad behavior.
if my pull request will be accepted then it will be fine but maybe other plugin uses the old class and will be loaded first. then there is still a bad behavior.
that's why my plugin uses a different name.

from wordpress-settings-api-class.

ahansson89 avatar ahansson89 commented on June 25, 2024

So why don't you just rename your class? I really don't get your logic and the big problem here?

Just change line 13 in the main php file.

from wordpress-settings-api-class.

roidayan avatar roidayan commented on June 25, 2024

There is no problem. That's what I said. I renamed the class.

On Thu, Apr 9, 2015, 20:55 ahansson89 [email protected] wrote:

So why don't you just rename your class? I really don't get your logic and
the big problem here?

Reply to this email directly or view it on GitHub
#21 (comment)
.

from wordpress-settings-api-class.

ahansson89 avatar ahansson89 commented on June 25, 2024

Well, then it is two different use cases. For other people using this class, without any modifications, they want the WP admin to load the latest version of the class no matter which plugin is using it. This is why I opened this ticket.

from wordpress-settings-api-class.

tareq1988 avatar tareq1988 commented on June 25, 2024

Just added initial composer support (see readme), so you can stay updated. Haven't added the version number yet. Also updated the directory structure. Added changelog too

from wordpress-settings-api-class.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.