hooks = $hooks;
}
/*
* Hooks table html
* @return string
*/
public function get_hooks_table() {
$table_class = AWL()->get_settings( 'display_hooks' ) === 'true' ? '' : 'awl-disabled';
if ( isset( $_REQUEST['display_hooks'] ) ) {
$table_class = $_REQUEST['display_hooks'] === 'true' ? '' : 'awl-disabled';
}
if ( $this->hooks && ! empty( $this->hooks ) ) {
$table_class .= ' awl-has-hooks';
}
$default_hook = array( 'hookid_1' => array( "position" => "on_image", "hook" => "", "type" => "action", "custom" => "", "priority" => "10", "js" => "", "js_pos" => "", "callback" => "", "callback_args" => "" ) );
$html = '';
$html .= '';
$html .= '
';
return $html;
}
/*
* Hook table row html
* @return string
*/
public function get_hooks( $hooks ) {
$html = '';
if ( $hooks && ! empty( $hooks ) ) {
foreach ($hooks as $hook_id => $hook_args) {
$this->hook['id'] = $hook_id;
$this->hook['args'] = $hook_args;
$position_html = $this->get_field('position');
$hooks_html = $this->get_field('hook');
$hook_custom_html = $this->get_field('custom') . $this->get_field('type') . $this->get_field('js') . $this->get_field('js_pos') . $this->get_field('callback') . $this->get_field('callback_args');
$priority_html = $this->get_field('priority');
if ( in_array( $this->hook['args']['hook'], array( 'custom action', 'custom filter', 'custom' ) ) ) {
$custom_class = ' awl-custom';
} elseif ( $this->hook['args']['hook'] === 'advanced' ) {
$custom_class = ' awl-custom awl-advanced';
} else {
$custom_class = '';
}
$html .= '';
$html .= '| ';
$html .= $position_html;
$html .= ' | ';
$html .= '';
$html .= $hooks_html . $hook_custom_html;
$html .= ' | ';
$html .= '';
$html .= $priority_html;
$html .= ' | ';
$html .= '';
$html .= '';
$html .= ' | ';
$html .= '
';
}
}
return $html;
}
/*
* Get field html markup
* @param $type string Field type
* @return string
*/
private function get_field( $type ) {
$this->field_name = "hooks[" . $this->hook['id'] . "][{$type}]";
return call_user_func( array( $this, 'get_hook_' . $type ) );
}
/*
* Hook position html
* @return string
*/
private function get_hook_position() {
$positions = AWL_Helpers::get_labels_positions();
$html = '';
$html .= '';
return $html;
}
/*
* Hooks html
* @return string
*/
private function get_hook_hook() {
$hooks = AWL_Helpers::get_woocommerce_hooks();
$hooks[] = 'custom';
$hooks[] = 'advanced';
$html = '';
$html .= '';
return $html;
}
/*
* Hooks html
* @return string
*/
private function get_hook_type() {
$types = array(
'action', 'filter',
);
$val = isset( $this->hook['args']['type'] ) ? $this->hook['args']['type'] : "action";
$html = '';
$html .= '';
return $html;
}
/*
* Custom hook html
* @return string
*/
private function get_hook_custom() {
$html = '';
$html .= '';
return $html;
}
/*
* Hook html
* @return string
*/
private function get_hook_js() {
$val = isset( $this->hook['args']['js'] ) ? $this->hook['args']['js'] : "";
$html = '';
$html .= '';
return $html;
}
/*
* Hook html
* @return string
*/
private function get_hook_js_pos() {
$positions = array(
'append', 'prepend', 'after', 'before'
);
$val = isset( $this->hook['args']['js_pos'] ) ? $this->hook['args']['js_pos'] : "";
$is_empty = $val ? '' : ' advanced-val-empty';
$html = '';
$html .= '';
return $html;
}
/*
* Hook html
* @return string
*/
private function get_hook_callback() {
$val = isset( $this->hook['args']['callback'] ) ? $this->hook['args']['callback'] : "";
$html = '';
$html .= '';
return $html;
}
/*
* Hooks html
* @return string
*/
private function get_hook_callback_args() {
$val = isset( $this->hook['args']['callback_args'] ) ? $this->hook['args']['callback_args'] : "";
$html = '';
$html .= '';
return $html;
}
/*
* Hooks html
* @return string
*/
private function get_hook_priority() {
$html = '';
$html .= '';
return $html;
}
}
endif;