Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
20d1bab
Support for Field's visibility based on other field's value
hasinhayder Sep 13, 2014
5eb1295
Initial value validation
hasinhayder Sep 13, 2014
bdc7585
Gallery Placeholder
hasinhayder Sep 13, 2014
2e2ae41
Gallery Placeholder
hasinhayder Sep 13, 2014
56fa1f6
Functional Gallery
hasinhayder Sep 15, 2014
d49fc8a
Metabox visibility based on post format
hasinhayder Sep 15, 2014
3125ce8
error fix when post format metabox is not shwon
hasinhayder Sep 15, 2014
4118f8c
added quote in the default list of post formats for metaboxes
hasinhayder Sep 15, 2014
41464cd
Visibility dependency support for color field
hasinhayder Sep 15, 2014
e6180e5
Visibility dependency support for checkbox and radio
hasinhayder Sep 15, 2014
d9c7a48
Single and Multiple Image Support for Gallery
hasinhayder Sep 16, 2014
ec512db
Single Image field
hasinhayder Sep 16, 2014
95a9d08
broken img fix
hasinhayder Sep 17, 2014
7068b60
Empty the container before prefetching attachments
hasinhayder Sep 17, 2014
70f9c09
Repeatable Text Field
hasinhayder Sep 17, 2014
71a5d7e
Merge branch 'master' of https://github.com/gambitph/Titan-Framework
hasinhayder Sep 17, 2014
1cecfaf
Return Repeater field's value properly
hasinhayder Sep 17, 2014
f6d3b50
Renamed RepeaterText to Multitext
hasinhayder Sep 17, 2014
d011fe4
Single Image Field file include
hasinhayder Sep 18, 2014
c5ce55e
Multitext default value fix
hasinhayder Sep 18, 2014
9849c80
Multitext default value fix
hasinhayder Sep 18, 2014
bef3651
Improved visibility dependency. If some field gets hidden due to it's…
hasinhayder Sep 28, 2014
88d3698
Hide all the dependendant feilds if the parent field hides. Added sup…
hasinhayder Sep 28, 2014
70d7b70
Hide all the dependendant feilds if the parent field hides. Added sup…
hasinhayder Sep 28, 2014
3e96876
Clear Images button in the gallery field
hasinhayder Sep 28, 2014
cbe7d9d
Images in the gallery field is now sortable
hasinhayder Sep 28, 2014
c6e3ae6
Merge branch 'master' of https://github.com/gambitph/Titan-Framework
hasinhayder Sep 29, 2014
44f6919
Merge branch 'master' of https://github.com/gambitph/Titan-Framework
hasinhayder Oct 11, 2014
5ea5aa9
Several Fixes
hasinhayder Oct 11, 2014
61d6e56
Latest Updates
hasinhayder Nov 30, 2014
096e387
Merge branch 'master' of https://github.com/gambitph/Titan-Framework
hasinhayder Dec 18, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion class-meta-box.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class TitanFrameworkMetaBox {
'hide_custom_fields' => true, // If true, the custom fields box will not be shown
'priority' => 'high', // high, core, default, low
'desc' => '', // Description displayed below the title
'post_format'=>array('standard','aside','chat','link','gallery','image','audio','video','status','quote'),
'page_template'=>array()
);

public $settings;
Expand Down Expand Up @@ -82,7 +84,7 @@ public function display( $post ) {
}

