Skip to content

A PHP class covering every need for interfacing with Jetpack's internals

License

Notifications You must be signed in to change notification settings

oskosk/jetpack-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Jetpack Api

Jetpack API is a PHP class covering every need for interfacing with Jetpack's internals without the need to actually have Jetpack installed side by side with your plugin for using this API.

This package is useful for including in any other WordPress plugin that can run side by side with Jetpack on the same WordPress installation but also without Jetpack being necessarily always installed on the same site.

Installation

JetpackApi can be used just by downloading the class or via composer.

Installation via composer

$ cd my-plugin
$ composer require oskosk/jetpack-api

Installation via simple download of the class file

$ cd my-plugin
$ wget https://raw.githubusercontent.com/oskosk/jetpack-api/master/class-jetpackapi.php

Usage

<?php
// This is your plugin file

if ( ! class_exists( 'JetpackApi' ) ) {
	require 'class.jetpackapi.php';
}


// Attempt to disable Jetpack comments

JetpackApi::disable_jetpack_comments();

// Check if a Jetpack feature is available

if ( JetpackApi::is_feature_available( 'photon' ) ) {
	// Do stuff with photon
}

// Check if Jetpack is connected
if ( JetpackApi::is_connected() ) {
	// Use safely anything that Jetpack disabled until it's been connected
}

License

GPL V2

About

A PHP class covering every need for interfacing with Jetpack's internals

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages