Add_Twitter_Integration

Adds Integration to Automator.


Source Source

File: src/integrations/twitter/add-twitter-integration.php

class Add_Twitter_Integration {

	/**
	 * Integration Identifier
	 *
	 * @var   string
	 * @since 2.4.0
	 */
	public static $integration = 'TWITTER';

	/**
	 * Constructs the class.
	 *
	 * @since 2.4.0
	 */
	public function __construct() {
	}

	/**
	 * Registers Integration.
	 *
	 * @since 2.4.0
	 */
	public function add_integration_func() {

		// set up configuration.
		$integration_config = array(
			'name'     => 'Twitter',
			'icon_svg' => Utilities::automator_get_integration_icon( __DIR__ . '/img/twitter-icon.svg' ),
		);

		// global automator object.


		// register integration into automator.
		Automator()->register->integration( self::$integration, $integration_config );

	}

	/**
	 * Set the directories that the auto loader will run in.
	 *
	 * @param $directory
	 *
	 * @return array
	 */
	public function add_integration_directory_func( $directory ) {

		$directory[]    = dirname( __FILE__ ) . '/helpers';
		$twitter_client = get_option( '_uncannyowl_twitter_settings', array() );

		if ( isset( $twitter_client['oauth_token'] ) && ! empty( $twitter_client['oauth_token_secret'] ) ) {
			$directory[] = dirname( __FILE__ ) . '/actions';
		}

		return $directory;
	}

	/**
	 * This integration doesn't require any third-party plugins too be active, so the following function will always
	 * return true.
	 *
	 * @param $status
	 * @param $code
	 *
	 * @return bool
	 */
	public function plugin_active( $status, $code ) {
		return true;
	}

}

Methods Methods


Top ↑

Changelog Changelog

Changelog
Version Description
2.4.0 Introduced.