Skip to content

Commit

Permalink
Sync plugin from SVN
Browse files Browse the repository at this point in the history
  • Loading branch information
farhadsakhaei committed Mar 17, 2024
1 parent 38b984b commit 4e3f6b3
Show file tree
Hide file tree
Showing 25 changed files with 2,406 additions and 1 deletion.
1 change: 0 additions & 1 deletion README.md

This file was deleted.

38 changes: 38 additions & 0 deletions aparat-feed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* Plugin Name: Latest Aparat Videos
* Description: Displaying the latest Aparat videos
* Plugin URI: https://dedidata.com
* Author: DediData
* Author URI: https://dedidata.com
* Version: 1.2.8
* Requires at least: 6.0
* Tested up to: 6.4
* Requires PHP: 7.0
* License: GPL v3
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Text Domain: aparat-feed
*
* @package Aparat_Feed
*/

declare(strict_types=1);

if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( '\DediData\Plugin_Autoloader' ) ) {
require 'includes/DediData/class-plugin-autoloader.php';
}
// Set name spaces we use in this plugin
new \DediData\Plugin_Autoloader( array( 'DediData', 'AparatFeed', 'AparatFeedWidget' ) );
/**
* The function APARAT_FEED returns an instance of the Aparat_Feed class.
*
* @return object an instance of the \AparatFeed\Aparat_Feed class.
* @SuppressWarnings(PHPMD.StaticAccess)
*/
function APARAT_FEED() { // phpcs:ignore Squiz.Functions.GlobalFunction.Found, WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
return \AparatFeed\Aparat_Feed::get_instance( __FILE__ );
}
APARAT_FEED();
Empty file added assets/admin/css/style-rtl.css
Empty file.
Empty file added assets/admin/css/style.css
Empty file.
Empty file added assets/admin/js/script.js
Empty file.
Empty file added assets/public/css/style-rtl.css
Empty file.
Empty file added assets/public/css/style.css
Empty file.
Empty file added assets/public/js/script.js
Empty file.
203 changes: 203 additions & 0 deletions includes/AparatFeed/class-aparat-feed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
<?php
/**
* Aparat Feed Main Class
*
* @package Aparat_Feed
*/

declare(strict_types=1);

namespace AparatFeed;

