403Webshell
Server IP : 172.67.159.97  /  Your IP : 216.73.217.154
Web Server : nginx/1.24.0
System : Linux wordpress-sites 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/rebeccaone.com/wp-content/plugins/cornerstone/includes/classes/Services/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/rebeccaone.com/wp-content/plugins/cornerstone/includes/classes/Services/Preferences.php
<?php

namespace Themeco\Cornerstone\Services;

use Themeco\Cornerstone\Plugin;

class Preferences implements Service {

  protected $defaults;
  protected $preferences = [];
  protected $config;

  public function __construct(Config $config) {
    $this->config = $config;
  }

  public function get_defaults() {
    if ( ! isset( $this->defaults ) ) {
      $defaults = $this->config->group( 'preference-defaults' );
      $keybinding_data = $this->config->group( 'keybindings' );

      $defaults['keybindings'] = [];

      foreach ($keybinding_data as $name => $binding) {
        $defaults['keybindings'][$name] = $binding[0];
      }

      $this->defaults = apply_filters('cs_app_preference_defaults', $defaults );
    }
    return $this->defaults;
  }

  public function get_user_preferences( $user_id = null ) {

    if ( ! $user_id ) {

      $user_id = get_current_user_id();

      if ( ! $user_id ) {
        return array();
      }

    }

    if ( ! isset( $this->preferences['u'. $user_id ] ) ) {
      $user_meta = get_user_meta( $user_id, 'cs_app_preferences', true );

      if ( ! is_array( $user_meta ) ) {
        $user_meta = array();
      }

      $defaults = $this->get_defaults();
      $preferences = array_merge( $defaults, $user_meta );
      $preferences['keybindings'] = array_merge( $defaults['keybindings'], isset( $user_meta['keybindings'] ) ? $user_meta['keybindings'] : [] );

      $this->preferences['u'. $user_id ] = apply_filters('cs_app_preferences', $preferences );

    }

    return $this->preferences['u'. $user_id ];

  }

  public function update_user_preferences( $user_id = null, $values = null ) {

    if ( ! $values ) {
      return null;
    }

    if ( ! $user_id ) {

      $user_id = get_current_user_id();

      if ( ! $user_id ) {
        return array();
      }

    }

    unset( $this->preferences['u'. $user_id ] );

    return update_user_meta( $user_id, 'cs_app_preferences', $values );

  }

  public function get_preference_controls() {
    return apply_filters("cs_preference_controls", $this->config->group( 'preference-controls' ));
  }

  public function get_preference( $name, $fallback = null, $user_id = null ) {
    $preferences = $this->get_user_preferences($user_id);
    return isset( $preferences[ $name ] ) ? $preferences[$name] : $fallback;
  }

  public function get_preferences() {
    return $this->preferences;
  }
}

Youez - 2016 - github.com/yon3zu
LinuXploit