?>
<table class="form-table tf-form-table">
<table class="form-table tf-form-table " data-post-format="<?php echo join(",",$this->settings['post_format']);?>" data-page-template="<?php echo join(",",$this->settings['page_template']);?>">
<tbody>
<?php
foreach ( $this->options as $option ) {
Expand Down
2 changes: 1 addition & 1 deletion class-option-checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function display() {

?>
<label for="<?php echo $this->getID() ?>">
<input name="<?php echo $this->getID() ?>" type="checkbox" id="<?php echo $this->getID() ?>" value="1" <?php checked( $this->getValue(), 1 ) ?>>
<input name="<?php echo $this->getID() ?>" type="checkbox" id="<?php echo $this->getID() ?>" value="1" data-did="<?php echo $this->settings['dependency']['id']; ?>" data-dvalue="<?php echo $this->settings['dependency']['value']; ?>" <?php checked( $this->getValue(), 1 ) ?>>
<?php echo $this->getDesc( true ) ?>
</label>
<?php
Expand Down
2 changes: 1 addition & 1 deletion class-option-color.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function display() {
$this->echoOptionHeader();

?>
<input class="tf-colorpicker" type="text" name="<?php echo $this->getID() ?>" id="<?php echo $this->getID() ?>" value="<?php echo $this->getValue() ?>" data-default-color="<?php echo $this->getValue() ?>"/>
<input class="tf-colorpicker" type="text" name="<?php echo $this->getID() ?>" id="<?php echo $this->getID() ?>" value="<?php echo $this->getValue() ?>" data-default-color="<?php echo $this->getValue() ?>" data-did="<?php echo $this->settings['dependency']['id']; ?>" data-dvalue="<?php echo $this->settings['dependency']['value']; ?>" />
<?php

// load the javascript to init the colorpicker
Expand Down
33 changes: 33 additions & 0 deletions class-option-gallery.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

class TitanFrameworkOptionGallery extends TitanFrameworkOption {


function __construct($settings, $owner){
parent::__construct($settings,$owner);
add_action("admin_enqueue_scripts",array($this,'enqueueScripts'));
}
/*
* Display for options and meta
*/
public function display() {
if(!isset($this->settings['dependency'])) $this->settings['dependency']=array("id"=>"","value"=>"");
$this->echoOptionHeader();
echo "<ul class='gallery-ph'></ul>";
echo "<input class='galleryinfo' data-did='{$this->settings['dependency']['id']}' data-dvalue='{$this->settings['dependency']['value']}' name='".$this->getID()."' type='hidden' value='".$this->getValue()."'/>";
echo "<input type='button' data-multiple='true' value='Add Images To Gallery' class='galgal button button-primary button-large'>";
echo "<input type='button' value='Clear' style='margin-left:10px;' class='galgalremove button button-large' >";
$this->echoOptionFooter();
}

public function enqueueScripts(){
wp_enqueue_media();
wp_enqueue_script("tf-gallery",get_template_directory_uri()."/libs/titan-framework/js/gallery.js","jquery","1.0",true);
wp_enqueue_style("tf-gallery-css",get_template_directory_uri()."/libs/titan-framework/css/class-option-gallery.css");
}



}
33 changes: 33 additions & 0 deletions class-option-image.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

class TitanFrameworkOptionImage extends TitanFrameworkOption {


function __construct($settings, $owner){
parent::__construct($settings,$owner);
add_action("admin_enqueue_scripts",array($this,'enqueueScripts'));
}
/*
* Display for options and meta
*/
public function display() {
if(!isset($this->settings['dependency'])) $this->settings['dependency']=array("id"=>"","value"=>"");
$this->echoOptionHeader();
echo "<ul class='gallery-ph'></ul>";
echo "<input class='galleryinfo' data-did='{$this->settings['dependency']['id']}' data-dvalue='{$this->settings['dependency']['value']}' name='".$this->getID()."' type='hidden' value='".$this->getValue()."'/>";
echo "<input type='button' value='Add Image' class='galgal button button-primary button-large' data-multiple='false'>";
echo "<input type='button' value='Clear' style='margin-left:10px;' class='galgalremove button button-large' >";
$this->echoOptionFooter();
}

public function enqueueScripts(){
wp_enqueue_media();
wp_enqueue_script("tf-gallery",get_template_directory_uri()."/libs/titan-framework/js/gallery.js","jquery","1.0",true);
wp_enqueue_style("tf-gallery-css",get_template_directory_uri()."/libs/titan-framework/css/class-option-gallery.css");
}



}
47 changes: 47 additions & 0 deletions class-option-multitext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

class TitanFrameworkOptionMultitext extends TitanFrameworkOption {

function __construct($settings, $owner){
parent::__construct($settings,$owner);
add_action("admin_enqueue_scripts",array($this,'enqueueScripts'));
}
/*
* Display for options and meta
*/
public function display() {
$value = $this->getValue();
if(empty($value))
$value = $this->settings['default'];

if(is_array($value))
$value=join("|||",$value);



if(!isset($this->settings['dependency'])) $this->settings['dependency']=array("id"=>"","value"=>"");
$this->echoOptionHeader();
echo "<input name='".$this->getID()."' type='hidden' class='repeaterjson' id='{$this->getID()}' value='".$value."' >";
echo "<div class='repeaterplaceholder'></div>";
echo "<div class='repeater' style='margin-top:10px;'><input type='button' class='repeaterbtn button button-primary' value='Add More'/> </div>";
$this->echoOptionFooter();
}

function enqueueScripts(){
wp_enqueue_script("tf-repeatable",get_template_directory_uri()."/libs/titan-framework/js/repeatable.js","jquery","1.0",true);
}

function cleanValueForGetting($value){

if( !is_array($value)){
$parts = explode("|||",$value);
return $parts;
}else{
return $value;
}

}

}
4 changes: 3 additions & 1 deletion class-option-radio-palette.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public function display() {
$value = $this->settings['options'][$value];
}

echo "<input type='hidden' class='dep' id='".$this->getID()."dep' data-did='{$this->settings['dependency']['id']}' data-dvalue='{$this->settings['dependency']['value']}' />";

// print the palettes
foreach ( $this->settings['options'] as $key => $colorSet ) {
printf( '<label id="%s"><input id="%s" type="radio" name="%s" value="%s" %s/> <span>',
Expand Down Expand Up @@ -163,4 +165,4 @@ public function render_content() {
}
}
}
}
}
2 changes: 1 addition & 1 deletion class-option-radio.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class TitanFrameworkOptionRadio extends TitanFrameworkOption {
public function display() {
$this->echoOptionHeader( true );

echo "<fieldset>";
echo "<fieldset data-did='{$this->settings['dependency']['id']}' data-dvalue='{$this->settings['dependency']['value']}' >";

foreach ( $this->settings['options'] as $value => $label ) {
printf('<label for="%s"><input id="%s" type="radio" name="%s" value="%s" %s/> %s</label><br>',
Expand Down
2 changes: 1 addition & 1 deletion class-option-select.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class TitanFrameworkOptionSelect extends TitanFrameworkOption {
public function display() {
$this->echoOptionHeader();

?><select name="<?php echo $this->getID(); ?>"><?php
?><select name="<?php echo $this->getID(); ?>" id="<?php echo $this->getID(); ?>" data-did="<?php echo $this->settings['dependency']['id']; ?>" data-dvalue="<?php echo $this->settings['dependency']['value']; ?>" ><?php
foreach ( $this->settings['options'] as $value => $label ) {

// this is if we have option groupings
Expand Down
10 changes: 7 additions & 3 deletions class-option-text.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@ class TitanFrameworkOptionText extends TitanFrameworkOption {
* Display for options and meta
*/
public function display() {
if(!isset($this->settings['dependency'])) $this->settings['dependency']=array("id"=>"","value"=>"");
$this->echoOptionHeader();
printf("<input class=\"regular-text\" name=\"%s\" placeholder=\"%s\" maxlength=\"%s\" id=\"%s\" type=\"%s\" value=\"%s\"\> %s",
printf("<input class=\"regular-text\" name=\"%s\" placeholder=\"%s\" maxlength=\"%s\" id=\"%s\" type=\"%s\" value=\"%s\" data-did=\"%s\" data-dvalue=\"%s\" \> %s",
$this->getID(),
$this->settings['placeholder'],
$this->settings['maxlength'],
$this->getID(),
$this->settings['is_password'] ? 'password' : 'text',
esc_attr( $this->getValue() ),
$this->settings['unit']
esc_attr( $this->getValue() ),
$this->settings['dependency']['id'],
$this->settings['dependency']['value'],
$this->settings['unit']

);
$this->echoOptionFooter();
}
Expand Down
1 change: 1 addition & 0 deletions class-option.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class TitanFrameworkOption {
'default' => '', // Menu icon for top level menus only
'example' => '', // An example value for this field, will be displayed in a <code>
'livepreview' => '', // jQuery script to update something in the site. For theme customizer only
'dependency' =>array('id'=>'','value'=>'')
);

public $defaultSecondarySettings = array();
Expand Down
2 changes: 2 additions & 0 deletions class-titan-framework.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ public function loadAdminScripts( $hook ) {
wp_enqueue_media();
wp_enqueue_script( 'tf-serialize', TitanFramework::getURL( 'js/serialize.js', __FILE__ ) );
wp_enqueue_script( 'tf-styling', TitanFramework::getURL( 'js/admin-styling.js', __FILE__ ) );
wp_enqueue_script( 'tf-visibility', TitanFramework::getURL( 'js/visibility.js', __FILE__ ) );
wp_enqueue_style( 'tf-admin-styles', TitanFramework::getURL( 'css/admin-styles.css', __FILE__ ) );
wp_localize_script("tf-visibility","fdata",array("namespace"=>$this->optionNamespace));
}
}

Expand Down
Loading