wp-parsidate
Last commit date
assets
10 years ago
includes
10 years ago
parsi-languages
10 years ago
readme.txt
10 years ago
screenshot-1.png
11 years ago
screenshot-2.png
11 years ago
screenshot-3.png
11 years ago
screenshot-4.png
11 years ago
wp-parsidate.php
10 years ago
wp-parsidate.php
174 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: WP-Parsidate |
| 4 | * Version: 2.1.6 |
| 5 | * Plugin URI: http://forum.wp-parsi.com/ |
| 6 | * Description: Persian package for WordPress, Adds full RTL and Shamsi (Jalali) support for: posts, comments, pages, archives, search, categories, permalinks and all admin sections and TinyMce editor, lists, quick editor. This package has Jalali archive widget. |
| 7 | * Author: WP-Parsi Team |
| 8 | * Author URI: http://wp-parsi.com/ |
| 9 | * Text Domain: wp-parsidate |
| 10 | * Domain Path: parsi-languages |
| 11 | * |
| 12 | * WordPress Parsi Package, Adds Persian language & Jalali date support to your blog |
| 13 | * |
| 14 | * Developers: |
| 15 | * Mobin Ghasempoor ( Senior programmer & Founder ) |
| 16 | * Morteza Geransayeh ( Senior programmer & Manager ) |
| 17 | * Ehsaan ( Programmer ) |
| 18 | * Farhan Nisi ( Programmer ) |
| 19 | * Parsa Kafi ( Programmer ) |
| 20 | * Saeed Fard ( Analyst ) |
| 21 | * |
| 22 | * @author Mobin Ghasempoor |
| 23 | * @author Morteza Geransayeh |
| 24 | * @author Farhan Nisi |
| 25 | * @author Ehsaan |
| 26 | * @link http://wp-parsi.com/ |
| 27 | * @version 2.0 |
| 28 | * @license http://www.gnu.org/licenses/gpl-2.0.html GNU Public License v2.0 |
| 29 | * @package WP-Parsidate |
| 30 | * @subpackage Core |
| 31 | */ |
| 32 | |
| 33 | |
| 34 | if ( ! defined( 'ABSPATH' ) ) exit; // No direct access allowed |
| 35 | |
| 36 | final class WP_Parsidate { |
| 37 | /** |
| 38 | * @var WP_Parsidate Class instance |
| 39 | */ |
| 40 | public static $instance = null; |
| 41 | |
| 42 | /** |
| 43 | * Returns an instance of WP_Parsidate class, makes instance if not exists |
| 44 | * |
| 45 | * @since 2.0 |
| 46 | * @return WP_Parsidate Instance of WP_Parsidate |
| 47 | */ |
| 48 | public static function get_instance() { |
| 49 | if ( self::$instance == null ) |
| 50 | self::$instance = new WP_Parsidate(); |
| 51 | |
| 52 | return self::$instance; |
| 53 | } |
| 54 | |
| 55 | private function __construct() { |
| 56 | $this->consts(); |
| 57 | $this->setup_vars(); |
| 58 | $this->include_files(); |
| 59 | add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'parsi_settings_link' ) ); |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Add Setting Link To Install Plugin |
| 64 | * |
| 65 | * @param string $links |
| 66 | * @return array |
| 67 | */ |
| 68 | public static function parsi_settings_link( $links ) { |
| 69 | $mylinks = array('<a href="'.menu_page_url('wp-parsi-settings',FALSE).'">'.__('settings','wp-parsidate').'</a>'); |
| 70 | return array_merge( $links, $mylinks ); |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Sets up constants for plugin |
| 75 | * |
| 76 | * @since 2.0 |
| 77 | * @return void |
| 78 | */ |
| 79 | private function consts() { |
| 80 | if ( ! defined( 'WP_PARSI_ROOT' ) ) |
| 81 | define( 'WP_PARSI_ROOT', __FILE__ ); |
| 82 | |
| 83 | if ( ! defined( 'WP_PARSI_DIR' ) ) |
| 84 | define( 'WP_PARSI_DIR', plugin_dir_path( WP_PARSI_ROOT ) ); |
| 85 | |
| 86 | if ( ! defined( 'WP_PARSI_URL' ) ) |
| 87 | define( 'WP_PARSI_URL', plugin_dir_url( WP_PARSI_ROOT ) ); |
| 88 | |
| 89 | if ( ! defined( 'WP_PARSI_VER' ) ) |
| 90 | define( 'WP_PARSI_VER', '2.1.5' ); |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * Includes files for plugin |
| 95 | * |
| 96 | * @since 2.0 |
| 97 | * @return void |
| 98 | */ |
| 99 | public function include_files() { |
| 100 | require_once( WP_PARSI_DIR . 'includes/settings.php' ); |
| 101 | global $wpp_settings; |
| 102 | $wpp_settings = wp_parsi_get_settings(); |
| 103 | |
| 104 | $files = array( |
| 105 | 'parsidate', |
| 106 | 'general', |
| 107 | 'fixes-archive', |
| 108 | 'fixes-permalinks', |
| 109 | 'fixes-dates', |
| 110 | 'fixes-misc', |
| 111 | 'admin/styles-fix', |
| 112 | 'admin/lists-fix', |
| 113 | 'admin/other-fix', |
| 114 | 'fixes-get_calendar', |
| 115 | 'fixes-get_archives', |
| 116 | 'plugins/woocommerce', |
| 117 | 'widget/widget_archive', |
| 118 | 'widget/widget_calendar' |
| 119 | ); |
| 120 | |
| 121 | foreach( $files as $file ) |
| 122 | require_once( WP_PARSI_DIR . 'includes/' . $file . '.php' ); |
| 123 | |
| 124 | if ( get_locale() == 'fa_IR' ) |
| 125 | load_textdomain( 'wp-parsidate', WP_PARSI_DIR . 'parsi-languages/fa_IR.mo' ); |
| 126 | |
| 127 | add_action( 'widgets_init', array( $this, 'register_widget' ) ); |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * Sets up global variables |
| 132 | * |
| 133 | * @since 2.0 |
| 134 | * @return void |
| 135 | */ |
| 136 | private function setup_vars() { |
| 137 | global $persian_month_names, $timezone; |
| 138 | $persian_month_names = array( '', |
| 139 | 'فروردین', |
| 140 | 'اردیبهشت', |
| 141 | 'خرداد', |
| 142 | 'تیر', |
| 143 | '� |
| 144 | رداد', |
| 145 | 'شهریور', |
| 146 | '� |
| 147 | هر', |
| 148 | 'آبان', |
| 149 | 'آذر', |
| 150 | 'دی', |
| 151 | 'به� |
| 152 | ن', |
| 153 | 'اسفند' |
| 154 | ); |
| 155 | |
| 156 | $timezone = get_option( 'timezone_string' ); |
| 157 | date_default_timezone_set( $timezone ); |
| 158 | } |
| 159 | |
| 160 | /** |
| 161 | * Register Plugin Widgets |
| 162 | * |
| 163 | * @since 2.0 |
| 164 | * @return boolean |
| 165 | */ |
| 166 | public function register_widget() { |
| 167 | register_widget('parsidate_archive'); |
| 168 | register_widget('parsidate_calendar'); |
| 169 | return true; |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | return WP_Parsidate::get_instance(); |
| 174 |