Plugin Directory

Changeset 2338473


Ignore:
Timestamp:
07/10/2020 06:04:52 AM (6 years ago)
Author:
farazsmsdeveloper
Message:

all user plugins

Location:
farazsms-club/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • farazsms-club/trunk/includes/class-config.php

    r2322025 r2338473  
    205205                $uname = self::$_digits_uname;
    206206                $pass  = self::$_digits_password;
    207             } elseif ( strtolower( $plugin ) == 'woo' ) {
     207            }
     208            elseif ( strtolower( $plugin ) == 'woo' ) {
    208209                if ( self::isWooSmsInstalled() ) {
    209210                    $uname = self::$_woo_uname;
     
    213214                    $pass  = self::$_options['pass'];
    214215                }
    215             } else {
    216                 return false;
     216            }
     217            else {
     218                $uname = self::options()['uname'];
     219                $pass  = self::options()['pass'];
    217220            }
    218221            $body = array(
     
    249252            if ( ! $options ) {
    250253                $options = array(
    251                     "digits" => array(),
    252                     "woo"    => array(),
    253                     "umame"  => array(),
    254                     "pass"   => array(),
     254                    "digits"             => array(),
     255                    "woo"                => array(),
     256                    "umame"              => array(),
     257                    "pass"               => array(),
     258                    "general_phone_book" => array(),
    255259                );
    256260                $config  = FARAZSMS_CLUB_CONFIG::getInstance();
     
    263267                }
    264268                add_option( 'farazsms_options', $options );
     269            } elseif ( ! $options['general_phone_book'] ) {
     270                $options['general_phone_book'] = array();
     271                update_option( 'farazsms_options', $options );
    265272            }
    266273
     
    278285                if ( ! $options ) {
    279286                    $options = array(
    280                         "digits" => array(),
    281                         "woo"    => array(),
    282                         "umame"  => array(),
    283                         "pass"   => array(),
     287                        "digits"             => array(),
     288                        "woo"                => array(),
     289                        "umame"              => array(),
     290                        "pass"               => array(),
     291                        "general_phone_book" => array(),
    284292                    );
    285293                    if ( self::get_woo_sms_configs() !== false ) {
     
    293301                }
    294302                self::$_options = $options;
    295 
    296303                return $options;
     304            } elseif ( ! self::$_options['general_phone_book'] ) {
     305                self::$_options['general_phone_book'] = array();
     306                update_option( 'farazsms_options',  self::$_options );
    297307            }
    298308
    299309            return self::$_options;
    300310        }
    301         public static function get_credit(){
    302             $options = self::options();
    303             $body  = array(
    304                 "uname"=>$options['uname'],
    305                 "pass"=>$options['pass'],
    306                 'op'=>'credit'
     311
     312        public static function get_credit() {
     313            $options  = self::options();
     314            $body     = array(
     315                "uname" => $options['uname'],
     316                "pass"  => $options['pass'],
     317                'op'    => 'credit'
    307318            );
    308319            $response = wp_remote_post( self::url(), array(
     
    316327            );
    317328            $response = json_decode( $response['body'] );
    318             if($response[0] !== 0) return false;
     329            if ( $response[0] !== 0 ) {
     330                return false;
     331            }
    319332            $credit_rial = explode( ".", $response[1] )[0];
    320333
    321334            return substr( $credit_rial, 0, - 1 );
    322335        }
     336
    323337        static function createdb() {
    324338            global $wpdb;
     
    426440            return true;
    427441        }
     442        public static function save_to_general_phone_book( $phone, $phone_book ) {
     443            $uname = self::options()['uname'];
     444            $pass  = self::options()['pass'];
     445            $body = array(
     446                'uname'       => $uname,
     447                'pass'        => $pass,
     448                'op'          => 'phoneBookAdd',
     449                'phoneBookId' => $phone_book,
     450                'number'      => $phone
     451            );
     452
     453            $response = wp_remote_post( self::url(), array(
     454                    'method'      => 'POST',
     455                    'headers'     => [
     456                        'Content-Type' => 'application/json',
     457                    ],
     458                    'data_format' => 'body',
     459                    'body'        => json_encode( $body )
     460                )
     461            );
     462            $response = json_decode( $response['body'] );
     463            if ( $response->status->code !== 0 ) {
     464                return false;
     465            }
     466
     467            return true;
     468        }
    428469
    429470    }
  • farazsms-club/trunk/includes/class-core.php

    r2322025 r2338473  
    188188                <h1><?php _e('Phonebook Configs','farazsms-club') ?></h1>
    189189        <?php
     190        $plugins['general_phone_book'] = array(
     191                'phoneBookId' => false,
     192                'name'        => __( 'Genral phones Plugin', 'farazsms-club' ),
     193                                'phonebookAll'=>$configs::getPhoneBooks( 'general_phone_book' )
     194
     195            );
    190196        if ( $configs::isDigitsInstalled() ) {
    191             $plugins['digits'] = array(
    192                 'phoneBookId' => false,
    193                 'name'        => __( 'Digits Plugin', 'farazsms-club' ),
    194                                 'phonebookAll'=>[]
    195 
    196             );
     197
     198            $plugins['digits'] = array(
     199                            'phoneBookId' => false,
     200                            'name'        => __( 'Digits Plugin', 'farazsms-club' ),
     201                                            'phonebookAll'=>[]
     202
     203                        );
    197204
    198205            if ( $configs->get_digits_configs() ) {
     
    285292
    286293    function updated_user_meta( $null,$object_id, $meta_key, $meta_value){
    287         if(strtolower($meta_key!=='digits_phone')) {return;}
    288         $phone =intval(substr($meta_value,-10));
     294        $mobile_pattern = "/^(\s)*(\+98|0098|98|0)?(9\d{9})(\s*|$)/";
     295        preg_match($mobile_pattern,$meta_value,$matches);
     296        if(strtolower($meta_key!=='digits_phone') && sizeof($matches) !== 5) {return;}
     297        $phone =intval($matches[3]);
    289298        if ($phone < 9000000000  ){return;}
    290299        $user_id = intval($object_id);
    291300        $user=get_userdata($user_id);
    292301        $config=FARAZSMS_CLUB_CONFIG::getInstance();
    293         $phone_books=$config::options()['digits'];
     302        $phone_books=$config::options()['general_phone_book'];
     303        if(strtolower($meta_key === 'digits_phone')) $phone_books=$config::options()['digits'];
    294304        foreach ($phone_books as $phone_book){
    295305            if(FARAZSMS_CLUB_CONFIG::db_find_one($phone,$phone_book)) {continue;}
     
    302312                                            );
    303313            if($config::save_to_digits_phone_book($phone,$phone_book)) {$config::db_save($phones);}
     314            elseif($config::save_to_general_phone_book($phone,$phone_book)) {$config::db_save($phones);}
     315
    304316        }
    305317    }
  • farazsms-club/trunk/languages/farazsms-club-fa_IR.po

    r2322025 r2338473  
     1# Translation of Plugins - FarazSMS-Club - Development (trunk) in Persian
     2# This file is distributed under the same license as the Plugins - FarazSMS-Club - Development (trunk) package.
    13msgid ""
    24msgstr ""
    3 "Project-Id-Version: farazsms-club\n"
    4 "Report-Msgid-Bugs-To: \n"
    5 "POT-Creation-Date: 2020-06-01 13:45+0000\n"
    6 "PO-Revision-Date: 2020-06-01 13:46+0000\n"
    7 "Last-Translator: \n"
    8 "Language-Team: فارسی\n"
    9 "Language: fa_IR\n"
    10 "Plural-Forms: nplurals=2; plural=n != 1;\n"
     5"PO-Revision-Date: 2020-07-09 16:25+0000\n"
    116"MIME-Version: 1.0\n"
    127"Content-Type: text/plain; charset=UTF-8\n"
    138"Content-Transfer-Encoding: 8bit\n"
     9"Plural-Forms: nplurals=2; plural=n != 1;\n"
    1410"X-Generator: Loco https://localise.biz/\n"
    15 "X-Loco-Version: 2.4.0; wp-5.4.1"
     11"Language: fa_IR\n"
     12"Project-Id-Version: Plugins - FarazSMS-Club - Development (trunk)\n"
     13"Report-Msgid-Bugs-To: \n"
     14"POT-Creation-Date: 2020-07-09 11:30+0000\n"
     15"Last-Translator: saeb molaee\n"
     16"Language-Team: \n"
     17"X-Loco-Version: 2.4.0; wp-5.4.2\n"
     18"X-Loco-Template: ../../languages/plugins/farazsms-club-fa_IR.po"
    1619
    17 #: includes/class-core.php:68
    18 #, fuzzy, php-format
     20#: includes/class-core.php:60
     21#, php-format
    1922msgid ""
    2023"<h2> Special Offer </h2>\n"
     
    3437"                <a href=\"https://farazsms.com/affiliate\" target=\"_blank\" "
    3538"rel=\"noopener\">اطلاعات بیشتر و شروع کسب درامد\n"
    36 "                    اینترنتی </a>\n"
     39"                    اینترنتی </a>\n"
    3740
    38 #: includes/class-core.php:182
     41#: includes/class-core.php:106
    3942msgid "FarazSMS Options"
    4043msgstr "تنظیمات فرازاس‌ام‌اس"
    4144
    42 #: includes/class-core.php:218
     45#: includes/class-core.php:142
    4346msgid "successfully saved"
    4447msgstr "ذخیره شد"
    4548
    46 #: includes/class-core.php:229
     49#: includes/class-core.php:153
    4750msgid "help"
    4851msgstr "راهنما"
    4952
    50 #: includes/class-core.php:235
     53#: includes/class-core.php:159
    5154msgid "Phonebook"
    5255msgstr "دفترتلفن"
    5356
    54 #: includes/class-core.php:241
     57#: includes/class-core.php:165
    5558msgid "Username and password"
    5659msgstr "نام کاربری و رمز عبور"
    5760
    58 #: includes/class-core.php:248
     61#: includes/class-core.php:172
    5962msgid ""
    6063"<h1> Guide to Customer Club </h1>\n"
     
    8891"                <br>"
    8992
    90 #: includes/class-core.php:264
     93#: includes/class-core.php:188
    9194msgid "Phonebook Configs"
    9295msgstr "تنظیمات فعال سازی باشگاه مشتریان"
    9396
    94 #: includes/class-core.php:269
     97#: includes/class-core.php:192
     98msgid "Genral phones Plugin"
     99msgstr "دفترتلفن به افزونه‌های یوزرپنل لیست نشده"
     100
     101#: includes/class-core.php:200
    95102msgid "Digits Plugin"
    96103msgstr "افزونه دیجیتز"
    97104
    98 #: includes/class-core.php:281
     105#: includes/class-core.php:212
    99106msgid "WooCommerce"
    100107msgstr "ووکامرس"
    101108
    102 #: includes/class-core.php:294
     109#: includes/class-core.php:225
    103110msgid "select phone books for "
    104111msgstr "انتخاب دفتر تلفن برای "
    105112
    106 #: includes/class-core.php:313 includes/class-core.php:346
     113#: includes/class-core.php:244 includes/class-core.php:277
    107114msgid "save"
    108115msgstr "ذخیره"
    109116
    110 #: includes/class-core.php:325
     117#: includes/class-core.php:256
    111118msgid "Credit"
    112119msgstr "اعتبار به تومان:"
    113120
    114 #: includes/class-core.php:333
     121#: includes/class-core.php:264
    115122msgid "It seems user name and password are not working yet are you saved them?"
    116123msgstr ""
     
    118125"عبور خود را درست ذخیره کرده‌اید؟"
    119126
    120 #: includes/class-core.php:339
     127#: includes/class-core.php:270
    121128msgid "User Name"
    122129msgstr "نام‌کاربری"
    123130
    124 #: includes/class-core.php:342
     131#: includes/class-core.php:273
    125132msgid "password"
    126133msgstr "رمزعبور"
  • farazsms-club/trunk/languages/farazsms-club.pot

    r2322025 r2338473  
    44"Project-Id-Version: farazsms-club\n"
    55"Report-Msgid-Bugs-To: \n"
    6 "POT-Creation-Date: 2020-06-01 13:45+0000\n"
     6"POT-Creation-Date: 2020-07-09 11:30+0000\n"
    77"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    88"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1616"X-Loco-Version: 2.4.0; wp-5.4.1"
    1717
    18 #: includes/class-core.php:68
     18#: includes/class-core.php:60
    1919#, php-format
    2020msgid ""
     
    2929msgstr ""
    3030
    31 #: includes/class-core.php:182
     31#: includes/class-core.php:106
    3232msgid "FarazSMS Options"
    3333msgstr ""
    3434
    35 #: includes/class-core.php:218
     35#: includes/class-core.php:142
    3636msgid "successfully saved"
    3737msgstr ""
    3838
    39 #: includes/class-core.php:229
     39#: includes/class-core.php:153
    4040msgid "help"
    4141msgstr ""
    4242
    43 #: includes/class-core.php:235
     43#: includes/class-core.php:159
    4444msgid "Phonebook"
    4545msgstr ""
    4646
    47 #: includes/class-core.php:241
     47#: includes/class-core.php:165
    4848msgid "Username and password"
    4949msgstr ""
    5050
    51 #: includes/class-core.php:248
     51#: includes/class-core.php:172
    5252msgid ""
    5353"<h1> Guide to Customer Club </h1>\n"
     
    6767msgstr ""
    6868
    69 #: includes/class-core.php:264
     69#: includes/class-core.php:188
    7070msgid "Phonebook Configs"
    7171msgstr ""
    7272
    73 #: includes/class-core.php:269
     73#: includes/class-core.php:192
     74msgid "Genral phones Plugin"
     75msgstr ""
     76
     77#: includes/class-core.php:200
    7478msgid "Digits Plugin"
    7579msgstr ""
    7680
    77 #: includes/class-core.php:281
     81#: includes/class-core.php:212
    7882msgid "WooCommerce"
    7983msgstr ""
    8084
    81 #: includes/class-core.php:294
     85#: includes/class-core.php:225
    8286msgid "select phone books for "
    8387msgstr ""
    8488
    85 #: includes/class-core.php:313 includes/class-core.php:346
     89#: includes/class-core.php:244 includes/class-core.php:277
    8690msgid "save"
    8791msgstr ""
    8892
    89 #: includes/class-core.php:325
     93#: includes/class-core.php:256
    9094msgid "Credit"
    9195msgstr ""
    9296
    93 #: includes/class-core.php:333
     97#: includes/class-core.php:264
    9498msgid "It seems user name and password are not working yet are you saved them?"
    9599msgstr ""
    96100
    97 #: includes/class-core.php:339
     101#: includes/class-core.php:270
    98102msgid "User Name"
    99103msgstr ""
    100104
    101 #: includes/class-core.php:342
     105#: includes/class-core.php:273
    102106msgid "password"
    103107msgstr ""
Note: See TracChangeset for help on using the changeset viewer.