Code Monkey home page Code Monkey logo

datafeedr / datafeedr-api Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 2.0 1.07 MB

The Datafeedr API WordPress plugin provides access to our database of roughly 800,000,000 affiliate products.

Home Page: https://wordpress.org/plugins/datafeedr-api/

License: GNU General Public License v3.0

PHP 86.82% CSS 8.84% JavaScript 4.20% Hack 0.14%
wordpress wordpress-plugin affiliate affiliate-networks affiliate-tools affiliate-marketing affiliate-script

datafeedr-api's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

agiza br8km

datafeedr-api's Issues

Add conditional to datafeedr-api.php to load v1 file

Add a conditional statement to the datafeedr-api.php file so that unless DATAFEEDR_DEV is set to true, we will load the v1 code.

This also involves creating a copy of datafeedr-api.php and renaming to datafeedr-api-v1.php. This will be our entry point for v1 code.

We also need a datafeedr-api-dev.php file to be our entry point for v2 code.

Add helper dfrapi_string_starts_with() function

Add the following function:

/**
 * Returns true if the $string starts with one of the $patterns. Otherwise returns false.
 *
 * @param string $string The haystack.
 * @param string|array $patterns The patterns to search for in the beginning of the $string.
 *
 * @return bool
 */
function dfrapi_string_starts_with( $string, $patterns ) {
	$patterns = ( is_string( $patterns ) ) ? array( $patterns ) : $patterns;
	foreach ( $patterns as $pattern ) {
		$length = mb_strlen( $pattern );
		if ( mb_substr( $string, 0, $length ) === $pattern ) {
			return true;
		}
	}

	return false;
}

Create datafeedr_merchants table migration

Need to create datafeedr_merchants table when plugin is installed. Need to outline schema, too.

Current merchant data from API is:

Array
(
    [source_id] => 3
    [source] => Commission Junction
    [product_count] => 172777
    [_id] => 45352
    [name] => 1800lighting.com
)

Write DB updater

When the plugin loads for the first time or when there is a DB upgrade, we need to run the upgrader.

Use sprintf() and double quotes in Table.php

We need to be consistent in the /wp-content/plugins/datafeedr-api/Wuwei/Framework/Database/Table.php file. Use sprintf() for query concatenation and use double quotes so we can use hidden characters like new lines \n in some SQL statements.

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.