Beispiel #1
0
 /**
  * Print necessary styles
  *
  * @return void
  *
  * @access public
  */
 public function printStylesheet()
 {
     if (AAM::isAAM()) {
         wp_enqueue_style('aam-bt', AAM_MEDIA . '/css/bootstrap.min.css');
         wp_enqueue_style('aam-db', AAM_MEDIA . '/css/datatables.min.css');
         wp_enqueue_style('aam-main', AAM_MEDIA . '/css/aam.css');
     }
 }
Beispiel #2
0
 /**
  * Initialize the AAM plugin
  *
  * @return AAM
  *
  * @access public
  * @static
  */
 public static function getInstance()
 {
     if (is_null(self::$_instance)) {
         load_plugin_textdomain(AAM_KEY, false, dirname(plugin_basename(__FILE__)) . '/Lang/');
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Beispiel #3
0
 /**
  * Filter posts from the list
  *  
  * @param array $posts
  * 
  * @return array
  * 
  * @access public
  */
 public function thePosts($posts)
 {
     $filtered = array();
     foreach ($posts as $post) {
         $object = AAM::getUser()->getObject('post', $post->ID);
         if (!$object->has('frontend.list')) {
             $filtered[] = $post;
         }
     }
     return $filtered;
 }
Beispiel #4
0
 /**
  * Check user capability
  * 
  * This is a hack function that add additional layout on top of WordPress
  * core functionality. Based on the capability passed in the $args array as
  * "0" element, it performs additional check on user's capability to manage
  * post.
  * 
  * @param array $allCaps
  * @param array $metaCaps
  * @param array $args
  * 
  * @return array
  * 
  * @access public
  */
 public function checkUserCap($allCaps, $metaCaps, $args)
 {
     //make sure that $args[2] is actually post ID
     if (isset($args[2]) && is_scalar($args[2])) {
         switch ($args[0]) {
             case 'edit_post':
                 $object = AAM::getUser()->getObject('post', $args[2]);
                 if ($object->has('backend.edit')) {
                     $allCaps = $this->restrictPostActions($allCaps, $metaCaps);
                 }
                 break;
             case 'delete_post':
                 $object = AAM::getUser()->getObject('post', $args[2]);
                 if ($object->has('backend.delete')) {
                     $allCaps = $this->restrictPostActions($allCaps, $metaCaps);
                 }
                 break;
         }
     }
     return $allCaps;
 }
Beispiel #5
0
 /**
  * Check user capability
  * 
  * This is a hack function that add additional layout on top of WordPress
  * core functionality. Based on the capability passed in the $args array as
  * "0" element, it performs additional check on user's capability to manage
  * post.
  * 
  * @param array $allCaps
  * @param array $metaCaps
  * @param array $args
  * 
  * @return array
  * 
  * @access public
  */
 public function checkUserCap($allCaps, $metaCaps, $args)
 {
     switch ($args[0]) {
         case 'edit_post':
             $object = AAM::getUser()->getObject('post', $args[2]);
             if ($object->has('backend.edit')) {
                 $allCaps = $this->restrictPostActions($allCaps, $metaCaps);
             }
             break;
         case 'delete_post':
             $object = AAM::getUser()->getObject('post', $args[2]);
             if ($object->has('backend.delete')) {
                 $allCaps = $this->restrictPostActions($allCaps, $metaCaps);
             }
             break;
     }
     return $allCaps;
 }
Beispiel #6
0
 /**
  * Write cache
  * 
  * @param string           $option
  * @param mixed            $value
  * @param AAM_Core_Subject $subject
  * 
  * @return void
  * 
  * @access public
  */
 public function writeCache($option, $value, AAM_Core_Subject $subject)
 {
     if ($this->isCacheOn() && !AAM::isAAM()) {
         $group = $subject->getUID() . '-' . $subject->getId();
         $this->cache[$group][$option] = $value;
         $this->save = true;
     }
 }