Plugin Directory

Changeset 2603576


Ignore:
Timestamp:
09/23/2021 11:14:34 AM (5 years ago)
Author:
contentstudio
Message:

tagging version 1.1.3

Location:
contentstudio
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • contentstudio/tags/1.1.3/trunk/contentstudio-plugin.php

    r2534739 r2603576  
    33Plugin Name: ContentStudio
    44Description: ContentStudio provides you with powerful blogging & social media tools to keep your audience hooked by streamlining the process for you to discover and share engaging content on multiple blogging & social media networks
    5 Version: 1.1.2
     5Version: 1.1.3
    66Author: ContentStudio
    77Author URI: http://contentstudio.io/
     
    4040        protected $assets = 'https://contentstudio.io/img';
    4141
    42         private $version = "1.1.2";
     42        private $version = "1.1.3";
    4343
    4444        protected $contentstudio_id = '';
     
    7474            // register style
    7575
    76             if (get_role('subscriber')) {
    77                 remove_role("subscriber");
    78             }
    7976        }
    8077
     
    117114        {
    118115
     116            add_action('init', [$this, 'cstu_verfiy_wp_user']);
    119117            add_action('init', [$this, 'cstu_check_token']);
    120118            add_action('init', [$this, 'cstu_set_token']);
     
    460458
    461459            return false;
     460        }
     461
     462        /**
     463         * verify wordpress user
     464         */
     465        public function cstu_verfiy_wp_user()
     466        {
     467            if (isset($_REQUEST['cstu_verfiy_wp_user']) && $_REQUEST['cstu_verfiy_wp_user']) {
     468                try {
     469                    if (isset($_REQUEST['username'], $_REQUEST['password']) && $_REQUEST['username'] && $_REQUEST['password']) {
     470                        $user = get_user_by('login', $_REQUEST['username']);
     471                        if ($user && $user->ID != 0) {
     472                            if (wp_check_password($_REQUEST['password'], $user->data->user_pass, $user->ID)) {
     473                                if (in_array('administrator', $user->roles) || in_array('editor', $user->roles) || in_array('author', $user->roles)) {
     474                                    echo json_encode(['status' => true, 'message' => 'User verification completed successfully!']);
     475                                    die();
     476                                } else {
     477                                    echo json_encode(['status' => false, 'message' => 'Your WordPress user role should be administrator, editor or author.']);
     478                                    die();
     479                                }
     480                            } else {
     481                                echo json_encode(['status' => false, 'message' => 'The password that you entered is incorrect.']);
     482                                die();
     483                            }
     484                        } else {
     485                            echo json_encode(['status' => false, 'message' => 'No user exists with your provided username.']);
     486                            die();
     487                        }
     488                    } else {
     489                        echo json_encode(['status' => false, 'message' => 'Invalid request parameters.']);
     490                        die();
     491                    }
     492                } catch (Exception $e) {
     493                    echo json_encode([
     494                        'status' => false, 'message' => self::UNKNOWN_ERROR_MESSAGE,
     495                        'line' => $e->getLine(), 'error_message' =>  $e->getMessage()
     496                    ]);
     497                }
     498            }
    462499        }
    463500
     
    608645                $valid = $this->do_validate_cstu_token($_REQUEST['token']);
    609646                if ($valid) {
    610                     $authors = get_users([['role__in' => ['editor', 'administrator', 'author']]]);
     647                    $authors = get_users(['role__in' => ['editor', 'administrator', 'author']]);
    611648                    $return_authors = [];
    612649                    foreach ($authors as $author) {
     
    11751212                else $filename = basename($image_url);
    11761213
    1177                 $modified_filename = str_replace(" ","-",$post_title);
     1214                $modified_filename = sanitize_title($post_title);
    11781215                if(strpos($filename, '.') === false){
    11791216                    $filename = $modified_filename . '.png';
  • contentstudio/trunk/contentstudio-plugin.php

    r2534739 r2603576  
    33Plugin Name: ContentStudio
    44Description: ContentStudio provides you with powerful blogging & social media tools to keep your audience hooked by streamlining the process for you to discover and share engaging content on multiple blogging & social media networks
    5 Version: 1.1.2
     5Version: 1.1.3
    66Author: ContentStudio
    77Author URI: http://contentstudio.io/
     
    4040        protected $assets = 'https://contentstudio.io/img';
    4141
    42         private $version = "1.1.2";
     42        private $version = "1.1.3";
    4343
    4444        protected $contentstudio_id = '';
     
    7474            // register style
    7575
    76             if (get_role('subscriber')) {
    77                 remove_role("subscriber");
    78             }
    7976        }
    8077
     
    117114        {
    118115
     116            add_action('init', [$this, 'cstu_verfiy_wp_user']);
    119117            add_action('init', [$this, 'cstu_check_token']);
    120118            add_action('init', [$this, 'cstu_set_token']);
     
    460458
    461459            return false;
     460        }
     461
     462        /**
     463         * verify wordpress user
     464         */
     465        public function cstu_verfiy_wp_user()
     466        {
     467            if (isset($_REQUEST['cstu_verfiy_wp_user']) && $_REQUEST['cstu_verfiy_wp_user']) {
     468                try {
     469                    if (isset($_REQUEST['username'], $_REQUEST['password']) && $_REQUEST['username'] && $_REQUEST['password']) {
     470                        $user = get_user_by('login', $_REQUEST['username']);
     471                        if ($user && $user->ID != 0) {
     472                            if (wp_check_password($_REQUEST['password'], $user->data->user_pass, $user->ID)) {
     473                                if (in_array('administrator', $user->roles) || in_array('editor', $user->roles) || in_array('author', $user->roles)) {
     474                                    echo json_encode(['status' => true, 'message' => 'User verification completed successfully!']);
     475                                    die();
     476                                } else {
     477                                    echo json_encode(['status' => false, 'message' => 'Your WordPress user role should be administrator, editor or author.']);
     478                                    die();
     479                                }
     480                            } else {
     481                                echo json_encode(['status' => false, 'message' => 'The password that you entered is incorrect.']);
     482                                die();
     483                            }
     484                        } else {
     485                            echo json_encode(['status' => false, 'message' => 'No user exists with your provided username.']);
     486                            die();
     487                        }
     488                    } else {
     489                        echo json_encode(['status' => false, 'message' => 'Invalid request parameters.']);
     490                        die();
     491                    }
     492                } catch (Exception $e) {
     493                    echo json_encode([
     494                        'status' => false, 'message' => self::UNKNOWN_ERROR_MESSAGE,
     495                        'line' => $e->getLine(), 'error_message' =>  $e->getMessage()
     496                    ]);
     497                }
     498            }
    462499        }
    463500
     
    608645                $valid = $this->do_validate_cstu_token($_REQUEST['token']);
    609646                if ($valid) {
    610                     $authors = get_users([['role__in' => ['editor', 'administrator', 'author']]]);
     647                    $authors = get_users(['role__in' => ['editor', 'administrator', 'author']]);
    611648                    $return_authors = [];
    612649                    foreach ($authors as $author) {
     
    11751212                else $filename = basename($image_url);
    11761213
    1177                 $modified_filename = str_replace(" ","-",$post_title);
     1214                $modified_filename = sanitize_title($post_title);
    11781215                if(strpos($filename, '.') === false){
    11791216                    $filename = $modified_filename . '.png';
Note: See TracChangeset for help on using the changeset viewer.