function Get_Meta($key = Null, $default = False, $post_id = Null)
 {
     # Get the post id
     if ($post_id == Null && Is_Object($GLOBALS['post'])) {
         $post_id = $GLOBALS['post']->ID;
     } elseif ($post_id == Null && !Is_Object($GLOBALS['post'])) {
         return False;
     }
     # Read meta data
     $arr_meta = Get_Post_Meta($post_id, '_wp_plugin_fancy_gallery', True);
     $arr_meta = Is_Array($arr_meta) ? $arr_meta : array();
     # Clean Meta data
     $arr_meta = Array_Filter($arr_meta);
     # Load default Meta data
     $arr_meta = Array_Merge($this->Default_Meta(), $arr_meta);
     # Get the key value
     if ($key == Null) {
         return $arr_meta;
     } elseif (isset($arr_meta[$key]) && $arr_meta[$key]) {
         return $arr_meta[$key];
     } else {
         return $default;
     }
 }
Exemplo n.º 2
0
        default:
            return ERROR | @Trigger_Error(101);
    }
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#Debug(SPrintF('[comp/Tasks/Dispatch]: SendToIDs = %s; SendedIDs = %s;',Implode(',',$SendToIDs),Implode(',',$SendedIDs)));
#-------------------------------------------------------------------------------
# сохраняем параметры задачи
$Task['Params']['SendToIDs'] = Implode(',', Array_Filter($SendToIDs));
$Task['Params']['SendedIDs'] = Implode(',', Array_Filter($SendedIDs));
$UTasks = array('Params' => $Task['Params']);
$IsUpdate = DB_Update('Tasks', $UTasks, array('ID' => $Task['ID']));
#-------------------------------------------------------------------------------
if (Is_Error($IsUpdate)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$GLOBALS['TaskReturnInfo']['Sended'] = array(SizeOf(Array_Filter($SendedIDs)));
$GLOBALS['TaskReturnInfo']['New'] = array($Count);
$GLOBALS['TaskReturnInfo']['Estimated'] = array(SizeOf(Array_Filter($SendToIDs)));
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (SizeOf($SendToIDs) > 0) {
    return $ExecuteTime;
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
return TRUE;
#-------------------------------------------------------------------------------
Exemplo n.º 3
0
 private function Save_Options()
 {
     # Check if this is a post request
     if (empty($_POST)) {
         return False;
     }
     # Add Capabilities
     if (isset($_POST['capabilities']) && Is_Array($_POST['capabilities'])) {
         foreach ($_POST['capabilities'] as $role_name => $arr_role) {
             if (!($role = get_role($role_name))) {
                 continue;
             }
             foreach ((array) $arr_role as $capability => $yes_no) {
                 if ($yes_no == 'yes') {
                     $role->add_cap($capability);
                 } else {
                     $role->remove_cap($capability);
                 }
             }
         }
         unset($_POST['capabilities']);
     }
     # Clean the Post array
     $_POST = StripSlashes_Deep($_POST);
     $options = Array_Filter($_POST, function ($value) {
         return $value == '0' || !empty($value);
     });
     # Save Options
     Update_Option(__CLASS__, $options);
     Delete_Option('wp_plugin_fancy_gallery_pro');
     Delete_Option('wp_plugin_fancy_gallery');
     # We delete the update cache
     $this->core->Clear_Plugin_Update_Cache();
     return True;
 }
Exemplo n.º 4
0
 static function saveOptions()
 {
     # Check if this is a post request
     if (empty($_POST)) {
         return False;
     }
     # Clean the Post array
     $options = StripSlashes_Deep($_POST);
     $options = Array_Filter($options, function ($value) {
         return $value == '0' || !empty($value);
     });
     # Save Options
     Update_Option(self::$options_key, $options);
     return True;
 }