[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-core/classes/ -> class-bp-attachment.php (source)

   1  <?php
   2  /**
   3   * Core attachment class.
   4   *
   5   * @package BuddyPress
   6   * @subpackage Core
   7   * @since 2.3.0
   8   */
   9  
  10  // Exit if accessed directly.
  11  defined( 'ABSPATH' ) || exit;
  12  
  13  /**
  14   * BP Attachment class.
  15   *
  16   * Extend it to manage your component's uploads.
  17   *
  18   * @since 2.3.0
  19   */
  20  abstract class BP_Attachment {
  21  
  22      /** Upload properties *****************************************************/
  23  
  24      /**
  25       * The file being uploaded.
  26       *
  27       * @var array
  28       */
  29      public $attachment = array();
  30  
  31      /**
  32       * The default args to be merged with the
  33       * ones passed by the child class.
  34       *
  35       * @var array
  36       */
  37      protected $default_args = array(
  38          'original_max_filesize'  => 0,
  39          'allowed_mime_types'     => array(),
  40          'base_dir'               => '',
  41          'action'                 => '',
  42          'file_input'             => '',
  43          'upload_error_strings'   => array(),
  44          'required_wp_files'      => array( 'file' ),
  45          'upload_dir_filter_args' => 0,
  46      );
  47  
  48      /**
  49       * Construct Upload parameters.
  50       *
  51       * @since 2.3.0
  52       * @since 2.4.0 Add the $upload_dir_filter_args argument to the $arguments array
  53       *
  54       * @param array|string $args {
  55       *     @type int    $original_max_filesize  Maximum file size in kilobytes. Defaults to php.ini settings.
  56       *     @type array  $allowed_mime_types     List of allowed file extensions (eg: array( 'jpg', 'gif', 'png' ) ).
  57       *                                          Defaults to WordPress allowed mime types.
  58       *     @type string $base_dir               Component's upload base directory. Defaults to WordPress 'uploads'.
  59       *     @type string $action                 The upload action used when uploading a file, $_POST['action'] must be set
  60       *                                          and its value must equal $action {@link wp_handle_upload()} (required).
  61       *     @type string $file_input             The name attribute used in the file input. (required).
  62       *     @type array  $upload_error_strings   A list of specific error messages (optional).
  63       *     @type array  $required_wp_files      The list of required WordPress core files. Default: array( 'file' ).
  64       *     @type int    $upload_dir_filter_args 1 to receive the original Upload dir array in the Upload dir filter, 0 otherwise.
  65       *                                          Defaults to 0 (optional).
  66       * }
  67       */
  68  	public function __construct( $args = '' ) {
  69          // Upload action and the file input name are required parameters.
  70          if ( empty( $args['action'] ) || empty( $args['file_input'] ) ) {
  71              return false;
  72          }
  73  
  74          // Sanitize the action ID and the file input name.
  75          $this->action     = sanitize_key( $args['action'] );
  76          $this->file_input = sanitize_key( $args['file_input'] );
  77  
  78          /**
  79           * Max file size defaults to php ini settings or, in the case of
  80           * a multisite config, the root site fileupload_maxk option.
  81           */
  82          $this->default_args['original_max_filesize'] = (int) wp_max_upload_size();
  83  
  84          $params = bp_parse_args( $args, $this->default_args, $this->action . '_upload_params' );
  85  
  86          foreach ( $params as $key => $param ) {
  87              if ( 'upload_error_strings' === $key ) {
  88                  $this->{$key} = $this->set_upload_error_strings( $param );
  89  
  90              // Sanitize the base dir.
  91              } elseif ( 'base_dir' === $key ) {
  92                  $this->{$key} = sanitize_title( $param );
  93  
  94              // Sanitize the upload dir filter arg to pass.
  95              } elseif ( 'upload_dir_filter_args' === $key ) {
  96                  $this->{$key} = (int) $param;
  97  
  98              // Action & File input are already set and sanitized.
  99              } elseif ( 'action' !== $key && 'file_input' !== $key ) {
 100                  $this->{$key} = $param;
 101              }
 102          }
 103  
 104          // Set the path/url and base dir for uploads.
 105          $this->set_upload_dir();
 106      }
 107  
 108      /**
 109       * Set upload path and url for the component.
 110       *
 111       * @since 2.3.0
 112       *
 113       */
 114  	public function set_upload_dir() {
 115          // Set the directory, path, & url variables.
 116          $this->upload_dir  = bp_upload_dir();
 117  
 118          if ( empty( $this->upload_dir ) ) {
 119              return false;
 120          }
 121  
 122          $this->upload_path = $this->upload_dir['basedir'];
 123          $this->url         = $this->upload_dir['baseurl'];
 124  
 125          // Ensure URL is https if SSL is set/forced.
 126          if ( is_ssl() ) {
 127              $this->url = str_replace( 'http://', 'https://', $this->url );
 128          }
 129  
 130          /**
 131           * Custom base dir.
 132           *
 133           * If the component set this property, set the specific path, url and create the dir
 134           */
 135          if ( ! empty( $this->base_dir ) ) {
 136              $this->upload_path = trailingslashit( $this->upload_path ) . $this->base_dir;
 137              $this->url         = trailingslashit( $this->url  ) . $this->base_dir;
 138  
 139              // Finally create the base dir.
 140              $this->create_dir();
 141          }
 142      }
 143  
 144      /**
 145       * Set Upload error messages.
 146       *
 147       * Used into the $overrides argument of BP_Attachment->upload()
 148       *
 149       * @since 2.3.0
 150       *
 151       * @param array $param A list of error messages to add to BuddyPress core ones.
 152       * @return array $upload_errors The list of upload errors.
 153       */
 154  	public function set_upload_error_strings( $param = array() ) {
 155          /**
 156           * Index of the array is the error code
 157           * Custom errors will start at 9 code
 158           */
 159          $upload_errors = array(
 160              0 => __( 'The file was uploaded successfully', 'buddypress' ),
 161              1 => __( 'The uploaded file exceeds the maximum allowed file size for this site', 'buddypress' ),
 162  
 163              /* translators: %s: Max file size for the file */
 164              2 => sprintf( __( 'The uploaded file exceeds the maximum allowed file size of: %s', 'buddypress' ), size_format( $this->original_max_filesize ) ),
 165              3 => __( 'The uploaded file was only partially uploaded.', 'buddypress' ),
 166              4 => __( 'No file was uploaded.', 'buddypress' ),
 167              5 => '',
 168              6 => __( 'Missing a temporary folder.', 'buddypress' ),
 169              7 => __( 'Failed to write file to disk.', 'buddypress' ),
 170              8 => __( 'File upload stopped by extension.', 'buddypress' ),
 171          );
 172  
 173          if ( ! array_intersect_key( $upload_errors, (array) $param ) ) {
 174              foreach ( $param as $key_error => $error_message ) {
 175                  $upload_errors[ $key_error ] = $error_message;
 176              }
 177          }
 178  
 179          return $upload_errors;
 180      }
 181  
 182      /**
 183       * Include the WordPress core needed files.
 184       *
 185       * @since 2.3.0
 186       */
 187  	public function includes() {
 188          foreach ( array_unique( $this->required_wp_files ) as $wp_file ) {
 189              if ( ! file_exists( ABSPATH . "/wp-admin/includes/{$wp_file}.php" ) ) {
 190                  continue;
 191              }
 192  
 193              require_once( ABSPATH . "/wp-admin/includes/{$wp_file}.php" );
 194          }
 195      }
 196  
 197      /**
 198       * Upload the attachment.
 199       *
 200       * @since 2.3.0
 201       *
 202       * @param array       $file              The appropriate entry the from $_FILES superglobal.
 203       * @param string      $upload_dir_filter A specific filter to be applied to 'upload_dir' (optional).
 204       * @param string|null $time              Optional. Time formatted in 'yyyy/mm'. Default null.
 205       * @return array On success, returns an associative array of file attributes.
 206       *               On failure, returns an array containing the error message
 207       *               (eg: array( 'error' => $message ) )
 208       */
 209  	public function upload( $file, $upload_dir_filter = '', $time = null ) {
 210          /**
 211           * Upload action and the file input name are required parameters.
 212           *
 213           * @see BP_Attachment:__construct()
 214           */
 215          if ( empty( $this->action ) || empty( $this->file_input ) ) {
 216              return false;
 217          }
 218  
 219          /**
 220           * Add custom rules before enabling the file upload
 221           */
 222          add_filter( "{$this->action}_prefilter", array( $this, 'validate_upload' ), 10, 1 );
 223  
 224          // Set Default overrides.
 225          $overrides = array(
 226              'action'               => $this->action,
 227              'upload_error_strings' => $this->upload_error_strings,
 228          );
 229  
 230          /**
 231           * Add a mime override if needed
 232           * Used to restrict uploads by extensions
 233           */
 234          if ( ! empty( $this->allowed_mime_types ) ) {
 235              $mime_types = $this->validate_mime_types();
 236  
 237              if ( ! empty( $mime_types ) ) {
 238                  $overrides['mimes'] = $mime_types;
 239              }
 240          }
 241  
 242          /**
 243           * If you need to add some overrides we haven't thought of.
 244           *
 245           * @param array $overrides The wp_handle_upload overrides
 246           */
 247          $overrides = apply_filters( 'bp_attachment_upload_overrides', $overrides );
 248  
 249          $this->includes();
 250  
 251          /**
 252           * If the $base_dir was set when constructing the class,
 253           * and no specific filter has been requested, use a default
 254           * filter to create the specific $base dir
 255           * @see  BP_Attachment->upload_dir_filter()
 256           */
 257          if ( empty( $upload_dir_filter ) && ! empty( $this->base_dir ) ) {
 258              $upload_dir_filter = array( $this, 'upload_dir_filter' );
 259          }
 260  
 261          // Make sure the file will be uploaded in the attachment directory.
 262          if ( ! empty( $upload_dir_filter ) ) {
 263              add_filter( 'upload_dir', $upload_dir_filter, 10, $this->upload_dir_filter_args );
 264          }
 265  
 266          // Helper for utf-8 filenames.
 267          add_filter( 'sanitize_file_name', array( $this, 'sanitize_utf8_filename' ) );
 268  
 269          // Upload the attachment.
 270          $this->attachment = wp_handle_upload( $file[ $this->file_input ], $overrides, $time );
 271  
 272          remove_filter( 'sanitize_file_name', array( $this, 'sanitize_utf8_filename' ) );
 273  
 274          // Restore WordPress Uploads data.
 275          if ( ! empty( $upload_dir_filter ) ) {
 276              remove_filter( 'upload_dir', $upload_dir_filter, 10 );
 277          }
 278  
 279          // Finally return the uploaded file or the error.
 280          return $this->attachment;
 281      }
 282  
 283      /**
 284       * Helper to convert utf-8 characters in filenames to their ASCII equivalent.
 285       *
 286       * @since 2.9.0
 287       *
 288       * @param  string $retval Filename.
 289       * @return string
 290       */
 291  	public function sanitize_utf8_filename( $retval ) {
 292          // PHP 5.4+ or with PECL intl 2.0+
 293          if ( function_exists( 'transliterator_transliterate' ) && seems_utf8( $retval ) ) {
 294              $retval = transliterator_transliterate( 'Any-Latin; Latin-ASCII; [\u0080-\u7fff] remove', $retval );
 295  
 296          // Older.
 297          } else {
 298              // Use WP's built-in function to convert accents to their ASCII equivalent.
 299              $retval = remove_accents( $retval );
 300  
 301              // Still here? use iconv().
 302              if ( function_exists( 'iconv' ) && seems_utf8( $retval ) ) {
 303                  $retval = iconv( 'UTF-8', 'ASCII//TRANSLIT//IGNORE', $retval );
 304              }
 305          }
 306  
 307          return $retval;
 308      }
 309  
 310      /**
 311       * Validate the allowed mime types using WordPress allowed mime types.
 312       *
 313       * In case of a multisite, the mime types are already restricted by
 314       * the 'upload_filetypes' setting. BuddyPress will respect this setting.
 315       *
 316       * @see check_upload_mimes()
 317       *
 318       * @since 2.3.0
 319       *
 320       */
 321  	protected function validate_mime_types() {
 322          $wp_mimes = get_allowed_mime_types();
 323          $valid_mimes = array();
 324  
 325          // Set the allowed mimes for the upload.
 326          foreach ( (array) $this->allowed_mime_types as $ext ) {
 327              foreach ( $wp_mimes as $ext_pattern => $mime ) {
 328                  if ( $ext !== '' && strpos( $ext_pattern, $ext ) !== false ) {
 329                      $valid_mimes[$ext_pattern] = $mime;
 330                  }
 331              }
 332          }
 333          return $valid_mimes;
 334      }
 335  
 336      /**
 337       * Specific upload rules.
 338       *
 339       * Override this function from your child class to build your specific rules
 340       * By default, if an original_max_filesize is provided, a check will be done
 341       * on the file size.
 342       *
 343       * @see BP_Attachment_Avatar->validate_upload() for an example of use
 344       *
 345       * @since 2.3.0
 346       *
 347       * @param array $file The temporary file attributes (before it has been moved).
 348       * @return array The file.
 349       */
 350  	public function validate_upload( $file = array() ) {
 351          // Bail if already an error.
 352          if ( ! empty( $file['error'] ) ) {
 353              return $file;
 354          }
 355  
 356          if ( ! empty( $this->original_max_filesize ) && $file['size'] > $this->original_max_filesize ) {
 357              $file['error'] = 2;
 358          }
 359  
 360          // Return the file.
 361          return $file;
 362      }
 363  
 364      /**
 365       * Default filter to save the attachments.
 366       *
 367       * @since 2.3.0
 368       * @since 2.4.0 Add the $upload_dir parameter to the method
 369       *
 370       *       regarding to context
 371       *
 372       * @param array $upload_dir The original Uploads dir.
 373       * @return array The upload directory data.
 374       */
 375  	public function upload_dir_filter( $upload_dir = array() ) {
 376  
 377          /**
 378           * Filters the component's upload directory.
 379           *
 380           * @since 2.3.0
 381           * @since 2.4.0 Include the original Upload directory as the second parameter of the filter.
 382           *
 383           * @param array $value          Array containing the path, URL, and other helpful settings.
 384           * @param array $upload_dir     The original Uploads dir.
 385           */
 386          return apply_filters( 'bp_attachment_upload_dir', array(
 387              'path'    => $this->upload_path,
 388              'url'     => $this->url,
 389              'subdir'  => false,
 390              'basedir' => $this->upload_path,
 391              'baseurl' => $this->url,
 392              'error'   => false
 393          ), $upload_dir );
 394      }
 395  
 396      /**
 397       * Create the custom base directory for the component uploads.
 398       *
 399       * Override this function in your child class to run specific actions.
 400       * (eg: add an .htaccess file)
 401       *
 402       * @since 2.3.0
 403       *
 404       */
 405  	public function create_dir() {
 406          // Bail if no specific base dir is set.
 407          if ( empty( $this->base_dir ) ) {
 408              return false;
 409          }
 410  
 411          // Check if upload path already exists.
 412          if ( ! is_dir( $this->upload_path ) ) {
 413  
 414              // If path does not exist, attempt to create it.
 415              if ( ! wp_mkdir_p( $this->upload_path ) ) {
 416                  return false;
 417              }
 418          }
 419  
 420          // Directory exists.
 421          return true;
 422      }
 423  
 424      /**
 425       * Crop an image file.
 426       *
 427       * @since 2.3.0
 428       *
 429       * @param array $args {
 430       *     @type string $original_file The source file (absolute path) for the Attachment.
 431       *     @type int    $crop_x        The start x position to crop from.
 432       *     @type int    $crop_y        The start y position to crop from.
 433       *     @type int    $crop_w        The width to crop.
 434       *     @type int    $crop_h        The height to crop.
 435       *     @type int    $dst_w         The destination width.
 436       *     @type int    $dst_h         The destination height.
 437       *     @type int    $src_abs       Optional. If the source crop points are absolute.
 438       *     @type string $dst_file      Optional. The destination file to write to.
 439       * }
 440       *
 441       * @return string|WP_Error New filepath on success, WP_Error on failure.
 442       */
 443  	public function crop( $args = array() ) {
 444          $wp_error = new WP_Error();
 445  
 446          $r = bp_parse_args( $args, array(
 447              'original_file' => '',
 448              'crop_x'        => 0,
 449              'crop_y'        => 0,
 450              'crop_w'        => 0,
 451              'crop_h'        => 0,
 452              'dst_w'         => 0,
 453              'dst_h'         => 0,
 454              'src_abs'       => false,
 455              'dst_file'      => false,
 456          ), 'bp_attachment_crop_args' );
 457  
 458          if ( empty( $r['original_file'] ) || ! file_exists( $r['original_file'] ) ) {
 459              $wp_error->add( 'crop_error', __( 'Cropping the file failed: missing source file.', 'buddypress' ) );
 460              return $wp_error;
 461          }
 462  
 463          // Check image file pathes.
 464          $path_error = __( 'Cropping the file failed: the file path is not allowed.', 'buddypress' );
 465  
 466          // Make sure it's coming from an uploaded file.
 467          if ( false === strpos( $r['original_file'], $this->upload_path ) ) {
 468              $wp_error->add( 'crop_error', $path_error );
 469              return $wp_error;
 470          }
 471  
 472          /**
 473           * If no destination file is provided, WordPress will use a default name
 474           * and will write the file in the source file's folder.
 475           * If a destination file is provided, we need to make sure it's going into uploads.
 476           */
 477          if ( ! empty( $r['dst_file'] ) && false === strpos( $r['dst_file'], $this->upload_path ) ) {
 478              $wp_error->add( 'crop_error', $path_error );
 479              return $wp_error;
 480          }
 481  
 482          // Check image file types.
 483          $check_types = array( 'src_file' => array( 'file' => $r['original_file'], 'error' => _x( 'source file', 'Attachment source file', 'buddypress' ) ) );
 484          if ( ! empty( $r['dst_file'] ) ) {
 485              $check_types['dst_file'] = array( 'file' => $r['dst_file'], 'error' => _x( 'destination file', 'Attachment destination file', 'buddypress' ) );
 486          }
 487  
 488          /**
 489           * WordPress image supported types.
 490           * @see wp_attachment_is()
 491           */
 492          $supported_image_types = array(
 493              'jpg'  => 1,
 494              'jpeg' => 1,
 495              'jpe'  => 1,
 496              'gif'  => 1,
 497              'png'  => 1,
 498          );
 499  
 500          foreach ( $check_types as $file ) {
 501              $is_image      = wp_check_filetype( $file['file'] );
 502              $ext           = $is_image['ext'];
 503  
 504              if ( empty( $ext ) || empty( $supported_image_types[ $ext ] ) ) {
 505                  $wp_error->add(
 506                      'crop_error',
 507                      sprintf(
 508                          /* translators: %s: image file extension */
 509                          __( 'Cropping the file failed: %s is not a supported image file.', 'buddypress' ),
 510                          $file['error']
 511                      )
 512                  );
 513  
 514                  return $wp_error;
 515              }
 516          }
 517  
 518          // Add the image.php to the required WordPress files, if it's not already the case.
 519          $required_files = array_flip( $this->required_wp_files );
 520          if ( ! isset( $required_files['image'] ) ) {
 521              $this->required_wp_files[] = 'image';
 522          }
 523  
 524          // Load the files.
 525          $this->includes();
 526  
 527          // Finally crop the image.
 528          return wp_crop_image( $r['original_file'], (int) $r['crop_x'], (int) $r['crop_y'], (int) $r['crop_w'], (int) $r['crop_h'], (int) $r['dst_w'], (int) $r['dst_h'], $r['src_abs'], $r['dst_file'] );
 529      }
 530  
 531      /**
 532       * Build script datas for the Uploader UI.
 533       *
 534       * Override this method from your child class to build the script datas.
 535       *
 536       * @since 2.3.0
 537       *
 538       * @return array The javascript localization data.
 539       */
 540  	public function script_data() {
 541          $script_data = array(
 542              'action'            => $this->action,
 543              'file_data_name'    => $this->file_input,
 544              'max_file_size'     => $this->original_max_filesize,
 545              'feedback_messages' => array(
 546                  1 => __( 'Sorry, uploading the file failed.', 'buddypress' ),
 547                  2 => __( 'File successfully uploaded.', 'buddypress' ),
 548              ),
 549          );
 550  
 551          return $script_data;
 552      }
 553  
 554      /**
 555       * Get full data for an image
 556       *
 557       * @since 2.4.0
 558       *
 559       * @param string $file Absolute path to the uploaded image.
 560       * @return bool|array   An associate array containing the width, height and metadatas.
 561       *                      False in case an important image attribute is missing.
 562       */
 563  	public static function get_image_data( $file ) {
 564          // Try to get image basic data.
 565          list( $width, $height, $sourceImageType ) = @getimagesize( $file );
 566  
 567          // No need to carry on if we couldn't get image's basic data.
 568          if ( is_null( $width ) || is_null( $height ) || is_null( $sourceImageType ) ) {
 569              return false;
 570          }
 571  
 572          // Initialize the image data.
 573          $image_data = array(
 574              'width'  => $width,
 575              'height' => $height,
 576          );
 577  
 578          /**
 579           * Make sure the wp_read_image_metadata function is reachable for the old Avatar UI
 580           * or if WordPress < 3.9 (New Avatar UI is not available in this case)
 581           */
 582          if ( ! function_exists( 'wp_read_image_metadata' ) ) {
 583              require_once( ABSPATH . 'wp-admin/includes/image.php' );
 584          }
 585  
 586          // Now try to get image's meta data.
 587          $meta = wp_read_image_metadata( $file );
 588          if ( ! empty( $meta ) ) {
 589              $image_data['meta'] = $meta;
 590          }
 591  
 592          /**
 593           * Filter here to add/remove/edit data to the image full data
 594           *
 595           * @since 2.4.0
 596           *
 597           * @param array $image_data An associate array containing the width, height and metadatas.
 598           */
 599          return apply_filters( 'bp_attachments_get_image_data', $image_data );
 600      }
 601  
 602      /**
 603       * Edit an image file to resize it or rotate it
 604       *
 605       * @since 2.4.0
 606       *
 607       * @param string $attachment_type The attachment type (eg: avatar or cover_image). Required.
 608       * @param array  $args {
 609       *     @type string $file     Absolute path to the image file (required).
 610       *     @type int    $max_w    Max width attribute for the editor's resize method (optional).
 611       *     @type int    $max_h    Max height attribute for the editor's resize method (optional).
 612       *     @type bool   $crop     Crop attribute for the editor's resize method (optional).
 613       *     @type float  $rotate   Angle for the editor's rotate method (optional).
 614       *     @type int    $quality  Compression quality on a 1-100% scale (optional).
 615       *     @type bool   $save     Whether to use the editor's save method or not (optional).
 616       * }
 617       * @return string|WP_Image_Editor|WP_Error The edited image path or the WP_Image_Editor object in case of success,
 618       *                                         an WP_Error object otherwise.
 619       */
 620  	public static function edit_image( $attachment_type, $args = array() ) {
 621          if ( empty( $attachment_type ) ) {
 622              return new WP_Error( 'missing_parameter' );
 623          }
 624  
 625          $r = bp_parse_args( $args, array(
 626              'file'   => '',
 627              'max_w'   => 0,
 628              'max_h'   => 0,
 629              'crop'    => false,
 630              'rotate'  => 0,
 631              'quality' => 90,
 632              'save'    => true,
 633          ), 'attachment_' . $attachment_type . '_edit_image' );
 634  
 635          // Make sure we have to edit the image.
 636          if ( empty( $r['max_w'] ) && empty( $r['max_h'] ) && empty( $r['rotate'] ) && empty( $r['file'] ) ) {
 637              return new WP_Error( 'missing_parameter' );
 638          }
 639  
 640          // Get the image editor.
 641          $editor = wp_get_image_editor( $r['file'] );
 642  
 643          if ( is_wp_error( $editor ) ) {
 644              return $editor;
 645          }
 646  
 647          $editor->set_quality( $r['quality'] );
 648  
 649          if ( ! empty( $r['rotate'] ) ) {
 650              $rotated = $editor->rotate( $r['rotate'] );
 651  
 652              // Stop in case of error.
 653              if ( is_wp_error( $rotated ) ) {
 654                  return $rotated;
 655              }
 656          }
 657  
 658          if ( ! empty( $r['max_w'] ) || ! empty( $r['max_h'] ) ) {
 659              $resized = $editor->resize( $r['max_w'], $r['max_h'], $r['crop'] );
 660  
 661              // Stop in case of error.
 662              if ( is_wp_error( $resized ) ) {
 663                  return $resized;
 664              }
 665          }
 666  
 667          // Use the editor save method to get a path to the edited image.
 668          if ( true === $r['save'] ) {
 669              return $editor->save( $editor->generate_filename() );
 670  
 671          // Need to do some other edit actions or use a specific method to save file.
 672          } else {
 673              return $editor;
 674          }
 675      }
 676  }


Generated: Mon Sep 28 01:01:32 2020 Cross-referenced by PHPXref 0.7.1