/**
* Class Aparat_Feed
*/
final class Aparat_Feed extends \DediData\Singleton {

/**
* Plugin URL
*
* @var string $plugin_url
*/
protected $plugin_url;

/**
* Plugin Folder
*
* @var string $plugin_folder
*/
protected $plugin_folder;

/**
* Plugin Name
*
* @var string $plugin_name
*/
protected $plugin_name;

/**
* Plugin Version
*
* @var string $plugin_version
*/
protected $plugin_version;

/**
* Plugin Slug
*
* @var string $plugin_slug
*/
protected $plugin_slug;

/**
* Plugin File
*
* @var string $plugin_file
*/
protected $plugin_file;

/**
* Constructor
*
* @param mixed $plugin_file Plugin File Name.
* @see https://developer.wordpress.org/reference/functions/register_activation_hook
* @see https://developer.wordpress.org/reference/functions/register_deactivation_hook
* @see https://developer.wordpress.org/reference/functions/register_uninstall_hook
* @SuppressWarnings(PHPMD.ElseExpression)
*/
protected function __construct( $plugin_file = null ) {
$this->plugin_file = $plugin_file;
$this->set_plugin_info();
register_activation_hook( $plugin_file, array( $this, 'activate' ) );
register_deactivation_hook( $plugin_file, array( $this, 'deactivate' ) );
register_uninstall_hook( $plugin_file, self::class . '::uninstall' );
if ( is_admin() ) {
add_action( 'admin_enqueue_scripts', array( $this, 'load_admin_scripts' ), 11 );
$this->admin();
} else {
add_action( 'wp_enqueue_scripts', array( $this, 'load_frontend_scripts' ), 11 );
$this->run();
}
add_action(
'widgets_init',
static function () {
register_widget( 'AparatFeedWidget\Aparat_Feed_Widget' );
}
);
}

/**
* The function is used to load frontend scripts and styles in a WordPress plugin, with support for
* RTL (right-to-left) languages.
*
* @return void
*/
public function load_frontend_scripts() {
/*
if ( is_rtl() ) {
wp_register_style( $this->plugin_slug . '-rtl', $this->plugin_url . '/assets/public/css/style.rtl.css', array(), $this->plugin_version );
wp_enqueue_style( $this->plugin_slug . '-rtl' );
} else {
wp_register_style( $this->plugin_slug, $this->plugin_url . '/assets/public/css/style.css', array(), $this->plugin_version );
wp_enqueue_style( $this->plugin_slug );
}
wp_register_script( $this->plugin_slug, $this->plugin_url . '/assets/public/js/script.js', array(), $this->plugin_version, true );
wp_enqueue_script( $this->plugin_slug );
*/
}

/**
* Styles for Admin
*
* @return void
*/
public function load_admin_scripts() {
/*
if ( is_rtl() ) {
wp_register_style( $this->plugin_slug . '-rtl', $this->plugin_url . '/assets/admin/css/style.rtl.css', array(), $this->plugin_version );
wp_enqueue_style( $this->plugin_slug . '-rtl' );
} else {
wp_register_style( $this->plugin_slug, $this->plugin_url . '/assets/admin/css/style.css', array(), $this->plugin_version );
wp_enqueue_style( $this->plugin_slug );
}
wp_register_script( $this->plugin_slug, $this->plugin_url . '/assets/admin/js/script.js', array(), $this->plugin_version, true );
wp_enqueue_script( $this->plugin_slug );
*/
}

/**
* Activate the plugin
*
* @return void
* @see https://developer.wordpress.org/reference/functions/add_option
*/
public function activate() {
// add_option( $this->plugin_slug );
}

/**
* Run when plugins deactivated
*
* @return void
*/
public function deactivate() {
// Clear any temporary data stored by plugin.
// Flush Cache/Temp.
// Flush Permalinks.
}

/**
* Uninstall plugin
*
* @return void
* @see https://developer.wordpress.org/reference/functions/delete_option
*/
public static function uninstall() {
// delete_option( 'aparat-feed' );
// Remove Tables from wpdb
// global $wpdb;
// $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}aparat-feed");
// Clear any cached data that has been removed.
wp_cache_flush();
}

/**
* Set Plugin Info
*
* @return void
*/
private function set_plugin_info() {
$this->plugin_slug = basename( $this->plugin_file, '.php' );
$this->plugin_url = plugins_url( '', $this->plugin_file );

if ( ! function_exists( 'get_plugins' ) ) {
include_once \ABSPATH . 'wp-admin/includes/plugin.php';
}

$this->plugin_folder = plugin_dir_path( $this->plugin_file );
$plugin_info = get_plugins( '/' . plugin_basename( $this->plugin_folder ) );
$plugin_file_name = basename( $this->plugin_file );
$this->plugin_version = $plugin_info[ $plugin_file_name ]['Version'];
$this->plugin_name = $plugin_info[ $plugin_file_name ]['Name'];
}

/**
* The function "run" is a placeholder function in PHP with no code inside.
*
* @return void
*/
private function run() {
// nothing for now
}

/**
* The admin function includes the options.php file and registers the admin menu.
*
* @return void
*/
private function admin() {
// add_action( 'admin_menu', 'AparatFeed\Admin_Menus::register_admin_menu' );
}
}
91 changes: 91 additions & 0 deletions includes/AparatFeedWidget/assets/admin/css/style-rtl.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
.ddaf-widget-form {
margin-bottom: 15px;
margin-right: -10px;
margin-left: -10px;
}

.ddaf-section {
margin: 5px 0;
}

.ddaf-section-top {
background-color: #F5F5F5;
border: 1px solid #DDD;
cursor: pointer;
}

.ddaf-section-top.ddaf-active,
.ddaf-section-top:hover {
background-color: #F1F1F1;
border: 1px solid #CCC;
}

.ddaf-section-top.ddaf-active {
background-color: rgba(0, 0, 0, 0.1);
}

.ddaf-top-action {
float: left;
position: relative;
}

.ddaf-action-indicator {
box-shadow: none;
color: inherit;
outline: medium none;
text-decoration: none;
}

a.ddaf-action-indicator:focus,
a.ddaf-action-indicator:focus::after {
border: 0 none;
box-shadow: 0 0 0 0 !important;
}

a.ddaf-action-indicator:after {
border: 0 none;
background: none;
content: "\f140";
display: block;
font: normal 20px/1 dashicons;
margin-top: 10px;
margin-left: 10px;
padding: 1px 0px 1px 2px;
position: relative;
left: 0;
text-align: center;
text-decoration: none !important;
text-indent: 0;
}

.ddaf-section-top.ddaf-active a.ddaf-action-indicator:after {
content: "\f142";
}

.ddaf-section-heading {
font-size: 1em;
line-height: 1;
margin: 0;
overflow: hidden;
padding: 15px 10px;
text-overflow: ellipsis;
white-space: nowrap;
}

.ddaf-fieldset {
background-color: #FAFAFA;
border-width: 0 1px 1px 1px;
border-color: #E5E5E5;
border-style: solid;
padding: 0 10px 10px 10px;
}

.ddaf-fieldset label {
display: inline-block;
margin-bottom: 1px;
padding: 1px 0;
}

.ltr {
direction: ltr;
}
Loading

0 comments on commit 4e3f6b3

Please sign in to comment.