Plugin Directory

Changeset 2811405


Ignore:
Timestamp:
11/03/2022 07:28:21 PM (3 years ago)
Author:
ibehroozir
Message:

31572209422252732

Location:
ibehroozir
Files:
29 added
3 edited

Legend:

Unmodified
Added
Removed
  • ibehroozir/trunk/iBehroozir.php

    r2810509 r2811405  
    77 * Plugin URI:
    88 * Description: iBehrooz.ir Plugin Base Panel.
    9  * Version:     0.0.4
     9 * Version:     0.0.5
    1010 * Author:      iBehrooz
    1111 * Author URI:  http://iBehrooz.ir
     
    1414
    1515defined( 'ABSPATH' ) or die( 'Not Authorized!' );
    16  
     16
     17define( "IBiBehroozirVersion", get_file_data(__FILE__, array('Version' => 'Version'), false)['Version'] );
     18
    1719require_once( plugin_dir_path( __FILE__ ) . '/include/ib.php' );
    18  
  • ibehroozir/trunk/include/ib.php

    r2810509 r2811405  
    1212        add_action('admin_enqueue_scripts', array($this,'admin_enqueue_scripts'));
    1313        add_action('wp_enqueue_scripts', array($this,'wp_enqueue_scripts'));
    14         add_action('admin_menu', array($this,'plugin_admin_menu_function'));
     14        add_action('admin_menu', array($this,'admin_menu'));
     15        add_filter( 'auto_update_plugin', array($this,'auto_update_plugin'), 10, 2 );
    1516    }
    16     function plugin_admin_menu_function()
     17    function admin_menu()
    1718    {
    1819        $page_title = 'iBehrooz.ir';
     
    2425        $position = 100;
    2526        add_menu_page($page_title, $menu_title, $capability, $slug, $callback, $icon, $position);
    26         
     27 
    2728        if ( is_plugin_active( 'digikalascraper/digikalaScraper.php' ) ) {
    2829          add_submenu_page($slug, 'digikalaScraper' , 'digikalaScraper', 'manage_options', 'digikalaScraper',  null);
    2930        }
     31
     32        if ( is_plugin_active( 'ibtoolbox/ibToolBox.php' ) ) {
     33          add_submenu_page($slug, 'ibToolBox' , 'ibToolBox', 'manage_options', 'ibToolBox',  null);
     34        }
    3035       
    3136    }
     37 
     38    function auto_update_plugin( $update, $item ) {
     39    $pluginLists =  array_map('strtolower', ['iBehroozir', 'digikalaScraper', 'ibToolBox']);
     40    $slug = strtolower(basename($item->id));
     41    if ( in_array($slug, $pluginLists) ) {
     42        return true;
     43    }
     44     return $update;
     45    }
    3246    function wp_remote_get($url){
     47       ini_set('display_errors', "Off");
    3348       $response = wp_remote_get( $url , array('headers' => array('Accept' => 'application/json')));
    34        if (( !is_wp_error($response)) && (200 === wp_remote_retrieve_response_code( $response ) )){
    35          if (trim($response['body'])!==""){
     49       if (!is_wp_error($response) && wp_remote_retrieve_response_code( $response ) === 200){
     50         if (!is_wp_error($response['body']) && trim($response['body'])!==""){
    3651           return $response['body'];
    3752         }
     
    4156    function is_ib_url()
    4257    {
    43         return strpos($_SERVER['REQUEST_URI'], self::pluginBaseCleanURL) !== false
    44         ||
    45         strpos($_SERVER['REQUEST_URI'], 'digikalaScraper') !== false;
     58        if (strpos($_SERVER['REQUEST_URI'], "admin.php?page=") !== false){
     59         $ok = array();
     60         $pluginLists = array_map('strtolower', ['iBehrooz.ir', 'digikalaScraper', 'ibToolBox']);
     61         $slug = strtolower(explode('=', trim($_SERVER['REQUEST_URI']))[1]);
     62         foreach ($pluginLists as $v){
     63          $vslug = strtolower(explode('=', trim($_SERVER['REQUEST_URI']))[1]);
     64          $ok[] = strpos($vslug, $v) !== false;
     65         }
     66        }
     67        return isset($ok) ? in_array($slug, $ok) : false;
    4668    }
    4769    function admin_enqueue_scripts()
     
    80102 
    81103       $is_plugin_active_ib_class = is_plugin_active( "ibehroozir/iBehroozir.php" ) ? "disabled" : null;
    82        $is_plugin_active_ib_text = $is_plugin_active_ib_class === null ? "install addon from WordPress" : "addon installed";
     104       $is_plugin_active_ib_text = $is_plugin_active_ib_class === null ? "install from WordPress" : "base panel installed";
    83105
    84106       $is_plugin_active_digikalascraper_class = is_plugin_active( 'digikalascraper/digikalaScraper.php' ) ? "disabled" : null;
    85107       $is_plugin_active_digikalascraper_text = $is_plugin_active_digikalascraper_class === null ? "install addon from WordPress" : "addon installed";
    86108       
    87        $is_plugin_active_ibtoolbox_class = is_plugin_active( 'ibtoolbox/iBToolBox.php' ) ? "disabled" : null;
     109       $is_plugin_active_ibtoolbox_class = is_plugin_active( 'ibtoolbox/ibToolBox.php' ) ? "disabled" : null;
    88110       $is_plugin_active_ibtoolbox_text = $is_plugin_active_ibtoolbox_class === null ? "install addon from WordPress" : "addon installed";
    89  
     111  
    90112       esc_html_e(_e('
    91113       <div class="container-fluid ibehroozir">
  • ibehroozir/trunk/readme.txt

    r2810511 r2811405  
    66Tested up to: 6.0.3
    77Requires PHP: 8.0
    8 Stable tag: 0.0.4
     8Stable tag: 0.0.5
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1111
    1212== Description ==
    13 iBehrooz.ir Plugin Base Panel. 
     13iBehrooz.ir Plugin Base Panel.
    1414
    1515== credits ==
Note: See TracChangeset for help on using the changeset viewer.