Skip to content

Commit 2b772cb

Browse files
committed
Minor fixes and changes.
1 parent 78d33e6 commit 2b772cb

File tree

6 files changed

+23
-10
lines changed

6 files changed

+23
-10
lines changed

Origin.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,10 @@ function action_admin_enqueue_scripts(){
262262
wp_enqueue_script('origin.admin', ORIGIN_BASE_URL.'/js/origin.js', array('jquery'));
263263
wp_enqueue_style('origin.admin', ORIGIN_BASE_URL.'/css/admin.css');
264264

265+
// Chosen
266+
wp_enqueue_script('jquery.chosen', ORIGIN_BASE_URL.'/externals/chosen/chosen.jquery.js', array('jquery'));
267+
wp_enqueue_style('jquery.chosen', ORIGIN_BASE_URL.'/externals/chosen/chosen.css');
268+
265269
// Everything that we need for the dynamic previews
266270
wp_enqueue_script('origin.preview', ORIGIN_BASE_URL.'/js/preview/preview.js', array('jquery'));
267271
wp_enqueue_script('origin.color', ORIGIN_BASE_URL.'/js/preview/color.js', array('jquery'));
@@ -326,7 +330,7 @@ function action_wp_enqueue_scripts(){
326330
*/
327331
function action_admin_bar_menu(){
328332
if (!is_super_admin() || !is_admin_bar_showing() || is_admin()) return;
329-
333+
330334
$href= add_query_arg('page', 'origin', admin_url('/themes.php'));
331335

332336
if(!is_admin() && !is_404()){
@@ -388,10 +392,11 @@ function filter_pre_set_site_transient_update_themes($checked_data){
388392

389393
$raw_response = wp_remote_post($this->_config->endpoint.'/'.$this->theme_name.'/', $send_for_check);
390394

391-
if (!is_wp_error($raw_response) && ($raw_response['response']['code'] == 200))
395+
if (!is_wp_error($raw_response) && ($raw_response['response']['code'] == 200)){
392396
$response = unserialize($raw_response['body']);
397+
$checked_data->response[$this->theme_name] = $response;
398+
}
393399

394-
$checked_data->response[$this->theme_name] = $response;
395400
return $checked_data;
396401
}
397402

config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
return array(
44
'endpoint' => 'http://192.168.1.102:8888/theme',
5+
'path' => 'plugins/origin'
56
);

inc/Grid.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ public function process($html){
144144
$tosign[$gi] = array(
145145
'id' => $grid_container->getAttribute('id'),
146146
'class' => $grid_container->getAttribute('class'),
147+
'data-responsive' => $grid_container->getAttribute('data-responsive'),
148+
'data-margin' => $grid_container->getAttribute('data-margin'),
149+
'data-cell-margin' => $grid_container->getAttribute('data-cell-margin'),
147150
'cells' => array()
148151
);
149152
foreach($grid_container->attributes as $attribute){
@@ -157,7 +160,8 @@ public function process($html){
157160

158161
$tosign[$gi]['cells'][$ci] = array(
159162
'id' => $cell->getAttribute('id'),
160-
'class' => $cell->getAttribute('class')
163+
'class' => $cell->getAttribute('class'),
164+
'data-weight' => $cell->getAttribute('data-weight'),
161165
);
162166
foreach($cell->attributes as $attribute){
163167
if(substr($attribute->name,0,5) == 'data-'){

inc/Image.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,17 @@ function register_effect($name, $callback){
7474

7575
/**
7676
* Get the URL of an attachment preset
77+
*
78+
* @param string $preset The preset name.
79+
* @param int $attachment_id The attachment ID.
80+
* @param string $filename The filename. Can be anything. For SEO purposes.
7781
*/
78-
function get_preset_url($name, $id, $filename){
82+
function get_preset_url($preset, $attachment_id, $filename = 'image.jpg'){
7983
global $wp_rewrite;
8084

8185
if ($wp_rewrite->using_permalinks()){
8286
// Return a pretty version
83-
return site_url().'/oim/'.urlencode($name).'/'.intval($id).'/'.$filename.'/';
87+
return site_url().'/oim/'.urlencode($preset).'/'.intval($attachment_id).'/'.$filename.'/';
8488
}
8589
else{
8690
// TODO Return an ugly version
@@ -161,7 +165,7 @@ function method_preset(){
161165

162166
$tosign = array(
163167
$post->ID,
164-
$preset['name']
168+
$preset
165169
);
166170
$file = Origin::single()->cache->get_file('images', $tosign,'jpg');
167171

inc/Settings.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ function save($input = null){
145145
* Load default values for any empty values
146146
*/
147147
function load_defaults(){
148+
if(empty($this->_settings)) return;
148149
foreach($this->_settings as $section_id => $section){
149150
foreach($section['settings'] as $field_id => $field){
150151
if(empty($this->_values[$section_id][$field_id]) && isset($field['default']))

inc/types/pattern.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ function __construct($section, $name, $settings){
3030
* Enqueue any JS and CSS that we require
3131
*/
3232
static function enqueue(){
33-
wp_enqueue_script('jquery.chosen', ORIGIN_BASE_URL.'/externals/chosen/chosen.jquery.js', array('jquery'));
34-
wp_enqueue_style('jquery.chosen', ORIGIN_BASE_URL.'/externals/chosen/chosen.css');
35-
wp_enqueue_script('origin.pattern.color', ORIGIN_BASE_URL.'/js/types/pattern.js', array('jquery'));
33+
wp_enqueue_script('origin.pattern', ORIGIN_BASE_URL.'/js/types/pattern.js', array('jquery'));
3634
}
3735

3836
function render_form(){

0 commit comments

Comments
 (0)