Changeset 618822
- Timestamp:
- 10/29/2012 09:18:12 PM (13 years ago)
- Location:
- ultimate-cms/trunk
- Files:
-
- 1 added
- 9 edited
-
class-xydac-cms-module.php (modified) (12 diffs)
-
class-xydac-page-type-use.php (added)
-
class-xydac-ultimate-cms-core.php (modified) (10 diffs)
-
index.php (modified) (8 diffs)
-
modules/page-type/class-xydac-page-type-fields.php (modified) (3 diffs)
-
modules/page-type/class-xydac-page-type-manager.php (modified) (2 diffs)
-
modules/taxonomy/class-xydac-taxonomy-type-fields.php (modified) (2 diffs)
-
modules/taxonomy/class-xydac-taxonomy-type-manager.php (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
-
style.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ultimate-cms/trunk/class-xydac-cms-module.php
r618227 r618822 58 58 if($this->has_custom_fields){ 59 59 $active_opt_arr = array(); 60 $active_names = $this->get_ active_names();60 $active_names = $this->get_main_names(); 61 61 if(is_array($active_names)) 62 62 foreach($active_names as $opt=>$val) … … 177 177 178 178 179 public function insert_object($type,$name,$ args,$namefieldname){179 public function insert_object($type,$name,$fieldmaster,$args,$namefieldname){ 180 180 if($type=='main' || $type=='field'){ 181 181 $message=''; … … 183 183 if(empty($name)) 184 184 $message = new WP_Error('err', $this->module_label.__(" Name is required to create ",XYDAC_CMS_NAME).$this->module_label); 185 elseif( in_array($name,$this->get_main_names()))186 $message = new WP_Error('err', $this->module_label.__(" Name already registered !!!",XYDAC_CMS_NAME));185 elseif(($type=='main' && in_array($name,(array)$this->get_main_names())) || ($type=='field' && in_array($name,(array)$this->get_field_names($fieldmaster)))) 186 $message = new WP_Error('err', $this->module_label.__(" Name already registered !!!",XYDAC_CMS_NAME)); 187 187 elseif($name=="active"){ 188 188 $message = new WP_Error('err', $this->module_label.__(" Name Not allowed",XYDAC_CMS_NAME)); … … 190 190 else{ 191 191 $args[$namefieldname] = sanitize_title_with_dashes($args[$namefieldname]); 192 if($this->dao->insert_object($this->get_registered_option($type),$args)) 192 $opt = ($type=='main')?$this->get_registered_option($type):$this->get_registered_option($type).'_'.$fieldmaster; 193 if($this->dao->insert_object($opt,$args)) 193 194 $message = $this->module_label.__(' Inserted.',XYDAC_CMS_NAME); 194 195 else … … 198 199 }else return new WP_Error('err', $this->module_label.__(" Name Not allowed",XYDAC_CMS_NAME)); 199 200 } 200 public function update_object($type,$name,$args,$oldname,$namefieldname){ 201 //-fieldmaster : the object of whose field has to updated 202 public function update_object($type,$name,$fieldmaster,$args,$oldname,$namefieldname){ 201 203 if($type=='main' || $type=='field'){ 202 204 $message=''; … … 205 207 if(empty($name)) 206 208 $message = new WP_Error('err', $this->module_label.__(" Name is required to create ",XYDAC_CMS_NAME).$this->module_label); 207 elseif( !in_array($name,$this->get_main_names()))209 elseif(($type=='main' && !in_array($name,$this->get_main_names())) || ($type=='field' && !in_array($name,$this->get_field_names($fieldmaster)))) 208 210 $message = new WP_Error('err', $this->module_label.__(" Name not registered !!!",XYDAC_CMS_NAME)); 209 211 elseif($name=="active"){ … … 213 215 } 214 216 else{ 215 if($this->dao->update_object($this->get_registered_option($type),$args,$oldname,$namefieldname)) 217 $opt = ($type=='main')?$this->get_registered_option($type):$this->get_registered_option($type).'_'.$fieldmaster; 218 if($this->dao->update_object($opt,$args,$oldname,$namefieldname)) 216 219 { 217 220 $message = $this->module_label.__(' Updated.',XYDAC_CMS_NAME); … … 223 226 }else return new WP_Error('err', $this->module_label.__(" Name Not allowed",XYDAC_CMS_NAME)); 224 227 } 225 public function delete_object($type,$name,$ namefieldname){228 public function delete_object($type,$name,$fieldmaster,$namefieldname){ 226 229 if($type=='main' || $type=='field'){ 227 if($this->dao->delete_object($this->get_registered_option($type),$name,$namefieldname)) 230 $opt = ($type=='main')?$this->get_registered_option($type):$this->get_registered_option($type).'_'.$fieldmaster; 231 if($this->dao->delete_object($opt,$name,$namefieldname)) 228 232 { 229 233 $this->deactivate_main($name); … … 310 314 return $this->_get_option('field',$args,$name); 311 315 } 316 function get_field_by_name($name,$field_name,$fieldname_colname=null){ 317 if(!$this->has_custom_fields || !isset($this->registered_option['field'])) 318 return; 319 if(!empty($fieldname_colname)&&!empty($fieldtype_colname)) 320 return $this->_get_option('field',array( 321 'is_value_array'=>'true','match_keys'=>'true', 322 'values'=>array($fieldname_colname=>array($field_name)) 323 ),$name); 324 else 325 return $this->_get_option('field',array( 326 'is_value_array'=>'true','match_keys'=>'true', 327 'values'=>array('field_name'=>array($field_name)) 328 ),$name); 329 } 312 330 /* This function returns the array of field items which are active 313 331 ^ $name: specifies the object name of which field is to be fetched. … … 330 348 return; 331 349 if(!empty($fieldname_colname)) 332 return $this->_get_option('field',array('fields'=>array($fieldname_colname) ),$name);333 else 334 return $this->_get_option('field',array('fields'=>array('field_name') ),$name);350 return $this->_get_option('field',array('fields'=>array($fieldname_colname),'is_value_array'=>'true','filter'=>array('value')),$name); 351 else 352 return $this->_get_option('field',array('fields'=>array('field_name'),'is_value_array'=>'true','filter'=>array('value')),$name); 335 353 } 336 354 /* This function returns the string of field's type … … 450 468 { 451 469 $formaction = $tab['href']; 452 $selectdata = $this->get_ active_names();470 $selectdata = $this->get_main_names(); 453 471 xydac()->log('view_fields_func',$selectdata); 454 472 ?> … … 483 501 private function show_sync_page($arr,$formaction) 484 502 { 485 $getCustomField = function($resultarr,$var){foreach($resultarr['custom_fields'] as $v)if($v['key']==$var)return $v['value'];};503 $getCustomField = create_function('$resultarr,$var',"foreach({$resultarr['custom_fields']} as {$v})if( {$v['key']} == {$var})return {$v['value']};"); 486 504 echo ' 487 505 <table class="wp-list-table widefat fixed posts" cellspacing="0"> -
ultimate-cms/trunk/class-xydac-ultimate-cms-core.php
r618272 r618822 10 10 var $parent_class; // The main class that uses object of this class 11 11 var $type; //used in parent class; 12 var $field_val; //this has the name of type of which field is being edited. 12 13 13 14 var $xydac_core_name; … … 45 46 $this->parent_class = $obj; 46 47 $this->xydac_core_name = $obj->get_module_name(); 47 $this->xydac_core_label = $obj->get_module_label();48 $this->xydac_core_label = ($type=='main') ? $obj->get_module_label() : $obj->get_module_label().' Fields'; 48 49 $this->type = $type; 49 50 $tab = (($this->type=='main')?'modules':(($this->type=='field')?'fields':'xydac_sync')); 50 $this->baselink = $obj->get_base_path($tab);51 $this->baselink = apply_filters( 'xydac_core_editlink',$obj->get_base_path($tab)); 51 52 $this->xydac_core_form_array = apply_filters('xydac_core_form_array', $formarray,$this->xydac_core_name); 52 $ field_val = isset($field_val)?$field_val:'';53 $this->field_val = $field_val = isset($field_val)?$field_val:''; 53 54 /* if(isset($optionname) && isset($optionvalue) && is_array($optionvalue)){ 54 55 $this->option_value = $optionvalue; … … 64 65 65 66 $this->activation = $obj->uses_active($this->type); 66 $this->xydac_core_form_action = $obj->get_base_path($tab);67 $this->xydac_core_form_action = apply_filters( 'xydac_core_editlink',$obj->get_base_path($tab)); 67 68 $this->namefield_name = apply_filters( 'xydac_core_field_name', 'name' ); 68 69 $this->args = $args; … … 80 81 function postHandler() 81 82 { 83 82 84 if(isset($_POST[$this->xydac_core_name.'_doaction_submit'])&& isset($_POST['action'])) 83 85 $this->bulk_action(); … … 93 95 { 94 96 $this->xydac_core_editmode = true; 95 $this->xydac_editdata = $this->parent_class->get_main_by_name($_GET[$this->xydac_core_name."_name"]); 97 $this->xydac_editdata = ($this->type=='main')? $this->parent_class->get_main_by_name($_GET[$this->xydac_core_name."_name"]) : $this->parent_class->get_field_by_name($this->field_val,$_GET[$this->xydac_core_name."_name"]) ; 98 //if manage is set it means we are at fields 99 if(isset($_GET["manage_".$this->xydac_core_name])){ 100 $key = $_GET[$this->xydac_core_name."_name"]; 101 $this->xydac_editdata = $this->xydac_editdata[$key]; 102 } 103 104 //$this->xydac_editdata = $this->parent_class->get_main_by_name($_GET[$this->xydac_core_name."_name"]); 96 105 $this->xydac_editdata[$this->xydac_core_name.'_old'] = $_GET[$this->xydac_core_name."_name"]; 97 106 } … … 180 189 function insert() 181 190 { 182 $msg = $this->parent_class->insert_object($this->type, $_POST[$this->xydac_core_name][$this->namefield_name], apply_filters( 'xydac_core_insert',$_POST[$this->xydac_core_name]),$this->namefield_name); 191 192 $msg = $this->parent_class->insert_object($this->type, $_POST[$this->xydac_core_name][$this->namefield_name],$_GET['manage_'.$this->xydac_core_name], apply_filters( 'xydac_core_insert',$_POST[$this->xydac_core_name]),$this->namefield_name); 183 193 if(is_wp_error(($msg))) 184 194 $this->xydac_core_error= $msg; … … 191 201 function update() 192 202 { 203 193 204 $this->xydac_core_editmode = true; 194 $msg= $this->parent_class->update_object($this->type, $_POST[$this->xydac_core_name][$this->namefield_name], apply_filters( 'xydac_core_update',$_POST[$this->xydac_core_name]),$_POST[$this->xydac_core_name."_old"],$this->namefield_name);205 $msg= $this->parent_class->update_object($this->type, $_POST[$this->xydac_core_name][$this->namefield_name],$_GET['manage_'.$this->xydac_core_name], apply_filters( 'xydac_core_update',$_POST[$this->xydac_core_name]),$_POST[$this->xydac_core_name."_old"],$this->namefield_name); 195 206 if(is_wp_error(($msg))){ 196 207 $this->xydac_core_error= $msg; … … 209 220 function delete($name) 210 221 { 211 $msg = $this->parent_class->delete_object($this->type, $name, $this->namefield_name);222 $msg = $this->parent_class->delete_object($this->type, $name,$_GET['manage_'.$this->xydac_core_name], $this->namefield_name); 212 223 if(is_wp_error(($msg))){ 213 224 $this->xydac_core_error= $msg; … … 308 319 function init() 309 320 { 310 $xydac_rowdata = apply_filters( 'xydac_core_rowdata', $this->parent_class->get_main() );//!is_array($this->option_name)?get_option($this->option_name):($this->option_name);321 $xydac_rowdata = apply_filters( 'xydac_core_rowdata', ($this->type=='main')? $this->parent_class->get_main() : $this->parent_class->get_field($this->field_val) );//!is_array($this->option_name)?get_option($this->option_name):($this->option_name); 311 322 $this->xydac_editdata = stripslashes_deep($this->xydac_editdata); 312 323 ?> … … 449 460 <div class="xydacfieldform"> 450 461 <h3><?php if($this->xydac_core_editmode) echo __('Edit ',XYDAC_CMS_NAME).$this->xydac_core_label; else echo __('Add ',XYDAC_CMS_NAME).$this->xydac_core_label; ?> 451 <?php if($this->xydac_core_editmode) echo "<a style='color:red;float:right;' href='".$this->xydac_core_form_action."&edit_".$this->xydac_core_name."=false '>Cancel Edit</a>"; ?>462 <?php if($this->xydac_core_editmode) echo "<a style='color:red;float:right;' href='".$this->xydac_core_form_action."&edit_".$this->xydac_core_name."=false"."'>Cancel Edit</a>"; ?> 452 463 </h3> 453 464 <div class="form-field form-required <?php if(isset($_POST[$this->xydac_core_name.'_update_submit']) || isset($_POST[$this->xydac_core_name.'_add_submit'])) if(isset($_POST[$this->xydac_core_name][$this->namefield_name]) && empty($_POST[$this->xydac_core_name][$this->namefield_name])) echo 'form-invalid';?>" > -
ultimate-cms/trunk/index.php
r618272 r618822 6 6 Author: XYDAC 7 7 Author URI: http://xydac.com/ 8 Version: 1.0 8 Version: 1.0.1 9 9 License: GPL2*/ 10 10 … … 15 15 16 16 global $xydac_cms_fields; 17 18 require_once ABSPATH . 'wp-admin/includes/plugin.php' ; 19 add_action('plugins_loaded', create_function('','deactivate_plugins("ultimate-taxonomy-manager/ultimate-taxonomy-manager.php");')); 17 20 //File includes 18 21 require_once 'class-field-type.php'; … … 51 54 'userMods'=> ABSPATH.'/wp-content/ultimate_cms/' 52 55 ); 56 57 58 53 59 self::$menu_slug = 'xydac_ultimate_cms'; 54 60 self::cms()->dao = new xydac_options_dao(); … … 106 112 ); 107 113 108 $modules_root = $path;114 $modules_root = rtrim( $path, '\\' );//Knut Sparhell patch. 109 115 $modules_dir = @opendir($modules_root); 110 116 $module_files = array(); … … 219 225 { 220 226 $names = $module->get_active_names(); 227 if(is_array($names)) 221 228 foreach($names as $name) 222 229 { … … 282 289 switch_to_blog($blog_id); 283 290 //$this->xydac_cms_cpt_field_convert(); 291 $this->xydac_taxonomy_fix(); 284 292 do_action('xydac_cms_activate'); 285 293 } … … 288 296 } 289 297 } 298 $this->xydac_taxonomy_fix(); 290 299 //$this->xydac_cms_cpt_field_convert(); 291 300 do_action('xydac_cms_activate'); 301 } 302 function xydac_taxonomy_fix(){ 303 global $wpdb; 304 $fields = $wpdb->get_results($wpdb->prepare("SELECT tax_name,field_name,field_label,field_type,field_desc,field_val FROM {$wpdb->prefix}taxonomyfield order by tax_name")); 305 $field_option = self::cms()->modules->taxonomy_type->get_registered_option('field'); 306 $tax_names = array(); 307 foreach($fields as $field){ 308 309 $tax_option = $field_option.'_'.$field->tax_name; 310 311 self::cms()->dao->register_option($tax_option); 312 $tax_field_data = self::cms()->dao->get_options($tax_option); 313 314 if(!isset($tax_names[$field->tax_name]) && !$tax_field_data) 315 $tax_names[$field->tax_name] = true; 316 if(isset($tax_names[$field->tax_name]) && $tax_names[$field->tax_name]) 317 { 318 $field_arr = array('field_name'=>$field->field_name,'field_label'=>$field->field_label,'field_type'=>$field->field_type,'field_desc'=>$field->field_desc,'field_val'=>$field->field_val,'field_order'=>0); 319 self::cms()->dao->insert_object($tax_option,$field_arr); 320 321 } 322 } 292 323 } 293 324 function xydac_taxonomy_activate() … … 378 409 379 410 } 411 380 412 xydac(); 381 413 -
ultimate-cms/trunk/modules/page-type/class-xydac-page-type-fields.php
r618227 r618822 20 20 add_action('xydac_core_righthead',array($this,'right_head')); 21 21 add_filter('xydac_core_field_name',array($this,'field_name')); 22 add_filter('xydac_core_editlink',array($this,'xydac_core_editlink_func')); 22 23 add_filter('xydac_core_headfootcolumn',array($this,'headfootcolumn')); 23 24 … … 27 28 xydac()->modules->page_type->get_registered_option('field')."_".$name, 28 29 $form_variables); */ 29 parent::__construct(xydac()->modules->page_type,'field',$form_variables); 30 $args = array('field_val' => $name); 31 parent::__construct(xydac()->modules->page_type,'field',$form_variables,$args); 30 32 } 31 33 … … 33 35 { 34 36 return "field_name"; 37 } 38 function xydac_core_editlink_func($str) 39 { 40 return $str.'&manage_page_type='.$this->name; 35 41 } 36 42 function headfootcolumn() -
ultimate-cms/trunk/modules/page-type/class-xydac-page-type-manager.php
r618227 r618822 28 28 add_filter('xydac_core_leftdiv',array($this,'xydac_core_leftdiv')); 29 29 add_action('xydac_core_bulkaction',array($this,'xydac_core_bulkaction')); 30 add_filter('xydac_core_rowactions',array($this,'xydac_core_rowactions'));30 //add_filter('xydac_core_rowactions',array($this,'xydac_core_rowactions')); 31 31 add_filter('xydac_core_doactions',array($this,'xydac_core_doactions')); 32 32 //parent::__construct(xydac()->modules->page_type->get_module_name(),xydac()->modules->page_type->get_module_label(),xydac()->modules->page_type->get_base_path(),xydac()->modules->page_type->get_registered_option('main'),$form_variables,true,false); … … 52 52 $action = array('activate'=>__("Activate",XYDAC_CMS_NAME), 53 53 'deactivate'=>__("Deactivate",XYDAC_CMS_NAME), 54 'delete'=>__("Delete",XYDAC_CMS_NAME), 55 'export'=>__("Export",XYDAC_CMS_NAME) 54 'delete'=>__("Delete",XYDAC_CMS_NAME) 56 55 ); 57 56 return $action; -
ultimate-cms/trunk/modules/taxonomy/class-xydac-taxonomy-type-fields.php
r618227 r618822 19 19 add_action('xydac_core_righthead',array($this,'right_head')); 20 20 add_filter('xydac_core_field_name',array($this,'field_name')); 21 add_filter('xydac_core_editlink',array($this,'xydac_core_editlink_func')); 21 22 add_filter('xydac_core_headfootcolumn',array($this,'headfootcolumn')); 22 23 //parent::__construct(xydac()->modules->taxonomy_type->get_module_name().__("_field",XYDAC_CMS_NAME),xydac()->modules->taxonomy_type->get_module_label().__(" Field",XYDAC_CMS_NAME),xydac()->modules->taxonomy_type->get_base_path()."&manage_".xydac()->modules->taxonomy_type->get_module_name()."=".$name,xydac()->modules->taxonomy_type->get_registered_option('field')."_".$name,$form_variables); 23 24 //parent::__construct("xydac_page_type_custom_field",__("Taxonomy Type Field",XYDAC_CMS_NAME),XYDAC_CMS_TAXONOMY_TYPE_FIELDS_PATH."&manage_taxonomy_type=".$name,XYDAC_CMS_TAXONOMY_TYPE_OPTION."_".$name,$form_variables); 24 parent::__construct(xydac()->modules->taxonomy_type,'field',$form_variables); 25 $args = array('field_val' => $name);; 26 parent::__construct(xydac()->modules->taxonomy_type,'field',$form_variables,$args); 25 27 } 26 28 … … 28 30 { 29 31 return "field_name"; 32 } 33 function xydac_core_editlink_func($str) 34 { 35 return $str.'&manage_taxonomy_type='.$this->name; 30 36 } 31 37 function headfootcolumn() -
ultimate-cms/trunk/modules/taxonomy/class-xydac-taxonomy-type-manager.php
r618227 r618822 60 60 add_action('xydac_core_delete',array($this,'xydac_core_delete')); 61 61 add_action('xydac_core_bulkaction',array($this,'xydac_core_bulkaction')); 62 add_filter('xydac_core_rowactions',array($this,'xydac_core_rowactions'));62 //add_filter('xydac_core_rowactions',array($this,'xydac_core_rowactions')); 63 63 add_filter('xydac_core_doactions',array($this,'xydac_core_doactions')); 64 64 add_filter('xydac_core_insert',array($this,'xydac_core_insert'),10,1); … … 96 96 function xydac_core_doactions() 97 97 { 98 $action = array('activate'=>__("Activate",XYDAC_CMS_NAME),'deactivate'=>__("Deactivate",XYDAC_CMS_NAME),'delete'=>__("Delete",XYDAC_CMS_NAME) ,'export'=>__("Export",XYDAC_CMS_NAME));98 $action = array('activate'=>__("Activate",XYDAC_CMS_NAME),'deactivate'=>__("Deactivate",XYDAC_CMS_NAME),'delete'=>__("Delete",XYDAC_CMS_NAME)); 99 99 return $action; 100 100 } … … 116 116 function xydac_core_insert($datas) 117 117 { 118 $datas = array(0=>$datas); 118 119 foreach($datas as $k=>$data){ 119 120 $datas[$k]['args']['labels']['name'] = xydac_mods_inflect::pluralize($datas[$k]['name']); … … 141 142 $datas[$k]['args']['hierarchical']= "false"; 142 143 } 143 return $datas ;144 return $datas[0]; 144 145 } 145 146 } -
ultimate-cms/trunk/readme.txt
r618227 r618822 62 62 == Changelog == 63 63 64 = 1.0.1 = 65 * Fixed the fatal error issue, The error still persists if using ultimate taxonomy manager, but goes away on refresh. 66 * Fixed Taxonomies and page types issues. 67 * Fixed Taxonomy Manager to Ultimate CMS transition 68 * Fixed Some style issue. 69 64 70 = 1.0 = 65 71 * Lots of enhancements … … 94 100 Please let me know if you have any problem. 95 101 102 = I get fatal Error when using Ultimate Taxonomy Manager or Ultimate Post type manager = 103 Deactivate Ultimate taxonomy manager or Ultimate Post type manager you are using and activate Ultimate CMS.Your data will be restored. 104 105 96 106 == Upgrade Notice == 107 108 = 1.0.1 = 109 Fixed the fatal error issue, The error still persists if using ultimate taxonomy manager, but goes away on refresh.Fixed Taxonomies and page types issues.Fixed Taxonomy Manager to Ultimate CMS transition 97 110 98 111 = 0.1 = -
ultimate-cms/trunk/style.css
r618227 r618822 285 285 border-width: 0 1px 1px; 286 286 margin: 0px; 287 padding:8px; 287 288 clear: both; 288 289 } /* ---------- */
Note: See TracChangeset
for help on using the changeset viewer.